From e5dfd805e6cc37103b07a0b7bfcfce02cb1f4ef2 Mon Sep 17 00:00:00 2001
From: jjlange
Date: Thu, 11 Jul 2019 16:50:00 +0000
Subject: [PATCH] Merged in jjlange/nuttx/lpc40xx (pull request #946)
Add support for LPC40xx family chips
* Corrected a few peripheral definitions and pin functions for the LPC17xx family.
Added configuration options, chip definitions, and additional pin functions for the LPC40xx family.
Added board configurations for Embedded Artists LPC4088 Quickstart board and LPC4088 Developer's kit. These configurations are still something of a work in progress. In particular, the LCD functionality is untested.
* First pass rename in *.c and *.h files.
* Renamed LPC17XX to LPC17XX_40XX in config files
* Rplaced LPC17xx with LPC17xx/LPC40xx in .c files
* Replaced LPC17xx with LPC17xx/LPC40xx in .h files
* Updated some documentation
* Working on moving directories
* moved arch/arm/src/lpc17xx and arch/arm/include/lpc17xx to lpc17xx_40xx
* Renamed LPC17_* constants / configuration options to LPC17_40_*
* Updated chip family name defines
* Renamed some chip-specific files
* Updated references to renamed files
* Updated references to lpc17_ to lpc17_40_
* Renamed source files from lpc17_* to lpc17_40_*
* Clean up white space
Approved-by: Gregory Nutt
---
Documentation/NuttxPortingGuide.html | 6 +-
Documentation/UsbTrace.html | 14 +-
arch/README.txt | 2 +-
arch/arm/Kconfig | 13 +-
arch/arm/include/lpc17xx/chip.h | 388 -----
arch/arm/include/lpc17xx/lpc176x_irq.h | 245 ---
arch/arm/include/lpc17xx/lpc178x_irq.h | 291 ----
arch/arm/include/lpc17xx_40xx/chip.h | 468 ++++++
.../include/{lpc17xx => lpc17xx_40xx}/irq.h | 46 +-
arch/arm/include/lpc17xx_40xx/lpc176x_irq.h | 245 +++
.../include/lpc17xx_40xx/lpc178x_40xx_irq.h | 291 ++++
arch/arm/src/armv7-m/up_ramvec_initialize.c | 2 +-
arch/arm/src/lpc11xx/lpc11_gpio.c | 4 +-
arch/arm/src/lpc11xx/lpc11_gpio.h | 2 +-
arch/arm/src/lpc11xx/lpc11_gpiodbg.c | 6 +-
arch/arm/src/lpc11xx/lpc11_gpioint.c | 18 +-
arch/arm/src/lpc11xx/lpc11_lowputc.c | 2 +-
arch/arm/src/lpc11xx/lpc11_timer.h | 2 +-
arch/arm/src/lpc11xx/lpc11_userspace.h | 2 +-
.../src/lpc17xx/hardware/lpc176x_memorymap.h | 136 --
.../src/lpc17xx/hardware/lpc176x_pinconn.h | 635 --------
.../arm/src/lpc17xx/hardware/lpc176x_syscon.h | 494 ------
arch/arm/src/lpc17xx/hardware/lpc178x_iocon.h | 375 -----
.../src/lpc17xx/hardware/lpc178x_memorymap.h | 158 --
.../arm/src/lpc17xx/hardware/lpc178x_syscon.h | 636 --------
arch/arm/src/lpc17xx/hardware/lpc17_can.h | 510 ------
arch/arm/src/lpc17xx/hardware/lpc17_eeprom.h | 186 ---
arch/arm/src/lpc17xx/hardware/lpc17_emc.h | 350 ----
.../arm/src/lpc17xx/hardware/lpc17_ethernet.h | 597 -------
arch/arm/src/lpc17xx/hardware/lpc17_gpdma.h | 597 -------
arch/arm/src/lpc17xx/hardware/lpc17_gpio.h | 210 ---
arch/arm/src/lpc17xx/hardware/lpc17_i2c.h | 208 ---
arch/arm/src/lpc17xx/hardware/lpc17_i2s.h | 190 ---
arch/arm/src/lpc17xx/hardware/lpc17_lcd.h | 346 ----
arch/arm/src/lpc17xx/hardware/lpc17_mcpwm.h | 280 ----
arch/arm/src/lpc17xx/hardware/lpc17_pwm.h | 223 ---
arch/arm/src/lpc17xx/hardware/lpc17_qei.h | 214 ---
arch/arm/src/lpc17xx/hardware/lpc17_rtc.h | 277 ----
arch/arm/src/lpc17xx/hardware/lpc17_rtcevmr.h | 143 --
arch/arm/src/lpc17xx/hardware/lpc17_sdcard.h | 272 ----
arch/arm/src/lpc17xx/hardware/lpc17_spi.h | 141 --
arch/arm/src/lpc17xx/hardware/lpc17_ssp.h | 185 ---
arch/arm/src/lpc17xx/hardware/lpc17_timer.h | 250 ---
arch/arm/src/lpc17xx/hardware/lpc17_uart.h | 414 -----
arch/arm/src/lpc17xx/hardware/lpc17_usb.h | 778 ---------
arch/arm/src/lpc17xx/hardware/lpc17_wdt.h | 156 --
.../arm/src/{lpc17xx => lpc17xx_40xx}/Kconfig | 491 +++---
.../src/{lpc17xx => lpc17xx_40xx}/Make.defs | 72 +-
arch/arm/src/{lpc17xx => lpc17xx_40xx}/chip.h | 20 +-
.../lpc17xx_40xx/hardware/lpc176x_memorymap.h | 136 ++
.../hardware/lpc176x_pinconfig.h | 8 +-
.../lpc17xx_40xx/hardware/lpc176x_pinconn.h | 635 ++++++++
.../lpc17xx_40xx/hardware/lpc176x_syscon.h | 494 ++++++
.../hardware/lpc178x_40xx_iocon.h | 375 +++++
.../hardware/lpc178x_40xx_memorymap.h | 159 ++
.../hardware/lpc178x_40xx_pinconfig.h} | 42 +-
.../hardware/lpc178x_40xx_syscon.h | 644 ++++++++
.../hardware/lpc17_40_adc.h} | 66 +-
.../src/lpc17xx_40xx/hardware/lpc17_40_can.h | 510 ++++++
.../hardware/lpc17_40_dac.h} | 48 +-
.../lpc17xx_40xx/hardware/lpc17_40_eeprom.h | 186 +++
.../src/lpc17xx_40xx/hardware/lpc17_40_emc.h | 350 ++++
.../lpc17xx_40xx/hardware/lpc17_40_ethernet.h | 597 +++++++
.../lpc17xx_40xx/hardware/lpc17_40_gpdma.h | 597 +++++++
.../src/lpc17xx_40xx/hardware/lpc17_40_gpio.h | 210 +++
.../src/lpc17xx_40xx/hardware/lpc17_40_i2c.h | 208 +++
.../src/lpc17xx_40xx/hardware/lpc17_40_i2s.h | 190 +++
.../src/lpc17xx_40xx/hardware/lpc17_40_lcd.h | 346 ++++
.../lpc17xx_40xx/hardware/lpc17_40_mcpwm.h | 280 ++++
.../hardware/lpc17_40_memorymap.h} | 18 +-
.../hardware/lpc17_40_pinconfig.h} | 18 +-
.../hardware/lpc17_40_pinconn.h} | 18 +-
.../src/lpc17xx_40xx/hardware/lpc17_40_pwm.h | 223 +++
.../src/lpc17xx_40xx/hardware/lpc17_40_qei.h | 214 +++
.../hardware/lpc17_40_rit.h} | 36 +-
.../src/lpc17xx_40xx/hardware/lpc17_40_rtc.h | 277 ++++
.../lpc17xx_40xx/hardware/lpc17_40_rtcevmr.h | 143 ++
.../lpc17xx_40xx/hardware/lpc17_40_sdcard.h | 272 ++++
.../src/lpc17xx_40xx/hardware/lpc17_40_spi.h | 141 ++
.../src/lpc17xx_40xx/hardware/lpc17_40_ssp.h | 185 +++
.../hardware/lpc17_40_syscon.h} | 18 +-
.../lpc17xx_40xx/hardware/lpc17_40_timer.h | 250 +++
.../src/lpc17xx_40xx/hardware/lpc17_40_uart.h | 414 +++++
.../src/lpc17xx_40xx/hardware/lpc17_40_usb.h | 778 +++++++++
.../src/lpc17xx_40xx/hardware/lpc17_40_wdt.h | 156 ++
.../lpc176x_clockconfig.c | 98 +-
.../{lpc17xx => lpc17xx_40xx}/lpc176x_gpio.c | 180 +--
.../{lpc17xx => lpc17xx_40xx}/lpc176x_gpio.h | 16 +-
.../{lpc17xx => lpc17xx_40xx}/lpc176x_rtc.c | 58 +-
.../lpc178x_40xx_clockconfig.c} | 86 +-
.../lpc178x_40xx_gpio.c} | 234 +--
.../lpc178x_40xx_gpio.h} | 12 +-
.../lpc17_40_adc.c} | 142 +-
.../lpc17_40_adc.h} | 38 +-
.../lpc17_40_allocateheap.c} | 120 +-
.../lpc17_40_can.c} | 272 ++--
.../lpc17_40_can.h} | 16 +-
.../lpc17_40_clockconfig.c} | 24 +-
.../lpc17_40_clockconfig.h} | 14 +-
.../lpc17_40_clrpend.c} | 22 +-
.../lpc17_40_clrpend.h} | 12 +-
.../lpc17_40_dac.c} | 28 +-
.../lpc17_40_dac.h} | 16 +-
.../lpc17_40_emacram.h} | 118 +-
.../lpc17_40_emc.c} | 54 +-
.../lpc17_40_emc.h} | 14 +-
.../lpc17_40_ethernet.c} | 1012 ++++++------
.../lpc17_40_ethernet.h} | 10 +-
.../lpc17_40_gpdma.c} | 252 +--
.../lpc17_40_gpdma.h} | 70 +-
.../lpc17_40_gpio.c} | 14 +-
.../lpc17_40_gpio.h} | 72 +-
.../lpc17_40_gpiodbg.c} | 44 +-
.../lpc17_40_gpioint.c} | 206 +--
.../lpc17_40_i2c.c} | 240 +--
.../lpc17_40_i2c.h} | 20 +-
.../lpc17_40_i2s.h} | 10 +-
.../lpc17_40_idle.c} | 6 +-
.../lpc17_40_irq.c} | 122 +-
.../lpc17_40_lcd.c} | 330 ++--
.../lpc17_40_lcd.h} | 134 +-
.../lpc17_40_lowputc.c} | 108 +-
.../lpc17_40_lowputc.h} | 12 +-
.../lpc17_40_mcpwm.c} | 172 +-
.../lpc17_40_mpuinit.c} | 12 +-
.../lpc17_40_mpuinit.h} | 20 +-
.../lpc17_40_ohciram.h} | 152 +-
.../lpc17_40_progmem.c} | 94 +-
.../lpc17_40_progmem.h} | 86 +-
.../lpc17_40_pwm.c} | 110 +-
.../lpc17_40_pwm.h} | 11 +-
.../lpc17_40_qei.h} | 11 +-
.../lpc17_40_rit.h} | 10 +-
.../lpc17_40_rtc.h} | 14 +-
.../lpc17_40_sdcard.c} | 868 +++++-----
.../lpc17_40_sdcard.h} | 10 +-
.../lpc17_40_serial.c} | 330 ++--
.../lpc17_40_serial.h} | 28 +-
.../lpc17_40_spi.c} | 88 +-
.../lpc17_40_spi.h} | 42 +-
.../lpc17_40_ssp.c} | 270 ++--
.../lpc17_40_ssp.h} | 60 +-
.../lpc17_40_start.c} | 28 +-
.../lpc17_40_start.h} | 14 +-
.../lpc17_40_timer.c} | 134 +-
.../lpc17_40_timer.h} | 10 +-
.../lpc17_40_timerisr.c} | 14 +-
.../lpc17_40_usbdev.c} | 1418 ++++++++---------
.../lpc17_40_usbhost.c} | 1150 ++++++-------
.../lpc17_40_usbhost.h} | 12 +-
.../lpc17_40_userspace.c} | 12 +-
.../lpc17_40_userspace.h} | 12 +-
.../lpc17_40_wdt.h} | 10 +-
arch/arm/src/lpc2378/lpc23xx_i2c.c | 2 +-
arch/arm/src/lpc2378/lpc23xx_i2c.h | 2 +-
arch/arm/src/lpc2378/lpc23xx_spi.c | 2 +-
arch/arm/src/lpc2378/lpc23xx_spi.h | 2 +-
arch/arm/src/lpc43xx/lpc43_sdmmc.c | 2 +-
arch/arm/src/lpc54xx/lpc54_sdmmc.c | 2 +-
arch/arm/src/nuc1xx/nuc_serial.c | 6 +-
arch/avr/src/avr/avr.h | 2 +-
arch/hc/src/m9s12/m9s12_ethernet.c | 2 +-
arch/x86/src/qemu/qemu.h | 4 +-
configs/Kconfig | 30 +
configs/bambino-200e/README.txt | 4 +-
configs/lincoln60/README.txt | 132 +-
configs/lincoln60/include/board.h | 26 +-
configs/lincoln60/netnsh/defconfig | 16 +-
configs/lincoln60/nsh/defconfig | 6 +-
configs/lincoln60/src/Makefile | 8 +-
configs/lincoln60/src/lincoln60.h | 2 +-
.../{lpc17_appinit.c => lpc17_40_appinit.c} | 2 +-
.../src/{lpc17_boot.c => lpc17_40_boot.c} | 8 +-
.../{lpc17_buttons.c => lpc17_40_buttons.c} | 12 +-
.../src/{lpc17_leds.c => lpc17_40_leds.c} | 26 +-
configs/lincoln60/thttpd-binfs/defconfig | 14 +-
configs/lpc4088-devkit/Kconfig | 18 +
configs/lpc4088-devkit/README.txt | 476 ++++++
configs/lpc4088-devkit/fb/defconfig | 57 +
configs/lpc4088-devkit/include/board.h | 439 +++++
configs/lpc4088-devkit/kernel/.gitignore | 2 +
configs/lpc4088-devkit/kernel/Makefile | 122 ++
.../kernel/lpc17_40_userspace.c | 132 ++
configs/lpc4088-devkit/knsh/Make.defs | 114 ++
configs/lpc4088-devkit/knsh/defconfig | 70 +
configs/lpc4088-devkit/knxterm/Make.defs | 114 ++
configs/lpc4088-devkit/knxterm/defconfig | 79 +
configs/lpc4088-devkit/nsh/defconfig | 96 ++
configs/lpc4088-devkit/nxlines/defconfig | 65 +
configs/lpc4088-devkit/pdcurses/defconfig | 78 +
configs/lpc4088-devkit/pwfb/defconfig | 71 +
configs/lpc4088-devkit/scripts/Make.defs | 112 ++
.../lpc4088-devkit/scripts/kernel-space.ld | 110 ++
configs/lpc4088-devkit/scripts/ld.script | 127 ++
configs/lpc4088-devkit/scripts/memory.ld | 99 ++
configs/lpc4088-devkit/scripts/user-space.ld | 111 ++
configs/lpc4088-devkit/src/.gitignore | 2 +
configs/lpc4088-devkit/src/Makefile | 79 +
configs/lpc4088-devkit/src/lpc17_40_appinit.c | 94 ++
.../lpc4088-devkit/src/lpc17_40_autoleds.c | 265 +++
.../src/lpc17_40_boardinitialize.c | 142 ++
configs/lpc4088-devkit/src/lpc17_40_bringup.c | 400 +++++
configs/lpc4088-devkit/src/lpc17_40_buttons.c | 240 +++
.../lpc4088-devkit/src/lpc17_40_djoystick.c | 336 ++++
configs/lpc4088-devkit/src/lpc17_40_lcd.c | 88 +
.../src/lpc17_40_nandinitialize.c | 93 ++
.../src/lpc17_40_norinitialize.c | 89 ++
.../src/lpc17_40_sdraminitialize.c | 234 +++
configs/lpc4088-devkit/src/lpc17_40_ssp.c | 179 +++
.../lpc4088-devkit/src/lpc17_40_touchscreen.c | 314 ++++
.../lpc4088-devkit/src/lpc17_40_userleds.c | 120 ++
configs/lpc4088-devkit/src/lpc4088-devkit.h | 272 ++++
.../lpc4088-devkit/tools/lpc4088-devkit.cfg | 166 ++
configs/lpc4088-devkit/tools/oocd.sh | 57 +
configs/lpc4088-quickstart/Kconfig | 7 +
configs/lpc4088-quickstart/README.txt | 547 +++++++
configs/lpc4088-quickstart/fb/defconfig | 57 +
configs/lpc4088-quickstart/include/board.h | 380 +++++
configs/lpc4088-quickstart/kernel/.gitignore | 2 +
configs/lpc4088-quickstart/kernel/Makefile | 122 ++
.../kernel/lpc17_40_userspace.c | 132 ++
configs/lpc4088-quickstart/knsh/Make.defs | 114 ++
configs/lpc4088-quickstart/knsh/defconfig | 66 +
configs/lpc4088-quickstart/knxterm/Make.defs | 114 ++
configs/lpc4088-quickstart/knxterm/defconfig | 79 +
configs/lpc4088-quickstart/nsh/defconfig | 56 +
configs/lpc4088-quickstart/nxlines/defconfig | 66 +
configs/lpc4088-quickstart/pdcurses/defconfig | 79 +
configs/lpc4088-quickstart/pwfb/defconfig | 71 +
configs/lpc4088-quickstart/scripts/Make.defs | 112 ++
.../scripts/kernel-space.ld | 110 ++
configs/lpc4088-quickstart/scripts/ld.script | 127 ++
configs/lpc4088-quickstart/scripts/memory.ld | 99 ++
.../lpc4088-quickstart/scripts/user-space.ld | 111 ++
configs/lpc4088-quickstart/src/.gitignore | 2 +
configs/lpc4088-quickstart/src/Makefile | 70 +
.../lpc4088-quickstart/src/lpc17_40_appinit.c | 94 ++
.../src/lpc17_40_autoleds.c | 271 ++++
.../src/lpc17_40_boardinitialize.c | 133 ++
.../lpc4088-quickstart/src/lpc17_40_bringup.c | 403 +++++
.../lpc4088-quickstart/src/lpc17_40_buttons.c | 229 +++
configs/lpc4088-quickstart/src/lpc17_40_lcd.c | 88 +
.../src/lpc17_40_nandinitialize.c | 93 ++
.../src/lpc17_40_sdraminitialize.c | 234 +++
configs/lpc4088-quickstart/src/lpc17_40_ssp.c | 171 ++
.../src/lpc17_40_userleds.c | 141 ++
.../src/lpc4088-quickstart.h | 143 ++
.../tools/lpc4088-quickstart.cfg | 166 ++
configs/lpc4088-quickstart/tools/oocd.sh | 57 +
configs/lpc4330-xplorer/README.txt | 12 +-
configs/lpc4337-ws/README.txt | 12 +-
configs/lpc4357-evb/README.txt | 12 +-
configs/lpc4370-link2/README.txt | 12 +-
.../lpcxpresso-lpc1115/src/lpc11_appinit.c | 2 +-
configs/lpcxpresso-lpc1115/src/lpc11_dac.c | 2 +-
configs/lpcxpresso-lpc1115/src/lpc11_pwm.c | 6 +-
configs/lpcxpresso-lpc1115/src/lpc11_ssp.c | 12 +-
configs/lpcxpresso-lpc1768/README.txt | 136 +-
configs/lpcxpresso-lpc1768/dhcpd/defconfig | 10 +-
configs/lpcxpresso-lpc1768/include/board.h | 18 +-
configs/lpcxpresso-lpc1768/nsh/defconfig | 16 +-
configs/lpcxpresso-lpc1768/nx/defconfig | 6 +-
configs/lpcxpresso-lpc1768/src/Makefile | 12 +-
.../src/{lpc17_adc.c => lpc17_40_adc.c} | 10 +-
.../{lpc17_appinit.c => lpc17_40_appinit.c} | 8 +-
.../src/{lpc17_boot.c => lpc17_40_boot.c} | 12 +-
.../src/{lpc17_dac.c => lpc17_40_dac.c} | 12 +-
.../src/{lpc17_leds.c => lpc17_40_leds.c} | 10 +-
.../src/{lpc17_oled.c => lpc17_40_oled.c} | 28 +-
.../src/{lpc17_pwm.c => lpc17_40_pwm.c} | 26 +-
.../src/{lpc17_ssp.c => lpc17_40_ssp.c} | 62 +-
.../src/{lpc17_usbmsc.c => lpc17_40_usbmsc.c} | 34 +-
.../src/lpcxpresso-lpc1768.h | 4 +-
configs/lpcxpresso-lpc1768/thttpd/defconfig | 10 +-
configs/lpcxpresso-lpc1768/usbmsc/defconfig | 14 +-
configs/mbed/README.txt | 134 +-
configs/mbed/include/board.h | 24 +-
configs/mbed/nsh/defconfig | 6 +-
configs/mbed/src/Makefile | 10 +-
.../mbed/src/{lpc17_adc.c => lpc17_40_adc.c} | 10 +-
.../{lpc17_appinit.c => lpc17_40_appinit.c} | 2 +-
.../src/{lpc17_boot.c => lpc17_40_boot.c} | 8 +-
.../mbed/src/{lpc17_dac.c => lpc17_40_dac.c} | 12 +-
.../src/{lpc17_leds.c => lpc17_40_leds.c} | 30 +-
.../mbed/src/{lpc17_pwm.c => lpc17_40_pwm.c} | 28 +-
configs/mcb1700/README.txt | 134 +-
configs/mcb1700/include/board.h | 24 +-
configs/mcb1700/nsh/defconfig | 6 +-
configs/mcb1700/src/Makefile | 10 +-
.../src/{lpc17_adc.c => lpc17_40_adc.c} | 10 +-
.../{lpc17_appinit.c => lpc17_40_appinit.c} | 2 +-
.../src/{lpc17_boot.c => lpc17_40_boot.c} | 8 +-
.../{lpc17_bringup.c => lpc17_40_bringup.c} | 26 +-
.../src/{lpc17_dac.c => lpc17_40_dac.c} | 12 +-
.../src/{lpc17_leds.c => lpc17_40_leds.c} | 30 +-
.../src/{lpc17_pwm.c => lpc17_40_pwm.c} | 28 +-
configs/olimex-lpc1766stk/README.txt | 148 +-
configs/olimex-lpc1766stk/ftpc/defconfig | 16 +-
configs/olimex-lpc1766stk/hidkbd/defconfig | 8 +-
configs/olimex-lpc1766stk/hidmouse/defconfig | 6 +-
configs/olimex-lpc1766stk/include/board.h | 20 +-
configs/olimex-lpc1766stk/nettest/defconfig | 14 +-
configs/olimex-lpc1766stk/nsh/defconfig | 16 +-
.../olimex-lpc1766stk/slip-httpd/defconfig | 6 +-
configs/olimex-lpc1766stk/src/Makefile | 10 +-
configs/olimex-lpc1766stk/src/lpc1766stk.h | 20 +-
.../{lpc17_appinit.c => lpc17_40_appinit.c} | 4 +-
.../src/{lpc17_boot.c => lpc17_40_boot.c} | 14 +-
.../{lpc17_bringup.c => lpc17_40_bringup.c} | 30 +-
.../{lpc17_buttons.c => lpc17_40_buttons.c} | 12 +-
.../src/{lpc17_can.c => lpc17_40_can.c} | 18 +-
.../src/{lpc17_leds.c => lpc17_40_leds.c} | 38 +-
.../src/{lpc17_ssp.c => lpc17_40_ssp.c} | 92 +-
.../src/{lpc17_usbmsc.c => lpc17_40_usbmsc.c} | 40 +-
.../olimex-lpc1766stk/thttpd-binfs/defconfig | 10 +-
.../olimex-lpc1766stk/thttpd-nxflat/defconfig | 10 +-
configs/olimex-lpc1766stk/usbmsc/defconfig | 10 +-
configs/olimex-lpc1766stk/usbserial/defconfig | 8 +-
configs/olimex-lpc1766stk/zmodem/defconfig | 18 +-
configs/open1788/README.txt | 28 +-
configs/open1788/fb/defconfig | 14 +-
configs/open1788/include/board.h | 36 +-
configs/open1788/kernel/Makefile | 2 +-
...lpc17_userspace.c => lpc17_40_userspace.c} | 2 +-
configs/open1788/knsh/defconfig | 10 +-
configs/open1788/knxterm/defconfig | 16 +-
configs/open1788/nsh/defconfig | 10 +-
configs/open1788/nxlines/defconfig | 14 +-
configs/open1788/pdcurses/defconfig | 16 +-
configs/open1788/pwfb/defconfig | 16 +-
configs/open1788/src/Makefile | 32 +-
.../{lpc17_appinit.c => lpc17_40_appinit.c} | 2 +-
.../{lpc17_autoleds.c => lpc17_40_autoleds.c} | 30 +-
...nitialize.c => lpc17_40_boardinitialize.c} | 26 +-
.../{lpc17_bringup.c => lpc17_40_bringup.c} | 32 +-
.../{lpc17_buttons.c => lpc17_40_buttons.c} | 14 +-
...lpc17_djoystick.c => lpc17_40_djoystick.c} | 22 +-
.../src/{lpc17_lcd.c => lpc17_40_lcd.c} | 22 +-
...initialize.c => lpc17_40_nandinitialize.c} | 26 +-
...rinitialize.c => lpc17_40_norinitialize.c} | 24 +-
...nitialize.c => lpc17_40_sdraminitialize.c} | 102 +-
.../src/{lpc17_ssp.c => lpc17_40_ssp.c} | 64 +-
...7_touchscreen.c => lpc17_40_touchscreen.c} | 32 +-
.../{lpc17_userleds.c => lpc17_40_userleds.c} | 26 +-
configs/open1788/src/open1788.h | 32 +-
configs/pnev5180b/Kconfig | 18 +-
configs/pnev5180b/include/board.h | 26 +-
configs/pnev5180b/kernel/Makefile | 2 +-
...lpc17_userspace.c => lpc17_40_userspace.c} | 4 +-
configs/pnev5180b/knsh/defconfig | 4 +-
configs/pnev5180b/nsh-cdcecm/defconfig | 8 +-
configs/pnev5180b/nsh/defconfig | 4 +-
configs/pnev5180b/src/Makefile | 20 +-
.../{lpc17_appinit.c => lpc17_40_appinit.c} | 2 +-
.../src/{lpc17_boot.c => lpc17_40_boot.c} | 8 +-
.../{lpc17_bringup.c => lpc17_40_bringup.c} | 20 +-
...lpc17_composite.c => lpc17_40_composite.c} | 2 +-
.../src/{lpc17_leds.c => lpc17_40_leds.c} | 60 +-
.../src/{lpc17_romfs.c => lpc17_40_romfs.c} | 38 +-
.../src/{lpc17_romfs.h => lpc17_40_romfs.h} | 18 +-
.../src/{lpc17_spi.c => lpc17_40_spi.c} | 28 +-
.../src/{lpc17_symtab.c => lpc17_40_symtab.c} | 6 +-
.../src/{lpc17_symtab.h => lpc17_40_symtab.h} | 12 +-
configs/pnev5180b/usbnsh-cdcecm/defconfig | 8 +-
configs/pnev5180b/usbnsh/defconfig | 8 +-
configs/stm32f103-minimum/src/stm32_lcd.c | 2 +-
configs/stm32f4discovery/src/stm32_st7567.c | 2 +-
configs/u-blox-c027/include/board.h | 18 +-
configs/u-blox-c027/nsh/defconfig | 26 +-
configs/u-blox-c027/src/Makefile | 12 +-
.../src/{lpc17_adc.c => lpc17_40_adc.c} | 16 +-
.../{lpc17_appinit.c => lpc17_40_appinit.c} | 16 +-
.../src/{lpc17_boot.c => lpc17_40_boot.c} | 32 +-
.../src/{lpc17_dac.c => lpc17_40_dac.c} | 14 +-
.../src/{lpc17_leds.c => lpc17_40_leds.c} | 10 +-
.../src/{lpc17_pwm.c => lpc17_40_pwm.c} | 30 +-
.../src/{lpc17_ssp.c => lpc17_40_ssp.c} | 60 +-
.../src/{lpc17_ubxmdm.c => lpc17_40_ubxmdm.c} | 132 +-
.../src/{lpc17_usbmsc.c => lpc17_40_usbmsc.c} | 34 +-
configs/u-blox-c027/src/u-blox-c027.h | 14 +-
configs/zkit-arm-1769/README.txt | 130 +-
configs/zkit-arm-1769/hello/defconfig | 10 +-
configs/zkit-arm-1769/include/board.h | 22 +-
configs/zkit-arm-1769/nsh/defconfig | 16 +-
configs/zkit-arm-1769/nxhello/defconfig | 16 +-
configs/zkit-arm-1769/src/Makefile | 16 +-
.../src/{lpc17_adc.c => lpc17_40_adc.c} | 10 +-
.../{lpc17_appinit.c => lpc17_40_appinit.c} | 10 +-
.../src/{lpc17_boot.c => lpc17_40_boot.c} | 12 +-
.../{lpc17_buttons.c => lpc17_40_buttons.c} | 14 +-
.../src/{lpc17_can.c => lpc17_40_can.c} | 20 +-
.../src/{lpc17_dac.c => lpc17_40_dac.c} | 12 +-
.../src/{lpc17_lcd.c => lpc17_40_lcd.c} | 26 +-
.../src/{lpc17_leds.c => lpc17_40_leds.c} | 26 +-
.../src/{lpc17_spi.c => lpc17_40_spi.c} | 48 +-
.../src/{lpc17_ssp.c => lpc17_40_ssp.c} | 66 +-
.../src/{lpc17_usbmsc.c => lpc17_40_usbmsc.c} | 36 +-
configs/zkit-arm-1769/src/zkit-arm-1769.h | 8 +-
configs/zkit-arm-1769/thttpd/defconfig | 12 +-
drivers/lcd/README.txt | 4 +-
400 files changed, 27550 insertions(+), 16939 deletions(-)
delete mode 100644 arch/arm/include/lpc17xx/chip.h
delete mode 100644 arch/arm/include/lpc17xx/lpc176x_irq.h
delete mode 100644 arch/arm/include/lpc17xx/lpc178x_irq.h
create mode 100644 arch/arm/include/lpc17xx_40xx/chip.h
rename arch/arm/include/{lpc17xx => lpc17xx_40xx}/irq.h (70%)
create mode 100644 arch/arm/include/lpc17xx_40xx/lpc176x_irq.h
create mode 100644 arch/arm/include/lpc17xx_40xx/lpc178x_40xx_irq.h
delete mode 100644 arch/arm/src/lpc17xx/hardware/lpc176x_memorymap.h
delete mode 100644 arch/arm/src/lpc17xx/hardware/lpc176x_pinconn.h
delete mode 100644 arch/arm/src/lpc17xx/hardware/lpc176x_syscon.h
delete mode 100644 arch/arm/src/lpc17xx/hardware/lpc178x_iocon.h
delete mode 100644 arch/arm/src/lpc17xx/hardware/lpc178x_memorymap.h
delete mode 100644 arch/arm/src/lpc17xx/hardware/lpc178x_syscon.h
delete mode 100644 arch/arm/src/lpc17xx/hardware/lpc17_can.h
delete mode 100644 arch/arm/src/lpc17xx/hardware/lpc17_eeprom.h
delete mode 100644 arch/arm/src/lpc17xx/hardware/lpc17_emc.h
delete mode 100644 arch/arm/src/lpc17xx/hardware/lpc17_ethernet.h
delete mode 100644 arch/arm/src/lpc17xx/hardware/lpc17_gpdma.h
delete mode 100644 arch/arm/src/lpc17xx/hardware/lpc17_gpio.h
delete mode 100644 arch/arm/src/lpc17xx/hardware/lpc17_i2c.h
delete mode 100644 arch/arm/src/lpc17xx/hardware/lpc17_i2s.h
delete mode 100644 arch/arm/src/lpc17xx/hardware/lpc17_lcd.h
delete mode 100644 arch/arm/src/lpc17xx/hardware/lpc17_mcpwm.h
delete mode 100644 arch/arm/src/lpc17xx/hardware/lpc17_pwm.h
delete mode 100644 arch/arm/src/lpc17xx/hardware/lpc17_qei.h
delete mode 100644 arch/arm/src/lpc17xx/hardware/lpc17_rtc.h
delete mode 100644 arch/arm/src/lpc17xx/hardware/lpc17_rtcevmr.h
delete mode 100644 arch/arm/src/lpc17xx/hardware/lpc17_sdcard.h
delete mode 100644 arch/arm/src/lpc17xx/hardware/lpc17_spi.h
delete mode 100644 arch/arm/src/lpc17xx/hardware/lpc17_ssp.h
delete mode 100644 arch/arm/src/lpc17xx/hardware/lpc17_timer.h
delete mode 100644 arch/arm/src/lpc17xx/hardware/lpc17_uart.h
delete mode 100644 arch/arm/src/lpc17xx/hardware/lpc17_usb.h
delete mode 100644 arch/arm/src/lpc17xx/hardware/lpc17_wdt.h
rename arch/arm/src/{lpc17xx => lpc17xx_40xx}/Kconfig (63%)
rename arch/arm/src/{lpc17xx => lpc17xx_40xx}/Make.defs (74%)
rename arch/arm/src/{lpc17xx => lpc17xx_40xx}/chip.h (86%)
create mode 100644 arch/arm/src/lpc17xx_40xx/hardware/lpc176x_memorymap.h
rename arch/arm/src/{lpc17xx => lpc17xx_40xx}/hardware/lpc176x_pinconfig.h (98%)
create mode 100644 arch/arm/src/lpc17xx_40xx/hardware/lpc176x_pinconn.h
create mode 100644 arch/arm/src/lpc17xx_40xx/hardware/lpc176x_syscon.h
create mode 100644 arch/arm/src/lpc17xx_40xx/hardware/lpc178x_40xx_iocon.h
create mode 100644 arch/arm/src/lpc17xx_40xx/hardware/lpc178x_40xx_memorymap.h
rename arch/arm/src/{lpc17xx/hardware/lpc178x_pinconfig.h => lpc17xx_40xx/hardware/lpc178x_40xx_pinconfig.h} (92%)
create mode 100644 arch/arm/src/lpc17xx_40xx/hardware/lpc178x_40xx_syscon.h
rename arch/arm/src/{lpc17xx/hardware/lpc17_adc.h => lpc17xx_40xx/hardware/lpc17_40_adc.h} (77%)
create mode 100644 arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_can.h
rename arch/arm/src/{lpc17xx/hardware/lpc17_dac.h => lpc17xx_40xx/hardware/lpc17_40_dac.h} (64%)
create mode 100644 arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_eeprom.h
create mode 100644 arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_emc.h
create mode 100644 arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_ethernet.h
create mode 100644 arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_gpdma.h
create mode 100644 arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_gpio.h
create mode 100644 arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_i2c.h
create mode 100644 arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_i2s.h
create mode 100644 arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_lcd.h
create mode 100644 arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_mcpwm.h
rename arch/arm/src/{lpc17xx/hardware/lpc17_memorymap.h => lpc17xx_40xx/hardware/lpc17_40_memorymap.h} (86%)
rename arch/arm/src/{lpc17xx/hardware/lpc17_pinconfig.h => lpc17xx_40xx/hardware/lpc17_40_pinconfig.h} (86%)
rename arch/arm/src/{lpc17xx/hardware/lpc17_pinconn.h => lpc17xx_40xx/hardware/lpc17_40_pinconn.h} (86%)
create mode 100644 arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_pwm.h
create mode 100644 arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_qei.h
rename arch/arm/src/{lpc17xx/hardware/lpc17_rit.h => lpc17xx_40xx/hardware/lpc17_40_rit.h} (72%)
create mode 100644 arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_rtc.h
create mode 100644 arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_rtcevmr.h
create mode 100644 arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_sdcard.h
create mode 100644 arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_spi.h
create mode 100644 arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_ssp.h
rename arch/arm/src/{lpc17xx/hardware/lpc17_syscon.h => lpc17xx_40xx/hardware/lpc17_40_syscon.h} (86%)
create mode 100644 arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_timer.h
create mode 100644 arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_uart.h
create mode 100644 arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_usb.h
create mode 100644 arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_wdt.h
rename arch/arm/src/{lpc17xx => lpc17xx_40xx}/lpc176x_clockconfig.c (71%)
rename arch/arm/src/{lpc17xx => lpc17xx_40xx}/lpc176x_gpio.c (78%)
rename arch/arm/src/{lpc17xx => lpc17xx_40xx}/lpc176x_gpio.h (95%)
rename arch/arm/src/{lpc17xx => lpc17xx_40xx}/lpc176x_rtc.c (87%)
rename arch/arm/src/{lpc17xx/lpc178x_clockconfig.c => lpc17xx_40xx/lpc178x_40xx_clockconfig.c} (77%)
rename arch/arm/src/{lpc17xx/lpc178x_gpio.c => lpc17xx_40xx/lpc178x_40xx_gpio.c} (77%)
rename arch/arm/src/{lpc17xx/lpc178x_gpio.h => lpc17xx_40xx/lpc178x_40xx_gpio.h} (96%)
rename arch/arm/src/{lpc17xx/lpc17_adc.c => lpc17xx_40xx/lpc17_40_adc.c} (83%)
rename arch/arm/src/{lpc17xx/lpc17_adc.h => lpc17xx_40xx/lpc17_40_adc.h} (79%)
rename arch/arm/src/{lpc17xx/lpc17_allocateheap.c => lpc17xx_40xx/lpc17_40_allocateheap.c} (78%)
rename arch/arm/src/{lpc17xx/lpc17_can.c => lpc17xx_40xx/lpc17_40_can.c} (81%)
rename arch/arm/src/{lpc17xx/lpc17_can.h => lpc17xx_40xx/lpc17_40_can.h} (88%)
rename arch/arm/src/{lpc17xx/lpc17_clockconfig.c => lpc17xx_40xx/lpc17_40_clockconfig.c} (82%)
rename arch/arm/src/{lpc17xx/lpc17_clockconfig.h => lpc17xx_40xx/lpc17_40_clockconfig.h} (89%)
rename arch/arm/src/{lpc17xx/lpc17_clrpend.c => lpc17xx_40xx/lpc17_40_clrpend.c} (87%)
rename arch/arm/src/{lpc17xx/lpc17_clrpend.h => lpc17xx_40xx/lpc17_40_clrpend.h} (92%)
rename arch/arm/src/{lpc17xx/lpc17_dac.c => lpc17xx_40xx/lpc17_40_dac.c} (90%)
rename arch/arm/src/{lpc17xx/lpc17_dac.h => lpc17xx_40xx/lpc17_40_dac.h} (90%)
rename arch/arm/src/{lpc17xx/lpc17_emacram.h => lpc17xx_40xx/lpc17_40_emacram.h} (58%)
rename arch/arm/src/{lpc17xx/lpc17_emc.c => lpc17xx_40xx/lpc17_40_emc.c} (84%)
rename arch/arm/src/{lpc17xx/lpc17_emc.h => lpc17xx_40xx/lpc17_40_emc.h} (90%)
rename arch/arm/src/{lpc17xx/lpc17_ethernet.c => lpc17xx_40xx/lpc17_40_ethernet.c} (73%)
rename arch/arm/src/{lpc17xx/lpc17_ethernet.h => lpc17xx_40xx/lpc17_40_ethernet.h} (91%)
rename arch/arm/src/{lpc17xx/lpc17_gpdma.c => lpc17xx_40xx/lpc17_40_gpdma.c} (72%)
rename arch/arm/src/{lpc17xx/lpc17_gpdma.h => lpc17xx_40xx/lpc17_40_gpdma.h} (82%)
rename arch/arm/src/{lpc17xx/lpc17_gpio.c => lpc17xx_40xx/lpc17_40_gpio.c} (90%)
rename arch/arm/src/{lpc17xx/lpc17_gpio.h => lpc17xx_40xx/lpc17_40_gpio.h} (78%)
rename arch/arm/src/{lpc17xx/lpc17_gpiodbg.c => lpc17xx_40xx/lpc17_40_gpiodbg.c} (79%)
rename arch/arm/src/{lpc17xx/lpc17_gpioint.c => lpc17xx_40xx/lpc17_40_gpioint.c} (64%)
rename arch/arm/src/{lpc17xx/lpc17_i2c.c => lpc17xx_40xx/lpc17_40_i2c.c} (66%)
rename arch/arm/src/{lpc17xx/lpc17_i2c.h => lpc17xx_40xx/lpc17_40_i2c.h} (86%)
rename arch/arm/src/{lpc17xx/lpc17_i2s.h => lpc17xx_40xx/lpc17_40_i2s.h} (91%)
rename arch/arm/src/{lpc17xx/lpc17_idle.c => lpc17xx_40xx/lpc17_40_idle.c} (97%)
rename arch/arm/src/{lpc17xx/lpc17_irq.c => lpc17xx_40xx/lpc17_40_irq.c} (82%)
rename arch/arm/src/{lpc17xx/lpc17_lcd.c => lpc17xx_40xx/lpc17_40_lcd.c} (68%)
rename arch/arm/src/{lpc17xx/lpc17_lcd.h => lpc17xx_40xx/lpc17_40_lcd.h} (56%)
rename arch/arm/src/{lpc17xx/lpc17_lowputc.c => lpc17xx_40xx/lpc17_40_lowputc.c} (83%)
rename arch/arm/src/{lpc17xx/lpc17_lowputc.h => lpc17xx_40xx/lpc17_40_lowputc.h} (92%)
rename arch/arm/src/{lpc17xx/lpc17_mcpwm.c => lpc17xx_40xx/lpc17_40_mcpwm.c} (74%)
rename arch/arm/src/{lpc17xx/lpc17_mpuinit.c => lpc17xx_40xx/lpc17_40_mpuinit.c} (94%)
rename arch/arm/src/{lpc17xx/lpc17_mpuinit.h => lpc17xx_40xx/lpc17_40_mpuinit.h} (88%)
rename arch/arm/src/{lpc17xx/lpc17_ohciram.h => lpc17xx_40xx/lpc17_40_ohciram.h} (58%)
rename arch/arm/src/{lpc17xx/lpc17_progmem.c => lpc17xx_40xx/lpc17_40_progmem.c} (81%)
rename arch/arm/src/{lpc17xx/lpc17_progmem.h => lpc17xx_40xx/lpc17_40_progmem.h} (58%)
rename arch/arm/src/{lpc17xx/lpc17_pwm.c => lpc17xx_40xx/lpc17_40_pwm.c} (84%)
rename arch/arm/src/{lpc17xx/lpc17_qei.h => lpc17xx_40xx/lpc17_40_pwm.h} (91%)
rename arch/arm/src/{lpc17xx/lpc17_pwm.h => lpc17xx_40xx/lpc17_40_qei.h} (92%)
rename arch/arm/src/{lpc17xx/lpc17_wdt.h => lpc17xx_40xx/lpc17_40_rit.h} (92%)
rename arch/arm/src/{lpc17xx/lpc17_rtc.h => lpc17xx_40xx/lpc17_40_rtc.h} (90%)
rename arch/arm/src/{lpc17xx/lpc17_sdcard.c => lpc17xx_40xx/lpc17_40_sdcard.c} (74%)
rename arch/arm/src/{lpc17xx/lpc17_sdcard.h => lpc17xx_40xx/lpc17_40_sdcard.h} (94%)
rename arch/arm/src/{lpc17xx/lpc17_serial.c => lpc17xx_40xx/lpc17_40_serial.c} (84%)
rename arch/arm/src/{lpc17xx/lpc17_serial.h => lpc17xx_40xx/lpc17_40_serial.h} (90%)
rename arch/arm/src/{lpc17xx/lpc17_spi.c => lpc17xx_40xx/lpc17_40_spi.c} (88%)
rename arch/arm/src/{lpc17xx/lpc17_spi.h => lpc17xx_40xx/lpc17_40_spi.h} (81%)
rename arch/arm/src/{lpc17xx/lpc17_ssp.c => lpc17xx_40xx/lpc17_40_ssp.c} (77%)
rename arch/arm/src/{lpc17xx/lpc17_ssp.h => lpc17xx_40xx/lpc17_40_ssp.h} (75%)
rename arch/arm/src/{lpc17xx/lpc17_start.c => lpc17xx_40xx/lpc17_40_start.c} (95%)
rename arch/arm/src/{lpc17xx/lpc17_start.h => lpc17xx_40xx/lpc17_40_start.h} (90%)
rename arch/arm/src/{lpc17xx/lpc17_timer.c => lpc17xx_40xx/lpc17_40_timer.c} (80%)
rename arch/arm/src/{lpc17xx/lpc17_timer.h => lpc17xx_40xx/lpc17_40_timer.h} (91%)
rename arch/arm/src/{lpc17xx/lpc17_timerisr.c => lpc17xx_40xx/lpc17_40_timerisr.c} (93%)
rename arch/arm/src/{lpc17xx/lpc17_usbdev.c => lpc17xx_40xx/lpc17_40_usbdev.c} (62%)
rename arch/arm/src/{lpc17xx/lpc17_usbhost.c => lpc17xx_40xx/lpc17_40_usbhost.c} (74%)
rename arch/arm/src/{lpc17xx/lpc17_usbhost.h => lpc17xx_40xx/lpc17_40_usbhost.h} (92%)
rename arch/arm/src/{lpc17xx/lpc17_userspace.c => lpc17xx_40xx/lpc17_40_userspace.c} (95%)
rename arch/arm/src/{lpc17xx/lpc17_userspace.h => lpc17xx_40xx/lpc17_40_userspace.h} (91%)
rename arch/arm/src/{lpc17xx/lpc17_rit.h => lpc17xx_40xx/lpc17_40_wdt.h} (92%)
rename configs/lincoln60/src/{lpc17_appinit.c => lpc17_40_appinit.c} (98%)
rename configs/lincoln60/src/{lpc17_boot.c => lpc17_40_boot.c} (93%)
rename configs/lincoln60/src/{lpc17_buttons.c => lpc17_40_buttons.c} (95%)
rename configs/lincoln60/src/{lpc17_leds.c => lpc17_40_leds.c} (90%)
create mode 100644 configs/lpc4088-devkit/Kconfig
create mode 100644 configs/lpc4088-devkit/README.txt
create mode 100644 configs/lpc4088-devkit/fb/defconfig
create mode 100644 configs/lpc4088-devkit/include/board.h
create mode 100644 configs/lpc4088-devkit/kernel/.gitignore
create mode 100644 configs/lpc4088-devkit/kernel/Makefile
create mode 100644 configs/lpc4088-devkit/kernel/lpc17_40_userspace.c
create mode 100644 configs/lpc4088-devkit/knsh/Make.defs
create mode 100644 configs/lpc4088-devkit/knsh/defconfig
create mode 100644 configs/lpc4088-devkit/knxterm/Make.defs
create mode 100644 configs/lpc4088-devkit/knxterm/defconfig
create mode 100644 configs/lpc4088-devkit/nsh/defconfig
create mode 100644 configs/lpc4088-devkit/nxlines/defconfig
create mode 100644 configs/lpc4088-devkit/pdcurses/defconfig
create mode 100644 configs/lpc4088-devkit/pwfb/defconfig
create mode 100644 configs/lpc4088-devkit/scripts/Make.defs
create mode 100644 configs/lpc4088-devkit/scripts/kernel-space.ld
create mode 100644 configs/lpc4088-devkit/scripts/ld.script
create mode 100644 configs/lpc4088-devkit/scripts/memory.ld
create mode 100644 configs/lpc4088-devkit/scripts/user-space.ld
create mode 100644 configs/lpc4088-devkit/src/.gitignore
create mode 100644 configs/lpc4088-devkit/src/Makefile
create mode 100644 configs/lpc4088-devkit/src/lpc17_40_appinit.c
create mode 100644 configs/lpc4088-devkit/src/lpc17_40_autoleds.c
create mode 100644 configs/lpc4088-devkit/src/lpc17_40_boardinitialize.c
create mode 100644 configs/lpc4088-devkit/src/lpc17_40_bringup.c
create mode 100644 configs/lpc4088-devkit/src/lpc17_40_buttons.c
create mode 100644 configs/lpc4088-devkit/src/lpc17_40_djoystick.c
create mode 100644 configs/lpc4088-devkit/src/lpc17_40_lcd.c
create mode 100644 configs/lpc4088-devkit/src/lpc17_40_nandinitialize.c
create mode 100644 configs/lpc4088-devkit/src/lpc17_40_norinitialize.c
create mode 100644 configs/lpc4088-devkit/src/lpc17_40_sdraminitialize.c
create mode 100644 configs/lpc4088-devkit/src/lpc17_40_ssp.c
create mode 100644 configs/lpc4088-devkit/src/lpc17_40_touchscreen.c
create mode 100644 configs/lpc4088-devkit/src/lpc17_40_userleds.c
create mode 100644 configs/lpc4088-devkit/src/lpc4088-devkit.h
create mode 100644 configs/lpc4088-devkit/tools/lpc4088-devkit.cfg
create mode 100755 configs/lpc4088-devkit/tools/oocd.sh
create mode 100644 configs/lpc4088-quickstart/Kconfig
create mode 100644 configs/lpc4088-quickstart/README.txt
create mode 100644 configs/lpc4088-quickstart/fb/defconfig
create mode 100644 configs/lpc4088-quickstart/include/board.h
create mode 100644 configs/lpc4088-quickstart/kernel/.gitignore
create mode 100644 configs/lpc4088-quickstart/kernel/Makefile
create mode 100644 configs/lpc4088-quickstart/kernel/lpc17_40_userspace.c
create mode 100644 configs/lpc4088-quickstart/knsh/Make.defs
create mode 100644 configs/lpc4088-quickstart/knsh/defconfig
create mode 100644 configs/lpc4088-quickstart/knxterm/Make.defs
create mode 100644 configs/lpc4088-quickstart/knxterm/defconfig
create mode 100644 configs/lpc4088-quickstart/nsh/defconfig
create mode 100644 configs/lpc4088-quickstart/nxlines/defconfig
create mode 100644 configs/lpc4088-quickstart/pdcurses/defconfig
create mode 100644 configs/lpc4088-quickstart/pwfb/defconfig
create mode 100644 configs/lpc4088-quickstart/scripts/Make.defs
create mode 100644 configs/lpc4088-quickstart/scripts/kernel-space.ld
create mode 100644 configs/lpc4088-quickstart/scripts/ld.script
create mode 100644 configs/lpc4088-quickstart/scripts/memory.ld
create mode 100644 configs/lpc4088-quickstart/scripts/user-space.ld
create mode 100644 configs/lpc4088-quickstart/src/.gitignore
create mode 100644 configs/lpc4088-quickstart/src/Makefile
create mode 100644 configs/lpc4088-quickstart/src/lpc17_40_appinit.c
create mode 100644 configs/lpc4088-quickstart/src/lpc17_40_autoleds.c
create mode 100644 configs/lpc4088-quickstart/src/lpc17_40_boardinitialize.c
create mode 100644 configs/lpc4088-quickstart/src/lpc17_40_bringup.c
create mode 100644 configs/lpc4088-quickstart/src/lpc17_40_buttons.c
create mode 100644 configs/lpc4088-quickstart/src/lpc17_40_lcd.c
create mode 100644 configs/lpc4088-quickstart/src/lpc17_40_nandinitialize.c
create mode 100644 configs/lpc4088-quickstart/src/lpc17_40_sdraminitialize.c
create mode 100644 configs/lpc4088-quickstart/src/lpc17_40_ssp.c
create mode 100644 configs/lpc4088-quickstart/src/lpc17_40_userleds.c
create mode 100644 configs/lpc4088-quickstart/src/lpc4088-quickstart.h
create mode 100644 configs/lpc4088-quickstart/tools/lpc4088-quickstart.cfg
create mode 100755 configs/lpc4088-quickstart/tools/oocd.sh
rename configs/lpcxpresso-lpc1768/src/{lpc17_adc.c => lpc17_40_adc.c} (93%)
rename configs/lpcxpresso-lpc1768/src/{lpc17_appinit.c => lpc17_40_appinit.c} (97%)
rename configs/lpcxpresso-lpc1768/src/{lpc17_boot.c => lpc17_40_boot.c} (91%)
rename configs/lpcxpresso-lpc1768/src/{lpc17_dac.c => lpc17_40_dac.c} (90%)
rename configs/lpcxpresso-lpc1768/src/{lpc17_leds.c => lpc17_40_leds.c} (94%)
rename configs/lpcxpresso-lpc1768/src/{lpc17_oled.c => lpc17_40_oled.c} (88%)
rename configs/lpcxpresso-lpc1768/src/{lpc17_pwm.c => lpc17_40_pwm.c} (85%)
rename configs/lpcxpresso-lpc1768/src/{lpc17_ssp.c => lpc17_40_ssp.c} (74%)
rename configs/lpcxpresso-lpc1768/src/{lpc17_usbmsc.c => lpc17_40_usbmsc.c} (81%)
rename configs/mbed/src/{lpc17_adc.c => lpc17_40_adc.c} (93%)
rename configs/mbed/src/{lpc17_appinit.c => lpc17_40_appinit.c} (99%)
rename configs/mbed/src/{lpc17_boot.c => lpc17_40_boot.c} (94%)
rename configs/mbed/src/{lpc17_dac.c => lpc17_40_dac.c} (90%)
rename configs/mbed/src/{lpc17_leds.c => lpc17_40_leds.c} (91%)
rename configs/mbed/src/{lpc17_pwm.c => lpc17_40_pwm.c} (84%)
rename configs/mcb1700/src/{lpc17_adc.c => lpc17_40_adc.c} (93%)
rename configs/mcb1700/src/{lpc17_appinit.c => lpc17_40_appinit.c} (98%)
rename configs/mcb1700/src/{lpc17_boot.c => lpc17_40_boot.c} (94%)
rename configs/mcb1700/src/{lpc17_bringup.c => lpc17_40_bringup.c} (94%)
rename configs/mcb1700/src/{lpc17_dac.c => lpc17_40_dac.c} (90%)
rename configs/mcb1700/src/{lpc17_leds.c => lpc17_40_leds.c} (90%)
rename configs/mcb1700/src/{lpc17_pwm.c => lpc17_40_pwm.c} (84%)
rename configs/olimex-lpc1766stk/src/{lpc17_appinit.c => lpc17_40_appinit.c} (98%)
rename configs/olimex-lpc1766stk/src/{lpc17_boot.c => lpc17_40_boot.c} (92%)
rename configs/olimex-lpc1766stk/src/{lpc17_bringup.c => lpc17_40_bringup.c} (94%)
rename configs/olimex-lpc1766stk/src/{lpc17_buttons.c => lpc17_40_buttons.c} (95%)
rename configs/olimex-lpc1766stk/src/{lpc17_can.c => lpc17_40_can.c} (89%)
rename configs/olimex-lpc1766stk/src/{lpc17_leds.c => lpc17_40_leds.c} (84%)
rename configs/olimex-lpc1766stk/src/{lpc17_ssp.c => lpc17_40_ssp.c} (79%)
rename configs/olimex-lpc1766stk/src/{lpc17_usbmsc.c => lpc17_40_usbmsc.c} (80%)
rename configs/open1788/kernel/{lpc17_userspace.c => lpc17_40_userspace.c} (99%)
rename configs/open1788/src/{lpc17_appinit.c => lpc17_40_appinit.c} (98%)
rename configs/open1788/src/{lpc17_autoleds.c => lpc17_40_autoleds.c} (93%)
rename configs/open1788/src/{lpc17_boardinitialize.c => lpc17_40_boardinitialize.c} (89%)
rename configs/open1788/src/{lpc17_bringup.c => lpc17_40_bringup.c} (93%)
rename configs/open1788/src/{lpc17_buttons.c => lpc17_40_buttons.c} (95%)
rename configs/open1788/src/{lpc17_djoystick.c => lpc17_40_djoystick.c} (95%)
rename configs/open1788/src/{lpc17_lcd.c => lpc17_40_lcd.c} (87%)
rename configs/open1788/src/{lpc17_nandinitialize.c => lpc17_40_nandinitialize.c} (82%)
rename configs/open1788/src/{lpc17_norinitialize.c => lpc17_40_norinitialize.c} (82%)
rename configs/open1788/src/{lpc17_sdraminitialize.c => lpc17_40_sdraminitialize.c} (66%)
rename configs/open1788/src/{lpc17_ssp.c => lpc17_40_ssp.c} (72%)
rename configs/open1788/src/{lpc17_touchscreen.c => lpc17_40_touchscreen.c} (93%)
rename configs/open1788/src/{lpc17_userleds.c => lpc17_40_userleds.c} (86%)
rename configs/pnev5180b/kernel/{lpc17_userspace.c => lpc17_40_userspace.c} (97%)
rename configs/pnev5180b/src/{lpc17_appinit.c => lpc17_40_appinit.c} (98%)
rename configs/pnev5180b/src/{lpc17_boot.c => lpc17_40_boot.c} (94%)
rename configs/pnev5180b/src/{lpc17_bringup.c => lpc17_40_bringup.c} (93%)
rename configs/pnev5180b/src/{lpc17_composite.c => lpc17_40_composite.c} (99%)
rename configs/pnev5180b/src/{lpc17_leds.c => lpc17_40_leds.c} (69%)
rename configs/pnev5180b/src/{lpc17_romfs.c => lpc17_40_romfs.c} (83%)
rename configs/pnev5180b/src/{lpc17_romfs.h => lpc17_40_romfs.h} (89%)
rename configs/pnev5180b/src/{lpc17_spi.c => lpc17_40_spi.c} (82%)
rename configs/pnev5180b/src/{lpc17_symtab.c => lpc17_40_symtab.c} (95%)
rename configs/pnev5180b/src/{lpc17_symtab.h => lpc17_40_symtab.h} (88%)
rename configs/u-blox-c027/src/{lpc17_adc.c => lpc17_40_adc.c} (91%)
rename configs/u-blox-c027/src/{lpc17_appinit.c => lpc17_40_appinit.c} (94%)
rename configs/u-blox-c027/src/{lpc17_boot.c => lpc17_40_boot.c} (79%)
rename configs/u-blox-c027/src/{lpc17_dac.c => lpc17_40_dac.c} (90%)
rename configs/u-blox-c027/src/{lpc17_leds.c => lpc17_40_leds.c} (95%)
rename configs/u-blox-c027/src/{lpc17_pwm.c => lpc17_40_pwm.c} (83%)
rename configs/u-blox-c027/src/{lpc17_ssp.c => lpc17_40_ssp.c} (73%)
rename configs/u-blox-c027/src/{lpc17_ubxmdm.c => lpc17_40_ubxmdm.c} (65%)
rename configs/u-blox-c027/src/{lpc17_usbmsc.c => lpc17_40_usbmsc.c} (81%)
rename configs/zkit-arm-1769/src/{lpc17_adc.c => lpc17_40_adc.c} (94%)
rename configs/zkit-arm-1769/src/{lpc17_appinit.c => lpc17_40_appinit.c} (96%)
rename configs/zkit-arm-1769/src/{lpc17_boot.c => lpc17_40_boot.c} (91%)
rename configs/zkit-arm-1769/src/{lpc17_buttons.c => lpc17_40_buttons.c} (95%)
rename configs/zkit-arm-1769/src/{lpc17_can.c => lpc17_40_can.c} (88%)
rename configs/zkit-arm-1769/src/{lpc17_dac.c => lpc17_40_dac.c} (90%)
rename configs/zkit-arm-1769/src/{lpc17_lcd.c => lpc17_40_lcd.c} (90%)
rename configs/zkit-arm-1769/src/{lpc17_leds.c => lpc17_40_leds.c} (90%)
rename configs/zkit-arm-1769/src/{lpc17_spi.c => lpc17_40_spi.c} (78%)
rename configs/zkit-arm-1769/src/{lpc17_ssp.c => lpc17_40_ssp.c} (73%)
rename configs/zkit-arm-1769/src/{lpc17_usbmsc.c => lpc17_40_usbmsc.c} (81%)
diff --git a/Documentation/NuttxPortingGuide.html b/Documentation/NuttxPortingGuide.html
index 7746ee3c5ce..d2c7b292d86 100644
--- a/Documentation/NuttxPortingGuide.html
+++ b/Documentation/NuttxPortingGuide.html
@@ -6273,7 +6273,7 @@ int kbd_decode(FAR struct lib_instream_s *stream, FAR struct kbd_getstate_s *sta
Examples:
- arch/arm/src/lpc17xx/lpc17_usbhost.c,
+ arch/arm/src/lpc17xx_40xx/lpc17_40_usbhost.c,
arch/arm/src/stm32/stm32_otgfshost.c,
arch/arm/src/sama5/sam_ohci.c, and
arch/arm/src/sama5/sam_ehci.c.
@@ -6366,7 +6366,7 @@ int kbd_decode(FAR struct lib_instream_s *stream, FAR struct kbd_getstate_s *sta
Examples:
- The function nsh_waiter() in the file configs/olimex-lpc1766stk/src/lpc17_appinit.c.
+ The function nsh_waiter() in the file configs/olimex-lpc1766stk/src/lpc17_40_appinit.c.
@@ -6409,7 +6409,7 @@ int kbd_decode(FAR struct lib_instream_s *stream, FAR struct kbd_getstate_s *sta
Examples:
- arch/arm/src/dm320/dm320_usbdev.c, arch/arm/src/lpc17xx/lpc17_usbdev.c,
+ arch/arm/src/dm320/dm320_usbdev.c, arch/arm/src/lpc17xx_40xx/lpc17_40_usbdev.c,
arch/arm/src/lpc214x/lpc214x_usbdev.c, arch/arm/src/lpc313x/lpc313x_usbdev.c, and
arch/arm/src/stm32/stm32_usbdev.c.
diff --git a/Documentation/UsbTrace.html b/Documentation/UsbTrace.html
index 2b26986e7f9..895b524df4d 100644
--- a/Documentation/UsbTrace.html
+++ b/Documentation/UsbTrace.html
@@ -112,7 +112,7 @@
For the USB device driver, that 8-bit event data is provided within the USB device driver itself.
- So, for example, the 8-bit event data for the LPC1768 USB device driver is found in arch/arm/src/lpc17xx/lpc17_usbdev.c.
+ So, for example, the 8-bit event data for the LPC1768 USB device driver is found in arch/arm/src/lpc17xx_40xx/lpc17_40_usbdev.c.
16-bit Trace Data.
@@ -237,28 +237,28 @@
3 |
TRACE_INTENTRY_ID1 |
1 |
- LPC17_TRACEINTID_USB2 |
+ LPC17_40_TRACEINTID_USB2 |
0039 |
| 4 |
TRACE_INTDECODE_ID2 |
7 |
- LPC17_TRACEINTID_DEVSTAT2 |
+ LPC17_40_TRACEINTID_DEVSTAT2 |
0019 |
| 5 |
TRACE_INTDECODE_ID2 |
32 |
- LPC17_TRACEINTID_SUSPENDCHG2 |
+ LPC17_40_TRACEINTID_SUSPENDCHG2 |
0019 |
| 6 |
TRACE_INTDECODE_ID2 |
6 |
- LPC17_TRACEINTID_DEVRESET2 |
+ LPC17_40_TRACEINTID_DEVRESET2 |
0019 |
@@ -279,13 +279,13 @@
| 9 |
TRACE_INTEXIT_ID1 |
1 |
- LPC17_TRACEINTID_USB2 |
+ LPC17_40_TRACEINTID_USB2 |
0000 |
NOTES:
1See include/nuttx/usb/usbdev_trace.h
- 2See arch/arm/src/lpc17xx/lpc17_usbdev.c
+ 2See arch/arm/src/lpc17xx_40xx/lpc17_40_usbdev.c
diff --git a/arch/README.txt b/arch/README.txt
index 51bccd4ad56..14664f763c9 100644
--- a/arch/README.txt
+++ b/arch/README.txt
@@ -168,7 +168,7 @@ arch/arm - ARM-based micro-controllers
arch/arm/include/kl and arch/arm/src/kl
arch/arm/include/lpc11xx and arch/arm/src/lc823450
arch/arm/include/lpc11xx and arch/arm/src/lpc11xx
- arch/arm/include/lpc17xx and arch/arm/src/lpc17xx
+ arch/arm/include/lpc17xx_40xx and arch/arm/src/lpc17xx_40xx
arch/arm/include/lpc214x and arch/arm/src/lpc214x
arch/arm/include/lpc2378 and arch/arm/src/lpc2378.
arch/arm/include/lpc31xx and arch/arm/src/lpc31xx
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 1a0e67c6881..e1ce3a4e03b 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -139,15 +139,14 @@ config ARCH_CHIP_LPC11XX
---help---
NXP LPC11xx architectures (ARM Cortex-M0)
-config ARCH_CHIP_LPC17XX
- bool "NXP LPC17xx"
- select ARCH_CORTEXM3
+config ARCH_CHIP_LPC17XX_40XX
+ bool "NXP LPC17xx/LPC40xx"
select ARCH_HAVE_MPU
select ARM_HAVE_MPU_UNIFIED
select ARCH_HAVE_FETCHADD
select ARMV7M_HAVE_STACKCHECK
---help---
- NXP LPC17xx architectures (ARM Cortex-M3)
+ NXP LPC17xx & LPC40xx architectures (ARM Cortex-M3/4)
config ARCH_CHIP_LPC214X
bool "NXP LPC214x"
@@ -667,7 +666,7 @@ config ARCH_CHIP
default "lc823450" if ARCH_CHIP_LC823450
default "tiva" if ARCH_CHIP_LM || ARCH_CHIP_TIVA ||ARCH_CHIP_SIMPLELINK
default "lpc11xx" if ARCH_CHIP_LPC11XX
- default "lpc17xx" if ARCH_CHIP_LPC17XX
+ default "lpc17xx_40xx" if ARCH_CHIP_LPC17XX_40XX
default "lpc214x" if ARCH_CHIP_LPC214X
default "lpc2378" if ARCH_CHIP_LPC2378
default "lpc31xx" if ARCH_CHIP_LPC31XX
@@ -880,8 +879,8 @@ endif
if ARCH_CHIP_LPC11XX
source arch/arm/src/lpc11xx/Kconfig
endif
-if ARCH_CHIP_LPC17XX
-source arch/arm/src/lpc17xx/Kconfig
+if ARCH_CHIP_LPC17XX_40XX
+source arch/arm/src/lpc17xx_40xx/Kconfig
endif
if ARCH_CHIP_LPC214X
source arch/arm/src/lpc214x/Kconfig
diff --git a/arch/arm/include/lpc17xx/chip.h b/arch/arm/include/lpc17xx/chip.h
deleted file mode 100644
index 91b15abad69..00000000000
--- a/arch/arm/include/lpc17xx/chip.h
+++ /dev/null
@@ -1,388 +0,0 @@
-/************************************************************************************
- * arch/arm/include/lpc17xx/chip.h
- *
- * Copyright (C) 2010-2011, 2013 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt
- * with LPC178x support from Rommel Marcelo
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. 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.
- * 3. Neither the name NuttX 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 THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- ************************************************************************************/
-
-#ifndef __ARCH_ARM_INCLUDE_LPC17XX_CHIP_H
-#define __ARCH_ARM_INCLUDE_LPC17XX_CHIP_H
-
-/************************************************************************************
- * Included Files
- ************************************************************************************/
-
-#include
-
-/************************************************************************************
- * Pre-processor Definitions
- ************************************************************************************/
-
-/* Get customizations for each supported chip */
-
-#if defined(CONFIG_ARCH_CHIP_LPC1751)
-# define LPC176x 1 /* LPC175/6 family */
-# undef LPC178x /* Not LPC177/8 family */
-# define LPC17_FLASH_SIZE (32*1024) /* 32Kb */
-# define LPC17_SRAM_SIZE (8*1024) /* 8Kb */
-# define LPC17_CPUSRAM_SIZE (8*1024)
-# undef LPC17_HAVE_BANK0 /* No AHB SRAM bank 0 */
-# undef LPC17_HAVE_BANK1 /* No AHB SRAM bank 1 */
-# define LPC17_NETHCONTROLLERS 0 /* No Ethernet controller */
-# define LPC17_NUSBHOST 0 /* No USB host controller */
-# define LPC17_NUSBOTG 0 /* No USB OTG controller */
-# define LPC17_NUSBDEV 1 /* One USB device controller */
-# define LPC17_NCAN 1 /* One CAN controller */
-# define LPC17_NI2S 0 /* No I2S modules */
-# define LPC17_NDAC 0 /* No DAC module */
-#elif defined(CONFIG_ARCH_CHIP_LPC1752)
-# define LPC176x 1 /* LPC175/6 family */
-# undef LPC178x /* Not LPC177/8 family */
-# define LPC17_FLASH_SIZE (64*1024) /* 65Kb */
-# define LPC17_SRAM_SIZE (16*1024) /* 16Kb */
-# define LPC17_CPUSRAM_SIZE (16*1024)
-# undef LPC17_HAVE_BANK0 /* No AHB SRAM bank 0 */
-# undef LPC17_HAVE_BANK1 /* No AHB SRAM bank 1 */
-# define LPC17_NETHCONTROLLERS 0 /* No Ethernet controller */
-# define LPC17_NUSBHOST 0 /* No USB host controller */
-# define LPC17_NUSBOTG 0 /* No USB OTG controller */
-# define LPC17_NUSBDEV 1 /* One USB device controller */
-# define LPC17_NCAN 1 /* One CAN controller */
-# define LPC17_NI2S 0 /* No I2S modules */
-# define LPC17_NDAC 0 /* No DAC module */
-#elif defined(CONFIG_ARCH_CHIP_LPC1754)
-# define LPC176x 1 /* LPC175/6 family */
-# undef LPC178x /* Not LPC177/8 family */
-# define LPC17_FLASH_SIZE (128*1024) /* 128Kb */
-# define LPC17_SRAM_SIZE (32*1024) /* 32Kb */
-# define LPC17_CPUSRAM_SIZE (16*1024)
-# define LPC17_HAVE_BANK0 1 /* Have AHB SRAM bank 0 */
-# undef LPC17_HAVE_BANK1 /* No AHB SRAM bank 1 */
-# define LPC17_NETHCONTROLLERS 0 /* No Ethernet controller */
-# define LPC17_NUSBHOST 1 /* One USB host controller */
-# define LPC17_NUSBOTG 1 /* One USB OTG controller */
-# define LPC17_NUSBDEV 1 /* One USB device controller */
-# define LPC17_NCAN 1 /* One CAN controller */
-# define LPC17_NI2S 0 /* No I2S modules */
-# define LPC17_NDAC 1 /* One DAC module */
-#elif defined(CONFIG_ARCH_CHIP_LPC1756)
-# define LPC176x 1 /* LPC175/6 family */
-# undef LPC178x /* Not LPC177/8 family */
-# define LPC17_FLASH_SIZE (256*1024) /* 256Kb */
-# define LPC17_SRAM_SIZE (32*1024) /* 32Kb */
-# define LPC17_CPUSRAM_SIZE (16*1024)
-# define LPC17_HAVE_BANK0 1 /* No AHB SRAM bank 0 */
-# undef LPC17_HAVE_BANK1 /* No AHB SRAM bank 1 */
-# define LPC17_NETHCONTROLLERS 0 /* No Ethernet controller */
-# define LPC17_NUSBHOST 1 /* One USB host controller */
-# define LPC17_NUSBOTG 1 /* One USB OTG controller */
-# define LPC17_NUSBDEV 1 /* One USB device controller */
-# define LPC17_NCAN 2 /* Two CAN controllers */
-# define LPC17_NI2S 1 /* One I2S module */
-# define LPC17_NDAC 1 /* One DAC module */
-#elif defined(CONFIG_ARCH_CHIP_LPC1758)
-# define LPC176x 1 /* LPC175/6 family */
-# undef LPC178x /* Not LPC177/8 family */
-# define LPC17_FLASH_SIZE (512*1024) /* 512Kb */
-# define LPC17_SRAM_SIZE (64*1024) /* 64Kb */
-# define LPC17_CPUSRAM_SIZE (32*1024)
-# define LPC17_HAVE_BANK0 1 /* Have AHB SRAM bank 0 */
-# define LPC17_HAVE_BANK1 1 /* Have AHB SRAM bank 1 */
-# define LPC17_NETHCONTROLLERS 1 /* One Ethernet controller */
-# define LPC17_NUSBHOST 1 /* One USB host controller */
-# define LPC17_NUSBOTG 1 /* One USB OTG controller */
-# define LPC17_NUSBDEV 1 /* One USB device controller */
-# define LPC17_NCAN 2 /* Two CAN controllers */
-# define LPC17_NI2S 1 /* One I2S module */
-# define LPC17_NDAC 1 /* One DAC module */
-#elif defined(CONFIG_ARCH_CHIP_LPC1759)
-# define LPC176x 1 /* LPC175/6 family */
-# undef LPC178x /* Not LPC177/8 family */
-# define LPC17_FLASH_SIZE (512*1024) /* 512Kb */
-# define LPC17_SRAM_SIZE (64*1024) /* 64Kb */
-# define LPC17_CPUSRAM_SIZE (32*1024)
-# define LPC17_HAVE_BANK0 1 /* Have AHB SRAM bank 0 */
-# define LPC17_HAVE_BANK1 1 /* Have AHB SRAM bank 1 */
-# define LPC17_NETHCONTROLLERS 0 /* No Ethernet controller */
-# define LPC17_NUSBHOST 1 /* One USB host controller */
-# define LPC17_NUSBOTG 1 /* One USB OTG controller */
-# define LPC17_NUSBDEV 1 /* One USB device controller */
-# define LPC17_NCAN 2 /* Two CAN controllers */
-# define LPC17_NI2S 1 /* One I2S module */
-# define LPC17_NDAC 1 /* One DAC module */
-#elif defined(CONFIG_ARCH_CHIP_LPC1764)
-# define LPC176x 1 /* LPC175/6 family */
-# undef LPC178x /* Not LPC177/8 family */
-# define LPC17_FLASH_SIZE (128*1024) /* 128Kb */
-# define LPC17_SRAM_SIZE (32*1024) /* 32Kb */
-# define LPC17_CPUSRAM_SIZE (16*1024)
-# define LPC17_HAVE_BANK0 1 /* Have AHB SRAM bank 0 */
-# undef LPC17_HAVE_BANK1 /* No AHB SRAM bank 1 */
-# define LPC17_NETHCONTROLLERS 1 /* One Ethernet controller */
-# define LPC17_NUSBHOST 0 /* No USB host controller */
-# define LPC17_NUSBOTG 0 /* No USB OTG controller */
-# define LPC17_NUSBDEV 1 /* One USB device controller */
-# define LPC17_NCAN 2 /* Two CAN controllers */
-# define LPC17_NI2S 0 /* No I2S modules */
-# define LPC17_NDAC 0 /* No DAC module */
-#elif defined(CONFIG_ARCH_CHIP_LPC1765)
-# define LPC176x 1 /* LPC175/6 family */
-# undef LPC178x /* Not LPC177/8 family */
-# define LPC17_FLASH_SIZE (256*1024) /* 256Kb */
-# define LPC17_SRAM_SIZE (64*1024) /* 64Kb */
-# define LPC17_CPUSRAM_SIZE (32*1024)
-# define LPC17_HAVE_BANK0 1 /* Have AHB SRAM bank 0 */
-# define LPC17_HAVE_BANK1 1 /* Have AHB SRAM bank 1 */
-# define LPC17_NETHCONTROLLERS 0 /* No Ethernet controller */
-# define LPC17_NUSBHOST 1 /* One USB host controller */
-# define LPC17_NUSBOTG 1 /* One USB OTG controller */
-# define LPC17_NUSBDEV 1 /* One USB device controller */
-# define LPC17_NCAN 2 /* Two CAN controllers */
-# define LPC17_NI2S 1 /* One I2S module */
-# define LPC17_NDAC 1 /* One DAC module */
-#elif defined(CONFIG_ARCH_CHIP_LPC1766)
-# define LPC176x 1 /* LPC175/6 family */
-# undef LPC178x /* Not LPC177/8 family */
-# define LPC17_FLASH_SIZE (256*1024) /* 256Kb */
-# define LPC17_SRAM_SIZE (64*1024) /* 64Kb */
-# define LPC17_CPUSRAM_SIZE (32*1024)
-# define LPC17_HAVE_BANK0 1 /* Have AHB SRAM bank 0 */
-# define LPC17_HAVE_BANK1 1 /* Have AHB SRAM bank 1 */
-# define LPC17_NETHCONTROLLERS 1 /* One Ethernet controller */
-# define LPC17_NUSBHOST 1 /* One USB host controller */
-# define LPC17_NUSBOTG 1 /* One USB OTG controller */
-# define LPC17_NUSBDEV 1 /* One USB device controller */
-# define LPC17_NCAN 2 /* Two CAN controllers */
-# define LPC17_NI2S 1 /* One I2S module */
-# define LPC17_NDAC 1 /* One DAC module */
-#elif defined(CONFIG_ARCH_CHIP_LPC1767)
-# define LPC176x 1 /* LPC175/6 family */
-# undef LPC178x /* Not LPC177/8 family */
-# define LPC17_FLASH_SIZE (512*1024) /* 512Kb */
-# define LPC17_SRAM_SIZE (64*1024) /* 64Kb */
-# define LPC17_CPUSRAM_SIZE (32*1024)
-# define LPC17_HAVE_BANK0 1 /* Have AHB SRAM bank 0 */
-# define LPC17_HAVE_BANK1 1 /* Have AHB SRAM bank 1 */
-# define LPC17_NETHCONTROLLERS 1 /* One Ethernet controller */
-# define LPC17_NUSBHOST 0 /* No USB host controller */
-# define LPC17_NUSBOTG 0 /* No USB OTG controller */
-# define LPC17_NUSBDEV 0 /* No USB device controller */
-# define LPC17_NCAN 0 /* No CAN controllers */
-# define LPC17_NI2S 1 /* One I2S module */
-# define LPC17_NDAC 1 /* One DAC module */
-#elif defined(CONFIG_ARCH_CHIP_LPC1769) || defined(CONFIG_ARCH_CHIP_LPC1768)
-# define LPC176x 1 /* LPC175/6 family */
-# undef LPC178x /* Not LPC177/8 family */
-# define LPC17_FLASH_SIZE (512*1024) /* 512Kb */
-# define LPC17_SRAM_SIZE (64*1024) /* 64Kb */
-# define LPC17_CPUSRAM_SIZE (32*1024)
-# define LPC17_HAVE_BANK0 1 /* Have AHB SRAM bank 0 */
-# define LPC17_HAVE_BANK1 1 /* Have AHB SRAM bank 1 */
-# define LPC17_NETHCONTROLLERS 1 /* One Ethernet controller */
-# define LPC17_NUSBHOST 1 /* One USB host controller */
-# define LPC17_NUSBOTG 1 /* One USB OTG controller */
-# define LPC17_NUSBDEV 1 /* One USB device controller */
-# define LPC17_NCAN 2 /* Two CAN controllers */
-# define LPC17_NI2S 1 /* One I2S module */
-# define LPC17_NDAC 1 /* One DAC module */
-#elif defined(CONFIG_ARCH_CHIP_LPC1773)
-# undef LPC176x /* Not LPC175/6 family */
-# define LPC178x 1 /* LPC177/8 family */
-# define LPC17_FLASH_SIZE (128*1024) /* 128Kb */
-# define LPC17_SRAM_SIZE (40*1024) /* 40Kb */
-# define LPC17_CPUSRAM_SIZE (32*1024)
-# define LPC17_HAVE_BANK0 1 /* Have Peripheral SRAM bank 0 */
-# undef LPC17_HAVE_BANK1 /* No Peripheral SRAM bank 1 */
-# define LPC17_NETHCONTROLLERS 1 /* One Ethernet controller */
-# undef LPC17_NUSBHOST /* No USB host controller */
-# undef LPC17_NUSBOTG /* No USB OTG controller */
-# define LPC17_NUSBDEV 1 /* One USB device controller */
-# define LPC17_HAVE_SPIFI 1 /* Have SPIFI interface */
-# undef LPC17_HAVE_LCD /* No LCD controller */
-# undef LPC17_HAVE_QEI /* No QEI interface */
-# undef LPC17_HAVE_SD /* No SD controller */
-#elif defined(CONFIG_ARCH_CHIP_LPC1774)
-# undef LPC176x /* Not LPC175/6 family */
-# define LPC178x 1 /* LPC177/8 family */
-# define LPC17_FLASH_SIZE (128*1024) /* 128Kb */
-# define LPC17_SRAM_SIZE (40*1024) /* 40Kb */
-# define LPC17_CPUSRAM_SIZE (32*1024)
-# define LPC17_HAVE_BANK0 1 /* Have Peripheral SRAM bank 0*/
-# undef LPC17_HAVE_BANK1 /* Have Peripheral SRAM bank 1 */
-# define LPC17_NETHCONTROLLERS 1 /* One Ethernet controller */
-# undef LPC17_NUSBHOST /* One USB host controller */
-# undef LPC17_NUSBOTG /* One USB OTG controller */
-# define LPC17_NUSBDEV 1 /* One USB device controller */
-# undef LPC17_HAVE_SPIFI /* Have SPIFI interface */
-# undef LPC17_HAVE_LCD /* One LCD controller */
-# define LPC17_HAVE_QEI 1 /* One QEI interface */
-# define LPC17_HAVE_SD 1 /* One SD controller */
-#elif defined(CONFIG_ARCH_CHIP_LPC1776)
-# undef LPC176x /* Not LPC175/6 family */
-# define LPC178x 1 /* LPC177/8 family */
-# define LPC17_FLASH_SIZE (256*1024) /* 256Kb */
-# define LPC17_SRAM_SIZE (80*1024) /* 80Kb */
-# define LPC17_CPUSRAM_SIZE (64*1024)
-# define LPC17_HAVE_BANK0 1 /* Have Peripheral SRAM bank 0 */
-# undef LPC17_HAVE_BANK1 /* Have Peripheral SRAM bank 1 */
-# define LPC17_NETHCONTROLLERS 1 /* One Ethernet controller */
-# define LPC17_NUSBHOST 1 /* One USB host controller */
-# define LPC17_NUSBOTG 1 /* One USB OTG controller */
-# define LPC17_NUSBDEV 1 /* One USB device controller */
-# undef LPC17_HAVE_SPIFI /* Have SPIFI interface */
-# undef LPC17_HAVE_LCD /* One LCD controller */
-# define LPC17_HAVE_QEI 1 /* One QEI interface */
-# define LPC17_HAVE_SD 1 /* One SD controller */
-#elif defined(CONFIG_ARCH_CHIP_LPC1777)
-# undef LPC176x /* Not LPC175/6 family */
-# define LPC178x 1 /* LPC177/8 family */
-# define LPC17_FLASH_SIZE (512*1024) /* 512Kb */
-# define LPC17_SRAM_SIZE (96*1024) /* 96Kb */
-# define LPC17_CPUSRAM_SIZE (64*1024)
-# define LPC17_HAVE_BANK0 1 /* Have Peripheral SRAM bank 0 */
-# define LPC17_HAVE_BANK1 1 /* Have Peripheral SRAM bank 1 */
-# undef LPC17_NETHCONTROLLERS /* One Ethernet controller */
-# define LPC17_NUSBHOST 1 /* One USB host controller */
-# define LPC17_NUSBOTG 1 /* One USB OTG controller */
-# define LPC17_NUSBDEV 1 /* One USB device controller */
-# undef LPC17_HAVE_SPIFI /* Have SPIFI interface */
-# undef LPC17_HAVE_LCD /* One LCD controller */
-# define LPC17_HAVE_QEI 1 /* One QEI interface */
-# define LPC17_HAVE_SD 1 /* One SD controller */
-#elif defined(CONFIG_ARCH_CHIP_LPC1778)
-# undef LPC176x /* Not LPC175/6 family */
-# define LPC178x 1 /* LPC177/8 family */
-# define LPC17_FLASH_SIZE (512*1024) /* 512Kb */
-# define LPC17_SRAM_SIZE (96*1024) /* 64Kb */
-# define LPC17_CPUSRAM_SIZE (64*1024)
-# define LPC17_HAVE_BANK0 1 /* Have Peripheral SRAM bank 0 */
-# define LPC17_HAVE_BANK1 1 /* Have Peripheral SRAM bank 1 */
-# define LPC17_NETHCONTROLLERS 1 /* One Ethernet controller */
-# define LPC17_NUSBHOST 1 /* One USB host controller */
-# define LPC17_NUSBOTG 1 /* One USB OTG controller */
-# define LPC17_NUSBDEV 1 /* One USB device controller */
-# undef LPC17_HAVE_SPIFI /* Have SPIFI interface */
-# undef LPC17_HAVE_LCD /* One LCD controller */
-# define LPC17_HAVE_QEI 1 /* One QEI interface */
-# define LPC17_HAVE_SD 1 /* One SD controller */
-#elif defined(CONFIG_ARCH_CHIP_LPC1785)
-# undef LPC176x /* Not LPC175/6 family */
-# define LPC178x 1 /* LPC177/8 family */
-# define LPC17_FLASH_SIZE (256*1024) /* 256Kb */
-# define LPC17_SRAM_SIZE (80*1024) /* 80Kb */
-# define LPC17_CPUSRAM_SIZE (64*1024)
-# define LPC17_HAVE_BANK0 1 /* Have Peripheral SRAM bank 0 */
-# undef LPC17_HAVE_BANK1 /* Have Peripheral SRAM bank 1 */
-# undef LPC17_NETHCONTROLLERS /* One Ethernet controller */
-# define LPC17_NUSBHOST 1 /* One USB host controller */
-# define LPC17_NUSBOTG 1 /* One USB OTG controller */
-# define LPC17_NUSBDEV 1 /* One USB device controller */
-# undef LPC17_HAVE_SPIFI /* Have SPIFI interface */
-# define LPC17_HAVE_LCD 1 /* One LCD controller */
-# undef LPC17_HAVE_QEI /* One QEI interface */
-# define LPC17_HAVE_SD 1 /* One SD controller */
-#elif defined(CONFIG_ARCH_CHIP_LPC1786)
-# undef LPC176x /* Not LPC175/6 family */
-# define LPC178x 1 /* LPC177/8 family */
-# define LPC17_FLASH_SIZE (256*1024) /* 256Kb */
-# define LPC17_SRAM_SIZE (80*1024) /* 80Kb */
-# define LPC17_CPUSRAM_SIZE (64*1024)
-# define LPC17_HAVE_BANK0 1 /* Have Peripheral SRAM bank 0 */
-# undef LPC17_HAVE_BANK1 /* Have Peripheral SRAM bank 1 */
-# define LPC17_NETHCONTROLLERS 1 /* One Ethernet controller */
-# define LPC17_NUSBHOST 1 /* One USB host controller */
-# define LPC17_NUSBOTG 1 /* One USB OTG controller */
-# define LPC17_NUSBDEV 1 /* One USB device controller */
-# undef LPC17_HAVE_SPIFI /* Have SPIFI interface */
-# define LPC17_HAVE_LCD 1 /* One LCD controller */
-# define LPC17_HAVE_QEI 1 /* One QEI interface */
-# define LPC17_HAVE_SD 1 /* One SD controller */
-#elif defined(CONFIG_ARCH_CHIP_LPC1787)
-# undef LPC176x /* Not LPC175/6 family */
-# define LPC178x 1 /* LPC177/8 family */
-# define LPC17_FLASH_SIZE (512*1024) /* 512Kb */
-# define LPC17_SRAM_SIZE (96*1024) /* 96Kb */
-# define LPC17_CPUSRAM_SIZE (64*1024)
-# define LPC17_HAVE_BANK0 1 /* Have Peripheral SRAM bank 0 */
-# define LPC17_HAVE_BANK1 1 /* Have Peripheral SRAM bank 1 */
-# undef LPC17_NETHCONTROLLERS /* One Ethernet controller */
-# define LPC17_NUSBHOST 1 /* One USB host controller */
-# define LPC17_NUSBOTG 1 /* One USB OTG controller */
-# define LPC17_NUSBDEV 1 /* One USB device controller */
-# undef LPC17_HAVE_SPIFI /* Have SPIFI interface */
-# define LPC17_HAVE_LCD 1 /* One LCD controller */
-# define LPC17_HAVE_QEI 1 /* One QEI interface */
-# define LPC17_HAVE_SD 1 /* One SD controller */
-#elif defined(CONFIG_ARCH_CHIP_LPC1788)
-# undef LPC176x /* Not LPC175/6 family */
-# define LPC178x 1 /* LPC177/8 family */
-# define LPC17_FLASH_SIZE (512*1024) /* 512Kb */
-# define LPC17_SRAM_SIZE (96*1024) /* 96Kb */
-# define LPC17_CPUSRAM_SIZE (64*1024)
-# define LPC17_HAVE_BANK0 1 /* Have Peripheral SRAM bank 0 */
-# define LPC17_HAVE_BANK1 1 /* Have Peripheral SRAM bank 1 */
-# define LPC17_NETHCONTROLLERS 1 /* One Ethernet controller */
-# define LPC17_NUSBHOST 1 /* One USB host controller */
-# define LPC17_NUSBOTG 1 /* One USB OTG controller */
-# define LPC17_NUSBDEV 1 /* One USB device controller */
-# undef LPC17_HAVE_SPIFI /* Have SPIFI interface */
-# define LPC17_HAVE_LCD 1 /* One LCD controller */
-# define LPC17_HAVE_QEI 1 /* One QEI interface */
-# define LPC17_HAVE_SD 1 /* One SD controller */
-#else
-# error "Unsupported LPC17xx chip"
-#endif
-
-/* NVIC priority levels *************************************************************/
-/* Each priority field holds a priority value, 0-31. The lower the value, the greater
- * the priority of the corresponding interrupt. The processor implements only
- * bits[7:3] of each field, bits[2:0] read as zero and ignore writes.
- */
-
-#define NVIC_SYSH_PRIORITY_MIN 0xf8 /* All bits[7:3] set is minimum priority */
-#define NVIC_SYSH_PRIORITY_DEFAULT 0x80 /* Midpoint is the default */
-#define NVIC_SYSH_PRIORITY_MAX 0x00 /* Zero is maximum priority */
-#define NVIC_SYSH_PRIORITY_STEP 0x08 /* Five bits of interrupt priority used */
-
-/************************************************************************************
- * Public Types
- ************************************************************************************/
-
-/************************************************************************************
- * Public Data
- ************************************************************************************/
-
-/************************************************************************************
- * Public Functions
- ************************************************************************************/
-
-#endif /* __ARCH_ARM_INCLUDE_LPC17XX_CHIP_H */
diff --git a/arch/arm/include/lpc17xx/lpc176x_irq.h b/arch/arm/include/lpc17xx/lpc176x_irq.h
deleted file mode 100644
index ed8b75a6b18..00000000000
--- a/arch/arm/include/lpc17xx/lpc176x_irq.h
+++ /dev/null
@@ -1,245 +0,0 @@
-/****************************************************************************
- * arch/lpc17xx/lpc176x_irq.h
- *
- * Copyright (C) 2010-2011, 2013 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. 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.
- * 3. Neither the name NuttX 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 THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- ****************************************************************************/
-
-/* This file should never be included directed but, rather, only indirectly
- * through nuttx/irq.h
- */
-
-#ifndef __ARCH_ARM_INCLUDE_LPC17XX_LPC176X_IRQ_H
-#define __ARCH_ARM_INCLUDE_LPC17XX_LPC176X_IRQ_H
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-/* IRQ numbers. The IRQ number corresponds vector number and hence map
- * directly to bits in the NVIC. This does, however, waste several words of
- * memory in the IRQ to handle mapping tables.
- */
-
-/* External interrupts (vectors >= 16) */
-
-#define LPC17_IRQ_WDT (LPC17_IRQ_EXTINT+0) /* WDT Watchdog Interrupt (WDINT) */
-#define LPC17_IRQ_TMR0 (LPC17_IRQ_EXTINT+1) /* Timer 0 Match 0 - 1 (MR0, MR1)
- * Capture 0 - 1 (CR0, CR1) */
-#define LPC17_IRQ_TMR1 (LPC17_IRQ_EXTINT+2) /* Timer 1 Match 0 - 2 (MR0, MR1, MR2)
- * Capture 0 - 1 (CR0, CR1) */
-#define LPC17_IRQ_TMR2 (LPC17_IRQ_EXTINT+3) /* Timer 2 Match 0-3
- * Capture 0-1 */
-#define LPC17_IRQ_TMR3 (LPC17_IRQ_EXTINT+4) /* Timer 3 Match 0-3
- * Capture 0-1 */
-#define LPC17_IRQ_UART0 (LPC17_IRQ_EXTINT+5) /* UART 0 Rx Line Status (RLS)
- * Transmit Holding Register Empty (THRE)
- * Rx Data Available (RDA)
- * Character Time-out Indicator (CTI)
- * End of Auto-Baud (ABEO)
- * Auto-Baud Time-Out (ABTO) */
-#define LPC17_IRQ_UART1 (LPC17_IRQ_EXTINT+6) /* UART 1 Rx Line Status (RLS)
- * Transmit Holding Register Empty (THRE)
- * Rx Data Available (RDA)
- * Character Time-out Indicator (CTI)
- * Modem Control Change
- * End of Auto-Baud (ABEO)
- * Auto-Baud Time-Out (ABTO) */
-#define LPC17_IRQ_UART2 (LPC17_IRQ_EXTINT+7) /* UART 2 Rx Line Status (RLS)
- * Transmit Holding Register Empty (THRE)
- * Rx Data Available (RDA)
- * Character Time-out Indicator (CTI)
- * End of Auto-Baud (ABEO)
- * Auto-Baud Time-Out (ABTO) */
-#define LPC17_IRQ_UART3 (LPC17_IRQ_EXTINT+8) /* UART 3 Rx Line Status (RLS)
- * Transmit Holding Register Empty (THRE)
- * Rx Data Available (RDA)
- * Character Time-out Indicator (CTI)
- * End of Auto-Baud (ABEO)
- * Auto-Baud Time-Out (ABTO) */
-#define LPC17_IRQ_PWM1 (LPC17_IRQ_EXTINT+9) /* PWM1 Match 0 - 6 of PWM1
- * Capture 0-1 of PWM1 */
-#define LPC17_IRQ_I2C0 (LPC17_IRQ_EXTINT+10) /* I2C0 SI (state change) */
-#define LPC17_IRQ_I2C1 (LPC17_IRQ_EXTINT+11) /* I2C1 SI (state change) */
-#define LPC17_IRQ_I2C2 (LPC17_IRQ_EXTINT+12) /* I2C2 SI (state change) */
-#define LPC17_IRQ_SPIF (LPC17_IRQ_EXTINT+13) /* SPI SPI Interrupt Flag (SPIF)
- * Mode Fault (MODF) */
-#define LPC17_IRQ_SSP0 (LPC17_IRQ_EXTINT+14) /* SSP0 Tx FIFO half empty of SSP0
- * Rx FIFO half full of SSP0
- * Rx Timeout of SSP0
- * Rx Overrun of SSP0 */
-#define LPC17_IRQ_SSP1 (LPC17_IRQ_EXTINT+15) /* SSP 1 Tx FIFO half empty
- * Rx FIFO half full
- * Rx Timeout
- * Rx Overrun */
-#define LPC17_IRQ_PLL0 (LPC17_IRQ_EXTINT+16) /* PLL0 (Main PLL) PLL0 Lock (PLOCK0) */
-#define LPC17_IRQ_RTC (LPC17_IRQ_EXTINT+17) /* RTC Counter Increment (RTCCIF)
- * Alarm (RTCALF) */
-#define LPC17_IRQ_EINT0 (LPC17_IRQ_EXTINT+18) /* External Interrupt 0 (EINT0) */
-#define LPC17_IRQ_EINT1 (LPC17_IRQ_EXTINT+19) /* External Interrupt 1 (EINT1) */
-#define LPC17_IRQ_EINT2 (LPC17_IRQ_EXTINT+20) /* External Interrupt 2 (EINT2) */
-#define LPC17_IRQ_EINT3 (LPC17_IRQ_EXTINT+21) /* External Interrupt 3 (EINT3)
- * Note: EINT3 channel is shared with GPIO interrupts */
-#define LPC17_IRQ_ADC (LPC17_IRQ_EXTINT+22) /* ADC A/D Converter end of conversion */
-#define LPC17_IRQ_BOD (LPC17_IRQ_EXTINT+23) /* BOD Brown Out detect */
-#define LPC17_IRQ_USB (LPC17_IRQ_EXTINT+24) /* USB USB_INT_REQ_LP, USB_INT_REQ_HP,
- * USB_INT_REQ_DMA */
-#define LPC17_IRQ_CAN (LPC17_IRQ_EXTINT+25) /* CAN CAN Common, CAN 0 Tx, CAN 0 Rx,
- * CAN 1 Tx, CAN 1 Rx */
-#define LPC17_IRQ_GPDMA (LPC17_IRQ_EXTINT+26) /* GPDMA IntStatus of DMA channel 0,
- * IntStatus of DMA channel 1 */
-#define LPC17_IRQ_I2S (LPC17_IRQ_EXTINT+27) /* I2S irq, dmareq1, dmareq2 */
-#define LPC17_IRQ_ETH (LPC17_IRQ_EXTINT+28) /* Ethernet WakeupInt, SoftInt, TxDoneInt,
- * TxFinishedInt, TxErrorInt,* TxUnderrunInt,
- * RxDoneInt, RxFinishedInt, RxErrorInt,
- * RxOverrunInt */
-#define LPC17_IRQ_RITINT (LPC17_IRQ_EXTINT+29) /* Repetitive Interrupt Timer (RITINT) */
-#define LPC17_IRQ_MCPWM (LPC17_IRQ_EXTINT+30) /* Motor Control PWM IPER[2:0], IPW[2:0],
- * ICAP[2:0], FES */
-#define LPC17_IRQ_QEI (LPC17_IRQ_EXTINT+31) /* Quadrature Encoder INX_Int, TIM_Int, VELC_Int,
- * DIR_Int, ERR_Int, ENCLK_Int, POS0_Int, POS1_Int
- * POS2_Int, REV_Int, POS0REV_Int, OS1REV_Int,
- * POS2REV_Int */
-#define LPC17_IRQ_PLL1 (LPC17_IRQ_EXTINT+32) /* PLL1 (USB PLL) PLL1 Lock (PLOCK1) */
-#define LPC17_IRQ_USBACT (LPC17_IRQ_EXTINT+33) /* USB Activity Interrupt USB_NEED_CLK */
-#define LPC17_IRQ_CANACT (LPC17_IRQ_EXTINT+34) /* CAN Activity Interrupt CAN1WAKE, CAN2WAKE */
-#define LPC17_IRQ_NEXTINT (35)
-#define LPC17_IRQ_NIRQS (LPC17_IRQ_EXTINT+LPC17_IRQ_NEXTINT)
-
-/* GPIO interrupts. The LPC17xx supports several interrupts on ports 0 and
- * 2 (only). We go through some special efforts to keep the number of IRQs
- * to a minimum in this sparse interrupt case.
- *
- * 28 interrupts on Port 0: p0.0 - p0.11, p0.15-p0.30
- * 14 interrupts on Port 2: p2.0 - p2.13
- * --
- * 42
- */
-
-#ifdef CONFIG_LPC17_GPIOIRQ
-# define LPC17_VALID_GPIOINT0 (0x7fff8ffful) /* GPIO port 0 interrupt set */
-# define LPC17_VALID_GPIOINT2 (0x00003ffful) /* GPIO port 2 interrupt set */
-
- /* Set 1: 12 interrupts p0.0-p0.11 */
-
-# define LPC17_VALID_GPIOINT0L (0x00000ffful)
-# define LPC17_VALID_SHIFT0L (0)
-# define LPC17_VALID_FIRST0L (LPC17_IRQ_EXTINT+LPC17_IRQ_NEXTINT)
-
-# define LPC17_IRQ_P0p0 (LPC17_VALID_FIRST0L+0)
-# define LPC17_IRQ_P0p1 (LPC17_VALID_FIRST0L+1)
-# define LPC17_IRQ_P0p2 (LPC17_VALID_FIRST0L+2)
-# define LPC17_IRQ_P0p3 (LPC17_VALID_FIRST0L+3)
-# define LPC17_IRQ_P0p4 (LPC17_VALID_FIRST0L+4)
-# define LPC17_IRQ_P0p5 (LPC17_VALID_FIRST0L+5)
-# define LPC17_IRQ_P0p6 (LPC17_VALID_FIRST0L+6)
-# define LPC17_IRQ_P0p7 (LPC17_VALID_FIRST0L+7)
-# define LPC17_IRQ_P0p8 (LPC17_VALID_FIRST0L+8)
-# define LPC17_IRQ_P0p9 (LPC17_VALID_FIRST0L+9)
-# define LPC17_IRQ_P0p10 (LPC17_VALID_FIRST0L+10)
-# define LPC17_IRQ_P0p11 (LPC17_VALID_FIRST0L+11)
-# define LPC17_VALID_NIRQS0L (12)
-
- /* Set 2: 16 interrupts p0.15-p0.30 */
-
-# define LPC17_VALID_GPIOINT0H (0x7fff8000ull)
-# define LPC17_VALID_SHIFT0H (15)
-# define LPC17_VALID_FIRST0H (LPC17_VALID_FIRST0L+LPC17_VALID_NIRQS0L)
-
-# define LPC17_IRQ_P0p15 (LPC17_VALID_FIRST0H+0)
-# define LPC17_IRQ_P0p16 (LPC17_VALID_FIRST0H+1)
-# define LPC17_IRQ_P0p17 (LPC17_VALID_FIRST0H+2)
-# define LPC17_IRQ_P0p18 (LPC17_VALID_FIRST0H+3)
-# define LPC17_IRQ_P0p19 (LPC17_VALID_FIRST0H+4)
-# define LPC17_IRQ_P0p20 (LPC17_VALID_FIRST0H+5)
-# define LPC17_IRQ_P0p21 (LPC17_VALID_FIRST0H+6)
-# define LPC17_IRQ_P0p22 (LPC17_VALID_FIRST0H+7)
-# define LPC17_IRQ_P0p23 (LPC17_VALID_FIRST0H+8)
-# define LPC17_IRQ_P0p24 (LPC17_VALID_FIRST0H+9)
-# define LPC17_IRQ_P0p25 (LPC17_VALID_FIRST0H+10)
-# define LPC17_IRQ_P0p26 (LPC17_VALID_FIRST0H+11)
-# define LPC17_IRQ_P0p27 (LPC17_VALID_FIRST0H+12)
-# define LPC17_IRQ_P0p28 (LPC17_VALID_FIRST0H+13)
-# define LPC17_IRQ_P0p29 (LPC17_VALID_FIRST0H+14)
-# define LPC17_IRQ_P0p30 (LPC17_VALID_FIRST0H+15)
-# define LPC17_VALID_NIRQS0H (16)
-
- /* Set 3: 14 interrupts p2.0-p2.13 */
-
-# define LPC17_VALID_GPIOINT2 (0x00003ffful)
-# define LPC17_VALID_SHIFT2 (0)
-# define LPC17_VALID_FIRST2 (LPC17_VALID_FIRST0H+LPC17_VALID_NIRQS0H)
-
-# define LPC17_IRQ_P2p0 (LPC17_VALID_FIRST2+0)
-# define LPC17_IRQ_P2p1 (LPC17_VALID_FIRST2+1)
-# define LPC17_IRQ_P2p2 (LPC17_VALID_FIRST2+2)
-# define LPC17_IRQ_P2p3 (LPC17_VALID_FIRST2+3)
-# define LPC17_IRQ_P2p4 (LPC17_VALID_FIRST2+4)
-# define LPC17_IRQ_P2p5 (LPC17_VALID_FIRST2+5)
-# define LPC17_IRQ_P2p6 (LPC17_VALID_FIRST2+6)
-# define LPC17_IRQ_P2p7 (LPC17_VALID_FIRST2+7)
-# define LPC17_IRQ_P2p8 (LPC17_VALID_FIRST2+8)
-# define LPC17_IRQ_P2p9 (LPC17_VALID_FIRST2+9)
-# define LPC17_IRQ_P2p10 (LPC17_VALID_FIRST2+10)
-# define LPC17_IRQ_P2p11 (LPC17_VALID_FIRST2+11)
-# define LPC17_IRQ_P2p12 (LPC17_VALID_FIRST2+12)
-# define LPC17_IRQ_P2p13 (LPC17_VALID_FIRST2+13)
-# define LPC17_VALID_NIRQS2 (14)
-# define LPC17_NGPIOAIRQS (LPC17_VALID_NIRQS0L+LPC17_VALID_NIRQS0H+LPC17_VALID_NIRQS2)
-#else
-# define LPC17_NGPIOAIRQS (0)
-#endif
-
-/* Total number of IRQ numbers */
-
-#define NR_IRQS (LPC17_IRQ_EXTINT+LPC17_IRQ_NEXTINT+LPC17_NGPIOAIRQS)
-
-/****************************************************************************
- * Public Types
- ****************************************************************************/
-
-/****************************************************************************
- * Inline functions
- ****************************************************************************/
-
-/****************************************************************************
- * Public Data
- ****************************************************************************/
-
-/****************************************************************************
- * Public Function Prototypes
- ****************************************************************************/
-
-#endif /* __ARCH_ARM_INCLUDE_LPC17XX_LPC176X_IRQ_H */
-
diff --git a/arch/arm/include/lpc17xx/lpc178x_irq.h b/arch/arm/include/lpc17xx/lpc178x_irq.h
deleted file mode 100644
index c9d5bee15f8..00000000000
--- a/arch/arm/include/lpc17xx/lpc178x_irq.h
+++ /dev/null
@@ -1,291 +0,0 @@
-/****************************************************************************
- * arch/arm/include/lpc17xxx/lpc178x_irq.h
- *
- * Copyright (C) 2013 Gregory Nutt. All rights reserved.
- * Authors: Rommel Marcelo
- * Gregory Nutt
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. 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.
- * 3. Neither the name NuttX 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 THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- ****************************************************************************/
-
-/* This file should never be included directed but, rather,
- * only indirectly through nuttx/irq.h
- */
-
-#ifndef __ARCH_ARM_INCLUDE_LPC17XX_LPC178X_IRQ_H
-#define __ARCH_ARM_INCLUDE_LPC17XX_LPC178X_IRQ_H
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-
-/* IRQ numbers. The IRQ number corresponds vector number and hence map
- * directly to bits in the NVIC. This does, however, waste several words of
- * memory in the IRQ to handle mapping tables.
- */
-
-/* External interrupts (vectors >= 16) */
-
-#define LPC17_IRQ_WDT (LPC17_IRQ_EXTINT+0) /* WDT Watchdog Interrupt (WDINT) */
-#define LPC17_IRQ_TMR0 (LPC17_IRQ_EXTINT+1) /* Timer 0 Match 0 - 1 (MR0, MR1)
- * Capture 0 - 1 (CR0, CR1) */
-#define LPC17_IRQ_TMR1 (LPC17_IRQ_EXTINT+2) /* Timer 1 Match 0 - 2 (MR0, MR1, MR2)
- * Capture 0 - 1 (CR0, CR1) */
-#define LPC17_IRQ_TMR2 (LPC17_IRQ_EXTINT+3) /* Timer 2 Match 0-3
- * Capture 0-1 */
-#define LPC17_IRQ_TMR3 (LPC17_IRQ_EXTINT+4) /* Timer 3 Match 0-3
- * Capture 0-1 */
-#define LPC17_IRQ_UART0 (LPC17_IRQ_EXTINT+5) /* UART 0 Rx Line Status (RLS)
- * Transmit Holding Register Empty (THRE)
- * Rx Data Available (RDA)
- * Character Time-out Indicator (CTI)
- * End of Auto-Baud (ABEO)
- * Auto-Baud Time-Out (ABTO) */
-#define LPC17_IRQ_UART1 (LPC17_IRQ_EXTINT+6) /* UART 1 Rx Line Status (RLS)
- * Transmit Holding Register Empty (THRE)
- * Rx Data Available (RDA)
- * Character Time-out Indicator (CTI)
- * Modem Control Change
- * End of Auto-Baud (ABEO)
- * Auto-Baud Time-Out (ABTO) */
-#define LPC17_IRQ_UART2 (LPC17_IRQ_EXTINT+7) /* UART 2 Rx Line Status (RLS)
- * Transmit Holding Register Empty (THRE)
- * Rx Data Available (RDA)
- * Character Time-out Indicator (CTI)
- * End of Auto-Baud (ABEO)
- * Auto-Baud Time-Out (ABTO) */
-#define LPC17_IRQ_UART3 (LPC17_IRQ_EXTINT+8) /* UART 3 Rx Line Status (RLS)
- * Transmit Holding Register Empty (THRE)
- * Rx Data Available (RDA)
- * Character Time-out Indicator (CTI)
- * End of Auto-Baud (ABEO)
- * Auto-Baud Time-Out (ABTO) */
-#define LPC17_IRQ_PWM1 (LPC17_IRQ_EXTINT+9) /* PWM1 Match 0 - 6 of PWM1
- * Capture 0-1 of PWM1 */
-#define LPC17_IRQ_I2C0 (LPC17_IRQ_EXTINT+10) /* I2C0 SI (state change) */
-#define LPC17_IRQ_I2C1 (LPC17_IRQ_EXTINT+11) /* I2C1 SI (state change) */
-#define LPC17_IRQ_I2C2 (LPC17_IRQ_EXTINT+12) /* I2C2 SI (state change) */
-#define LPC17_IRQ_RESERVED29 (LPC17_IRQ_EXTINT+13) /* Unused */
-#define LPC17_IRQ_SSP0 (LPC17_IRQ_EXTINT+14) /* SSP0 Tx FIFO half empty of SSP0
- * Rx FIFO half full of SSP0
- * Rx Timeout of SSP0
- * Rx Overrun of SSP0 */
-#define LPC17_IRQ_SSP1 (LPC17_IRQ_EXTINT+15) /* SSP 1 Tx FIFO half empty
- * Rx FIFO half full
- * Rx Timeout
- * Rx Overrun */
-#define LPC17_IRQ_PLL0 (LPC17_IRQ_EXTINT+16) /* PLL0 (Main PLL) PLL0 Lock (PLOCK0) */
-#define LPC17_IRQ_RTC (LPC17_IRQ_EXTINT+17) /* RTC Counter Increment (RTCCIF)
- * Alarm (RTCALF) */
-#define LPC17_IRQ_EINT0 (LPC17_IRQ_EXTINT+18) /* External Interrupt 0 (EINT0) */
-#define LPC17_IRQ_EINT1 (LPC17_IRQ_EXTINT+19) /* External Interrupt 1 (EINT1) */
-#define LPC17_IRQ_EINT2 (LPC17_IRQ_EXTINT+20) /* External Interrupt 2 (EINT2) */
-#define LPC17_IRQ_EINT3 (LPC17_IRQ_EXTINT+21) /* External Interrupt 3 (EINT3)
- * Note: EINT3 channel is shared with GPIO interrupts */
-#define LPC17_IRQ_ADC (LPC17_IRQ_EXTINT+22) /* ADC A/D Converter end of conversion */
-#define LPC17_IRQ_BOD (LPC17_IRQ_EXTINT+23) /* BOD Brown Out detect */
-#define LPC17_IRQ_USB (LPC17_IRQ_EXTINT+24) /* USB USB_INT_REQ_LP, USB_INT_REQ_HP,
- * USB_INT_REQ_DMA */
-#define LPC17_IRQ_CAN (LPC17_IRQ_EXTINT+25) /* CAN CAN Common, CAN 0 Tx, CAN 0 Rx,
- * CAN 1 Tx, CAN 1 Rx */
-#define LPC17_IRQ_GPDMA (LPC17_IRQ_EXTINT+26) /* GPDMA IntStatus of DMA channel 0,
- * IntStatus of DMA channel 1 */
-#define LPC17_IRQ_I2S (LPC17_IRQ_EXTINT+27) /* I2S irq, dmareq1, dmareq2 */
-#define LPC17_IRQ_ETH (LPC17_IRQ_EXTINT+28) /* Ethernet WakeupInt, SoftInt, TxDoneInt,
- * TxFinishedInt, TxErrorInt,* TxUnderrunInt,
- * RxDoneInt, RxFinishedInt, RxErrorInt,
- * RxOverrunInt */
-#define LPC17_IRQ_MCI (LPC17_IRQ_EXTINT+29) /* MCI SD Card Interface */
-#define LPC17_IRQ_MCPWM (LPC17_IRQ_EXTINT+30) /* Motor Control PWM IPER[2:0], IPW[2:0],
- * ICAP[2:0], FES */
-#define LPC17_IRQ_QEI (LPC17_IRQ_EXTINT+31) /* Quadrature Encoder INX_Int, TIM_Int, VELC_Int,
- * DIR_Int, ERR_Int, ENCLK_Int, POS0_Int, POS1_Int
- * POS2_Int, REV_Int, POS0REV_Int, OS1REV_Int,
- * POS2REV_Int */
-#define LPC17_IRQ_PLL1 (LPC17_IRQ_EXTINT+32) /* PLL1 (USB PLL) PLL1 Lock (PLOCK1) */
-#define LPC17_IRQ_USBACT (LPC17_IRQ_EXTINT+33) /* USB Activity Interrupt USB_NEED_CLK */
-#define LPC17_IRQ_CANACT (LPC17_IRQ_EXTINT+34) /* CAN Activity Interrupt CAN1WAKE, CAN2WAKE */
-#define LPC17_IRQ_UART4 (LPC17_IRQ_EXTINT+35) /* UART 4 Rx Line Status (RLS)
- * Transmit Holding Register Empty (THRE)
- * Rx Data Available (RDA)
- * Character Time-out Indicator (CTI)
- * End of Auto-Baud (ABEO)
- * Auto-Baud Time-Out (ABTO) */
-#define LPC17_IRQ_SSP2 (LPC17_IRQ_EXTINT+36) /* SSP2 Tx FIFO half empty of SSP2
- * Rx FIFO half full of SSP2
- * Rx Timeout of SSP2
- * Rx Overrun of SSP2 */
-#define LPC17_IRQ_LCD (LPC17_IRQ_EXTINT+37) /* LCD interrupt
- * BER, VCompI, LNBUI, FUFI, CrsrI */
-#define LPC17_IRQ_GPIO (LPC17_IRQ_EXTINT+38) /* GPIO Interrupt
- * P0xREI, P2xREI, P0xFEI, P2xFEI */
-#define LPC17_IRQ_PWM0 (LPC17_IRQ_EXTINT+39) /* PWM0 Match 0 - 6 of PWM0
- * Capture 0-1 of PWM0 */
-#define LPC17_IRQ_EEPROM (LPC17_IRQ_EXTINT+40) /* EEPROM Interrupt
- * EE_PROG_DONE, EE_RW_DONE */
-#define LPC17_IRQ_NEXTINT (41)
-#define LPC17_IRQ_NIRQS (LPC17_IRQ_EXTINT+LPC17_IRQ_NEXTINT)
-
-/* GPIO interrupts. The LPC177x_8x supports several interrupts on ports 0 and
- * 2 (only). We go through some special efforts to keep the number of IRQs
- * to a minimum in this sparse interrupt case.
- *
- * 31 interrupts on Port 0: p0.0 - p0.30
- * 31 interrupts on Port 2: p2.0 - p2.30
- * --
- * 42
- */
-
-#ifdef CONFIG_LPC17_GPIOIRQ
-# define LPC17_VALID_GPIOINT0 (0xfffffffful) /* GPIO port 0 interrupt set */
-# define LPC17_VALID_GPIOINT2 (0xfffffffful) /* GPIO port 2 interrupt set */
-
- /* Set 1: 16 interrupts p0.0-p0.15 */
-
-# define LPC17_VALID_SHIFT0L (0)
-# define LPC17_VALID_FIRST0L (LPC17_IRQ_EXTINT+LPC17_IRQ_NEXTINT)
-
-# define LPC17_IRQ_P0p0 (LPC17_VALID_FIRST0L+0)
-# define LPC17_IRQ_P0p1 (LPC17_VALID_FIRST0L+1)
-# define LPC17_IRQ_P0p2 (LPC17_VALID_FIRST0L+2)
-# define LPC17_IRQ_P0p3 (LPC17_VALID_FIRST0L+3)
-# define LPC17_IRQ_P0p4 (LPC17_VALID_FIRST0L+4)
-# define LPC17_IRQ_P0p5 (LPC17_VALID_FIRST0L+5)
-# define LPC17_IRQ_P0p6 (LPC17_VALID_FIRST0L+6)
-# define LPC17_IRQ_P0p7 (LPC17_VALID_FIRST0L+7)
-# define LPC17_IRQ_P0p8 (LPC17_VALID_FIRST0L+8)
-# define LPC17_IRQ_P0p9 (LPC17_VALID_FIRST0L+9)
-# define LPC17_IRQ_P0p10 (LPC17_VALID_FIRST0L+10)
-# define LPC17_IRQ_P0p11 (LPC17_VALID_FIRST0L+11)
-# define LPC17_IRQ_P0p12 (LPC17_VALID_FIRST0L+12)
-# define LPC17_IRQ_P0p13 (LPC17_VALID_FIRST0L+13)
-# define LPC17_IRQ_P0p14 (LPC17_VALID_FIRST0L+14)
-# define LPC17_IRQ_P0p15 (LPC17_VALID_FIRST0L+15)
-# define LPC17_VALID_NIRQS0L (16)
-
- /* Set 2: 16 interrupts p0.16-p0.31 */
-
-# define LPC17_VALID_SHIFT0H (16)
-# define LPC17_VALID_FIRST0H (LPC17_VALID_FIRST0L+LPC17_VALID_NIRQS0L)
-
-# define LPC17_IRQ_P0p16 (LPC17_VALID_FIRST0H+0)
-# define LPC17_IRQ_P0p17 (LPC17_VALID_FIRST0H+1)
-# define LPC17_IRQ_P0p18 (LPC17_VALID_FIRST0H+2)
-# define LPC17_IRQ_P0p19 (LPC17_VALID_FIRST0H+3)
-# define LPC17_IRQ_P0p20 (LPC17_VALID_FIRST0H+4)
-# define LPC17_IRQ_P0p21 (LPC17_VALID_FIRST0H+5)
-# define LPC17_IRQ_P0p22 (LPC17_VALID_FIRST0H+6)
-# define LPC17_IRQ_P0p23 (LPC17_VALID_FIRST0H+7)
-# define LPC17_IRQ_P0p24 (LPC17_VALID_FIRST0H+8)
-# define LPC17_IRQ_P0p25 (LPC17_VALID_FIRST0H+9)
-# define LPC17_IRQ_P0p26 (LPC17_VALID_FIRST0H+10)
-# define LPC17_IRQ_P0p27 (LPC17_VALID_FIRST0H+11)
-# define LPC17_IRQ_P0p28 (LPC17_VALID_FIRST0H+12)
-# define LPC17_IRQ_P0p29 (LPC17_VALID_FIRST0H+13)
-# define LPC17_IRQ_P0p30 (LPC17_VALID_FIRST0H+14)
-# define LPC17_IRQ_P0p31 (LPC17_VALID_FIRST0H+15)
-# define LPC17_VALID_NIRQS0H (16)
-
- /* Set 3: 16 interrupts p2.0-p2.15 */
-
-# define LPC17_VALID_SHIFT2L (0)
-# define LPC17_VALID_FIRST2L (LPC17_VALID_FIRST0H+LPC17_VALID_NIRQS0H)
-
-# define LPC17_IRQ_P2p0 (LPC17_VALID_FIRST2L+0)
-# define LPC17_IRQ_P2p1 (LPC17_VALID_FIRST2L+1)
-# define LPC17_IRQ_P2p2 (LPC17_VALID_FIRST2L+2)
-# define LPC17_IRQ_P2p3 (LPC17_VALID_FIRST2L+3)
-# define LPC17_IRQ_P2p4 (LPC17_VALID_FIRST2L+4)
-# define LPC17_IRQ_P2p5 (LPC17_VALID_FIRST2L+5)
-# define LPC17_IRQ_P2p6 (LPC17_VALID_FIRST2L+6)
-# define LPC17_IRQ_P2p7 (LPC17_VALID_FIRST2L+7)
-# define LPC17_IRQ_P2p8 (LPC17_VALID_FIRST2L+8)
-# define LPC17_IRQ_P2p9 (LPC17_VALID_FIRST2L+9)
-# define LPC17_IRQ_P2p10 (LPC17_VALID_FIRST2L+10)
-# define LPC17_IRQ_P2p11 (LPC17_VALID_FIRST2L+11)
-# define LPC17_IRQ_P2p12 (LPC17_VALID_FIRST2L+12)
-# define LPC17_IRQ_P2p13 (LPC17_VALID_FIRST2L+13)
-# define LPC17_IRQ_P2p14 (LPC17_VALID_FIRST2L+14)
-# define LPC17_IRQ_P2p15 (LPC17_VALID_FIRST2L+15)
-# define LPC17_VALID_NIRQS2L (16)
-
- /* Set 4: 16 interrupts p2.16 - p2.31 */
-
-# define LPC17_VALID_SHIFT2H (16)
-# define LPC17_VALID_FIRST2H (LPC17_VALID_FIRST2L+LPC17_VALID_NIRQS2L)
-
-# define LPC17_IRQ_P2p16 (LPC17_VALID_FIRST2H+0)
-# define LPC17_IRQ_P2p17 (LPC17_VALID_FIRST2H+1)
-# define LPC17_IRQ_P2p18 (LPC17_VALID_FIRST2H+2)
-# define LPC17_IRQ_P2p19 (LPC17_VALID_FIRST2H+3)
-# define LPC17_IRQ_P2p20 (LPC17_VALID_FIRST2H+4)
-# define LPC17_IRQ_P2p21 (LPC17_VALID_FIRST2H+5)
-# define LPC17_IRQ_P2p22 (LPC17_VALID_FIRST2H+6)
-# define LPC17_IRQ_P2p23 (LPC17_VALID_FIRST2H+7)
-# define LPC17_IRQ_P2p24 (LPC17_VALID_FIRST2H+8)
-# define LPC17_IRQ_P2p25 (LPC17_VALID_FIRST2H+9)
-# define LPC17_IRQ_P2p26 (LPC17_VALID_FIRST2H+10)
-# define LPC17_IRQ_P2p27 (LPC17_VALID_FIRST2H+11)
-# define LPC17_IRQ_P2p28 (LPC17_VALID_FIRST2H+12)
-# define LPC17_IRQ_P2p29 (LPC17_VALID_FIRST2H+13)
-# define LPC17_IRQ_P2p30 (LPC17_VALID_FIRST2H+14)
-# define LPC17_IRQ_P2p31 (LPC17_VALID_FIRST2H+15)
-# define LPC17_VALID_NIRQS2H (16)
-
-# define LPC17_NGPIOAIRQS (LPC17_VALID_NIRQS0L+LPC17_VALID_NIRQS0H+LPC17_VALID_NIRQS2L+LPC17_VALID_NIRQS2H)
-#else
-# define LPC17_NGPIOAIRQS (0)
-#endif
-
-/* Total number of IRQ numbers */
-
-#define NR_IRQS (LPC17_IRQ_EXTINT+LPC17_IRQ_NEXTINT+LPC17_NGPIOAIRQS)
-
-/****************************************************************************
- * Public Types
- ****************************************************************************/
-
-/****************************************************************************
- * Inline functions
- ****************************************************************************/
-
-/****************************************************************************
- * Public Data
- ****************************************************************************/
-
-/****************************************************************************
- * Public Function Prototypes
- ****************************************************************************/
-
-#endif /* __ARCH_ARM_INCLUDE_LPC17XX_LPC178X_IRQ_H */
-
diff --git a/arch/arm/include/lpc17xx_40xx/chip.h b/arch/arm/include/lpc17xx_40xx/chip.h
new file mode 100644
index 00000000000..faa36ac8a34
--- /dev/null
+++ b/arch/arm/include/lpc17xx_40xx/chip.h
@@ -0,0 +1,468 @@
+/************************************************************************************
+ * arch/arm/include/lpc17xx_40xx/chip.h
+ *
+ * Copyright (C) 2010-2011, 2013 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt
+ * with LPC178x support from Rommel Marcelo
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ * 3. Neither the name NuttX 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 THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#ifndef __ARCH_ARM_INCLUDE_LPC17XX_40XX_CHIP_H
+#define __ARCH_ARM_INCLUDE_LPC17XX_40XX_CHIP_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include
+
+/************************************************************************************
+ * Pre-processor Definitions
+ ************************************************************************************/
+
+/* Get customizations for each supported chip */
+
+#if defined(CONFIG_ARCH_CHIP_LPC1751)
+# define LPC176x 1 /* LPC175/6 family */
+# undef LPC178x_40xx /* Not LPC177/8 or LPC40xx family */
+# define LPC17_40_FLASH_SIZE (32*1024) /* 32Kb */
+# define LPC17_40_SRAM_SIZE (8*1024) /* 8Kb */
+# define LPC17_40_CPUSRAM_SIZE (8*1024)
+# undef LPC17_40_HAVE_BANK0 /* No AHB SRAM bank 0 */
+# undef LPC17_40_HAVE_BANK1 /* No AHB SRAM bank 1 */
+# define LPC17_40_NETHCONTROLLERS 0 /* No Ethernet controller */
+# define LPC17_40_NUSBHOST 0 /* No USB host controller */
+# define LPC17_40_NUSBOTG 0 /* No USB OTG controller */
+# define LPC17_40_NUSBDEV 1 /* One USB device controller */
+# define LPC17_40_NCAN 1 /* One CAN controller */
+# define LPC17_40_NI2S 0 /* No I2S modules */
+# define LPC17_40_NDAC 0 /* No DAC module */
+#elif defined(CONFIG_ARCH_CHIP_LPC1752)
+# define LPC176x 1 /* LPC175/6 family */
+# undef LPC178x_40xx /* Not LPC177/8 or LPC40xx family */
+# define LPC17_40_FLASH_SIZE (64*1024) /* 65Kb */
+# define LPC17_40_SRAM_SIZE (16*1024) /* 16Kb */
+# define LPC17_40_CPUSRAM_SIZE (16*1024)
+# undef LPC17_40_HAVE_BANK0 /* No AHB SRAM bank 0 */
+# undef LPC17_40_HAVE_BANK1 /* No AHB SRAM bank 1 */
+# define LPC17_40_NETHCONTROLLERS 0 /* No Ethernet controller */
+# define LPC17_40_NUSBHOST 0 /* No USB host controller */
+# define LPC17_40_NUSBOTG 0 /* No USB OTG controller */
+# define LPC17_40_NUSBDEV 1 /* One USB device controller */
+# define LPC17_40_NCAN 1 /* One CAN controller */
+# define LPC17_40_NI2S 0 /* No I2S modules */
+# define LPC17_40_NDAC 0 /* No DAC module */
+#elif defined(CONFIG_ARCH_CHIP_LPC1754)
+# define LPC176x 1 /* LPC175/6 family */
+# undef LPC178x_40xx /* Not LPC177/8 or LPC40xx family */
+# define LPC17_40_FLASH_SIZE (128*1024) /* 128Kb */
+# define LPC17_40_SRAM_SIZE (32*1024) /* 32Kb */
+# define LPC17_40_CPUSRAM_SIZE (16*1024)
+# define LPC17_40_HAVE_BANK0 1 /* Have AHB SRAM bank 0 */
+# undef LPC17_40_HAVE_BANK1 /* No AHB SRAM bank 1 */
+# define LPC17_40_NETHCONTROLLERS 0 /* No Ethernet controller */
+# define LPC17_40_NUSBHOST 1 /* One USB host controller */
+# define LPC17_40_NUSBOTG 1 /* One USB OTG controller */
+# define LPC17_40_NUSBDEV 1 /* One USB device controller */
+# define LPC17_40_NCAN 1 /* One CAN controller */
+# define LPC17_40_NI2S 0 /* No I2S modules */
+# define LPC17_40_NDAC 1 /* One DAC module */
+#elif defined(CONFIG_ARCH_CHIP_LPC1756)
+# define LPC176x 1 /* LPC175/6 family */
+# undef LPC178x_40xx /* Not LPC177/8 or LPC40xx family */
+# define LPC17_40_FLASH_SIZE (256*1024) /* 256Kb */
+# define LPC17_40_SRAM_SIZE (32*1024) /* 32Kb */
+# define LPC17_40_CPUSRAM_SIZE (16*1024)
+# define LPC17_40_HAVE_BANK0 1 /* No AHB SRAM bank 0 */
+# undef LPC17_40_HAVE_BANK1 /* No AHB SRAM bank 1 */
+# define LPC17_40_NETHCONTROLLERS 0 /* No Ethernet controller */
+# define LPC17_40_NUSBHOST 1 /* One USB host controller */
+# define LPC17_40_NUSBOTG 1 /* One USB OTG controller */
+# define LPC17_40_NUSBDEV 1 /* One USB device controller */
+# define LPC17_40_NCAN 2 /* Two CAN controllers */
+# define LPC17_40_NI2S 1 /* One I2S module */
+# define LPC17_40_NDAC 1 /* One DAC module */
+#elif defined(CONFIG_ARCH_CHIP_LPC1758)
+# define LPC176x 1 /* LPC175/6 family */
+# undef LPC178x_40xx /* Not LPC177/8 or LPC40xx family */
+# define LPC17_40_FLASH_SIZE (512*1024) /* 512Kb */
+# define LPC17_40_SRAM_SIZE (64*1024) /* 64Kb */
+# define LPC17_40_CPUSRAM_SIZE (32*1024)
+# define LPC17_40_HAVE_BANK0 1 /* Have AHB SRAM bank 0 */
+# define LPC17_40_HAVE_BANK1 1 /* Have AHB SRAM bank 1 */
+# define LPC17_40_NETHCONTROLLERS 1 /* One Ethernet controller */
+# define LPC17_40_NUSBHOST 1 /* One USB host controller */
+# define LPC17_40_NUSBOTG 1 /* One USB OTG controller */
+# define LPC17_40_NUSBDEV 1 /* One USB device controller */
+# define LPC17_40_NCAN 2 /* Two CAN controllers */
+# define LPC17_40_NI2S 1 /* One I2S module */
+# define LPC17_40_NDAC 1 /* One DAC module */
+#elif defined(CONFIG_ARCH_CHIP_LPC1759)
+# define LPC176x 1 /* LPC175/6 family */
+# undef LPC178x_40xx /* Not LPC177/8 or LPC40xx family */
+# define LPC17_40_FLASH_SIZE (512*1024) /* 512Kb */
+# define LPC17_40_SRAM_SIZE (64*1024) /* 64Kb */
+# define LPC17_40_CPUSRAM_SIZE (32*1024)
+# define LPC17_40_HAVE_BANK0 1 /* Have AHB SRAM bank 0 */
+# define LPC17_40_HAVE_BANK1 1 /* Have AHB SRAM bank 1 */
+# define LPC17_40_NETHCONTROLLERS 0 /* No Ethernet controller */
+# define LPC17_40_NUSBHOST 1 /* One USB host controller */
+# define LPC17_40_NUSBOTG 1 /* One USB OTG controller */
+# define LPC17_40_NUSBDEV 1 /* One USB device controller */
+# define LPC17_40_NCAN 2 /* Two CAN controllers */
+# define LPC17_40_NI2S 1 /* One I2S module */
+# define LPC17_40_NDAC 1 /* One DAC module */
+#elif defined(CONFIG_ARCH_CHIP_LPC1764)
+# define LPC176x 1 /* LPC175/6 family */
+# undef LPC178x_40xx /* Not LPC177/8 or LPC40xx family */
+# define LPC17_40_FLASH_SIZE (128*1024) /* 128Kb */
+# define LPC17_40_SRAM_SIZE (32*1024) /* 32Kb */
+# define LPC17_40_CPUSRAM_SIZE (16*1024)
+# define LPC17_40_HAVE_BANK0 1 /* Have AHB SRAM bank 0 */
+# undef LPC17_40_HAVE_BANK1 /* No AHB SRAM bank 1 */
+# define LPC17_40_NETHCONTROLLERS 1 /* One Ethernet controller */
+# define LPC17_40_NUSBHOST 0 /* No USB host controller */
+# define LPC17_40_NUSBOTG 0 /* No USB OTG controller */
+# define LPC17_40_NUSBDEV 1 /* One USB device controller */
+# define LPC17_40_NCAN 2 /* Two CAN controllers */
+# define LPC17_40_NI2S 0 /* No I2S modules */
+# define LPC17_40_NDAC 0 /* No DAC module */
+#elif defined(CONFIG_ARCH_CHIP_LPC1765)
+# define LPC176x 1 /* LPC175/6 family */
+# undef LPC178x_40xx /* Not LPC177/8 or LPC40xx family */
+# define LPC17_40_FLASH_SIZE (256*1024) /* 256Kb */
+# define LPC17_40_SRAM_SIZE (64*1024) /* 64Kb */
+# define LPC17_40_CPUSRAM_SIZE (32*1024)
+# define LPC17_40_HAVE_BANK0 1 /* Have AHB SRAM bank 0 */
+# define LPC17_40_HAVE_BANK1 1 /* Have AHB SRAM bank 1 */
+# define LPC17_40_NETHCONTROLLERS 0 /* No Ethernet controller */
+# define LPC17_40_NUSBHOST 1 /* One USB host controller */
+# define LPC17_40_NUSBOTG 1 /* One USB OTG controller */
+# define LPC17_40_NUSBDEV 1 /* One USB device controller */
+# define LPC17_40_NCAN 2 /* Two CAN controllers */
+# define LPC17_40_NI2S 1 /* One I2S module */
+# define LPC17_40_NDAC 1 /* One DAC module */
+#elif defined(CONFIG_ARCH_CHIP_LPC1766)
+# define LPC176x 1 /* LPC175/6 family */
+# undef LPC178x_40xx /* Not LPC177/8 or LPC40xx family */
+# define LPC17_40_FLASH_SIZE (256*1024) /* 256Kb */
+# define LPC17_40_SRAM_SIZE (64*1024) /* 64Kb */
+# define LPC17_40_CPUSRAM_SIZE (32*1024)
+# define LPC17_40_HAVE_BANK0 1 /* Have AHB SRAM bank 0 */
+# define LPC17_40_HAVE_BANK1 1 /* Have AHB SRAM bank 1 */
+# define LPC17_40_NETHCONTROLLERS 1 /* One Ethernet controller */
+# define LPC17_40_NUSBHOST 1 /* One USB host controller */
+# define LPC17_40_NUSBOTG 1 /* One USB OTG controller */
+# define LPC17_40_NUSBDEV 1 /* One USB device controller */
+# define LPC17_40_NCAN 2 /* Two CAN controllers */
+# define LPC17_40_NI2S 1 /* One I2S module */
+# define LPC17_40_NDAC 1 /* One DAC module */
+#elif defined(CONFIG_ARCH_CHIP_LPC1767)
+# define LPC176x 1 /* LPC175/6 family */
+# undef LPC178x_40xx /* Not LPC177/8 or LPC40xx family */
+# define LPC17_40_FLASH_SIZE (512*1024) /* 512Kb */
+# define LPC17_40_SRAM_SIZE (64*1024) /* 64Kb */
+# define LPC17_40_CPUSRAM_SIZE (32*1024)
+# define LPC17_40_HAVE_BANK0 1 /* Have AHB SRAM bank 0 */
+# define LPC17_40_HAVE_BANK1 1 /* Have AHB SRAM bank 1 */
+# define LPC17_40_NETHCONTROLLERS 1 /* One Ethernet controller */
+# define LPC17_40_NUSBHOST 0 /* No USB host controller */
+# define LPC17_40_NUSBOTG 0 /* No USB OTG controller */
+# define LPC17_40_NUSBDEV 0 /* No USB device controller */
+# define LPC17_40_NCAN 0 /* No CAN controllers */
+# define LPC17_40_NI2S 1 /* One I2S module */
+# define LPC17_40_NDAC 1 /* One DAC module */
+#elif defined(CONFIG_ARCH_CHIP_LPC1769) || defined(CONFIG_ARCH_CHIP_LPC1768)
+# define LPC176x 1 /* LPC175/6 family */
+# undef LPC178x_40xx /* Not LPC177/8 or LPC40xx family */
+# define LPC17_40_FLASH_SIZE (512*1024) /* 512Kb */
+# define LPC17_40_SRAM_SIZE (64*1024) /* 64Kb */
+# define LPC17_40_CPUSRAM_SIZE (32*1024)
+# define LPC17_40_HAVE_BANK0 1 /* Have AHB SRAM bank 0 */
+# define LPC17_40_HAVE_BANK1 1 /* Have AHB SRAM bank 1 */
+# define LPC17_40_NETHCONTROLLERS 1 /* One Ethernet controller */
+# define LPC17_40_NUSBHOST 1 /* One USB host controller */
+# define LPC17_40_NUSBOTG 1 /* One USB OTG controller */
+# define LPC17_40_NUSBDEV 1 /* One USB device controller */
+# define LPC17_40_NCAN 2 /* Two CAN controllers */
+# define LPC17_40_NI2S 1 /* One I2S module */
+# define LPC17_40_NDAC 1 /* One DAC module */
+#elif defined(CONFIG_ARCH_CHIP_LPC1773)
+# undef LPC176x /* Not LPC175/6 family */
+# define LPC178x_40xx 1 /* LPC177/8 or LPC40xx family */
+# define LPC17_40_FLASH_SIZE (128*1024) /* 128Kb */
+# define LPC17_40_SRAM_SIZE (40*1024) /* 40Kb */
+# define LPC17_40_CPUSRAM_SIZE (32*1024)
+# define LPC17_40_HAVE_BANK0 1 /* Have Peripheral SRAM bank 0 */
+# undef LPC17_40_HAVE_BANK1 /* No Peripheral SRAM bank 1 */
+# define LPC17_40_NETHCONTROLLERS 1 /* One Ethernet controller */
+# undef LPC17_40_NUSBHOST /* No USB host controller */
+# undef LPC17_40_NUSBOTG /* No USB OTG controller */
+# define LPC17_40_NUSBDEV 1 /* One USB device controller */
+# define LPC17_40_HAVE_SPIFI 1 /* Have SPIFI interface */
+# undef LPC17_40_HAVE_LCD /* No LCD controller */
+# undef LPC17_40_HAVE_QEI /* No QEI interface */
+# undef LPC17_40_HAVE_SD /* No SD controller */
+#elif defined(CONFIG_ARCH_CHIP_LPC1774)
+# undef LPC176x /* Not LPC175/6 family */
+# define LPC178x_40xx 1 /* LPC177/8 or LPC40xx family */
+# define LPC17_40_FLASH_SIZE (128*1024) /* 128Kb */
+# define LPC17_40_SRAM_SIZE (40*1024) /* 40Kb */
+# define LPC17_40_CPUSRAM_SIZE (32*1024)
+# define LPC17_40_HAVE_BANK0 1 /* Have Peripheral SRAM bank 0*/
+# undef LPC17_40_HAVE_BANK1 /* Have Peripheral SRAM bank 1 */
+# define LPC17_40_NETHCONTROLLERS 1 /* One Ethernet controller */
+# undef LPC17_40_NUSBHOST /* One USB host controller */
+# undef LPC17_40_NUSBOTG /* One USB OTG controller */
+# define LPC17_40_NUSBDEV 1 /* One USB device controller */
+# undef LPC17_40_HAVE_SPIFI /* Have SPIFI interface */
+# undef LPC17_40_HAVE_LCD /* No LCD controller */
+# define LPC17_40_HAVE_QEI 1 /* One QEI interface */
+# define LPC17_40_HAVE_SD 1 /* One SD controller */
+#elif defined(CONFIG_ARCH_CHIP_LPC1776)
+# undef LPC176x /* Not LPC175/6 family */
+# define LPC178x_40xx 1 /* LPC177/8 or LPC40xx family */
+# define LPC17_40_FLASH_SIZE (256*1024) /* 256Kb */
+# define LPC17_40_SRAM_SIZE (80*1024) /* 80Kb */
+# define LPC17_40_CPUSRAM_SIZE (64*1024)
+# define LPC17_40_HAVE_BANK0 1 /* Have Peripheral SRAM bank 0 */
+# undef LPC17_40_HAVE_BANK1 /* Have Peripheral SRAM bank 1 */
+# define LPC17_40_NETHCONTROLLERS 1 /* One Ethernet controller */
+# define LPC17_40_NUSBHOST 1 /* One USB host controller */
+# define LPC17_40_NUSBOTG 1 /* One USB OTG controller */
+# define LPC17_40_NUSBDEV 1 /* One USB device controller */
+# undef LPC17_40_HAVE_SPIFI /* Have SPIFI interface */
+# undef LPC17_40_HAVE_LCD /* No LCD controller */
+# define LPC17_40_HAVE_QEI 1 /* One QEI interface */
+# define LPC17_40_HAVE_SD 1 /* One SD controller */
+#elif defined(CONFIG_ARCH_CHIP_LPC1777)
+# undef LPC176x /* Not LPC175/6 family */
+# define LPC178x_40xx 1 /* LPC177/8 or LPC40xx family */
+# define LPC17_40_FLASH_SIZE (512*1024) /* 512Kb */
+# define LPC17_40_SRAM_SIZE (96*1024) /* 96Kb */
+# define LPC17_40_CPUSRAM_SIZE (64*1024)
+# define LPC17_40_HAVE_BANK0 1 /* Have Peripheral SRAM bank 0 */
+# define LPC17_40_HAVE_BANK1 1 /* Have Peripheral SRAM bank 1 */
+# undef LPC17_40_NETHCONTROLLERS /* No Ethernet controller */
+# define LPC17_40_NUSBHOST 1 /* One USB host controller */
+# define LPC17_40_NUSBOTG 1 /* One USB OTG controller */
+# define LPC17_40_NUSBDEV 1 /* One USB device controller */
+# undef LPC17_40_HAVE_SPIFI /* Have SPIFI interface */
+# undef LPC17_40_HAVE_LCD /* No LCD controller */
+# define LPC17_40_HAVE_QEI 1 /* One QEI interface */
+# define LPC17_40_HAVE_SD 1 /* One SD controller */
+#elif defined(CONFIG_ARCH_CHIP_LPC1778)
+# undef LPC176x /* Not LPC175/6 family */
+# define LPC178x_40xx 1 /* LPC177/8 or LPC40xx family */
+# define LPC17_40_FLASH_SIZE (512*1024) /* 512Kb */
+# define LPC17_40_SRAM_SIZE (96*1024) /* 64Kb */
+# define LPC17_40_CPUSRAM_SIZE (64*1024)
+# define LPC17_40_HAVE_BANK0 1 /* Have Peripheral SRAM bank 0 */
+# define LPC17_40_HAVE_BANK1 1 /* Have Peripheral SRAM bank 1 */
+# define LPC17_40_NETHCONTROLLERS 1 /* One Ethernet controller */
+# define LPC17_40_NUSBHOST 1 /* One USB host controller */
+# define LPC17_40_NUSBOTG 1 /* One USB OTG controller */
+# define LPC17_40_NUSBDEV 1 /* One USB device controller */
+# undef LPC17_40_HAVE_SPIFI /* Have SPIFI interface */
+# undef LPC17_40_HAVE_LCD /* No LCD controller */
+# define LPC17_40_HAVE_QEI 1 /* One QEI interface */
+# define LPC17_40_HAVE_SD 1 /* One SD controller */
+#elif defined(CONFIG_ARCH_CHIP_LPC1785)
+# undef LPC176x /* Not LPC175/6 family */
+# define LPC178x_40xx 1 /* LPC177/8 or LPC40xx family */
+# define LPC17_40_FLASH_SIZE (256*1024) /* 256Kb */
+# define LPC17_40_SRAM_SIZE (80*1024) /* 80Kb */
+# define LPC17_40_CPUSRAM_SIZE (64*1024)
+# define LPC17_40_HAVE_BANK0 1 /* Have Peripheral SRAM bank 0 */
+# undef LPC17_40_HAVE_BANK1 /* Have Peripheral SRAM bank 1 */
+# undef LPC17_40_NETHCONTROLLERS /* No Ethernet controller */
+# define LPC17_40_NUSBHOST 1 /* One USB host controller */
+# define LPC17_40_NUSBOTG 1 /* One USB OTG controller */
+# define LPC17_40_NUSBDEV 1 /* One USB device controller */
+# undef LPC17_40_HAVE_SPIFI /* Have SPIFI interface */
+# define LPC17_40_HAVE_LCD 1 /* One LCD controller */
+# undef LPC17_40_HAVE_QEI /* One QEI interface */
+# define LPC17_40_HAVE_SD 1 /* One SD controller */
+#elif defined(CONFIG_ARCH_CHIP_LPC1786)
+# undef LPC176x /* Not LPC175/6 family */
+# define LPC178x_40xx 1 /* LPC177/8 or LPC40xx family */
+# define LPC17_40_FLASH_SIZE (256*1024) /* 256Kb */
+# define LPC17_40_SRAM_SIZE (80*1024) /* 80Kb */
+# define LPC17_40_CPUSRAM_SIZE (64*1024)
+# define LPC17_40_HAVE_BANK0 1 /* Have Peripheral SRAM bank 0 */
+# undef LPC17_40_HAVE_BANK1 /* Have Peripheral SRAM bank 1 */
+# define LPC17_40_NETHCONTROLLERS 1 /* One Ethernet controller */
+# define LPC17_40_NUSBHOST 1 /* One USB host controller */
+# define LPC17_40_NUSBOTG 1 /* One USB OTG controller */
+# define LPC17_40_NUSBDEV 1 /* One USB device controller */
+# undef LPC17_40_HAVE_SPIFI /* Have SPIFI interface */
+# define LPC17_40_HAVE_LCD 1 /* One LCD controller */
+# define LPC17_40_HAVE_QEI 1 /* One QEI interface */
+# define LPC17_40_HAVE_SD 1 /* One SD controller */
+#elif defined(CONFIG_ARCH_CHIP_LPC1787)
+# undef LPC176x /* Not LPC175/6 family */
+# define LPC178x_40xx 1 /* LPC177/8 or LPC40xx family */
+# define LPC17_40_FLASH_SIZE (512*1024) /* 512Kb */
+# define LPC17_40_SRAM_SIZE (96*1024) /* 96Kb */
+# define LPC17_40_CPUSRAM_SIZE (64*1024)
+# define LPC17_40_HAVE_BANK0 1 /* Have Peripheral SRAM bank 0 */
+# define LPC17_40_HAVE_BANK1 1 /* Have Peripheral SRAM bank 1 */
+# undef LPC17_40_NETHCONTROLLERS /* No Ethernet controller */
+# define LPC17_40_NUSBHOST 1 /* One USB host controller */
+# define LPC17_40_NUSBOTG 1 /* One USB OTG controller */
+# define LPC17_40_NUSBDEV 1 /* One USB device controller */
+# undef LPC17_40_HAVE_SPIFI /* Have SPIFI interface */
+# define LPC17_40_HAVE_LCD 1 /* One LCD controller */
+# define LPC17_40_HAVE_QEI 1 /* One QEI interface */
+# define LPC17_40_HAVE_SD 1 /* One SD controller */
+#elif defined(CONFIG_ARCH_CHIP_LPC1788)
+# undef LPC176x /* Not LPC175/6 family */
+# define LPC178x_40xx 1 /* LPC177/8 or LPC40xx family */
+# define LPC17_40_FLASH_SIZE (512*1024) /* 512Kb */
+# define LPC17_40_SRAM_SIZE (96*1024) /* 96Kb */
+# define LPC17_40_CPUSRAM_SIZE (64*1024)
+# define LPC17_40_HAVE_BANK0 1 /* Have Peripheral SRAM bank 0 */
+# define LPC17_40_HAVE_BANK1 1 /* Have Peripheral SRAM bank 1 */
+# define LPC17_40_NETHCONTROLLERS 1 /* One Ethernet controller */
+# define LPC17_40_NUSBHOST 1 /* One USB host controller */
+# define LPC17_40_NUSBOTG 1 /* One USB OTG controller */
+# define LPC17_40_NUSBDEV 1 /* One USB device controller */
+# undef LPC17_40_HAVE_SPIFI /* Have SPIFI interface */
+# define LPC17_40_HAVE_LCD 1 /* One LCD controller */
+# define LPC17_40_HAVE_QEI 1 /* One QEI interface */
+# define LPC17_40_HAVE_SD 1 /* One SD controller */
+#elif defined(CONFIG_ARCH_CHIP_LPC4072)
+# undef LPC176x /* Not LPC175/6 family */
+# define LPC178x_40xx 1 /* LPC177/8 or LPC40xx family */
+# define LPC17_40_FLASH_SIZE (64*1024) /* 64Kb */
+# define LPC17_40_SRAM_SIZE (24*1024) /* 24Kb */
+# define LPC17_40_CPUSRAM_SIZE (16*1024)
+# define LPC17_40_HAVE_BANK0 1 /* Have Peripheral SRAM bank 0 */
+# undef LPC17_40_HAVE_BANK1 /* No Peripheral SRAM bank 1 */
+# undef LPC17_40_NETHCONTROLLERS /* No Ethernet controller */
+# undef LPC17_40_NUSBHOST /* No USB host controller */
+# undef LPC17_40_NUSBOTG /* No USB OTG controller */
+# define LPC17_40_NUSBDEV 1 /* One USB device controller */
+# define LPC17_40_HAVE_SPIFI 1 /* Have SPIFI interface */
+# undef LPC17_40_HAVE_LCD /* No LCD controller */
+# undef LPC17_40_HAVE_QEI /* No QEI interface */
+# undef LPC17_40_HAVE_SD /* No SD controller */
+#elif defined(CONFIG_ARCH_CHIP_LPC4074)
+# undef LPC176x /* Not LPC175/6 family */
+# define LPC178x_40xx 1 /* LPC177/8 or LPC40xx family */
+# define LPC17_40_FLASH_SIZE (128*1024) /* 128Kb */
+# define LPC17_40_SRAM_SIZE (40*1024) /* 40Kb */
+# define LPC17_40_CPUSRAM_SIZE (32*1024)
+# define LPC17_40_HAVE_BANK0 1 /* Have Peripheral SRAM bank 0*/
+# undef LPC17_40_HAVE_BANK1 /* Have Peripheral SRAM bank 1 */
+# undef LPC17_40_NETHCONTROLLERS 0 /* No Ethernet controller */
+# undef LPC17_40_NUSBHOST /* No USB host controller */
+# undef LPC17_40_NUSBOTG /* No USB OTG controller */
+# define LPC17_40_NUSBDEV 1 /* One USB device controller */
+# define LPC17_40_HAVE_SPIFI 1 /* Have SPIFI interface */
+# undef LPC17_40_HAVE_LCD /* One LCD controller */
+# undef LPC17_40_HAVE_QEI /* No QEI interface */
+# undef LPC17_40_HAVE_SD /* No SD controller */
+#elif defined(CONFIG_ARCH_CHIP_LPC4076)
+# undef LPC176x /* Not LPC175/6 family */
+# define LPC178x_40xx 1 /* LPC177/8 or LPC40xx family */
+# define LPC17_40_FLASH_SIZE (256*1024) /* 256Kb */
+# define LPC17_40_SRAM_SIZE (80*1024) /* 80Kb */
+# define LPC17_40_CPUSRAM_SIZE (64*1024)
+# define LPC17_40_HAVE_BANK0 1 /* Have Peripheral SRAM bank 0 */
+# undef LPC17_40_HAVE_BANK1 /* Have Peripheral SRAM bank 1 */
+# define LPC17_40_NETHCONTROLLERS 1 /* One Ethernet controller */
+# define LPC17_40_NUSBHOST 1 /* One USB host controller */
+# define LPC17_40_NUSBOTG 1 /* One USB OTG controller */
+# define LPC17_40_NUSBDEV 1 /* One USB device controller */
+# define LPC17_40_HAVE_SPIFI 1 /* Have SPIFI interface */
+# undef LPC17_40_HAVE_LCD /* No LCD controller */
+# define LPC17_40_HAVE_QEI 1 /* One QEI interface */
+# define LPC17_40_HAVE_SD 1 /* One SD controller */
+#elif defined(CONFIG_ARCH_CHIP_LPC4078)
+# undef LPC176x /* Not LPC175/6 family */
+# define LPC178x_40xx 1 /* LPC177/8 or LPC40xx family */
+# define LPC17_40_FLASH_SIZE (512*1024) /* 512Kb */
+# define LPC17_40_SRAM_SIZE (96*1024) /* 96Kb */
+# define LPC17_40_CPUSRAM_SIZE (64*1024)
+# define LPC17_40_HAVE_BANK0 1 /* Have Peripheral SRAM bank 0 */
+# define LPC17_40_HAVE_BANK1 1 /* Have Peripheral SRAM bank 1 */
+# define LPC17_40_NETHCONTROLLERS 1 /* One Ethernet controller */
+# define LPC17_40_NUSBHOST 1 /* One USB host controller */
+# define LPC17_40_NUSBOTG 1 /* One USB OTG controller */
+# define LPC17_40_NUSBDEV 1 /* One USB device controller */
+# define LPC17_40_HAVE_SPIFI 1 /* Have SPIFI interface */
+# undef LPC17_40_HAVE_LCD /* No LCD controller */
+# define LPC17_40_HAVE_QEI 1 /* One QEI interface */
+# define LPC17_40_HAVE_SD 1 /* One SD controller */
+#elif defined(CONFIG_ARCH_CHIP_LPC4088)
+# undef LPC176x /* Not LPC175/6 family */
+# define LPC178x_40xx 1 /* LPC177/8 or LPC40xx family */
+# define LPC17_40_FLASH_SIZE (512*1024) /* 512Kb */
+# define LPC17_40_SRAM_SIZE (96*1024) /* 64Kb */
+# define LPC17_40_CPUSRAM_SIZE (64*1024)
+# define LPC17_40_HAVE_BANK0 1 /* Have Peripheral SRAM bank 0 */
+# define LPC17_40_HAVE_BANK1 1 /* Have Peripheral SRAM bank 1 */
+# define LPC17_40_NETHCONTROLLERS 1 /* One Ethernet controller */
+# define LPC17_40_NUSBHOST 1 /* One USB host controller */
+# define LPC17_40_NUSBOTG 1 /* One USB OTG controller */
+# define LPC17_40_NUSBDEV 1 /* One USB device controller */
+# define LPC17_40_HAVE_SPIFI 1 /* Have SPIFI interface */
+# define LPC17_40_HAVE_LCD 1 /* One LCD controller */
+# define LPC17_40_HAVE_QEI 1 /* One QEI interface */
+# define LPC17_40_HAVE_SD 1 /* One SD controller */
+#else
+# error "Unsupported LPC17xx/LPC40xx chip"
+#endif
+
+/* NVIC priority levels *************************************************************/
+/* Each priority field holds a priority value, 0-31. The lower the value, the greater
+ * the priority of the corresponding interrupt. The processor implements only
+ * bits[7:3] of each field, bits[2:0] read as zero and ignore writes.
+ */
+
+#define NVIC_SYSH_PRIORITY_MIN 0xf8 /* All bits[7:3] set is minimum priority */
+#define NVIC_SYSH_PRIORITY_DEFAULT 0x80 /* Midpoint is the default */
+#define NVIC_SYSH_PRIORITY_MAX 0x00 /* Zero is maximum priority */
+#define NVIC_SYSH_PRIORITY_STEP 0x08 /* Five bits of interrupt priority used */
+
+/************************************************************************************
+ * Public Types
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Data
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+#endif /* __ARCH_ARM_INCLUDE_LPC17XX_40XX_CHIP_H */
diff --git a/arch/arm/include/lpc17xx/irq.h b/arch/arm/include/lpc17xx_40xx/irq.h
similarity index 70%
rename from arch/arm/include/lpc17xx/irq.h
rename to arch/arm/include/lpc17xx_40xx/irq.h
index 99bffe17ebb..3b8e4c50ed2 100644
--- a/arch/arm/include/lpc17xx/irq.h
+++ b/arch/arm/include/lpc17xx_40xx/irq.h
@@ -1,5 +1,5 @@
/****************************************************************************
- * arch/arm/include/lpc17xxx/irq.h
+ * arch/arm/include/lpc17xx_40xxx/irq.h
*
* Copyright (C) 2010-2011, 2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt
@@ -37,8 +37,8 @@
* through nuttx/irq.h
*/
-#ifndef __ARCH_ARM_INCLUDE_LPC17XX_IRQ_H
-#define __ARCH_ARM_INCLUDE_LPC17XX_IRQ_H
+#ifndef __ARCH_ARM_INCLUDE_LPC17XX_40XX_IRQ_H
+#define __ARCH_ARM_INCLUDE_LPC17XX_40XX_IRQ_H
/****************************************************************************
* Included Files
@@ -47,7 +47,7 @@
#ifndef __ASSEMBLY__
# include
#endif
-#include
+#include
/****************************************************************************
* Pre-processor Definitions
@@ -59,32 +59,32 @@
/* Common Processor Exceptions (vectors 0-15) */
-#define LPC17_IRQ_RESERVED (0) /* Reserved vector (only used with CONFIG_DEBUG_FEATURES) */
- /* Vector 0: Reset stack pointer value */
- /* Vector 1: Reset (not handler as an IRQ) */
-#define LPC17_IRQ_NMI (2) /* Vector 2: Non-Maskable Interrupt (NMI) */
-#define LPC17_IRQ_HARDFAULT (3) /* Vector 3: Hard fault */
-#define LPC17_IRQ_MEMFAULT (4) /* Vector 4: Memory management (MPU) */
-#define LPC17_IRQ_BUSFAULT (5) /* Vector 5: Bus fault */
-#define LPC17_IRQ_USAGEFAULT (6) /* Vector 6: Usage fault */
-#define LPC17_IRQ_SVCALL (11) /* Vector 11: SVC call */
-#define LPC17_IRQ_DBGMONITOR (12) /* Vector 12: Debug Monitor */
- /* Vector 13: Reserved */
-#define LPC17_IRQ_PENDSV (14) /* Vector 14: Pendable system service request */
-#define LPC17_IRQ_SYSTICK (15) /* Vector 15: System tick */
+#define LPC17_40_IRQ_RESERVED (0) /* Reserved vector (only used with CONFIG_DEBUG_FEATURES) */
+ /* Vector 0: Reset stack pointer value */
+ /* Vector 1: Reset (not handler as an IRQ) */
+#define LPC17_40_IRQ_NMI (2) /* Vector 2: Non-Maskable Interrupt (NMI) */
+#define LPC17_40_IRQ_HARDFAULT (3) /* Vector 3: Hard fault */
+#define LPC17_40_IRQ_MEMFAULT (4) /* Vector 4: Memory management (MPU) */
+#define LPC17_40_IRQ_BUSFAULT (5) /* Vector 5: Bus fault */
+#define LPC17_40_IRQ_USAGEFAULT (6) /* Vector 6: Usage fault */
+#define LPC17_40_IRQ_SVCALL (11) /* Vector 11: SVC call */
+#define LPC17_40_IRQ_DBGMONITOR (12) /* Vector 12: Debug Monitor */
+ /* Vector 13: Reserved */
+#define LPC17_40_IRQ_PENDSV (14) /* Vector 14: Pendable system service request */
+#define LPC17_40_IRQ_SYSTICK (15) /* Vector 15: System tick */
/* External interrupts (vectors >= 16) */
-#define LPC17_IRQ_EXTINT (16) /* Vector number of the first external interrupt */
+#define LPC17_40_IRQ_EXTINT (16) /* Vector number of the first external interrupt */
/* Family Specfic Interrupts */
#if defined(LPC176x) /* LPC175/6 family */
-# include
-#elif defined(LPC178x) /* LPC177/8 family */
-# include
+# include
+#elif defined(LPC178x_40xx) /* LPC177/8 or LPC40xx family */
+# include
#else
-# error "Unknown LPC17xx family"
+# error "Unknown LPC17xx/LPC40xx family"
#endif
/****************************************************************************
@@ -116,4 +116,4 @@ extern "C"
#endif
#endif /* __ASSEMBLY__ */
-#endif /* __ARCH_ARM_INCLUDE_LPC17XX_IRQ_H */
+#endif /* __ARCH_ARM_INCLUDE_LPC17XX_40XX_IRQ_H */
diff --git a/arch/arm/include/lpc17xx_40xx/lpc176x_irq.h b/arch/arm/include/lpc17xx_40xx/lpc176x_irq.h
new file mode 100644
index 00000000000..c91ddc78c1a
--- /dev/null
+++ b/arch/arm/include/lpc17xx_40xx/lpc176x_irq.h
@@ -0,0 +1,245 @@
+/****************************************************************************
+ * arch/lpc17xx_40xx/lpc176x_irq.h
+ *
+ * Copyright (C) 2010-2011, 2013 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ * 3. Neither the name NuttX 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 THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* This file should never be included directed but, rather, only indirectly
+ * through nuttx/irq.h
+ */
+
+#ifndef __ARCH_ARM_INCLUDE_LPC17XX_40XX_LPC176X_IRQ_H
+#define __ARCH_ARM_INCLUDE_LPC17XX_40XX_LPC176X_IRQ_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+/* IRQ numbers. The IRQ number corresponds vector number and hence map
+ * directly to bits in the NVIC. This does, however, waste several words of
+ * memory in the IRQ to handle mapping tables.
+ */
+
+/* External interrupts (vectors >= 16) */
+
+#define LPC17_40_IRQ_WDT (LPC17_40_IRQ_EXTINT+0) /* WDT Watchdog Interrupt (WDINT) */
+#define LPC17_40_IRQ_TMR0 (LPC17_40_IRQ_EXTINT+1) /* Timer 0 Match 0 - 1 (MR0, MR1)
+ * Capture 0 - 1 (CR0, CR1) */
+#define LPC17_40_IRQ_TMR1 (LPC17_40_IRQ_EXTINT+2) /* Timer 1 Match 0 - 2 (MR0, MR1, MR2)
+ * Capture 0 - 1 (CR0, CR1) */
+#define LPC17_40_IRQ_TMR2 (LPC17_40_IRQ_EXTINT+3) /* Timer 2 Match 0-3
+ * Capture 0-1 */
+#define LPC17_40_IRQ_TMR3 (LPC17_40_IRQ_EXTINT+4) /* Timer 3 Match 0-3
+ * Capture 0-1 */
+#define LPC17_40_IRQ_UART0 (LPC17_40_IRQ_EXTINT+5) /* UART 0 Rx Line Status (RLS)
+ * Transmit Holding Register Empty (THRE)
+ * Rx Data Available (RDA)
+ * Character Time-out Indicator (CTI)
+ * End of Auto-Baud (ABEO)
+ * Auto-Baud Time-Out (ABTO) */
+#define LPC17_40_IRQ_UART1 (LPC17_40_IRQ_EXTINT+6) /* UART 1 Rx Line Status (RLS)
+ * Transmit Holding Register Empty (THRE)
+ * Rx Data Available (RDA)
+ * Character Time-out Indicator (CTI)
+ * Modem Control Change
+ * End of Auto-Baud (ABEO)
+ * Auto-Baud Time-Out (ABTO) */
+#define LPC17_40_IRQ_UART2 (LPC17_40_IRQ_EXTINT+7) /* UART 2 Rx Line Status (RLS)
+ * Transmit Holding Register Empty (THRE)
+ * Rx Data Available (RDA)
+ * Character Time-out Indicator (CTI)
+ * End of Auto-Baud (ABEO)
+ * Auto-Baud Time-Out (ABTO) */
+#define LPC17_40_IRQ_UART3 (LPC17_40_IRQ_EXTINT+8) /* UART 3 Rx Line Status (RLS)
+ * Transmit Holding Register Empty (THRE)
+ * Rx Data Available (RDA)
+ * Character Time-out Indicator (CTI)
+ * End of Auto-Baud (ABEO)
+ * Auto-Baud Time-Out (ABTO) */
+#define LPC17_40_IRQ_PWM1 (LPC17_40_IRQ_EXTINT+9) /* PWM1 Match 0 - 6 of PWM1
+ * Capture 0-1 of PWM1 */
+#define LPC17_40_IRQ_I2C0 (LPC17_40_IRQ_EXTINT+10) /* I2C0 SI (state change) */
+#define LPC17_40_IRQ_I2C1 (LPC17_40_IRQ_EXTINT+11) /* I2C1 SI (state change) */
+#define LPC17_40_IRQ_I2C2 (LPC17_40_IRQ_EXTINT+12) /* I2C2 SI (state change) */
+#define LPC17_40_IRQ_SPIF (LPC17_40_IRQ_EXTINT+13) /* SPI SPI Interrupt Flag (SPIF)
+ * Mode Fault (MODF) */
+#define LPC17_40_IRQ_SSP0 (LPC17_40_IRQ_EXTINT+14) /* SSP0 Tx FIFO half empty of SSP0
+ * Rx FIFO half full of SSP0
+ * Rx Timeout of SSP0
+ * Rx Overrun of SSP0 */
+#define LPC17_40_IRQ_SSP1 (LPC17_40_IRQ_EXTINT+15) /* SSP 1 Tx FIFO half empty
+ * Rx FIFO half full
+ * Rx Timeout
+ * Rx Overrun */
+#define LPC17_40_IRQ_PLL0 (LPC17_40_IRQ_EXTINT+16) /* PLL0 (Main PLL) PLL0 Lock (PLOCK0) */
+#define LPC17_40_IRQ_RTC (LPC17_40_IRQ_EXTINT+17) /* RTC Counter Increment (RTCCIF)
+ * Alarm (RTCALF) */
+#define LPC17_40_IRQ_EINT0 (LPC17_40_IRQ_EXTINT+18) /* External Interrupt 0 (EINT0) */
+#define LPC17_40_IRQ_EINT1 (LPC17_40_IRQ_EXTINT+19) /* External Interrupt 1 (EINT1) */
+#define LPC17_40_IRQ_EINT2 (LPC17_40_IRQ_EXTINT+20) /* External Interrupt 2 (EINT2) */
+#define LPC17_40_IRQ_EINT3 (LPC17_40_IRQ_EXTINT+21) /* External Interrupt 3 (EINT3)
+ * Note: EINT3 channel is shared with GPIO interrupts */
+#define LPC17_40_IRQ_ADC (LPC17_40_IRQ_EXTINT+22) /* ADC A/D Converter end of conversion */
+#define LPC17_40_IRQ_BOD (LPC17_40_IRQ_EXTINT+23) /* BOD Brown Out detect */
+#define LPC17_40_IRQ_USB (LPC17_40_IRQ_EXTINT+24) /* USB USB_INT_REQ_LP, USB_INT_REQ_HP,
+ * USB_INT_REQ_DMA */
+#define LPC17_40_IRQ_CAN (LPC17_40_IRQ_EXTINT+25) /* CAN CAN Common, CAN 0 Tx, CAN 0 Rx,
+ * CAN 1 Tx, CAN 1 Rx */
+#define LPC17_40_IRQ_GPDMA (LPC17_40_IRQ_EXTINT+26) /* GPDMA IntStatus of DMA channel 0,
+ * IntStatus of DMA channel 1 */
+#define LPC17_40_IRQ_I2S (LPC17_40_IRQ_EXTINT+27) /* I2S irq, dmareq1, dmareq2 */
+#define LPC17_40_IRQ_ETH (LPC17_40_IRQ_EXTINT+28) /* Ethernet WakeupInt, SoftInt, TxDoneInt,
+ * TxFinishedInt, TxErrorInt,* TxUnderrunInt,
+ * RxDoneInt, RxFinishedInt, RxErrorInt,
+ * RxOverrunInt */
+#define LPC17_40_IRQ_RITINT (LPC17_40_IRQ_EXTINT+29) /* Repetitive Interrupt Timer (RITINT) */
+#define LPC17_40_IRQ_MCPWM (LPC17_40_IRQ_EXTINT+30) /* Motor Control PWM IPER[2:0], IPW[2:0],
+ * ICAP[2:0], FES */
+#define LPC17_40_IRQ_QEI (LPC17_40_IRQ_EXTINT+31) /* Quadrature Encoder INX_Int, TIM_Int, VELC_Int,
+ * DIR_Int, ERR_Int, ENCLK_Int, POS0_Int, POS1_Int
+ * POS2_Int, REV_Int, POS0REV_Int, OS1REV_Int,
+ * POS2REV_Int */
+#define LPC17_40_IRQ_PLL1 (LPC17_40_IRQ_EXTINT+32) /* PLL1 (USB PLL) PLL1 Lock (PLOCK1) */
+#define LPC17_40_IRQ_USBACT (LPC17_40_IRQ_EXTINT+33) /* USB Activity Interrupt USB_NEED_CLK */
+#define LPC17_40_IRQ_CANACT (LPC17_40_IRQ_EXTINT+34) /* CAN Activity Interrupt CAN1WAKE, CAN2WAKE */
+#define LPC17_40_IRQ_NEXTINT (35)
+#define LPC17_40_IRQ_NIRQS (LPC17_40_IRQ_EXTINT+LPC17_40_IRQ_NEXTINT)
+
+/* GPIO interrupts. The LPC17xx/LPC40xx supports several interrupts on ports 0 and
+ * 2 (only). We go through some special efforts to keep the number of IRQs
+ * to a minimum in this sparse interrupt case.
+ *
+ * 28 interrupts on Port 0: p0.0 - p0.11, p0.15-p0.30
+ * 14 interrupts on Port 2: p2.0 - p2.13
+ * --
+ * 42
+ */
+
+#ifdef CONFIG_LPC17_40_GPIOIRQ
+# define LPC17_40_VALID_GPIOINT0 (0x7fff8ffful) /* GPIO port 0 interrupt set */
+# define LPC17_40_VALID_GPIOINT2 (0x00003ffful) /* GPIO port 2 interrupt set */
+
+ /* Set 1: 12 interrupts p0.0-p0.11 */
+
+# define LPC17_40_VALID_GPIOINT0L (0x00000ffful)
+# define LPC17_40_VALID_SHIFT0L (0)
+# define LPC17_40_VALID_FIRST0L (LPC17_40_IRQ_EXTINT+LPC17_40_IRQ_NEXTINT)
+
+# define LPC17_40_IRQ_P0p0 (LPC17_40_VALID_FIRST0L+0)
+# define LPC17_40_IRQ_P0p1 (LPC17_40_VALID_FIRST0L+1)
+# define LPC17_40_IRQ_P0p2 (LPC17_40_VALID_FIRST0L+2)
+# define LPC17_40_IRQ_P0p3 (LPC17_40_VALID_FIRST0L+3)
+# define LPC17_40_IRQ_P0p4 (LPC17_40_VALID_FIRST0L+4)
+# define LPC17_40_IRQ_P0p5 (LPC17_40_VALID_FIRST0L+5)
+# define LPC17_40_IRQ_P0p6 (LPC17_40_VALID_FIRST0L+6)
+# define LPC17_40_IRQ_P0p7 (LPC17_40_VALID_FIRST0L+7)
+# define LPC17_40_IRQ_P0p8 (LPC17_40_VALID_FIRST0L+8)
+# define LPC17_40_IRQ_P0p9 (LPC17_40_VALID_FIRST0L+9)
+# define LPC17_40_IRQ_P0p10 (LPC17_40_VALID_FIRST0L+10)
+# define LPC17_40_IRQ_P0p11 (LPC17_40_VALID_FIRST0L+11)
+# define LPC17_40_VALID_NIRQS0L (12)
+
+ /* Set 2: 16 interrupts p0.15-p0.30 */
+
+# define LPC17_40_VALID_GPIOINT0H (0x7fff8000ull)
+# define LPC17_40_VALID_SHIFT0H (15)
+# define LPC17_40_VALID_FIRST0H (LPC17_40_VALID_FIRST0L+LPC17_40_VALID_NIRQS0L)
+
+# define LPC17_40_IRQ_P0p15 (LPC17_40_VALID_FIRST0H+0)
+# define LPC17_40_IRQ_P0p16 (LPC17_40_VALID_FIRST0H+1)
+# define LPC17_40_IRQ_P0p17 (LPC17_40_VALID_FIRST0H+2)
+# define LPC17_40_IRQ_P0p18 (LPC17_40_VALID_FIRST0H+3)
+# define LPC17_40_IRQ_P0p19 (LPC17_40_VALID_FIRST0H+4)
+# define LPC17_40_IRQ_P0p20 (LPC17_40_VALID_FIRST0H+5)
+# define LPC17_40_IRQ_P0p21 (LPC17_40_VALID_FIRST0H+6)
+# define LPC17_40_IRQ_P0p22 (LPC17_40_VALID_FIRST0H+7)
+# define LPC17_40_IRQ_P0p23 (LPC17_40_VALID_FIRST0H+8)
+# define LPC17_40_IRQ_P0p24 (LPC17_40_VALID_FIRST0H+9)
+# define LPC17_40_IRQ_P0p25 (LPC17_40_VALID_FIRST0H+10)
+# define LPC17_40_IRQ_P0p26 (LPC17_40_VALID_FIRST0H+11)
+# define LPC17_40_IRQ_P0p27 (LPC17_40_VALID_FIRST0H+12)
+# define LPC17_40_IRQ_P0p28 (LPC17_40_VALID_FIRST0H+13)
+# define LPC17_40_IRQ_P0p29 (LPC17_40_VALID_FIRST0H+14)
+# define LPC17_40_IRQ_P0p30 (LPC17_40_VALID_FIRST0H+15)
+# define LPC17_40_VALID_NIRQS0H (16)
+
+ /* Set 3: 14 interrupts p2.0-p2.13 */
+
+# define LPC17_40_VALID_GPIOINT2 (0x00003ffful)
+# define LPC17_40_VALID_SHIFT2 (0)
+# define LPC17_40_VALID_FIRST2 (LPC17_40_VALID_FIRST0H+LPC17_40_VALID_NIRQS0H)
+
+# define LPC17_40_IRQ_P2p0 (LPC17_40_VALID_FIRST2+0)
+# define LPC17_40_IRQ_P2p1 (LPC17_40_VALID_FIRST2+1)
+# define LPC17_40_IRQ_P2p2 (LPC17_40_VALID_FIRST2+2)
+# define LPC17_40_IRQ_P2p3 (LPC17_40_VALID_FIRST2+3)
+# define LPC17_40_IRQ_P2p4 (LPC17_40_VALID_FIRST2+4)
+# define LPC17_40_IRQ_P2p5 (LPC17_40_VALID_FIRST2+5)
+# define LPC17_40_IRQ_P2p6 (LPC17_40_VALID_FIRST2+6)
+# define LPC17_40_IRQ_P2p7 (LPC17_40_VALID_FIRST2+7)
+# define LPC17_40_IRQ_P2p8 (LPC17_40_VALID_FIRST2+8)
+# define LPC17_40_IRQ_P2p9 (LPC17_40_VALID_FIRST2+9)
+# define LPC17_40_IRQ_P2p10 (LPC17_40_VALID_FIRST2+10)
+# define LPC17_40_IRQ_P2p11 (LPC17_40_VALID_FIRST2+11)
+# define LPC17_40_IRQ_P2p12 (LPC17_40_VALID_FIRST2+12)
+# define LPC17_40_IRQ_P2p13 (LPC17_40_VALID_FIRST2+13)
+# define LPC17_40_VALID_NIRQS2 (14)
+# define LPC17_40_NGPIOAIRQS (LPC17_40_VALID_NIRQS0L+LPC17_40_VALID_NIRQS0H+LPC17_40_VALID_NIRQS2)
+#else
+# define LPC17_40_NGPIOAIRQS (0)
+#endif
+
+/* Total number of IRQ numbers */
+
+#define NR_IRQS (LPC17_40_IRQ_EXTINT+LPC17_40_IRQ_NEXTINT+LPC17_40_NGPIOAIRQS)
+
+/****************************************************************************
+ * Public Types
+ ****************************************************************************/
+
+/****************************************************************************
+ * Inline functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Function Prototypes
+ ****************************************************************************/
+
+#endif /* __ARCH_ARM_INCLUDE_LPC17XX_40XX_LPC176X_IRQ_H */
+
diff --git a/arch/arm/include/lpc17xx_40xx/lpc178x_40xx_irq.h b/arch/arm/include/lpc17xx_40xx/lpc178x_40xx_irq.h
new file mode 100644
index 00000000000..b35ef750f56
--- /dev/null
+++ b/arch/arm/include/lpc17xx_40xx/lpc178x_40xx_irq.h
@@ -0,0 +1,291 @@
+/****************************************************************************
+ * arch/arm/include/lpc17xx_40xxx/lpc178x_40xx_irq.h
+ *
+ * Copyright (C) 2013 Gregory Nutt. All rights reserved.
+ * Authors: Rommel Marcelo
+ * Gregory Nutt
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ * 3. Neither the name NuttX 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 THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/* This file should never be included directed but, rather,
+ * only indirectly through nuttx/irq.h
+ */
+
+#ifndef __ARCH_ARM_INCLUDE_LPC17XX_40XX_LPC178X_IRQ_H
+#define __ARCH_ARM_INCLUDE_LPC17XX_40XX_LPC178X_IRQ_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/* IRQ numbers. The IRQ number corresponds vector number and hence map
+ * directly to bits in the NVIC. This does, however, waste several words of
+ * memory in the IRQ to handle mapping tables.
+ */
+
+/* External interrupts (vectors >= 16) */
+
+#define LPC17_40_IRQ_WDT (LPC17_40_IRQ_EXTINT+0) /* WDT Watchdog Interrupt (WDINT) */
+#define LPC17_40_IRQ_TMR0 (LPC17_40_IRQ_EXTINT+1) /* Timer 0 Match 0 - 1 (MR0, MR1)
+ * Capture 0 - 1 (CR0, CR1) */
+#define LPC17_40_IRQ_TMR1 (LPC17_40_IRQ_EXTINT+2) /* Timer 1 Match 0 - 2 (MR0, MR1, MR2)
+ * Capture 0 - 1 (CR0, CR1) */
+#define LPC17_40_IRQ_TMR2 (LPC17_40_IRQ_EXTINT+3) /* Timer 2 Match 0-3
+ * Capture 0-1 */
+#define LPC17_40_IRQ_TMR3 (LPC17_40_IRQ_EXTINT+4) /* Timer 3 Match 0-3
+ * Capture 0-1 */
+#define LPC17_40_IRQ_UART0 (LPC17_40_IRQ_EXTINT+5) /* UART 0 Rx Line Status (RLS)
+ * Transmit Holding Register Empty (THRE)
+ * Rx Data Available (RDA)
+ * Character Time-out Indicator (CTI)
+ * End of Auto-Baud (ABEO)
+ * Auto-Baud Time-Out (ABTO) */
+#define LPC17_40_IRQ_UART1 (LPC17_40_IRQ_EXTINT+6) /* UART 1 Rx Line Status (RLS)
+ * Transmit Holding Register Empty (THRE)
+ * Rx Data Available (RDA)
+ * Character Time-out Indicator (CTI)
+ * Modem Control Change
+ * End of Auto-Baud (ABEO)
+ * Auto-Baud Time-Out (ABTO) */
+#define LPC17_40_IRQ_UART2 (LPC17_40_IRQ_EXTINT+7) /* UART 2 Rx Line Status (RLS)
+ * Transmit Holding Register Empty (THRE)
+ * Rx Data Available (RDA)
+ * Character Time-out Indicator (CTI)
+ * End of Auto-Baud (ABEO)
+ * Auto-Baud Time-Out (ABTO) */
+#define LPC17_40_IRQ_UART3 (LPC17_40_IRQ_EXTINT+8) /* UART 3 Rx Line Status (RLS)
+ * Transmit Holding Register Empty (THRE)
+ * Rx Data Available (RDA)
+ * Character Time-out Indicator (CTI)
+ * End of Auto-Baud (ABEO)
+ * Auto-Baud Time-Out (ABTO) */
+#define LPC17_40_IRQ_PWM1 (LPC17_40_IRQ_EXTINT+9) /* PWM1 Match 0 - 6 of PWM1
+ * Capture 0-1 of PWM1 */
+#define LPC17_40_IRQ_I2C0 (LPC17_40_IRQ_EXTINT+10) /* I2C0 SI (state change) */
+#define LPC17_40_IRQ_I2C1 (LPC17_40_IRQ_EXTINT+11) /* I2C1 SI (state change) */
+#define LPC17_40_IRQ_I2C2 (LPC17_40_IRQ_EXTINT+12) /* I2C2 SI (state change) */
+#define LPC17_40_IRQ_RESERVED29 (LPC17_40_IRQ_EXTINT+13) /* Unused */
+#define LPC17_40_IRQ_SSP0 (LPC17_40_IRQ_EXTINT+14) /* SSP0 Tx FIFO half empty of SSP0
+ * Rx FIFO half full of SSP0
+ * Rx Timeout of SSP0
+ * Rx Overrun of SSP0 */
+#define LPC17_40_IRQ_SSP1 (LPC17_40_IRQ_EXTINT+15) /* SSP 1 Tx FIFO half empty
+ * Rx FIFO half full
+ * Rx Timeout
+ * Rx Overrun */
+#define LPC17_40_IRQ_PLL0 (LPC17_40_IRQ_EXTINT+16) /* PLL0 (Main PLL) PLL0 Lock (PLOCK0) */
+#define LPC17_40_IRQ_RTC (LPC17_40_IRQ_EXTINT+17) /* RTC Counter Increment (RTCCIF)
+ * Alarm (RTCALF) */
+#define LPC17_40_IRQ_EINT0 (LPC17_40_IRQ_EXTINT+18) /* External Interrupt 0 (EINT0) */
+#define LPC17_40_IRQ_EINT1 (LPC17_40_IRQ_EXTINT+19) /* External Interrupt 1 (EINT1) */
+#define LPC17_40_IRQ_EINT2 (LPC17_40_IRQ_EXTINT+20) /* External Interrupt 2 (EINT2) */
+#define LPC17_40_IRQ_EINT3 (LPC17_40_IRQ_EXTINT+21) /* External Interrupt 3 (EINT3)
+ * Note: EINT3 channel is shared with GPIO interrupts */
+#define LPC17_40_IRQ_ADC (LPC17_40_IRQ_EXTINT+22) /* ADC A/D Converter end of conversion */
+#define LPC17_40_IRQ_BOD (LPC17_40_IRQ_EXTINT+23) /* BOD Brown Out detect */
+#define LPC17_40_IRQ_USB (LPC17_40_IRQ_EXTINT+24) /* USB USB_INT_REQ_LP, USB_INT_REQ_HP,
+ * USB_INT_REQ_DMA */
+#define LPC17_40_IRQ_CAN (LPC17_40_IRQ_EXTINT+25) /* CAN CAN Common, CAN 0 Tx, CAN 0 Rx,
+ * CAN 1 Tx, CAN 1 Rx */
+#define LPC17_40_IRQ_GPDMA (LPC17_40_IRQ_EXTINT+26) /* GPDMA IntStatus of DMA channel 0,
+ * IntStatus of DMA channel 1 */
+#define LPC17_40_IRQ_I2S (LPC17_40_IRQ_EXTINT+27) /* I2S irq, dmareq1, dmareq2 */
+#define LPC17_40_IRQ_ETH (LPC17_40_IRQ_EXTINT+28) /* Ethernet WakeupInt, SoftInt, TxDoneInt,
+ * TxFinishedInt, TxErrorInt,* TxUnderrunInt,
+ * RxDoneInt, RxFinishedInt, RxErrorInt,
+ * RxOverrunInt */
+#define LPC17_40_IRQ_MCI (LPC17_40_IRQ_EXTINT+29) /* MCI SD Card Interface */
+#define LPC17_40_IRQ_MCPWM (LPC17_40_IRQ_EXTINT+30) /* Motor Control PWM IPER[2:0], IPW[2:0],
+ * ICAP[2:0], FES */
+#define LPC17_40_IRQ_QEI (LPC17_40_IRQ_EXTINT+31) /* Quadrature Encoder INX_Int, TIM_Int, VELC_Int,
+ * DIR_Int, ERR_Int, ENCLK_Int, POS0_Int, POS1_Int
+ * POS2_Int, REV_Int, POS0REV_Int, OS1REV_Int,
+ * POS2REV_Int */
+#define LPC17_40_IRQ_PLL1 (LPC17_40_IRQ_EXTINT+32) /* PLL1 (USB PLL) PLL1 Lock (PLOCK1) */
+#define LPC17_40_IRQ_USBACT (LPC17_40_IRQ_EXTINT+33) /* USB Activity Interrupt USB_NEED_CLK */
+#define LPC17_40_IRQ_CANACT (LPC17_40_IRQ_EXTINT+34) /* CAN Activity Interrupt CAN1WAKE, CAN2WAKE */
+#define LPC17_40_IRQ_UART4 (LPC17_40_IRQ_EXTINT+35) /* UART 4 Rx Line Status (RLS)
+ * Transmit Holding Register Empty (THRE)
+ * Rx Data Available (RDA)
+ * Character Time-out Indicator (CTI)
+ * End of Auto-Baud (ABEO)
+ * Auto-Baud Time-Out (ABTO) */
+#define LPC17_40_IRQ_SSP2 (LPC17_40_IRQ_EXTINT+36) /* SSP2 Tx FIFO half empty of SSP2
+ * Rx FIFO half full of SSP2
+ * Rx Timeout of SSP2
+ * Rx Overrun of SSP2 */
+#define LPC17_40_IRQ_LCD (LPC17_40_IRQ_EXTINT+37) /* LCD interrupt
+ * BER, VCompI, LNBUI, FUFI, CrsrI */
+#define LPC17_40_IRQ_GPIO (LPC17_40_IRQ_EXTINT+38) /* GPIO Interrupt
+ * P0xREI, P2xREI, P0xFEI, P2xFEI */
+#define LPC17_40_IRQ_PWM0 (LPC17_40_IRQ_EXTINT+39) /* PWM0 Match 0 - 6 of PWM0
+ * Capture 0-1 of PWM0 */
+#define LPC17_40_IRQ_EEPROM (LPC17_40_IRQ_EXTINT+40) /* EEPROM Interrupt
+ * EE_PROG_DONE, EE_RW_DONE */
+#define LPC17_40_IRQ_NEXTINT (41)
+#define LPC17_40_IRQ_NIRQS (LPC17_40_IRQ_EXTINT+LPC17_40_IRQ_NEXTINT)
+
+/* GPIO interrupts. The LPC177x_8x supports several interrupts on ports 0 and
+ * 2 (only). We go through some special efforts to keep the number of IRQs
+ * to a minimum in this sparse interrupt case.
+ *
+ * 31 interrupts on Port 0: p0.0 - p0.30
+ * 31 interrupts on Port 2: p2.0 - p2.30
+ * --
+ * 42
+ */
+
+#ifdef CONFIG_LPC17_40_GPIOIRQ
+# define LPC17_40_VALID_GPIOINT0 (0xfffffffful) /* GPIO port 0 interrupt set */
+# define LPC17_40_VALID_GPIOINT2 (0xfffffffful) /* GPIO port 2 interrupt set */
+
+ /* Set 1: 16 interrupts p0.0-p0.15 */
+
+# define LPC17_40_VALID_SHIFT0L (0)
+# define LPC17_40_VALID_FIRST0L (LPC17_40_IRQ_EXTINT+LPC17_40_IRQ_NEXTINT)
+
+# define LPC17_40_IRQ_P0p0 (LPC17_40_VALID_FIRST0L+0)
+# define LPC17_40_IRQ_P0p1 (LPC17_40_VALID_FIRST0L+1)
+# define LPC17_40_IRQ_P0p2 (LPC17_40_VALID_FIRST0L+2)
+# define LPC17_40_IRQ_P0p3 (LPC17_40_VALID_FIRST0L+3)
+# define LPC17_40_IRQ_P0p4 (LPC17_40_VALID_FIRST0L+4)
+# define LPC17_40_IRQ_P0p5 (LPC17_40_VALID_FIRST0L+5)
+# define LPC17_40_IRQ_P0p6 (LPC17_40_VALID_FIRST0L+6)
+# define LPC17_40_IRQ_P0p7 (LPC17_40_VALID_FIRST0L+7)
+# define LPC17_40_IRQ_P0p8 (LPC17_40_VALID_FIRST0L+8)
+# define LPC17_40_IRQ_P0p9 (LPC17_40_VALID_FIRST0L+9)
+# define LPC17_40_IRQ_P0p10 (LPC17_40_VALID_FIRST0L+10)
+# define LPC17_40_IRQ_P0p11 (LPC17_40_VALID_FIRST0L+11)
+# define LPC17_40_IRQ_P0p12 (LPC17_40_VALID_FIRST0L+12)
+# define LPC17_40_IRQ_P0p13 (LPC17_40_VALID_FIRST0L+13)
+# define LPC17_40_IRQ_P0p14 (LPC17_40_VALID_FIRST0L+14)
+# define LPC17_40_IRQ_P0p15 (LPC17_40_VALID_FIRST0L+15)
+# define LPC17_40_VALID_NIRQS0L (16)
+
+ /* Set 2: 16 interrupts p0.16-p0.31 */
+
+# define LPC17_40_VALID_SHIFT0H (16)
+# define LPC17_40_VALID_FIRST0H (LPC17_40_VALID_FIRST0L+LPC17_40_VALID_NIRQS0L)
+
+# define LPC17_40_IRQ_P0p16 (LPC17_40_VALID_FIRST0H+0)
+# define LPC17_40_IRQ_P0p17 (LPC17_40_VALID_FIRST0H+1)
+# define LPC17_40_IRQ_P0p18 (LPC17_40_VALID_FIRST0H+2)
+# define LPC17_40_IRQ_P0p19 (LPC17_40_VALID_FIRST0H+3)
+# define LPC17_40_IRQ_P0p20 (LPC17_40_VALID_FIRST0H+4)
+# define LPC17_40_IRQ_P0p21 (LPC17_40_VALID_FIRST0H+5)
+# define LPC17_40_IRQ_P0p22 (LPC17_40_VALID_FIRST0H+6)
+# define LPC17_40_IRQ_P0p23 (LPC17_40_VALID_FIRST0H+7)
+# define LPC17_40_IRQ_P0p24 (LPC17_40_VALID_FIRST0H+8)
+# define LPC17_40_IRQ_P0p25 (LPC17_40_VALID_FIRST0H+9)
+# define LPC17_40_IRQ_P0p26 (LPC17_40_VALID_FIRST0H+10)
+# define LPC17_40_IRQ_P0p27 (LPC17_40_VALID_FIRST0H+11)
+# define LPC17_40_IRQ_P0p28 (LPC17_40_VALID_FIRST0H+12)
+# define LPC17_40_IRQ_P0p29 (LPC17_40_VALID_FIRST0H+13)
+# define LPC17_40_IRQ_P0p30 (LPC17_40_VALID_FIRST0H+14)
+# define LPC17_40_IRQ_P0p31 (LPC17_40_VALID_FIRST0H+15)
+# define LPC17_40_VALID_NIRQS0H (16)
+
+ /* Set 3: 16 interrupts p2.0-p2.15 */
+
+# define LPC17_40_VALID_SHIFT2L (0)
+# define LPC17_40_VALID_FIRST2L (LPC17_40_VALID_FIRST0H+LPC17_40_VALID_NIRQS0H)
+
+# define LPC17_40_IRQ_P2p0 (LPC17_40_VALID_FIRST2L+0)
+# define LPC17_40_IRQ_P2p1 (LPC17_40_VALID_FIRST2L+1)
+# define LPC17_40_IRQ_P2p2 (LPC17_40_VALID_FIRST2L+2)
+# define LPC17_40_IRQ_P2p3 (LPC17_40_VALID_FIRST2L+3)
+# define LPC17_40_IRQ_P2p4 (LPC17_40_VALID_FIRST2L+4)
+# define LPC17_40_IRQ_P2p5 (LPC17_40_VALID_FIRST2L+5)
+# define LPC17_40_IRQ_P2p6 (LPC17_40_VALID_FIRST2L+6)
+# define LPC17_40_IRQ_P2p7 (LPC17_40_VALID_FIRST2L+7)
+# define LPC17_40_IRQ_P2p8 (LPC17_40_VALID_FIRST2L+8)
+# define LPC17_40_IRQ_P2p9 (LPC17_40_VALID_FIRST2L+9)
+# define LPC17_40_IRQ_P2p10 (LPC17_40_VALID_FIRST2L+10)
+# define LPC17_40_IRQ_P2p11 (LPC17_40_VALID_FIRST2L+11)
+# define LPC17_40_IRQ_P2p12 (LPC17_40_VALID_FIRST2L+12)
+# define LPC17_40_IRQ_P2p13 (LPC17_40_VALID_FIRST2L+13)
+# define LPC17_40_IRQ_P2p14 (LPC17_40_VALID_FIRST2L+14)
+# define LPC17_40_IRQ_P2p15 (LPC17_40_VALID_FIRST2L+15)
+# define LPC17_40_VALID_NIRQS2L (16)
+
+ /* Set 4: 16 interrupts p2.16 - p2.31 */
+
+# define LPC17_40_VALID_SHIFT2H (16)
+# define LPC17_40_VALID_FIRST2H (LPC17_40_VALID_FIRST2L+LPC17_40_VALID_NIRQS2L)
+
+# define LPC17_40_IRQ_P2p16 (LPC17_40_VALID_FIRST2H+0)
+# define LPC17_40_IRQ_P2p17 (LPC17_40_VALID_FIRST2H+1)
+# define LPC17_40_IRQ_P2p18 (LPC17_40_VALID_FIRST2H+2)
+# define LPC17_40_IRQ_P2p19 (LPC17_40_VALID_FIRST2H+3)
+# define LPC17_40_IRQ_P2p20 (LPC17_40_VALID_FIRST2H+4)
+# define LPC17_40_IRQ_P2p21 (LPC17_40_VALID_FIRST2H+5)
+# define LPC17_40_IRQ_P2p22 (LPC17_40_VALID_FIRST2H+6)
+# define LPC17_40_IRQ_P2p23 (LPC17_40_VALID_FIRST2H+7)
+# define LPC17_40_IRQ_P2p24 (LPC17_40_VALID_FIRST2H+8)
+# define LPC17_40_IRQ_P2p25 (LPC17_40_VALID_FIRST2H+9)
+# define LPC17_40_IRQ_P2p26 (LPC17_40_VALID_FIRST2H+10)
+# define LPC17_40_IRQ_P2p27 (LPC17_40_VALID_FIRST2H+11)
+# define LPC17_40_IRQ_P2p28 (LPC17_40_VALID_FIRST2H+12)
+# define LPC17_40_IRQ_P2p29 (LPC17_40_VALID_FIRST2H+13)
+# define LPC17_40_IRQ_P2p30 (LPC17_40_VALID_FIRST2H+14)
+# define LPC17_40_IRQ_P2p31 (LPC17_40_VALID_FIRST2H+15)
+# define LPC17_40_VALID_NIRQS2H (16)
+
+# define LPC17_40_NGPIOAIRQS (LPC17_40_VALID_NIRQS0L+LPC17_40_VALID_NIRQS0H+LPC17_40_VALID_NIRQS2L+LPC17_40_VALID_NIRQS2H)
+#else
+# define LPC17_40_NGPIOAIRQS (0)
+#endif
+
+/* Total number of IRQ numbers */
+
+#define NR_IRQS (LPC17_40_IRQ_EXTINT+LPC17_40_IRQ_NEXTINT+LPC17_40_NGPIOAIRQS)
+
+/****************************************************************************
+ * Public Types
+ ****************************************************************************/
+
+/****************************************************************************
+ * Inline functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Function Prototypes
+ ****************************************************************************/
+
+#endif /* __ARCH_ARM_INCLUDE_LPC17XX_40XX_LPC178X_IRQ_H */
+
diff --git a/arch/arm/src/armv7-m/up_ramvec_initialize.c b/arch/arm/src/armv7-m/up_ramvec_initialize.c
index 2e00cf2d4ce..0e0c4eb194e 100644
--- a/arch/arm/src/armv7-m/up_ramvec_initialize.c
+++ b/arch/arm/src/armv7-m/up_ramvec_initialize.c
@@ -86,7 +86,7 @@
* vector table must be zero). In this case alignment to a 128 byte address
* boundary is sufficient.
*
- * Some parts, such as the LPC17xx family, require alignment to a 256 byte
+ * Some parts, such as the LPC17xx/LPC40xx family, require alignment to a 256 byte
* address boundary. Any other unusual alignment requirements for the vector
* can be specified for a given architecture be redefining
* NVIC_VECTAB_TBLOFF_MASK in the chip-specific chip.h header file for the
diff --git a/arch/arm/src/lpc11xx/lpc11_gpio.c b/arch/arm/src/lpc11xx/lpc11_gpio.c
index ef984351db5..65dcbc64550 100644
--- a/arch/arm/src/lpc11xx/lpc11_gpio.c
+++ b/arch/arm/src/lpc11xx/lpc11_gpio.c
@@ -40,9 +40,9 @@
#include
/* This file is only a thin shell that includes the correct GPIO logic for
- * the selected LPC17xx family. The correct file cannot be selected by the
+ * the selected LPC17xx/LPC40xx family. The correct file cannot be selected by the
* make system because it needs the intelligence that only exists in chip.h
- * that can associate an LPC17xx part number with an LPC17xx family.
+ * that can associate an LPC17xx/LPC40xx part number with an LPC17xx/LPC40xx family.
*/
#include
diff --git a/arch/arm/src/lpc11xx/lpc11_gpio.h b/arch/arm/src/lpc11xx/lpc11_gpio.h
index dea2a0cef8f..21d5dce1be0 100644
--- a/arch/arm/src/lpc11xx/lpc11_gpio.h
+++ b/arch/arm/src/lpc11xx/lpc11_gpio.h
@@ -52,7 +52,7 @@
#include "hardware/lpc11_gpio.h"
#include "hardware/lpc11_pinconfig.h"
-/* Include the GPIO definitions for the selected LPC17xx family. */
+/* Include the GPIO definitions for the selected LPC17xx/LPC40xx family. */
#if defined(LPC111x)
# include "lpc111x_gpio.h"
diff --git a/arch/arm/src/lpc11xx/lpc11_gpiodbg.c b/arch/arm/src/lpc11xx/lpc11_gpiodbg.c
index 86b3098dcda..ce072430b4e 100644
--- a/arch/arm/src/lpc11xx/lpc11_gpiodbg.c
+++ b/arch/arm/src/lpc11xx/lpc11_gpiodbg.c
@@ -125,7 +125,7 @@ int lpc11_dumpgpio(lpc11_pinset_t pinset, const char *msg)
#if defined(LPC176x)
uint32_t pinsel;
uint32_t pinmode;
-#elif defined(LPC178x)
+#elif defined(LPC178x_40xx)
uint32_t iocon;
#endif /* LPC176x */
unsigned int port;
@@ -139,7 +139,7 @@ int lpc11_dumpgpio(lpc11_pinset_t pinset, const char *msg)
#if defined(LPC176x)
pinsel = lpc11_pinsel(port, pin);
pinmode = lpc11_pinmode(port, pin);
-#elif defined(LPC178x)
+#elif defined(LPC178x_40xx)
iocon = LPC11_IOCON_P(port, pin);
#endif /* LPC176x */
@@ -154,7 +154,7 @@ int lpc11_dumpgpio(lpc11_pinset_t pinset, const char *msg)
pinsel, pinsel ? getreg32(pinsel) : 0,
pinmode, pinmode ? getreg32(pinmode) : 0,
g_odmode[port], getreg32(g_odmode[port]));
-#elif defined(LPC178x)
+#elif defined(LPC178x_40xx)
gpioinfo(" IOCON[%08x]: %08x\n", iocon, getreg32(iocon));
#endif
diff --git a/arch/arm/src/lpc11xx/lpc11_gpioint.c b/arch/arm/src/lpc11xx/lpc11_gpioint.c
index 5327b9e9ff8..af8d6c3d1a2 100644
--- a/arch/arm/src/lpc11xx/lpc11_gpioint.c
+++ b/arch/arm/src/lpc11xx/lpc11_gpioint.c
@@ -165,7 +165,7 @@ static int lpc11_irq2port(int irq)
{
/* Set 1:
* LPC176x: 12 interrupts p0.0-p0.11
- * LPC178x: 16 interrupts p0.0-p0.15
+ * LPC178x_40xx: 16 interrupts p0.0-p0.15
*/
if (irq >= LPC11_VALID_FIRST0L &&
@@ -176,7 +176,7 @@ static int lpc11_irq2port(int irq)
/* Set 2:
* LPC176x: 16 interrupts p0.15-p0.30
- * LPC178x: 16 interrupts p0.16-p0.31
+ * LPC178x_40xx: 16 interrupts p0.16-p0.31
*/
else if (irq >= LPC11_VALID_FIRST0H &&
@@ -196,7 +196,7 @@ static int lpc11_irq2port(int irq)
return 2;
}
-#elif defined (LPC178x)
+#elif defined (LPC178x_40xx)
/* Set 3:
* LPC18x: 16 interrupts p2.0-p2.15
*/
@@ -208,7 +208,7 @@ static int lpc11_irq2port(int irq)
}
/* Set 4:
- * LPC178x: 16 interrupts p2.16-p2.31
+ * LPC178x_40xx: 16 interrupts p2.16-p2.31
*/
else if (irq >= LPC11_VALID_FIRST2H &&
@@ -251,7 +251,7 @@ static int lpc11_irq2pin(int irq)
/* Set 2:
* LPC176x: 16 interrupts p0.15-p0.30
- * LPC178x: 16 interrupts p0.16-p0.31
+ * LPC178x_40xx: 16 interrupts p0.16-p0.31
*
* LPC11_VALID_SHIFT0H 15/16 - Bit number of the first bit in a group
* of 16 interrupts
@@ -281,7 +281,7 @@ static int lpc11_irq2pin(int irq)
return irq - LPC11_VALID_FIRST2 + LPC11_VALID_SHIFT2;
}
-#elif defined(LPC178x)
+#elif defined(LPC178x_40xx)
/* Set 3:
* LPC18x: 16 interrupts p2.0-p2.15
@@ -425,7 +425,7 @@ static int lpc11_gpiointerrupt(int irq, void *context, FAR void *arg)
LPC11_VALID_FIRST2, context);
}
-#elif defined(LPC178x)
+#elif defined(LPC178x_40xx)
/* Check for an interrupt on GPIO2 */
if ((intstatus & GPIOINT_IOINTSTATUS_P2INT) != 0)
@@ -471,8 +471,8 @@ void lpc11_gpioirqinitialize(void)
(void)irq_attach(LPC11_IRQ_EINT3, lpc11_gpiointerrupt, NULL);
up_enable_irq(LPC11_IRQ_EINT3);
-#elif defined(LPC178x)
- /* the LPC178x family has a single, dedicated interrupt for GPIO0 and
+#elif defined(LPC178x_40xx)
+ /* the LPC178x_40xx family has a single, dedicated interrupt for GPIO0 and
* GPIO2.
*/
diff --git a/arch/arm/src/lpc11xx/lpc11_lowputc.c b/arch/arm/src/lpc11xx/lpc11_lowputc.c
index 8bf3759f488..c3f371fff46 100644
--- a/arch/arm/src/lpc11xx/lpc11_lowputc.c
+++ b/arch/arm/src/lpc11xx/lpc11_lowputc.c
@@ -118,7 +118,7 @@
* This Baud Rate configuration is based on idea suggested at LPCWare:
* www.lpcware.com/content/blog/lpc17xx-uart-simpler-way-calculate-baudrate-timming
*
- * The original code is for LPC17xx but with few modifications it worked
+ * The original code is for LPC17xx/LPC40xx but with few modifications it worked
* fine in the LPC11xx as well.
*
****************************************************************************/
diff --git a/arch/arm/src/lpc11xx/lpc11_timer.h b/arch/arm/src/lpc11xx/lpc11_timer.h
index 02f58a50ca7..16a02a6736f 100644
--- a/arch/arm/src/lpc11xx/lpc11_timer.h
+++ b/arch/arm/src/lpc11xx/lpc11_timer.h
@@ -1,5 +1,5 @@
/************************************************************************************
- * arch/arm/src/lpc17xx/lpc11_timer.h
+ * arch/arm/src/lpc17xx_40xx/lpc11_timer.h
*
* Copyright (C) 2010, 2012-2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt
diff --git a/arch/arm/src/lpc11xx/lpc11_userspace.h b/arch/arm/src/lpc11xx/lpc11_userspace.h
index a515654ce98..7ced14e710a 100644
--- a/arch/arm/src/lpc11xx/lpc11_userspace.h
+++ b/arch/arm/src/lpc11xx/lpc11_userspace.h
@@ -1,5 +1,5 @@
/************************************************************************************
- * arch/arm/src/lpc17xx/lpc11_userspace.h
+ * arch/arm/src/lpc17xx_40xx/lpc11_userspace.h
*
* Copyright (C) 2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt
diff --git a/arch/arm/src/lpc17xx/hardware/lpc176x_memorymap.h b/arch/arm/src/lpc17xx/hardware/lpc176x_memorymap.h
deleted file mode 100644
index a99f93d754d..00000000000
--- a/arch/arm/src/lpc17xx/hardware/lpc176x_memorymap.h
+++ /dev/null
@@ -1,136 +0,0 @@
-/************************************************************************************
- * arch/arm/src/lpc17xx/hardware/lpc176x_memorymap.h
- *
- * Copyright (C) 2010, 2013 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. 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.
- * 3. Neither the name NuttX 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 THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- ************************************************************************************/
-
-#ifndef __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC176X_MEMORYMAP_H
-#define __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC176X_MEMORYMAP_H
-
-/************************************************************************************
- * Included Files
- ************************************************************************************/
-
-#include
-
-#include "chip.h"
-
-/************************************************************************************
- * Pre-processor Definitions
- ************************************************************************************/
-
-/* Memory Map ***********************************************************************/
-
-#define LPC17_FLASH_BASE 0x00000000 /* -0x1fffffff: On-chip non-volatile memory */
-#define LPC17_SRAM_BASE 0x10000000 /* -0x10007fff: On-chip SRAM (devices <=32Kb) */
-#define LPC17_ROM_BASE 0x1fff0000 /* -0x1fffffff: 8Kb Boot ROM with flash services */
-#define LPC17_AHBSRAM_BASE 0x20000000 /* -0x3fffffff: On-chip AHB SRAM (devices >32Kb) */
-# define LPC17_SRAM_BANK0 0x2007c000 /* -0x2007ffff: On-chip AHB SRAM Bank0 (devices >=32Kb) */
-# define LPC17_SRAM_BANK1 0x20080000 /* -0x2008ffff: On-chip AHB SRAM Bank1 (devices 64Kb) */
-#define LPC17_GPIO_BASE 0x2009c000 /* -0x2009ffff: GPIO */
-#define LPC17_APB_BASE 0x40000000 /* -0x5fffffff: APB Peripherals */
-# define LPC17_APB0_BASE 0x40000000 /* -0x4007ffff: APB0 Peripherals */
-# define LPC17_APB1_BASE 0x40080000 /* -0x400fffff: APB1 Peripherals */
-# define LPC17_AHB_BASE 0x50000000 /* -0x501fffff: DMA Controller, Ethernet, and USB */
-#define LPC17_CORTEXM3_BASE 0xe0000000 /* -0xe00fffff: (see armv7-m/nvic.h) */
-#define LPC17_SCS_BASE 0xe000e000
-#define LPC17_DEBUGMCU_BASE 0xe0042000
-
-/* AHB SRAM Bank sizes **************************************************************/
-
-#define LPC17_BANK0_SIZE (16*1024) /* Size of AHB SRAM Bank0 (if present) */
-#define LPC17_BANK1_SIZE (16*1024) /* Size of AHB SRAM Bank1 (if present) */
-
-/* APB0 Peripherals *****************************************************************/
-
-#define LPC17_WDT_BASE 0x40000000 /* -0x40003fff: Watchdog timer */
-#define LPC17_TMR0_BASE 0x40004000 /* -0x40007fff: Timer 0 */
-#define LPC17_TMR1_BASE 0x40008000 /* -0x4000bfff: Timer 1 */
-#define LPC17_UART0_BASE 0x4000c000 /* -0x4000ffff: UART 0 */
-#define LPC17_UART1_BASE 0x40010000 /* -0x40013fff: UART 1 */
- /* -0x40017fff: Reserved */
-#define LPC17_PWM1_BASE 0x40018000 /* -0x4001bfff: PWM 1 */
-#define LPC17_I2C0_BASE 0x4001c000 /* -0x4001ffff: I2C 0 */
-#define LPC17_SPI_BASE 0x40020000 /* -0x40023fff: SPI */
-#define LPC17_RTC_BASE 0x40024000 /* -0x40027fff: RTC + backup registers */
-#define LPC17_GPIOINT_BASE 0x40028000 /* -0x4002bfff: GPIO interrupts */
-#define LPC17_PINCONN_BASE 0x4002c000 /* -0x4002ffff: Pin connect block */
-#define LPC17_SSP1_BASE 0x40030000 /* -0x40033fff: SSP 1 */
-#define LPC17_ADC_BASE 0x40034000 /* -0x40037fff: ADC */
-#define LPC17_CANAFRAM_BASE 0x40038000 /* -0x4003bfff: CAN acceptance filter (AF) RAM */
-#define LPC17_CANAF_BASE 0x4003c000 /* -0x4003ffff: CAN acceptance filter (AF) registers */
-#define LPC17_CAN_BASE 0x40040000 /* -0x40043fff: CAN common registers */
-#define LPC17_CAN1_BASE 0x40044000 /* -0x40047fff: CAN controller l */
-#define LPC17_CAN2_BASE 0x40048000 /* -0x4004bfff: CAN controller 2 */
- /* -0x4005bfff: Reserved */
-#define LPC17_I2C1_BASE 0x4005c000 /* -0x4005ffff: I2C 1 */
- /* -0x4007ffff: Reserved */
-
-/* APB1 Peripherals *****************************************************************/
-
- /* -0x40087fff: Reserved */
-#define LPC17_SSP0_BASE 0x40088000 /* -0x4008bfff: SSP 0 */
-#define LPC17_DAC_BASE 0x4008c000 /* -0x4008ffff: DAC */
-#define LPC17_TMR2_BASE 0x40090000 /* -0x40093fff: Timer 2 */
-#define LPC17_TMR3_BASE 0x40094000 /* -0x40097fff: Timer 3 */
-#define LPC17_UART2_BASE 0x40098000 /* -0x4009bfff: UART 2 */
-#define LPC17_UART3_BASE 0x4009c000 /* -0x4009ffff: UART 3 */
-#define LPC17_I2C2_BASE 0x400a0000 /* -0x400a3fff: I2C 2 */
- /* -0x400a7fff: Reserved */
-#define LPC17_I2S_BASE 0x400a8000 /* -0x400abfff: I2S */
- /* -0x400affff: Reserved */
-#define LPC17_RIT_BASE 0x400b0000 /* -0x400b3fff: Repetitive interrupt timer */
- /* -0x400b7fff: Reserved */
-#define LPC17_MCPWM_BASE 0x400b8000 /* -0x400bbfff: Motor control PWM */
-#define LPC17_QEI_BASE 0x400bc000 /* -0x400bffff: Quadrature encoder interface */
- /* -0x400fbfff: Reserved */
-#define LPC17_SYSCON_BASE 0x400fc000 /* -0x400fffff: System control */
-
-/* AHB Peripherals ******************************************************************/
-
-#define LPC17_ETH_BASE 0x50000000 /* -0x50003fff: Ethernet controller */
-#define LPC17_GPDMA_BASE 0x50004000 /* -0x50007fff: GPDMA controller */
-#define LPC17_USB_BASE 0x5000c000 /* -0x5000cfff: USB controller */
-
-/************************************************************************************
- * Public Types
- ************************************************************************************/
-
-/************************************************************************************
- * Public Data
- ************************************************************************************/
-
-/************************************************************************************
- * Public Functions
- ************************************************************************************/
-
-#endif /* __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC176X_MEMORYMAP_H */
diff --git a/arch/arm/src/lpc17xx/hardware/lpc176x_pinconn.h b/arch/arm/src/lpc17xx/hardware/lpc176x_pinconn.h
deleted file mode 100644
index fccf9e8854d..00000000000
--- a/arch/arm/src/lpc17xx/hardware/lpc176x_pinconn.h
+++ /dev/null
@@ -1,635 +0,0 @@
-/************************************************************************************
- * arch/arm/src/lpc17xx/hardware/lpc176x_pinconn.h
- *
- * Copyright (C) 2010, 2013 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. 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.
- * 3. Neither the name NuttX 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 THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- ************************************************************************************/
-
-#ifndef __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC176X_PINCONN_H
-#define __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC176X_PINCONN_H
-
-/************************************************************************************
- * Included Files
- ************************************************************************************/
-
-#include
-
-#include "chip.h"
-#include "hardware/lpc17_memorymap.h"
-
-/************************************************************************************
- * Pre-processor Definitions
- ************************************************************************************/
-
-/* Register offsets *****************************************************************/
-
-#define LPC17_PINCONN_PINSEL0_OFFSET 0x0000 /* Pin function select register 0 */
-#define LPC17_PINCONN_PINSEL1_OFFSET 0x0004 /* Pin function select register 1 */
-#define LPC17_PINCONN_PINSEL2_OFFSET 0x0008 /* Pin function select register 2 */
-#define LPC17_PINCONN_PINSEL3_OFFSET 0x000c /* Pin function select register 3 */
-#define LPC17_PINCONN_PINSEL4_OFFSET 0x0010 /* Pin function select register 4 */
-#define LPC17_PINCONN_PINSEL7_OFFSET 0x001c /* Pin function select register 7 */
-#define LPC17_PINCONN_PINSEL8_OFFSET 0x0020 /* Pin function select register 8 */
-#define LPC17_PINCONN_PINSEL9_OFFSET 0x0024 /* Pin function select register 9 */
-#define LPC17_PINCONN_PINSEL10_OFFSET 0x0028 /* Pin function select register 10 */
-#define LPC17_PINCONN_PINMODE0_OFFSET 0x0040 /* Pin mode select register 0 */
-#define LPC17_PINCONN_PINMODE1_OFFSET 0x0044 /* Pin mode select register 1 */
-#define LPC17_PINCONN_PINMODE2_OFFSET 0x0048 /* Pin mode select register 2 */
-#define LPC17_PINCONN_PINMODE3_OFFSET 0x004c /* Pin mode select register 3 */
-#define LPC17_PINCONN_PINMODE4_OFFSET 0x0050 /* Pin mode select register 4 */
-#define LPC17_PINCONN_PINMODE5_OFFSET 0x0054 /* Pin mode select register 5 */
-#define LPC17_PINCONN_PINMODE6_OFFSET 0x0058 /* Pin mode select register 6 */
-#define LPC17_PINCONN_PINMODE7_OFFSET 0x005c /* Pin mode select register 7 */
-#define LPC17_PINCONN_PINMODE9_OFFSET 0x0064 /* Pin mode select register 9 */
-#define LPC17_PINCONN_ODMODE0_OFFSET 0x0068 /* Open drain mode control register 0 */
-#define LPC17_PINCONN_ODMODE1_OFFSET 0x006c /* Open drain mode control register 1 */
-#define LPC17_PINCONN_ODMODE2_OFFSET 0x0070 /* Open drain mode control register 2 */
-#define LPC17_PINCONN_ODMODE3_OFFSET 0x0074 /* Open drain mode control register 3 */
-#define LPC17_PINCONN_ODMODE4_OFFSET 0x0078 /* Open drain mode control register 4 */
-#define LPC17_PINCONN_I2CPADCFG_OFFSET 0x007c /* I2C Pin Configuration register */
-
-/* Register addresses ***************************************************************/
-
-#define LPC17_PINCONN_PINSEL0 (LPC17_PINCONN_BASE+LPC17_PINCONN_PINSEL0_OFFSET)
-#define LPC17_PINCONN_PINSEL1 (LPC17_PINCONN_BASE+LPC17_PINCONN_PINSEL1_OFFSET)
-#define LPC17_PINCONN_PINSEL2 (LPC17_PINCONN_BASE+LPC17_PINCONN_PINSEL2_OFFSET)
-#define LPC17_PINCONN_PINSEL3 (LPC17_PINCONN_BASE+LPC17_PINCONN_PINSEL3_OFFSET)
-#define LPC17_PINCONN_PINSEL4 (LPC17_PINCONN_BASE+LPC17_PINCONN_PINSEL4_OFFSET)
-#define LPC17_PINCONN_PINSEL7 (LPC17_PINCONN_BASE+LPC17_PINCONN_PINSEL7_OFFSET)
-#define LPC17_PINCONN_PINSEL8 (LPC17_PINCONN_BASE+LPC17_PINCONN_PINSEL8_OFFSET)
-#define LPC17_PINCONN_PINSEL9 (LPC17_PINCONN_BASE+LPC17_PINCONN_PINSEL9_OFFSET)
-#define LPC17_PINCONN_PINSEL10 (LPC17_PINCONN_BASE+LPC17_PINCONN_PINSEL10_OFFSET)
-#define LPC17_PINCONN_PINMODE0 (LPC17_PINCONN_BASE+LPC17_PINCONN_PINMODE0_OFFSET)
-#define LPC17_PINCONN_PINMODE1 (LPC17_PINCONN_BASE+LPC17_PINCONN_PINMODE1_OFFSET)
-#define LPC17_PINCONN_PINMODE2 (LPC17_PINCONN_BASE+LPC17_PINCONN_PINMODE2_OFFSET)
-#define LPC17_PINCONN_PINMODE3 (LPC17_PINCONN_BASE+LPC17_PINCONN_PINMODE3_OFFSET)
-#define LPC17_PINCONN_PINMODE4 (LPC17_PINCONN_BASE+LPC17_PINCONN_PINMODE4_OFFSET)
-#define LPC17_PINCONN_PINMODE5 (LPC17_PINCONN_BASE+LPC17_PINCONN_PINMODE5_OFFSET)
-#define LPC17_PINCONN_PINMODE6 (LPC17_PINCONN_BASE+LPC17_PINCONN_PINMODE6_OFFSET)
-#define LPC17_PINCONN_PINMODE7 (LPC17_PINCONN_BASE+LPC17_PINCONN_PINMODE7_OFFSET)
-#define LPC17_PINCONN_PINMODE9 (LPC17_PINCONN_BASE+LPC17_PINCONN_PINMODE9_OFFSET)
-#define LPC17_PINCONN_ODMODE0 (LPC17_PINCONN_BASE+LPC17_PINCONN_ODMODE0_OFFSET)
-#define LPC17_PINCONN_ODMODE1 (LPC17_PINCONN_BASE+LPC17_PINCONN_ODMODE1_OFFSET)
-#define LPC17_PINCONN_ODMODE2 (LPC17_PINCONN_BASE+LPC17_PINCONN_ODMODE2_OFFSET)
-#define LPC17_PINCONN_ODMODE3 (LPC17_PINCONN_BASE+LPC17_PINCONN_ODMODE3_OFFSET)
-#define LPC17_PINCONN_ODMODE4 (LPC17_PINCONN_BASE+LPC17_PINCONN_ODMODE4_OFFSET)
-#define LPC17_PINCONN_I2CPADCFG (LPC17_PINCONN_BASE+LPC17_PINCONN_I2CPADCFG_OFFSET)
-
-/* Register bit definitions *********************************************************/
-/* Pin Function Select register 0 (PINSEL0: 0x4002c000) */
-
-#define PINCONN_PINSEL_GPIO (0)
-#define PINCONN_PINSEL_ALT1 (1)
-#define PINCONN_PINSEL_ALT2 (2)
-#define PINCONN_PINSEL_ALT3 (3)
-#define PINCONN_PINSEL_MASK (3)
-
-#define PINCONN_PINSELL_SHIFT(n) ((n) << 1) /* n=0,1,..,15 */
-#define PINCONN_PINSELL_MASK(n) (3 << PINCONN_PINSELL_SHIFT(n))
-#define PINCONN_PINSELH_SHIFT(n) (((n)-16) << 1) /* n=16,17,..31 */
-#define PINCONN_PINSELH_MASK(n) (3 << PINCONN_PINSELH_SHIFT(n))
-
-#define PINCONN_PINSEL0_P0_SHIFT(n) PINCONN_PINSELL_SHIFT(n) /* n=0,1,..,15 */
-#define PINCONN_PINSEL0_P0_MASK(n) PINCONN_PINSELL_MASK(n) /* n=0,1,..,15 */
-
-#define PINCONN_PINSEL0_P0p0_SHIFT (0) /* Bits 0-1: P0.0 00=GPIO 01=RD1 10=TXD3 11=SDA1 */
-#define PINCONN_PINSEL0_P0p0_MASK (3 << PINCONN_PINSEL0_P0p0_SHIFT)
-#define PINCONN_PINSEL0_P0p1_SHIFT (2) /* Bits 2-3: P0.1 00=GPIO 01=TD1 10=RXD3 11=SCL1 */
-#define PINCONN_PINSEL0_P0p1_MASK (3 << PINCONN_PINSEL0_P0p1_SHIFT)
-#define PINCONN_PINSEL0_P0p2_SHIFT (4) /* Bits 4-5: P0.2 00=GPIO 01=TXD0 10=AD0.7 11=Reserved */
-#define PINCONN_PINSEL0_P0p2_MASK (3 << PINCONN_PINSEL0_P0p2_SHIFT)
-#define PINCONN_PINSEL0_P0p3_SHIFT (6) /* Bits 6-7: P0.3 00=GPIO 01=RXD0 10=AD0.6 11=Reserved */
-#define PINCONN_PINSEL0_P0p3_MASK (3 << PINCONN_PINSEL0_P0p3_SHIFT)
-#define PINCONN_PINSEL0_P0p4_SHIFT (8) /* Bits 8-9: P0.4 00=GPIO 01=I2SRX_CLK 10=RD2 11=CAP2.0 */
-#define PINCONN_PINSEL0_P0p4_MASK (3 << PINCONN_PINSEL0_P0p4_SHIFT)
-#define PINCONN_PINSEL0_P0p5_SHIFT (10) /* Bits 10-11: P0.5 00=GPIO 01=I2SRX_WS 10=TD2 11=CAP2.1 */
-#define PINCONN_PINSEL0_P0p5_MASK (3 << PINCONN_PINSEL0_P0p5_SHIFT)
-#define PINCONN_PINSEL0_P0p6_SHIFT (12) /* Bits 12-13: P0.6 00=GPIO 01=I2SRX_SDA 10=SSEL1 11=MAT2.0 */
-#define PINCONN_PINSEL0_P0p6_MASK (3 << PINCONN_PINSEL0_P0p6_SHIFT)
-#define PINCONN_PINSEL0_P0p7_SHIFT (14) /* Bits 14-15: P0.7 00=GPIO 01=I2STX_CLK 10=SCK1 11=MAT2.1 */
-#define PINCONN_PINSEL0_P0p7_MASK (3 << PINCONN_PINSEL0_P0p7_SHIFT)
-#define PINCONN_PINSEL0_P0p8_SHIFT (16) /* Bits 16-17: P0.8 00=GPIO 01=I2STX_WS 10=MISO1 11=MAT2.2 */
-#define PINCONN_PINSEL0_P0p8_MASK (3 << PINCONN_PINSEL0_P0p8_SHIFT)
-#define PINCONN_PINSEL0_P0p9_SHIFT (18) /* Bits 18-19: P0.9 00=GPIO 01=I2STX_SDA 10=MOSI1 11=MAT2.3 */
-#define PINCONN_PINSEL0_P0p9_MASK (3 << PINCONN_PINSEL0_P0p9_SHIFT)
-#define PINCONN_PINSEL0_P0p10_SHIFT (20) /* Bits 20-21: P0.10 00=GPIO 01=TXD2 10=SDA2 11=MAT3.0 */
-#define PINCONN_PINSEL0_P0p10_MASK (3 << PINCONN_PINSEL0_P0p10_SHIFT)
-#define PINCONN_PINSEL0_P0p11_SHIFT (22) /* Bits 22-23: P0.11 00=GPIO 01=RXD2 10=SCL2 11=MAT3.1 */
-#define PINCONN_PINSEL0_P0p11_MASK (3 << PINCONN_PINSEL0_P0p11_SHIFT)
- /* Bits 24-29: Reserved */
-#define PINCONN_PINSEL0_P0p15_SHIFT (30) /* Bits 30-31: P0.15 00=GPIO 01=TXD1 10=SCK0 11=SCK */
-#define PINCONN_PINSEL0_P0p15_MASK (3 << PINCONN_PINSEL0_P0p15_SHIFT)
-
-/* Pin Function Select Register 1 (PINSEL1: 0x4002c004) */
-
-#define PINCONN_PINSEL1_P0_SHIFT(n) PINCONN_PINSELH_SHIFT(n) /* n=16,17,..31 */
-#define PINCONN_PINSEL1_P0_MASK(n) PINCONN_PINSELH_MASK(n) /* n=16,17,..31 */
-
-#define PINCONN_PINSEL1_P0p16_SHIFT (0) /* Bits 0-1: P0.16 00=GPIO 01=RXD1 10=SSEL0 11=SSEL */
-#define PINCONN_PINSEL1_P0p16_MASK (3 << PINCONN_PINSEL1_P0p16_SHIFT)
-#define PINCONN_PINSEL1_P0p17_SHIFT (2) /* Bits 2-3: P0.17 00=GPIO 01=CTS1 10=MISO0 11=MISO */
-#define PINCONN_PINSEL1_P0p17_MASK (3 << PINCONN_PINSEL1_P0p17_SHIFT)
-#define PINCONN_PINSEL1_P0p18_SHIFT (4) /* Bits 4-5: P0.18 00=GPIO 01=DCD1 10=MOSI0 11=MOSI */
-#define PINCONN_PINSEL1_P0p18_MASK (3 << PINCONN_PINSEL1_P0p18_SHIFT)
-#define PINCONN_PINSEL1_P0p19_SHIFT (6) /* Bits 6-7: P0.19 00=GPIO 01=DSR1 10=Reserved 11=SDA1 */
-#define PINCONN_PINSEL1_P0p19_MASK (3 << PINCONN_PINSEL1_P0p19_SHIFT)
-#define PINCONN_PINSEL1_P0p20_SHIFT (8) /* Bits 8-9: P0.20 00=GPIO 01=DTR1 10=Reserved 11=SCL1 */
-#define PINCONN_PINSEL1_P0p20_MASK (3 << PINCONN_PINSEL1_P0p20_SHIFT)
-#define PINCONN_PINSEL1_P0p21_SHIFT (10) /* Bits 10-11: P0.21 00=GPIO 01=RI1 10=Reserved 11=RD1 */
-#define PINCONN_PINSEL1_P0p21_MASK (3 << PINCONN_PINSEL1_P0p21_SHIFT)
-#define PINCONN_PINSEL1_P0p22_SHIFT (12) /* Bits 12-13: P0.22 00=GPIO 01=RTS1 10=Reserved 11=TD1 */
-#define PINCONN_PINSEL1_P0p22_MASK (3 << PINCONN_PINSEL1_P0p22_SHIFT)
-#define PINCONN_PINSEL1_P0p23_SHIFT (14) /* Bits 14-15: P0.23 00=GPIO 01=AD0.0 10=I2SRX_CLK 11=CAP3.0 */
-#define PINCONN_PINSEL1_P0p23_MASK (3 << PINCONN_PINSEL1_P0p23_SHIFT)
-#define PINCONN_PINSEL1_P0p24_SHIFT (16) /* Bits 16-17: P0.24 00=GPIO 01=AD0.1 10=I2SRX_WS 11=CAP3.1 */
-#define PINCONN_PINSEL1_P0p24_MASK (3 << PINCONN_PINSEL1_P0p24_SHIFT)
-#define PINCONN_PINSEL1_P0p25_SHIFT (18) /* Bits 18-19: P0.25 00=GPIO 01=AD0.2 10=I2SRX_SDA 11=TXD3 */
-#define PINCONN_PINSEL1_P0p25_MASK (3 << PINCONN_PINSEL1_P0p25_SHIFT)
-#define PINCONN_PINSEL1_P0p26_SHIFT (20) /* Bits 20-21: P0.26 00=GPIO 01=AD0.3 10=AOUT 11=RXD3 */
-#define PINCONN_PINSEL1_P0p26_MASK (3 << PINCONN_PINSEL1_P0p26_SHIFT)
-#define PINCONN_PINSEL1_P0p27_SHIFT (22) /* Bits 22-23: P0.27 00=GPIO 01=SDA0 10=USB_SDA 11=Reserved */
-#define PINCONN_PINSEL1_P0p27_MASK (3 << PINCONN_PINSEL1_P0p27_SHIFT)
-#define PINCONN_PINSEL1_P0p28_SHIFT (24) /* Bits 24-25: P0.28 00=GPIO 01=SCL0 10=USB_SCL 11=Reserved */
-#define PINCONN_PINSEL1_P0p28_MASK (3 << PINCONN_PINSEL1_P0p28_SHIFT)
-#define PINCONN_PINSEL1_P0p29_SHIFT (26) /* Bits 26-27: P0.29 00=GPIO 01=USB_D+ 10=Reserved 11=Reserved */
-#define PINCONN_PINSEL1_P0p29_MASK (3 << PINCONN_PINSEL1_P0p29_SHIFT)
-#define PINCONN_PINSEL1_P0p30_SHIFT (28) /* Bits 28-29: P0.30 00=GPIO 01=USB_D- 10=Reserved 11=Reserved */
-#define PINCONN_PINSEL1_P0p30_MASK (3 << PINCONN_PINSEL1_P0p30_SHIFT)
- /* Bits 30-31: Reserved */
-/* Pin Function Select register 2 (PINSEL2: 0x4002c008) */
-
-#define PINCONN_PINSEL2_P1_SHIFT(n) PINCONN_PINSELL_SHIFT(n) /* n=0,1,..,15 */
-#define PINCONN_PINSEL2_P1_MASK(n) PINCONN_PINSELL_MASK(n) /* n=0,1,..,15 */
-
-#define PINCONN_PINSEL2_P1p0_SHIFT (0) /* Bits 0-1: P1.0 00=GPIO 01=ENET_TXD0 10=Reserved 11=Reserved */
-#define PINCONN_PINSEL2_P1p0_MASK (3 << PINCONN_PINSEL2_P1p0_SHIFT)
-#define PINCONN_PINSEL2_P1p1_SHIFT (2) /* Bits 2-3: P1.1 00=GPIO 01=ENET_TXD1 10=Reserved 11=Reserved */
-#define PINCONN_PINSEL2_P1p1_MASK (3 << PINCONN_PINSEL2_P1p1_SHIFT)
- /* Bits 4-7: Reserved */
-#define PINCONN_PINSEL2_P1p4_SHIFT (8) /* Bits 8-9: P1.4 00=GPIO 01=ENET_TX_EN 10=Reserved 11=Reserved */
-#define PINCONN_PINSEL2_P1p4_MASK (3 << PINCONN_PINSEL2_P1p4_SHIFT)
- /* Bits 10-15: Reserved */
-#define PINCONN_PINSEL2_P1p8_SHIFT (16) /* Bits 16-17: P1.8 00=GPIO 01=ENET_CRS 10=Reserved 11=Reserved */
-#define PINCONN_PINSEL2_P1p8_MASK (3 << PINCONN_PINSEL2_P1p8_SHIFT)
-#define PINCONN_PINSEL2_P1p9_SHIFT (18) /* Bits 18-19: P1.9 00=GPIO 01=ENET_RXD0 10=Reserved 11=Reserved */
-#define PINCONN_PINSEL2_P1p9_MASK (3 << PINCONN_PINSEL2_P1p9_SHIFT)
-#define PINCONN_PINSEL2_P1p10_SHIFT (20) /* Bits 20-21: P1.10 00=GPIO 01=ENET_RXD1 10=Reserved 11=Reserved */
-#define PINCONN_PINSEL2_P1p10_MASK (3 << PINCONN_PINSEL2_P1p10_SHIFT)
- /* Bits 22-27: Reserved */
-#define PINCONN_PINSEL2_P1p14_SHIFT (28) /* Bits 28-29: P1.14 00=GPIO 01=ENET_RX_ER 10=Reserved 11=Reserved */
-#define PINCONN_PINSEL2_P1p14_MASK (3 << PINCONN_PINSEL2_P1p14_SHIFT)
-#define PINCONN_PINSEL2_P1p15_SHIFT (30) /* Bits 30-31: P1.15 00=GPIO 01=ENET_REF_CLK 10=Reserved 11=Reserved */
-#define PINCONN_PINSEL2_P1p15_MASK (3 << PINCONN_PINSEL2_P1p15_SHIFT)
-
-/* Pin Function Select Register 3 (PINSEL3: 0x4002c00c) */
-
-#define PINCONN_PINSEL3_P1_SHIFT(n) PINCONN_PINSELH_SHIFT(n) /* n=16,17,..31 */
-#define PINCONN_PINSEL3_P1_MASK(n) PINCONN_PINSELH_MASK(n) /* n=16,17,..31 */
-
-#define PINCONN_PINSEL3_P1p16_SHIFT (0) /* Bits 0-1: P1.16 00=GPIO 01=ENET_MDC 10=Reserved 11=Reserved */
-#define PINCONN_PINSEL3_P1p16_MASK (3 << PINCONN_PINSEL3_P1p16_SHIFT)
-#define PINCONN_PINSEL3_P1p17_SHIFT (2) /* Bits 2-3: P1.17 00=GPIO 01=ENET_MDIO 10=Reserved 11=Reserved */
-#define PINCONN_PINSEL3_P1p17_MASK (3 << PINCONN_PINSEL3_P1p17_SHIFT)
-#define PINCONN_PINSEL3_P1p18_SHIFT (4) /* Bits 4-5: P1.18 00=GPIO 01=USB_UP_LED 10=PWM1.1 11=CAP1.0 */
-#define PINCONN_PINSEL3_P1p18_MASK (3 << PINCONN_PINSEL3_P1p18_SHIFT)
-#define PINCONN_PINSEL3_P1p19_SHIFT (6) /* Bits 6-7: P1.19 00=GPIO 01=MCOA0 10=USB_PPWR 11=CAP1.1 */
-#define PINCONN_PINSEL3_P1p19_MASK (3 << PINCONN_PINSEL3_P1p19_SHIFT)
-#define PINCONN_PINSEL3_P1p20_SHIFT (8) /* Bits 8-9: P1.20 00=GPIO 01=MCI0 10=PWM1.2 11=SCK0 */
-#define PINCONN_PINSEL3_P1p20_MASK (3 << PINCONN_PINSEL3_P1p20_SHIFT)
-#define PINCONN_PINSEL3_P1p21_SHIFT (10) /* Bits 10-11: P1.21 00=GPIO 01=MCABORT 10=PWM1.3 11=SSEL0 */
-#define PINCONN_PINSEL3_P1p21_MASK (3 << PINCONN_PINSEL3_P1p21_SHIFT)
-#define PINCONN_PINSEL3_P1p22_SHIFT (12) /* Bits 12-13: P1.22 00=GPIO 01=MCOB0 10=USB_PWRD 11=MAT1.0 */
-#define PINCONN_PINSEL3_P1p22_MASK (3 << PINCONN_PINSEL3_P1p22_SHIFT)
-#define PINCONN_PINSEL3_P1p23_SHIFT (14) /* Bits 14-15: P1.23 00=GPIO 01=MCI1 10=PWM1.4 11=MISO0 */
-#define PINCONN_PINSEL3_P1p23_MASK (3 << PINCONN_PINSEL3_P1p23_SHIFT)
-#define PINCONN_PINSEL3_P1p24_SHIFT (16) /* Bits 16-17: P1.24 00=GPIO 01=MCI2 10=PWM1.5 11=MOSI0 */
-#define PINCONN_PINSEL3_P1p24_MASK (3 << PINCONN_PINSEL3_P1p24_SHIFT)
-#define PINCONN_PINSEL3_P1p25_SHIFT (18) /* Bits 18-19: P1.25 00=GPIO 01=MCOA1 10=Reserved 11=MAT1.1 */
-#define PINCONN_PINSEL3_P1p25_MASK (3 << PINCONN_PINSEL3_P1p25_SHIFT)
-#define PINCONN_PINSEL3_P1p26_SHIFT (20) /* Bits 20-21: P1.26 00=GPIO 01=MCOB1 10=PWM1.6 11=CAP0.0 */
-#define PINCONN_PINSEL3_P1p26_MASK (3 << PINCONN_PINSEL3_P1p26_SHIFT)
-#define PINCONN_PINSEL3_P1p27_SHIFT (22) /* Bits 22-23: P1.27 00=GPIO 01=CLKOUT 10=USB_OVRCR 11=CAP0.1 */
-#define PINCONN_PINSEL3_P1p27_MASK (3 << PINCONN_PINSEL3_P1p27_SHIFT)
-#define PINCONN_PINSEL3_P1p28_SHIFT (24) /* Bits 24-25: P1.28 00=GPIO 01=MCOA2 10=PCAP1.0 11=MAT0.0 */
-#define PINCONN_PINSEL3_P1p28_MASK (3 << PINCONN_PINSEL3_P1p28_SHIFT)
-#define PINCONN_PINSEL3_P1p29_SHIFT (26) /* Bits 26-27: P1.29 00=GPIO 01=MCOB2 10=PCAP1.1 11=MAT0.1 */
-#define PINCONN_PINSEL3_P1p29_MASK (3 << PINCONN_PINSEL3_P1p29_SHIFT)
-#define PINCONN_PINSEL3_P1p30_SHIFT (28) /* Bits 28-29: P1.30 00=GPIO 01=Reserved 10=VBUS 11=AD0.4 */
-#define PINCONN_PINSEL3_P1p30_MASK (3 << PINCONN_PINSEL3_P1p30_SHIFT)
-#define PINCONN_PINSEL3_P1p31_SHIFT (30) /* Bits 30-31: P1.31 00=GPIO 01=Reserved 10=SCK1 11=AD0.5 */
-#define PINCONN_PINSEL3_P1p31_MASK (3 << PINCONN_PINSEL3_P1p31_SHIFT)
-
-/* Pin Function Select Register 4 (PINSEL4: 0x4002c010) */
-
-#define PINCONN_PINSEL4_P2_SHIFT(n) PINCONN_PINSELL_SHIFT(n) /* n=0,1,..,15 */
-#define PINCONN_PINSEL4_P2_MASK(n) PINCONN_PINSELL_MASK(n) /* n=0,1,..,15 */
-
-#define PINCONN_PINSEL4_P2p0_SHIFT (0) /* Bits 0-1: P2.0 00=GPIO 01=PWM1.1 10=TXD1 11=Reserved */
-#define PINCONN_PINSEL4_P2p0_MASK (3 << PINCONN_PINSEL4_P2p0_SHIFT)
-#define PINCONN_PINSEL4_P2p1_SHIFT (2) /* Bits 2-3: P2.1 00=GPIO 01=PWM1.2 10=RXD1 11=Reserved */
-#define PINCONN_PINSEL4_P2p1_MASK (3 << PINCONN_PINSEL4_P2p1_SHIFT)
-#define PINCONN_PINSEL4_P2p2_SHIFT (4) /* Bits 4-5: P2.2 00=GPIO 01=PWM1.3 10=CTS1 11=Reserved */
-#define PINCONN_PINSEL4_P2p2_MASK (3 << PINCONN_PINSEL4_P2p2_SHIFT)
-#define PINCONN_PINSEL4_P2p3_SHIFT (6) /* Bits 6-7: P2.3 00=GPIO 01=PWM1.4 10=DCD1 11=Reserved */
-#define PINCONN_PINSEL4_P2p3_MASK (3 << PINCONN_PINSEL4_P2p3_SHIFT)
-#define PINCONN_PINSEL4_P2p4_SHIFT (8) /* Bits 8-9: P2.4 00=GPIO 01=PWM1.5 10=DSR1 11=Reserved */
-#define PINCONN_PINSEL4_P2p4_MASK (3 << PINCONN_PINSEL4_P2p4_SHIFT)
-#define PINCONN_PINSEL4_P2p5_SHIFT (10) /* Bits 10-11: P2.5 00=GPIO 01=PWM1.6 10=DTR1 11=Reserved */
-#define PINCONN_PINSEL4_P2p5_MASK (3 << PINCONN_PINSEL4_P2p5_SHIFT)
-#define PINCONN_PINSEL4_P2p6_SHIFT (12) /* Bits 12-13: P2.6 00=GPIO 01=PCAP1.0 10=RI1 11=Reserved */
-#define PINCONN_PINSEL4_P2p6_MASK (3 << PINCONN_PINSEL4_P2p6_SHIFT)
-#define PINCONN_PINSEL4_P2p7_SHIFT (14) /* Bits 14-15: P2.7 00=GPIO 01=RD2 10=RTS1 11=Reserved */
-#define PINCONN_PINSEL4_P2p7_MASK (3 << PINCONN_PINSEL4_P2p7_SHIFT)
-#define PINCONN_PINSEL4_P2p8_SHIFT (16) /* Bits 16-17: P2.8 00=GPIO 01=TD2 10=TXD2 11=ENET_MDC */
-#define PINCONN_PINSEL4_P2p8_MASK (3 << PINCONN_PINSEL4_P2p8_SHIFT)
-#define PINCONN_PINSEL4_P2p9_SHIFT (18) /* Bits 18-19: P2.9 00=GPIO 01=USB_CONNECT 10=RXD2 11=ENET_MDIO */
-#define PINCONN_PINSEL4_P2p9_MASK (3 << PINCONN_PINSEL4_P2p9_SHIFT)
-#define PINCONN_PINSEL4_P2p10_SHIFT (20) /* Bits 20-21: P2.10 00=GPIO 01=EINT0 10=NMI 11=Reserved */
-#define PINCONN_PINSEL4_P2p10_MASK (3 << PINCONN_PINSEL4_P2p10_SHIFT)
-#define PINCONN_PINSEL4_P2p11_SHIFT (22) /* Bits 22-23: P2.11 00=GPIO 01=EINT1 10=Reserved 11=I2STX_CLK */
-#define PINCONN_PINSEL4_P2p11_MASK (3 << PINCONN_PINSEL4_P2p11_SHIFT)
-#define PINCONN_PINSEL4_P2p12_SHIFT (24) /* Bits 24-25: P2.12 00=GPIO 01=PEINT2 10=Reserved 11=I2STX_WS */
-#define PINCONN_PINSEL4_P2p12_MASK (3 << PINCONN_PINSEL4_P2p12_SHIFT)
-#define PINCONN_PINSEL4_P2p13_SHIFT (26) /* Bits 26-27: P2.13 00=GPIO 01=EINT3 10=Reserved 11=I2STX_SDA */
-#define PINCONN_PINSEL4_P2p13_MASK (3 << PINCONN_PINSEL4_P2p13_SHIFT)
- /* Bits 28-31: Reserved */
-/* Pin Function Select Register 7 (PINSEL7: 0x4002c01c) */
-
-#define PINCONN_PINSEL7_P3_SHIFT(n) PINCONN_PINSELH_SHIFT(n) /* n=16,17,..31 */
-#define PINCONN_PINSEL7_P3_MASK(n) PINCONN_PINSELH_MASK(n) /* n=16,17,..31 */
-
- /* Bits 0-17: Reserved */
-#define PINCONN_PINSEL7_P3p25_SHIFT (18) /* Bits 18-19: P3.25 00=GPIO 01=Reserved 10=MAT0.0 11=PWM1.2 */
-#define PINCONN_PINSEL7_P3p25_MASK (3 << PINCONN_PINSEL7_P3p25_SHIFT)
-#define PINCONN_PINSEL7_P3p26_SHIFT (20) /* Bits 20-21: P3.26 00=GPIO 01=STCLK 10=MAT0.1 11=PWM1.3 */
-#define PINCONN_PINSEL7_P3p26_MASK (3 << PINCONN_PINSEL7_P3p26_SHIFT)
- /* Bits 22-31: Reserved */
-
-/* Pin Function Select Register 8 (PINSEL8: 0x4002c020) */
-/* No description of bits -- Does this register exist? */
-
-/* Pin Function Select Register 9 (PINSEL9: 0x4002c024) */
-
-#define PINCONN_PINSEL9_P4_SHIFT(n) PINCONN_PINSELH_SHIFT(n) /* n=16,17,..31 */
-#define PINCONN_PINSEL9_P4_MASK(n) PINCONN_PINSELH_MASK(n) /* n=16,17,..31 */
-
- /* Bits 0-23: Reserved */
-#define PINCONN_PINSEL9_P4p28_SHIFT (24) /* Bits 24-25: P4.28 00=GPIO 01=RX_MCLK 10=MAT2.0 11=TXD3 */
-#define PINCONN_PINSEL9_P4p28_MASK (3 << PINCONN_PINSEL9_P4p28_SHIFT)
-#define PINCONN_PINSEL9_P4p29_SHIFT (26) /* Bits 26-27: P4.29 00=GPIO 01=TX_MCLK 10=MAT2.1 11=RXD3 */
-#define PINCONN_PINSEL9_P4p29_MASK (3 << PINCONN_PINSEL9_P4p29_SHIFT)
- /* Bits 28-31: Reserved */
-/* Pin Function Select Register 10 (PINSEL10: 0x4002c028) */
- /* Bits 0-2: Reserved */
-#define PINCONN_PINSEL10_TPIU (1 << 3) /* Bit 3: 0=TPIU interface disabled; 1=TPIU interface enabled */
- /* Bits 4-31: Reserved */
-/* Pin Mode select register 0 (PINMODE0: 0x4002c040) */
-
-#define PINCONN_PINMODE_PU (0) /* 00: pin has a pull-up resistor enabled */
-#define PINCONN_PINMODE_RM (1) /* 01: pin has repeater mode enabled */
-#define PINCONN_PINMODE_FLOAT (2) /* 10: pin has neither pull-up nor pull-down */
-#define PINCONN_PINMODE_PD (3) /* 11: pin has a pull-down resistor enabled */
-#define PINCONN_PINMODE_MASK (3)
-
-#define PINCONN_PINMODEL_SHIFT(n) ((n) << 1) /* n=0,1,..,15 */
-#define PINCONN_PINMODEL_MASK(n) (3 << PINCONN_PINMODEL_SHIFT(n))
-#define PINCONN_PINMODEH_SHIFT(n) (((n)-16) << 1) /* n=16,17,..31 */
-#define PINCONN_PINMODEH_MASK(n) (3 << PINCONN_PINMODEH_SHIFT(n))
-
-#define PINCONN_PINMODE0_P0_SHIFT(n) PINCONN_PINMODEL_SHIFT(n) /* n=0,1,..,15 */
-#define PINCONN_PINMODE0_P0_MASK(n) PINCONN_PINMODEL_MASK(n) /* n=0,1,..,15 */
-
-#define PINCONN_PINMODE0_P0p0_SHIFT (0) /* Bits 0-1: P0.0 mode control */
-#define PINCONN_PINMODE0_P0p0_MASK (3 << PINCONN_PINMODE0_P0p0_SHIFT)
-#define PINCONN_PINMODE0_P0p1_SHIFT (2) /* Bits 2-3: P0.1 mode control */
-#define PINCONN_PINMODE0_P0p1_MASK (3 << PINCONN_PINMODE0_P0p1_SHIFT)
-#define PINCONN_PINMODE0_P0p2_SHIFT (4) /* Bits 4-5: P0.2 mode control */
-#define PINCONN_PINMODE0_P0p2_MASK (3 << PINCONN_PINMODE0_P0p2_SHIFT)
-#define PINCONN_PINMODE0_P0p3_SHIFT (6) /* Bits 6-7: P0.3 mode control */
-#define PINCONN_PINMODE0_P0p3_MASK (3 << PINCONN_PINMODE0_P0p3_SHIFT)
-#define PINCONN_PINMODE0_P0p4_SHIFT (8) /* Bits 8-9: P0.4 mode control */
-#define PINCONN_PINMODE0_P0p4_MASK (3 << PINCONN_PINMODE0_P0p4_SHIFT)
-#define PINCONN_PINMODE0_P0p5_SHIFT (10) /* Bits 10-11: P0.5 mode control */
-#define PINCONN_PINMODE0_P0p5_MASK (3 << PINCONN_PINMODE0_P0p5_SHIFT)
-#define PINCONN_PINMODE0_P0p6_SHIFT (12) /* Bits 12-13: P0.6 mode control */
-#define PINCONN_PINMODE0_P0p6_MASK (3 << PINCONN_PINMODE0_P0p6_SHIFT)
-#define PINCONN_PINMODE0_P0p7_SHIFT (14) /* Bits 14-15: P0.7 mode control */
-#define PINCONN_PINMODE0_P0p7_MASK (3 << PINCONN_PINMODE0_P0p7_SHIFT)
-#define PINCONN_PINMODE0_P0p8_SHIFT (16) /* Bits 16-17: P0.8 mode control */
-#define PINCONN_PINMODE0_P0p8_MASK (3 << PINCONN_PINMODE0_P0p8_SHIFT)
-#define PINCONN_PINMODE0_P0p9_SHIFT (18) /* Bits 18-19: P0.9 mode control */
-#define PINCONN_PINMODE0_P0p9_MASK (3 << PINCONN_PINMODE0_P0p9_SHIFT)
-#define PINCONN_PINMODE0_P0p10_SHIFT (20) /* Bits 20-21: P0.10 mode control */
-#define PINCONN_PINMODE0_P0p10_MASK (3 << PINCONN_PINMODE0_P0p10_SHIFT)
-#define PINCONN_PINMODE0_P0p11_SHIFT (22) /* Bits 22-23: P0.11 mode control */
-#define PINCONN_PINMODE0_P0p11_MASK (3 << PINCONN_PINMODE0_P0p11_SHIFT)
- /* Bits 24-29: Reserved */
-#define PINCONN_PINMODE0_P0p15_SHIFT (30) /* Bits 30-31: P0.15 mode control */
-#define PINCONN_PINMODE0_P0p15_MASK (3 << PINCONN_PINMODE0_P0p15_SHIFT)
-
-/* Pin Mode select register 1 (PINMODE1: 0x4002c044) */
-
-#define PINCONN_PINMODE1_P0_SHIFT(n) PINCONN_PINMODEH_SHIFT(n) /* n=16,17,..31 */
-#define PINCONN_PINMODE1_P0_MASK(n) PINCONN_PINMODEH_MASK(n) /* n=16,17,..31 */
-
-#define PINCONN_PINMODE1_P0p16_SHIFT (0) /* Bits 0-1: P0.16 mode control */
-#define PINCONN_PINMODE1_P0p16_MASK (3 << PINCONN_PINMODE1_P0p16_SHIFT)
-#define PINCONN_PINMODE1_P0p17_SHIFT (2) /* Bits 2-3: P0.17 mode control */
-#define PINCONN_PINMODE1_P0p17_MASK (3 << PINCONN_PINMODE1_P0p17_SHIFT)
-#define PINCONN_PINMODE1_P0p18_SHIFT (4) /* Bits 4-5: P0.18 mode control */
-#define PINCONN_PINMODE1_P0p18_MASK (3 << PINCONN_PINMODE1_P0p18_SHIFT)
-#define PINCONN_PINMODE1_P0p19_SHIFT (6) /* Bits 6-7: P0.19 mode control */
-#define PINCONN_PINMODE1_P0p19_MASK (3 << PINCONN_PINMODE1_P0p19_SHIFT)
-#define PINCONN_PINMODE1_P0p20_SHIFT (8) /* Bits 8-9: P0.20 mode control */
-#define PINCONN_PINMODE1_P0p20_MASK (3 << PINCONN_PINMODE1_P0p20_SHIFT)
-#define PINCONN_PINMODE1_P0p21_SHIFT (10) /* Bits 10-11: P0.21 mode control */
-#define PINCONN_PINMODE1_P0p21_MASK (3 << PINCONN_PINMODE1_P0p21_SHIFT)
-#define PINCONN_PINMODE1_P0p22_SHIFT (12) /* Bits 12-13: P0.22 mode control */
-#define PINCONN_PINMODE1_P0p22_MASK (3 << PINCONN_PINMODE1_P0p22_SHIFT)
-#define PINCONN_PINMODE1_P0p23_SHIFT (14) /* Bits 14-15: P0.23 mode control */
-#define PINCONN_PINMODE1_P0p23_MASK (3 << PINCONN_PINMODE1_P0p23_SHIFT)
-#define PINCONN_PINMODE1_P0p24_SHIFT (16) /* Bits 16-17: P0.24 mode control */
-#define PINCONN_PINMODE1_P0p24_MASK (3 << PINCONN_PINMODE1_P0p24_SHIFT)
-#define PINCONN_PINMODE1_P0p25_SHIFT (18) /* Bits 18-19: P0.25 mode control */
-#define PINCONN_PINMODE1_P0p25_MASK (3 << PINCONN_PINMODE1_P0p25_SHIFT)
-#define PINCONN_PINMODE1_P0p26_SHIFT (20) /* Bits 20-21: P0.26 mode control */
-#define PINCONN_PINMODE1_P0p26_MASK (3 << PINCONN_PINMODE1_P0p26_SHIFT)
- /* Bits 22-31: Reserved */
-
-/* Pin Mode select register 2 (PINMODE2: 0x4002c048) */
-
-#define PINCONN_PINMODE2_P1_SHIFT(n) PINCONN_PINMODEL_SHIFT(n) /* n=0,1,..,15 */
-#define PINCONN_PINMODE2_P1_MASK(n) PINCONN_PINMODEL_MASK(n) /* n=0,1,..,15 */
-
-#define PINCONN_PINMODE2_P1p0_SHIFT (0) /* Bits 2-1: P1.0 mode control */
-#define PINCONN_PINMODE2_P1p0_MASK (3 << PINCONN_PINMODE2_P1p0_SHIFT)
-#define PINCONN_PINMODE2_P1p1_SHIFT (2) /* Bits 2-3: P1.1 mode control */
-#define PINCONN_PINMODE2_P1p1_MASK (3 << PINCONN_PINMODE2_P1p1_SHIFT)
- /* Bits 4-7: Reserved */
-#define PINCONN_PINMODE2_P1p4_SHIFT (8) /* Bits 8-9: P1.4 mode control */
-#define PINCONN_PINMODE2_P1p4_MASK (3 << PINCONN_PINMODE2_P1p4_SHIFT)
- /* Bits 10-15: Reserved */
-#define PINCONN_PINMODE2_P1p8_SHIFT (16) /* Bits 16-17: P1.8 mode control */
-#define PINCONN_PINMODE2_P1p8_MASK (3 << PINCONN_PINMODE2_P1p8_SHIFT)
-#define PINCONN_PINMODE2_P1p9_SHIFT (18) /* Bits 18-19: P1.9 mode control */
-#define PINCONN_PINMODE2_P1p9_MASK (3 << PINCONN_PINMODE2_P1p9_SHIFT)
-#define PINCONN_PINMODE2_P1p10_SHIFT (20) /* Bits 20-21: P1.10 mode control */
-#define PINCONN_PINMODE2_P1p10_MASK (3 << PINCONN_PINMODE2_P1p10_SHIFT)
- /* Bits 22-27: Reserved */
-#define PINCONN_PINMODE2_P1p14_SHIFT (28) /* Bits 28-29: P1.14 mode control */
-#define PINCONN_PINMODE2_P1p14_MASK (3 << PINCONN_PINMODE2_P1p14_SHIFT)
-#define PINCONN_PINMODE2_P1p15_SHIFT (30) /* Bits 30-31: P1.15 mode control */
-#define PINCONN_PINMODE2_P1p15_MASK (3 << PINCONN_PINMODE2_P1p15_SHIFT)
-
-/* Pin Mode select register 3 (PINMODE3: 0x4002c04c) */
-
-#define PINCONN_PINMODE3_P1_SHIFT(n) PINCONN_PINMODEH_SHIFT(n) /* n=16,17,..31 */
-#define PINCONN_PINMODE3_P1_MASK(n) PINCONN_PINMODEH_MASK(n) /* n=16,17,..31 */
-
-#define PINCONN_PINMODE3_P1p16_SHIFT (0) /* Bits 0-1: P1.16 mode control */
-#define PINCONN_PINMODE3_P1p16_MASK (3 << PINCONN_PINMODE3_P1p16_SHIFT)
-#define PINCONN_PINMODE3_P1p17_SHIFT (2) /* Bits 2-3: P1.17 mode control */
-#define PINCONN_PINMODE3_P1p17_MASK (3 << PINCONN_PINMODE3_P1p17_SHIFT)
-#define PINCONN_PINMODE3_P1p18_SHIFT (4) /* Bits 4-5: P1.18 mode control */
-#define PINCONN_PINMODE3_P1p18_MASK (3 << PINCONN_PINMODE3_P1p18_SHIFT)
-#define PINCONN_PINMODE3_P1p19_SHIFT (6) /* Bits 6-7: P1.19 mode control */
-#define PINCONN_PINMODE3_P1p19_MASK (3 << PINCONN_PINMODE3_P1p19_SHIFT)
-#define PINCONN_PINMODE3_P1p20_SHIFT (8) /* Bits 8-9: P1.20 mode control */
-#define PINCONN_PINMODE3_P1p20_MASK (3 << PINCONN_PINMODE3_P1p20_SHIFT)
-#define PINCONN_PINMODE3_P1p21_SHIFT (10) /* Bits 10-11: P1.21 mode control */
-#define PINCONN_PINMODE3_P1p21_MASK (3 << PINCONN_PINMODE3_P1p21_SHIFT)
-#define PINCONN_PINMODE3_P1p22_SHIFT (12) /* Bits 12-13: P1.22 mode control */
-#define PINCONN_PINMODE3_P1p22_MASK (3 << PINCONN_PINMODE3_P1p22_SHIFT)
-#define PINCONN_PINMODE3_P1p23_SHIFT (14) /* Bits 14-15: P1.23 mode control */
-#define PINCONN_PINMODE3_P1p23_MASK (3 << PINCONN_PINMODE3_P1p23_SHIFT)
-#define PINCONN_PINMODE3_P1p24_SHIFT (16) /* Bits 16-17: P1.24 mode control */
-#define PINCONN_PINMODE3_P1p24_MASK (3 << PINCONN_PINMODE3_P1p24_SHIFT)
-#define PINCONN_PINMODE3_P1p25_SHIFT (18) /* Bits 18-19: P1.25 mode control */
-#define PINCONN_PINMODE3_P1p25_MASK (3 << PINCONN_PINMODE3_P1p25_SHIFT)
-#define PINCONN_PINMODE3_P1p26_SHIFT (20) /* Bits 20-21: P1.26 mode control */
-#define PINCONN_PINMODE3_P1p26_MASK (3 << PINCONN_PINMODE3_P1p26_SHIFT)
-#define PINCONN_PINMODE3_P1p27_SHIFT (22) /* Bits 22-23: P1.27 mode control */
-#define PINCONN_PINMODE3_P1p27_MASK (3 << PINCONN_PINMODE3_P1p27_SHIFT)
-#define PINCONN_PINMODE3_P1p28_SHIFT (24) /* Bits 24-25: P1.28 mode control */
-#define PINCONN_PINMODE3_P1p28_MASK (3 << PINCONN_PINMODE3_P1p28_SHIFT)
-#define PINCONN_PINMODE3_P1p29_SHIFT (26) /* Bits 26-27: P1.29 mode control */
-#define PINCONN_PINMODE3_P1p29_MASK (3 << PINCONN_PINMODE3_P1p29_SHIFT)
-#define PINCONN_PINMODE3_P1p30_SHIFT (28) /* Bits 28-29: P1.30 mode control */
-#define PINCONN_PINMODE3_P1p30_MASK (3 << PINCONN_PINMODE3_P1p30_SHIFT)
-#define PINCONN_PINMODE3_P1p31_SHIFT (30) /* Bits 30-31: P1.31 mode control */
-#define PINCONN_PINMODE3_P1p31_MASK (3 << PINCONN_PINMODE3_P1p31_SHIFT)
-
-/* Pin Mode select register 4 (PINMODE4: 0x4002c050) */
-
-#define PINCONN_PINMODE4_P2_SHIFT(n) PINCONN_PINMODEL_SHIFT(n) /* n=0,1,..,15 */
-#define PINCONN_PINMODE4_P2_MASK(n) PINCONN_PINMODEL_MASK(n) /* n=0,1,..,15 */
-
-#define PINCONN_PINMODE4_P2p0_SHIFT (0) /* Bits 0-1: P2.0 mode control */
-#define PINCONN_PINMODE4_P2p0_MASK (3 << PINCONN_PINMODE4_P2p0_SHIFT)
-#define PINCONN_PINMODE4_P2p1_SHIFT (2) /* Bits 2-3: P2.1 mode control */
-#define PINCONN_PINMODE4_P2p1_MASK (3 << PINCONN_PINMODE4_P2p1_SHIFT)
-#define PINCONN_PINMODE4_P2p2_SHIFT (4) /* Bits 4-5: P2.2 mode control */
-#define PINCONN_PINMODE4_P2p2_MASK (3 << PINCONN_PINMODE4_P2p2_SHIFT)
-#define PINCONN_PINMODE4_P2p3_SHIFT (6) /* Bits 6-7: P2.3 mode control */
-#define PINCONN_PINMODE4_P2p3_MASK (3 << PINCONN_PINMODE4_P2p3_SHIFT)
-#define PINCONN_PINMODE4_P2p4_SHIFT (8) /* Bits 8-9: P2.4 mode control */
-#define PINCONN_PINMODE4_P2p4_MASK (3 << PINCONN_PINMODE4_P2p4_SHIFT)
-#define PINCONN_PINMODE4_P2p5_SHIFT (10) /* Bits 10-11: P2.5 mode control */
-#define PINCONN_PINMODE4_P2p5_MASK (3 << PINCONN_PINMODE4_P2p5_SHIFT)
-#define PINCONN_PINMODE4_P2p6_SHIFT (12) /* Bits 12-13: P2.6 mode control */
-#define PINCONN_PINMODE4_P2p6_MASK (3 << PINCONN_PINMODE4_P2p6_SHIFT)
-#define PINCONN_PINMODE4_P2p7_SHIFT (14) /* Bits 14-15: P2.7 mode control */
-#define PINCONN_PINMODE4_P2p7_MASK (3 << PINCONN_PINMODE4_P2p7_SHIFT)
-#define PINCONN_PINMODE4_P2p8_SHIFT (16) /* Bits 16-17: P2.8 mode control */
-#define PINCONN_PINMODE4_P2p8_MASK (3 << PINCONN_PINMODE4_P2p8_SHIFT)
-#define PINCONN_PINMODE4_P2p9_SHIFT (18) /* Bits 18-19: P2.9 mode control */
-#define PINCONN_PINMODE4_P2p9_MASK (3 << PINCONN_PINMODE4_P2p9_SHIFT)
-#define PINCONN_PINMODE4_P2p10_SHIFT (20) /* Bits 20-21: P2.10 mode control */
-#define PINCONN_PINMODE4_P2p10_MASK (3 << PINCONN_PINMODE4_P2p10_SHIFT)
-#define PINCONN_PINMODE4_P2p11_SHIFT (22) /* Bits 22-23: P2.11 mode control */
-#define PINCONN_PINMODE4_P2p11_MASK (3 << PINCONN_PINMODE4_P2p11_SHIFT)
-#define PINCONN_PINMODE4_P2p12_SHIFT (24) /* Bits 24-25: P2.12 mode control */
-#define PINCONN_PINMODE4_P2p12_MASK (3 << PINCONN_PINMODE4_P2p12_SHIFT)
-#define PINCONN_PINMODE4_P2p13_SHIFT (26) /* Bits 26-27: P2.13 mode control */
-#define PINCONN_PINMODE4_P2p13_MASK (3 << PINCONN_PINMODE4_P2p13_SHIFT)
- /* Bits 28-31: Reserved */
-/* Pin Mode select register 5 (PINMODE5: 0x4002c054)
- * Pin Mode select register 6 (PINMODE6: 0x4002c058)
- * No bit definitions -- do these registers exist?
- */
-
-#define PINCONN_PINMODE5_P2_SHIFT(n) PINCONN_PINMODEH_SHIFT(n) /* n=16,17,..31 */
-#define PINCONN_PINMODE5_P2_MASK(n) PINCONN_PINMODEH_MASK(n) /* n=16,17,..31 */
-
-#define PINCONN_PINMODE6_P3_SHIFT(n) PINCONN_PINMODEL_SHIFT(n) /* n=0,1,..,15 */
-#define PINCONN_PINMODE6_P3_MASK(n) PINCONN_PINMODEL_MASK(n) /* n=0,1,..,15 */
-
-/* Pin Mode select register 7 (PINMODE7: 0x4002c05c) */
-
-#define PINCONN_PINMODE7_P3_SHIFT(n) PINCONN_PINMODEH_SHIFT(n) /* n=16,17,..31 */
-#define PINCONN_PINMODE7_P3_MASK(n) PINCONN_PINMODEH_MASK(n) /* n=16,17,..31 */
- /* Bits 0-17: Reserved */
-#define PINCONN_PINMODE7_P3p25_SHIFT (18) /* Bits 18-19: P3.25 mode control */
-#define PINCONN_PINMODE7_P3p25_MASK (3 << PINCONN_PINMODE7_P3p25_SHIFT)
-#define PINCONN_PINMODE7_P3p26_SHIFT (20) /* Bits 20-21: P3.26 mode control */
-#define PINCONN_PINMODE7_P3p26_MASK (3 << PINCONN_PINMODE7_P3p26_SHIFT)
- /* Bits 22-31: Reserved */
-/* Pin Mode select register 9 (PINMODE9: 0x4002c064) */
-
-#define PINCONN_PINMODE9_P4_SHIFT(n) PINCONN_PINMODEH_SHIFT(n) /* n=16,17,..31 */
-#define PINCONN_PINMODE9_P4_MASK(n) PINCONN_PINMODEH_MASK(n) /* n=16,17,..31 */
- /* Bits 0-23: Reserved */
-#define PINCONN_PINMODE9_P4p28_SHIFT (24) /* Bits 24-25: P4.28 mode control */
-#define PINCONN_PINMODE9_P4p28_MASK (3 << PINCONN_PINMODE9_P4p28_SHIFT)
-#define PINCONN_PINMODE9_P4p29_SHIFT (26) /* Bits 26-27: P4.29 mode control */
-#define PINCONN_PINMODE9_P4p29_MASK (3 << PINCONN_PINMODE9_P4p29_SHIFT)
- /* Bits 28-31: Reserved */
-/* Open Drain Pin Mode select register 0 (PINMODE_OD0: 0x4002c068) */
-
-#define PINCONN_ODMODE0_P0(n) (1 << (n))
-
-#define PINCONN_ODMODE0_P0p0 (1 << 0) /* Bit 0: P0.0 open drain mode */
-#define PINCONN_ODMODE0_P0p1 (1 << 1) /* Bit 1: P0.1 open drain mode */
-#define PINCONN_ODMODE0_P0p2 (1 << 2) /* Bit 2: P0.2 open drain mode */
-#define PINCONN_ODMODE0_P0p3 (1 << 3) /* Bit 3: P0.3 open drain mode */
-#define PINCONN_ODMODE0_P0p4 (1 << 4) /* Bit 4: P0.4 open drain mode */
-#define PINCONN_ODMODE0_P0p5 (1 << 5) /* Bit 5: P0.5 open drain mode */
-#define PINCONN_ODMODE0_P0p6 (1 << 6) /* Bit 6: P0.6 open drain mode */
-#define PINCONN_ODMODE0_P0p7 (1 << 7) /* Bit 7: P0.7 open drain mode */
-#define PINCONN_ODMODE0_P0p8 (1 << 8) /* Bit 8: P0.8 open drain mode */
-#define PINCONN_ODMODE0_P0p9 (1 << 9) /* Bit 9: P0.9 open drain mode */
-#define PINCONN_ODMODE0_P0p10 (1 << 10) /* Bit 10: P0.10 open drain mode */
-#define PINCONN_ODMODE0_P0p11 (1 << 11) /* Bit 11: P0.11 open drain mode */
- /* Bits 12-14: Reserved */
-#define PINCONN_ODMODE0_P0p15 (1 << 15) /* Bit 15: P0.15 open drain mode */
-#define PINCONN_ODMODE0_P0p16 (1 << 16) /* Bit 16: P0.16 open drain mode */
-#define PINCONN_ODMODE0_P0p17 (1 << 17) /* Bit 17: P0.17 open drain mode */
-#define PINCONN_ODMODE0_P0p18 (1 << 18) /* Bit 18: P0.18 open drain mode */
-#define PINCONN_ODMODE0_P0p19 (1 << 19) /* Bit 19: P0.19 open drain mode */
-#define PINCONN_ODMODE0_P0p20 (1 << 20) /* Bit 20: P0.20 open drain mode */
-#define PINCONN_ODMODE0_P0p21 (1 << 21) /* Bit 21: P0.21 open drain mode */
-#define PINCONN_ODMODE0_P0p22 (1 << 22) /* Bit 22: P0.22 open drain mode */
-#define PINCONN_ODMODE0_P0p23 (1 << 23) /* Bit 23: P0.23 open drain mode */
-#define PINCONN_ODMODE0_P0p24 (1 << 24) /* Bit 24: P0.24 open drain mode */
-#define PINCONN_ODMODE0_P0p25 (1 << 25) /* Bit 25: P0.25 open drain mode */
-#define PINCONN_ODMODE0_P0p26 (1 << 25) /* Bit 26: P0.26 open drain mode */
- /* Bits 27-28: Reserved */
-#define PINCONN_ODMODE0_P0p29 (1 << 29) /* Bit 29: P0.29 open drain mode */
-#define PINCONN_ODMODE0_P0p30 (1 << 30) /* Bit 30: P0.30 open drain mode */
- /* Bit 31: Reserved */
-/* Open Drain Pin Mode select register 1 (PINMODE_OD1: 0x4002c06c) */
-
-#define PINCONN_ODMODE1_P1(n) (1 << (n))
-
-#define PINCONN_ODMODE1_P1p0 (1 << 0) /* Bit 0: P1.0 open drain mode */
-#define PINCONN_ODMODE1_P1p1 (1 << 1) /* Bit 1: P1.1 open drain mode */
- /* Bits 2-3: Reserved */
-#define PINCONN_ODMODE1_P1p4 (1 << 4) /* Bit 4: P1.4 open drain mode */
- /* Bits 5-7: Reserved */
-#define PINCONN_ODMODE1_P1p8 (1 << 8) /* Bit 8: P1.8 open drain mode */
-#define PINCONN_ODMODE1_P1p9 (1 << 9) /* Bit 9: P1.9 open drain mode */
-#define PINCONN_ODMODE1_P1p10 (1 << 10) /* Bit 10: P1.10 open drain mode */
- /* Bits 11-13: Reserved */
-#define PINCONN_ODMODE1_P1p14 (1 << 14) /* Bit 14: P1.14 open drain mode */
-#define PINCONN_ODMODE1_P1p15 (1 << 15) /* Bit 15: P1.15 open drain mode */
-#define PINCONN_ODMODE1_P1p16 (1 << 16) /* Bit 16: P1.16 open drain mode */
-#define PINCONN_ODMODE1_P1p17 (1 << 17) /* Bit 17: P1.17 open drain mode */
-#define PINCONN_ODMODE1_P1p18 (1 << 18) /* Bit 18: P1.18 open drain mode */
-#define PINCONN_ODMODE1_P1p19 (1 << 19) /* Bit 19: P1.19 open drain mode */
-#define PINCONN_ODMODE1_P1p20 (1 << 20) /* Bit 20: P1.20 open drain mode */
-#define PINCONN_ODMODE1_P1p21 (1 << 21) /* Bit 21: P1.21 open drain mode */
-#define PINCONN_ODMODE1_P1p22 (1 << 22) /* Bit 22: P1.22 open drain mode */
-#define PINCONN_ODMODE1_P1p23 (1 << 23) /* Bit 23: P1.23 open drain mode */
-#define PINCONN_ODMODE1_P1p24 (1 << 24) /* Bit 24: P1.24 open drain mode */
-#define PINCONN_ODMODE1_P1p25 (1 << 25) /* Bit 25: P1.25 open drain mode */
-#define PINCONN_ODMODE1_P1p26 (1 << 25) /* Bit 26: P1.26 open drain mode */
-#define PINCONN_ODMODE1_P1p27 (1 << 27) /* Bit 27: P1.27 open drain mode */
-#define PINCONN_ODMODE1_P1p28 (1 << 28) /* Bit 28: P1.28 open drain mode */
-#define PINCONN_ODMODE1_P1p29 (1 << 29) /* Bit 29: P1.29 open drain mode */
-#define PINCONN_ODMODE1_P1p30 (1 << 30) /* Bit 30: P1.30 open drain mode */
-#define PINCONN_ODMODE1_P1p31 (1 << 31) /* Bit 31: P1.31 open drain mode */
-
-/* Open Drain Pin Mode select register 2 (PINMODE_OD2: 0x4002c070) */
-
-#define PINCONN_ODMODE2_P2(n) (1 << (n))
-
-#define PINCONN_ODMODE2_P2p0 (1 << 0) /* Bit 0: P2.0 open drain mode */
-#define PINCONN_ODMODE2_P2p1 (1 << 1) /* Bit 1: P2.1 open drain mode */
-#define PINCONN_ODMODE2_P2p2 (1 << 2) /* Bit 2: P2.2 open drain mode */
-#define PINCONN_ODMODE2_P2p3 (1 << 3) /* Bit 3: P2.3 open drain mode */
-#define PINCONN_ODMODE2_P2p4 (1 << 4) /* Bit 4: P2.4 open drain mode */
-#define PINCONN_ODMODE2_P2p5 (1 << 5) /* Bit 5: P2.5 open drain mode */
-#define PINCONN_ODMODE2_P2p6 (1 << 6) /* Bit 6: P2.6 open drain mode */
-#define PINCONN_ODMODE2_P2p7 (1 << 7) /* Bit 7: P2.7 open drain mode */
-#define PINCONN_ODMODE2_P2p8 (1 << 8) /* Bit 8: P2.8 open drain mode */
-#define PINCONN_ODMODE2_P2p9 (1 << 9) /* Bit 9: P2.9 open drain mode */
-#define PINCONN_ODMODE2_P2p10 (1 << 10) /* Bit 10: P2.10 open drain mode */
-#define PINCONN_ODMODE2_P2p11 (1 << 11) /* Bit 11: P2.11 open drain mode */
-#define PINCONN_ODMODE2_P2p12 (1 << 12) /* Bit 12: P2.12 open drain mode */
-#define PINCONN_ODMODE2_P2p13 (1 << 13) /* Bit 13: P2.13 open drain mode */
- /* Bits 14-31: Reserved */
-/* Open Drain Pin Mode select register 3 (PINMODE_OD3: 0x4002c074) */
-
-#define PINCONN_ODMODE3_P3(n) (1 << (n))
- /* Bits 0-24: Reserved */
-#define PINCONN_ODMODE3_P3p25 (1 << 25) /* Bit 25: P3.25 open drain mode */
-#define PINCONN_ODMODE3_P3p26 (1 << 25) /* Bit 26: P3.26 open drain mode */
- /* Bits 17-31: Reserved */
-/* Open Drain Pin Mode select register 4 (PINMODE_OD4: 0x4002c078) */
-
-#define PINCONN_ODMODE4_P4(n) (1 << (n))
- /* Bits 0-27: Reserved */
-#define PINCONN_ODMODE4_P4p28 (1 << 28) /* Bit 28: P4.28 open drain mode */
-#define PINCONN_ODMODE4_P4p29 (1 << 29) /* Bit 29: P4.29 open drain mode */
- /* Bits 30-31: Reserved */
-/* I2C Pin Configuration register (I2CPADCFG: 0x4002c07c) */
-
-#define PINCONN_I2CPADCFG_SDADRV0 (1 << 0) /* Bit 0: SDA0 pin, P0.27 in Fast Mode Plus */
-#define PINCONN_I2CPADCFG_SDAI2C0 (1 << 1) /* Bit 1: SDA0 pin, P0.27 I2C glitch
- * filtering/slew rate control */
-#define PINCONN_I2CPADCFG_SCLDRV0 (1 << 2) /* Bit 2: SCL0 pin, P0.28 in Fast Mode Plus */
-#define PINCONN_I2CPADCFG_SCLI2C0 (1 << 3) /* Bit 3: SCL0 pin, P0.28 I2C glitch
- * filtering/slew rate control */
- /* Bits 4-31: Reserved */
-
-/************************************************************************************
- * Public Types
- ************************************************************************************/
-
-/************************************************************************************
- * Public Data
- ************************************************************************************/
-
-/************************************************************************************
- * Public Functions
- ************************************************************************************/
-
-#endif /* __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC176X_PINCONN_H */
diff --git a/arch/arm/src/lpc17xx/hardware/lpc176x_syscon.h b/arch/arm/src/lpc17xx/hardware/lpc176x_syscon.h
deleted file mode 100644
index 96b75be806b..00000000000
--- a/arch/arm/src/lpc17xx/hardware/lpc176x_syscon.h
+++ /dev/null
@@ -1,494 +0,0 @@
-/************************************************************************************
- * arch/arm/src/lpc17xx/hardware/lpc176x_syscon.h
- *
- * Copyright (C) 2010, 2013 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. 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.
- * 3. Neither the name NuttX 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 THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- ************************************************************************************/
-
-#ifndef __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC176X_SYSCON_H
-#define __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC176X_SYSCON_H
-
-/************************************************************************************
- * Included Files
- ************************************************************************************/
-
-#include
-
-#include "chip.h"
-#include "hardware/lpc17_memorymap.h"
-
-/************************************************************************************
- * Pre-processor Definitions
- ************************************************************************************/
-
-/* Register offsets *****************************************************************/
-/* Flash accelerator module */
-
-#define LPC17_SYSCON_FLASHCFG_OFFSET 0x0000 /* Flash Accelerator Configuration Register */
-
-/* Memory Mapping Control register (MEMMAP - 0x400F C040) */
-
-#define LPC17_SYSCON_MEMMAP_OFFSET 0x0040 /* Memory Mapping Control register */
-
-/* Clocking and power control - Phase locked loops */
-
-#define LPC17_SYSCON_PLL0CON_OFFSET 0x0080 /* PLL0 Control Register */
-#define LPC17_SYSCON_PLL0CFG_OFFSET 0x0084 /* PLL0 Configuration Register */
-#define LPC17_SYSCON_PLL0STAT_OFFSET 0x0088 /* PLL0 Status Register */
-#define LPC17_SYSCON_PLL0FEED_OFFSET 0x008c /* PLL0 Feed Register */
-
-#define LPC17_SYSCON_PLL1CON_OFFSET 0x00a0 /* PLL1 Control Register */
-#define LPC17_SYSCON_PLL1CFG_OFFSET 0x00a4 /* PLL1 Configuration Register */
-#define LPC17_SYSCON_PLL1STAT_OFFSET 0x00a8 /* PLL1 Status Register */
-#define LPC17_SYSCON_PLL1FEED_OFFSET 0x00ac /* PLL1 Feed Register */
-
-/* Clocking and power control - Peripheral power control registers */
-
-#define LPC17_SYSCON_PCON_OFFSET 0x00c0 /* Power Control Register */
-#define LPC17_SYSCON_PCONP_OFFSET 0x00c4 /* Power Control for Peripherals Register */
-
-/* Clocking and power control -- Clock dividers */
-
-#define LPC17_SYSCON_CCLKCFG_OFFSET 0x0104 /* CPU Clock Configuration Register */
-#define LPC17_SYSCON_USBCLKCFG_OFFSET 0x0108 /* USB Clock Configuration Register */
-
-/* 0x400f c110 - 0x400f c114: CAN Wake and Sleep Registers */
-
-/* Clocking and power control -- Clock source selection */
-
-#define LPC17_SYSCON_CLKSRCSEL_OFFSET 0x010c /* Clock Source Select Register */
-
-/* System control registers -- External Interrupts */
-
-#define LPC17_SYSCON_EXTINT_OFFSET 0x0140 /* External Interrupt Flag Register */
-
-#define LPC17_SYSCON_EXTMODE_OFFSET 0x0148 /* External Interrupt Mode register */
-#define LPC17_SYSCON_EXTPOLAR_OFFSET 0x014c /* External Interrupt Polarity Register */
-
-/* System control registers -- Reset */
-
-#define LPC17_SYSCON_RSID_OFFSET 0x0180 /* Reset Source Identification Register */
-
-/* System control registers -- Syscon Miscellaneous Registers */
-
-#define LPC17_SYSCON_SCS_OFFSET 0x01a0 /* System Control and Status */
-
-/* More clocking and power control -- Clock dividers */
-
-#define LPC17_SYSCON_PCLKSEL0_OFFSET 0x01a8 /* Peripheral Clock Selection register 0 */
-#define LPC17_SYSCON_PCLKSEL1_OFFSET 0x01ac /* Peripheral Clock Selection register 1 */
-
-/* Device Interrupt Registers (Might be a error in the User Manual, might be at 0x5000c1c0) */
-
-#define LPC17_SYSCON_USBINTST_OFFSET 0x01c0 /* USB Interrupt Status */
-
-/* DMA Request Select Register */
-
-#define LPC17_SYSCON_DMAREQSEL_OFFSET 0x01c4 /* Selects between UART and timer DMA requests */
-
-/* More clocking and power control -- Utility */
-
-#define LPC17_SYSCON_CLKOUTCFG_OFFSET 0x01c8 /* Clock Output Configuration Register */
-
-/* Register addresses ***************************************************************/
-/* Flash accelerator module */
-
-#define LPC17_SYSCON_FLASHCFG (LPC17_SYSCON_BASE+LPC17_SYSCON_FLASHCFG_OFFSET)
-
-/* Memory Mapping Control register (MEMMAP - 0x400F C040) */
-
-#define LPC17_SYSCON_MEMMAP (LPC17_SYSCON_BASE+LPC17_SYSCON_MEMMAP_OFFSET)
-
-/* Clocking and power control - Phase locked loops */
-
-#define LPC17_SYSCON_PLL0CON (LPC17_SYSCON_BASE+LPC17_SYSCON_PLL0CON_OFFSET)
-#define LPC17_SYSCON_PLL0CFG (LPC17_SYSCON_BASE+LPC17_SYSCON_PLL0CFG_OFFSET)
-#define LPC17_SYSCON_PLL0STAT (LPC17_SYSCON_BASE+LPC17_SYSCON_PLL0STAT_OFFSET)
-#define LPC17_SYSCON_PLL0FEED (LPC17_SYSCON_BASE+LPC17_SYSCON_PLL0FEED_OFFSET)
-
-#define LPC17_SYSCON_PLL1CON (LPC17_SYSCON_BASE+LPC17_SYSCON_PLL1CON_OFFSET)
-#define LPC17_SYSCON_PLL1CFG (LPC17_SYSCON_BASE+LPC17_SYSCON_PLL1CFG_OFFSET)
-#define LPC17_SYSCON_PLL1STAT (LPC17_SYSCON_BASE+LPC17_SYSCON_PLL1STAT_OFFSET)
-#define LPC17_SYSCON_PLL1FEED (LPC17_SYSCON_BASE+LPC17_SYSCON_PLL1FEED_OFFSET)
-
-/* Clocking and power control - Peripheral power control registers */
-
-#define LPC17_SYSCON_PCON (LPC17_SYSCON_BASE+LPC17_SYSCON_PCON_OFFSET)
-#define LPC17_SYSCON_PCONP (LPC17_SYSCON_BASE+LPC17_SYSCON_PCONP_OFFSET)
-
-/* Clocking and power control -- Clock dividers */
-
-#define LPC17_SYSCON_CCLKCFG (LPC17_SYSCON_BASE+LPC17_SYSCON_CCLKCFG_OFFSET)
-#define LPC17_SYSCON_USBCLKCFG (LPC17_SYSCON_BASE+LPC17_SYSCON_USBCLKCFG_OFFSET)
-
-/* 0x400f c110 - 0x400f c114: CAN Wake and Sleep Registers */
-
-/* Clocking and power control -- Clock source selection */
-
-#define LPC17_SYSCON_CLKSRCSEL (LPC17_SYSCON_BASE+LPC17_SYSCON_CLKSRCSEL_OFFSET)
-
-/* System control registers -- External Interrupts */
-
-#define LPC17_SYSCON_EXTINT (LPC17_SYSCON_BASE+LPC17_SYSCON_EXTINT_OFFSET)
-
-#define LPC17_SYSCON_EXTMODE (LPC17_SYSCON_BASE+LPC17_SYSCON_EXTMODE_OFFSET)
-#define LPC17_SYSCON_EXTPOLAR (LPC17_SYSCON_BASE+LPC17_SYSCON_EXTPOLAR_OFFSET)
-
-/* System control registers -- Reset */
-
-#define LPC17_SYSCON_RSID (LPC17_SYSCON_BASE+LPC17_SYSCON_RSID_OFFSET)
-
-/* System control registers -- Syscon Miscellaneous Registers */
-
-#define LPC17_SYSCON_SCS (LPC17_SYSCON_BASE+LPC17_SYSCON_SCS_OFFSET)
-
-/* More clocking and power control -- Clock dividers */
-
-#define LPC17_SYSCON_PCLKSEL0 (LPC17_SYSCON_BASE+LPC17_SYSCON_PCLKSEL0_OFFSET)
-#define LPC17_SYSCON_PCLKSEL1 (LPC17_SYSCON_BASE+LPC17_SYSCON_PCLKSEL1_OFFSET)
-
-/* Device Interrupt Registers (Might be a error in the User Manual, might be at 0x5000c1c0) */
-
-#define LPC17_SYSCON_USBINTST (LPC17_SYSCON_BASE+LPC17_SYSCON_USBINTST_OFFSET)
-
-/* DMA Request Select Register */
-
-#define LPC17_SYSCON_DMAREQSEL (LPC17_SYSCON_BASE+LPC17_SYSCON_DMAREQSEL_OFFSET)
-
-/* More clocking and power control -- Utility */
-
-#define LPC17_SYSCON_CLKOUTCFG (LPC17_SYSCON_BASE+LPC17_SYSCON_CLKOUTCFG_OFFSET)
-
-/* Register bit definitions *********************************************************/
-/* Flash accelerator module */
- /* Bits 0-11: Reserved */
-#define SYSCON_FLASHCFG_TIM_SHIFT (12) /* Bits 12-15: FLASHTIM Flash access time */
-#define SYSCON_FLASHCFG_TIM_MASK (15 << SYSCON_FLASHCFG_TIM_SHIFT)
-# define SYSCON_FLASHCFG_TIM_1 (0 << SYSCON_FLASHCFG_TIM_SHIFT) /* 1 CPU clock <= 20 MHz CPU clock */
-# define SYSCON_FLASHCFG_TIM_2 (1 << SYSCON_FLASHCFG_TIM_SHIFT) /* 2 CPU clock <= 40 MHz CPU clock */
-# define SYSCON_FLASHCFG_TIM_3 (2 << SYSCON_FLASHCFG_TIM_SHIFT) /* 3 CPU clock <= 60 MHz CPU clock */
-# define SYSCON_FLASHCFG_TIM_4 (3 << SYSCON_FLASHCFG_TIM_SHIFT) /* 4 CPU clock <= 80 MHz CPU clock */
-# define SYSCON_FLASHCFG_TIM_5 (4 << SYSCON_FLASHCFG_TIM_SHIFT) /* 5 CPU clock <= 100 MHz CPU clock
- * (Up to 120 Mhz for LPC1759/69 only */
-# define SYSCON_FLASHCFG_TIM_6 (5 << SYSCON_FLASHCFG_TIM_SHIFT) /* "safe" setting for any conditions */
- /* Bits 16-31: Reserved */
-
-/* Memory Mapping Control register (MEMMAP - 0x400F C040) */
-
-#define SYSCON_MEMMAP_MAP (1 << 0) /* Bit 0:
- * 0:Boot mode. A portion of the Boot ROM is mapped to address 0.
- * 1:User mode. The on-chip Flash memory is mapped to address 0 */
- /* Bits 1-31: Reserved */
-
-/* Clocking and power control -- Clock source selection */
-
-#define SYSCON_CLKSRCSEL_SHIFT (0) /* Bits 0-1: Clock selection */
-#define SYSCON_CLKSRCSEL_MASK (3 << SYSCON_CLKSRCSEL_SHIFT)
-# define SYSCON_CLKSRCSEL_INTRC (0 << SYSCON_CLKSRCSEL_SHIFT) /* PLL0 source = internal RC oscillator */
-# define SYSCON_CLKSRCSEL_MAIN (1 << SYSCON_CLKSRCSEL_SHIFT) /* PLL0 source = main oscillator */
-# define SYSCON_CLKSRCSEL_RTC (2 << SYSCON_CLKSRCSEL_SHIFT) /* PLL0 source = RTC oscillator */
- /* Bits 2-31: Reserved */
-
-/* Clocking and power control - Phase locked loops */
-/* PLL0/1 Control register */
-
-#define SYSCON_PLLCON_PLLE (1 << 0) /* Bit 0: PLL0/1 Enable */
-#define SYSCON_PLLCON_PLLC (1 << 1) /* Bit 1: PLL0/1 Connect */
- /* Bits 2-31: Reserved */
-/* PLL0 Configuration register */
-
-#define SYSCON_PLL0CFG_MSEL_SHIFT (0) /* Bit 0-14: PLL0 Multiplier value */
-#define SYSCON_PLL0CFG_MSEL_MASK (0x7fff << SYSCON_PLL0CFG_MSEL_SHIFT)
- /* Bit 15: Reserved */
-#define SYSCON_PLL0CFG_NSEL_SHIFT (16) /* Bit 16-23: PLL0 Pre-Divider value */
-#define SYSCON_PLL0CFG_NSEL_MASK (0xff << SYSCON_PLL0CFG_NSEL_SHIFT)
- /* Bits 24-31: Reserved */
-/* PLL1 Configuration register */
-
-#define SYSCON_PLL1CFG_MSEL_SHIFT (0) /* Bit 0-4: PLL1 Multiplier value */
-#define SYSCON_PLL1CFG_MSEL_MASK (0x1f < SYSCON_PLL1CFG_MSEL_SHIFT)
-#define SYSCON_PLL1CFG_NSEL_SHIFT (5) /* Bit 5-6: PLL1 Pre-Divider value */
-#define SYSCON_PLL1CFG_NSEL_MASK (3 << SYSCON_PLL1CFG_NSEL_SHIFT)
- /* Bits 7-31: Reserved */
-/* PLL0 Status register */
-
-#define SYSCON_PLL0STAT_MSEL_SHIFT (0) /* Bit 0-14: PLL0 Multiplier value readback */
-#define SYSCON_PLL0STAT_MSEL_MASK (0x7fff << SYSCON_PLL0STAT_MSEL_SHIFT)
- /* Bit 15: Reserved */
-#define SYSCON_PLL0STAT_NSEL_SHIFT (16) /* Bit 16-23: PLL0 Pre-Divider value readback */
-#define SYSCON_PLL0STAT_NSEL_MASK (0xff << SYSCON_PLL0STAT_NSEL_SHIFT)
-#define SYSCON_PLL0STAT_PLLE (1 << 24) /* Bit 24: PLL0 enable readback */
-#define SYSCON_PLL0STAT_PLLC (1 << 25) /* Bit 25: PLL0 connect readback */
-#define SYSCON_PLL0STAT_PLOCK (1 << 26) /* Bit 26: PLL0 lock status */
- /* Bits 27-31: Reserved */
-/* PLL1 Status register */
-
-#define SYSCON_PLL1STAT_MSEL_SHIFT (0) /* Bit 0-4: PLL1 Multiplier value readback */
-#define SYSCON_PLL1STAT_MSEL_MASK (0x1f << SYSCON_PLL1STAT_MSEL_SHIFT)
-#define SYSCON_PLL1STAT_NSEL_SHIFT (5) /* Bit 5-6: PLL1 Pre-Divider value readback */
-#define SYSCON_PLL1STAT_NSEL_MASK (3 << SYSCON_PLL1STAT_NSEL_SHIFT)
- /* Bit 7: Reserved */
-#define SYSCON_PLL1STAT_PLLE (1 << 8) /* Bit 8: PLL1 enable readback */
-#define SYSCON_PLL1STAT_PLLC (1 << 9) /* Bit 9: PLL1 connect readback */
-#define SYSCON_PLL1STAT_PLOCK (1 << 10) /* Bit 10: PLL1 lock status */
- /* Bits 11-31: Reserved */
-/* PLL0/1 Feed register */
-
-#define SYSCON_PLLFEED_SHIFT (0) /* Bit 0-7: PLL0/1 feed sequence */
-#define SYSCON_PLLFEED_MASK (0xff << SYSCON_PLLFEED_SHIFT)
- /* Bits 8-31: Reserved */
-/* Clocking and power control -- Clock dividers */
-/* CPU Clock Configuration register */
-
-#define SYSCON_CCLKCFG_SHIFT (0) /* 0-7: Divide value for CPU clock (CCLK) */
-#define SYSCON_CCLKCFG_MASK (0xff << SYSCON_CCLKCFG_SHIFT)
-# define SYSCON_CCLKCFG_DIV(n) ((n-1) << SYSCON_CCLKCFG_SHIFT) /* n=2,3,..255 */
- /* Bits 8-31: Reserved */
-/* USB Clock Configuration register */
-
-#define SYSCON_USBCLKCFG_SHIFT (0) /* Bits 0-3: PLL0 divide value USB clock */
-#define SYSCON_USBCLKCFG_MASK (15 << SYSCON_USBCLKCFG_SHIFT)
-# define SYSCON_USBCLKCFG_DIV6 (5 << SYSCON_USBCLKCFG_SHIFT) /* PLL0/6 for PLL0=288 MHz */
-# define SYSCON_USBCLKCFG_DIV8 (7 << SYSCON_USBCLKCFG_SHIFT) /* PLL0/8 for PLL0=384 MHz */
-# define SYSCON_USBCLKCFG_DIV10 (9 << SYSCON_USBCLKCFG_SHIFT) /* PLL0/10 for PLL0=480 MHz */
- /* Bits 8-31: Reserved */
-/* Peripheral Clock Selection registers 0 and 1 */
-
-#define SYSCON_PCLKSEL_CCLK4 (0) /* PCLK_peripheral = CCLK/4 */
-#define SYSCON_PCLKSEL_CCLK (1) /* PCLK_peripheral = CCLK */
-#define SYSCON_PCLKSEL_CCLK2 (2) /* PCLK_peripheral = CCLK/2 */
-#define SYSCON_PCLKSEL_CCLK8 (3) /* PCLK_peripheral = CCLK/8 (except CAN1, CAN2, and CAN) */
-#define SYSCON_PCLKSEL_CCLK6 (3) /* PCLK_peripheral = CCLK/6 (CAN1, CAN2, and CAN) */
-#define SYSCON_PCLKSEL_MASK (3)
-
-#define SYSCON_PCLKSEL0_WDT_SHIFT (0) /* Bits 0-1: Peripheral clock WDT */
-#define SYSCON_PCLKSEL0_WDT_MASK (3 << SYSCON_PCLKSEL0_WDT_SHIFT)
-#define SYSCON_PCLKSEL0_TMR0_SHIFT (2) /* Bits 2-3: Peripheral clock TIMER0 */
-#define SYSCON_PCLKSEL0_TMR0_MASK (3 << SYSCON_PCLKSEL0_TMR0_SHIFT)
-#define SYSCON_PCLKSEL0_TMR1_SHIFT (4) /* Bits 4-5: Peripheral clock TIMER1 */
-#define SYSCON_PCLKSEL0_TMR1_MASK (3 << SYSCON_PCLKSEL0_TMR1_SHIFT)
-#define SYSCON_PCLKSEL0_UART0_SHIFT (6) /* Bits 6-7: Peripheral clock UART0 */
-#define SYSCON_PCLKSEL0_UART0_MASK (3 << SYSCON_PCLKSEL0_UART0_SHIFT)
-#define SYSCON_PCLKSEL0_UART1_SHIFT (8) /* Bits 8-9: Peripheral clock UART1 */
-#define SYSCON_PCLKSEL0_UART1_MASK (3 << SYSCON_PCLKSEL0_UART1_SHIFT)
- /* Bits 10-11: Reserved */
-#define SYSCON_PCLKSEL0_PWM1_SHIFT (12) /* Bits 12-13: Peripheral clock PWM1 */
-#define SYSCON_PCLKSEL0_PWM1_MASK (3 << SYSCON_PCLKSEL0_PWM1_SHIFT)
-#define SYSCON_PCLKSEL0_I2C0_SHIFT (14) /* Bits 14-15: Peripheral clock I2C0 */
-#define SYSCON_PCLKSEL0_I2C0_MASK (3 << SYSCON_PCLKSEL0_I2C0_SHIFT)
-#define SYSCON_PCLKSEL0_SPI_SHIFT (16) /* Bits 16-17: Peripheral clock SPI */
-#define SYSCON_PCLKSEL0_SPI_MASK (3 << SYSCON_PCLKSEL0_SPI_SHIFT)
- /* Bits 18-19: Reserved */
-#define SYSCON_PCLKSEL0_SSP1_SHIFT (20) /* Bits 20-21: Peripheral clock SSP1 */
-#define SYSCON_PCLKSEL0_SSP1_MASK (3 << SYSCON_PCLKSEL0_SSP1_SHIFT)
-#define SYSCON_PCLKSEL0_DAC_SHIFT (22) /* Bits 22-23: Peripheral clock DAC */
-#define SYSCON_PCLKSEL0_DAC_MASK (3 << SYSCON_PCLKSEL0_DAC_SHIFT)
-#define SYSCON_PCLKSEL0_ADC_SHIFT (24) /* Bits 24-25: Peripheral clock ADC */
-#define SYSCON_PCLKSEL0_ADC_MASK (3 << SYSCON_PCLKSEL0_ADC_SHIFT)
-#define SYSCON_PCLKSEL0_CAN1_SHIFT (26) /* Bits 26-27: Peripheral clock CAN1 */
-#define SYSCON_PCLKSEL0_CAN1_MASK (3 << SYSCON_PCLKSEL0_CAN1_SHIFT)
-#define SYSCON_PCLKSEL0_CAN2_SHIFT (28) /* Bits 28-29: Peripheral clock CAN2 */
-#define SYSCON_PCLKSEL0_CAN2_MASK (3 << SYSCON_PCLKSEL0_CAN2_SHIFT)
-#define SYSCON_PCLKSEL0_ACF_SHIFT (30) /* Bits 30-31: Peripheral clock CAN AF */
-#define SYSCON_PCLKSEL0_ACF_MASK (3 << SYSCON_PCLKSEL0_ACF_SHIFT)
-
-#define SYSCON_PCLKSEL1_QEI_SHIFT (0) /* Bits 0-1: Peripheral clock Quadrature Encoder */
-#define SYSCON_PCLKSEL1_QEI_MASK (3 << SYSCON_PCLKSEL1_QEI_SHIFT)
-#define SYSCON_PCLKSEL1_GPIOINT_SHIFT (2) /* Bits 2-3: Peripheral clock GPIO interrupts */
-#define SYSCON_PCLKSEL1_GPIOINT_MASK (3 << SYSCON_PCLKSEL1_GPIOINT_SHIFT)
-#define SYSCON_PCLKSEL1_PCB_SHIFT (4) /* Bits 4-5: Peripheral clock the Pin Connect block */
-#define SYSCON_PCLKSEL1_PCB_MASK (3 << SYSCON_PCLKSEL1_PCB_SHIFT)
-#define SYSCON_PCLKSEL1_I2C1_SHIFT (6) /* Bits 6-7: Peripheral clock I2C1 */
-#define SYSCON_PCLKSEL1_I2C1_MASK (3 << SYSCON_PCLKSEL1_I2C1_SHIFT)
- /* Bits 8-9: Reserved */
-#define SYSCON_PCLKSEL1_SSP0_SHIFT (10) /* Bits 10-11: Peripheral clock SSP0 */
-#define SYSCON_PCLKSEL1_SSP0_MASK (3 << SYSCON_PCLKSEL1_SSP0_SHIFT)
-#define SYSCON_PCLKSEL1_TMR2_SHIFT (12) /* Bits 12-13: Peripheral clock TIMER2 */
-#define SYSCON_PCLKSEL1_TMR2_MASK (3 << SYSCON_PCLKSEL1_TMR2_SHIFT)
-#define SYSCON_PCLKSEL1_TMR3_SHIFT (14) /* Bits 14-15: Peripheral clock TIMER3 */
-#define SYSCON_PCLKSEL1_TMR3_MASK (3 << SYSCON_PCLKSEL1_TMR3_SHIFT)
-#define SYSCON_PCLKSEL1_UART2_SHIFT (16) /* Bits 16-17: Peripheral clock UART2 */
-#define SYSCON_PCLKSEL1_UART2_MASK (3 << SYSCON_PCLKSEL1_UART2_SHIFT)
-#define SYSCON_PCLKSEL1_UART3_SHIFT (18) /* Bits 18-19: Peripheral clock UART3 */
-#define SYSCON_PCLKSEL1_UART3_MASK (3 << SYSCON_PCLKSEL1_UART3_SHIFT)
-#define SYSCON_PCLKSEL1_I2C2_SHIFT (20) /* Bits 20-21: Peripheral clock I2C2 */
-#define SYSCON_PCLKSEL1_I2C2_MASK (3 << SYSCON_PCLKSEL1_I2C2_SHIFT)
-#define SYSCON_PCLKSEL1_I2S_SHIFT (22) /* Bits 22-23: Peripheral clock I2S */
-#define SYSCON_PCLKSEL1_I2S_MASK (3 << SYSCON_PCLKSEL1_I2S_SHIFT)
- /* Bits 24-25: Reserved */
-#define SYSCON_PCLKSEL1_RIT_SHIFT (26) /* Bits 26-27: Peripheral clock Repetitive Interrupt Timer */
-#define SYSCON_PCLKSEL1_RIT_MASK (3 << SYSCON_PCLKSEL1_RIT_SHIFT)
-#define SYSCON_PCLKSEL1_SYSCON_SHIFT (28) /* Bits 28-29: Peripheral clock the System Control block */
-#define SYSCON_PCLKSEL1_SYSCON_MASK (3 << SYSCON_PCLKSEL1_SYSCON_SHIFT)
-#define SYSCON_PCLKSEL1_MC_SHIFT (30) /* Bits 30-31: Peripheral clock the Motor Control PWM */
-#define SYSCON_PCLKSEL1_MC_MASK (3 << SYSCON_PCLKSEL1_MC_SHIFT)
-
-/* Clocking and power control - Peripheral power control registers */
-/* Power Control Register */
-
-#define SYSCON_PCON_PM0 (1 << 0) /* Bit 0: Power mode control bit 0 */
-#define SYSCON_PCON_PM1 (1 << 1) /* Bit 1: Power mode control bit 1 */
-#define SYSCON_PCON_BODRPM (1 << 2) /* Bit 2: Brown-Out Reduced Power Mode */
-#define SYSCON_PCON_BOGD (1 << 3) /* Bit 3: Brown-Out Global Disable */
-#define SYSCON_PCON_BORD (1 << 4) /* Bit 4: Brown-Out Reset Disable */
- /* Bits 5-7: Reserved */
-#define SYSCON_PCON_SMFLAG (1 << 8) /* Bit 8: Sleep Mode entry flag */
-#define SYSCON_PCON_DSFLAG (1 << 9) /* Bit 9: Deep Sleep entry flag */
-#define SYSCON_PCON_PDFLAG (1 << 10) /* Bit 10: Power-down entry flag */
-#define SYSCON_PCON_DPDFLAG (1 << 11) /* Bit 11: Deep Power-down entry flag */
- /* Bits 12-31: Reserved */
-/* Power Control for Peripherals Register */
-
- /* Bit 0: Reserved */
-#define SYSCON_PCONP_PCTIM0 (1 << 1) /* Bit 1: Timer/Counter 0 power/clock control */
-#define SYSCON_PCONP_PCTIM1 (1 << 2) /* Bit 2: Timer/Counter 1 power/clock control */
-#define SYSCON_PCONP_PCUART0 (1 << 3) /* Bit 3: UART0 power/clock control */
-#define SYSCON_PCONP_PCUART1 (1 << 4) /* Bit 4: UART1 power/clock control */
- /* Bit 5: Reserved */
-#define SYSCON_PCONP_PCPWM1 (1 << 6) /* Bit 6: PWM1 power/clock control */
-#define SYSCON_PCONP_PCI2C0 (1 << 7) /* Bit 7: I2C0 power/clock control */
-#define SYSCON_PCONP_PCSPI (1 << 8) /* Bit 8: SPI power/clock control */
-#define SYSCON_PCONP_PCRTC (1 << 9) /* Bit 9: RTC power/clock control */
-#define SYSCON_PCONP_PCSSP1 (1 << 10) /* Bit 10: SSP 1 power/clock control */
- /* Bit 11: Reserved */
-#define SYSCON_PCONP_PCADC (1 << 12) /* Bit 12: A/D converter (ADC) power/clock control */
-#define SYSCON_PCONP_PCCAN1 (1 << 13) /* Bit 13: CAN Controller 1 power/clock control */
-#define SYSCON_PCONP_PCCAN2 (1 << 14) /* Bit 14: CAN Controller 2 power/clock control */
-#define SYSCON_PCONP_PCGPIO (1 << 15) /* Bit 15: GPIOs power/clock enable */
-#define SYSCON_PCONP_PCRIT (1 << 16) /* Bit 16: Repetitive Interrupt Timer power/clock control */
-#define SYSCON_PCONP_PCMCPWM (1 << 17) /* Bit 17: Motor Control PWM */
-#define SYSCON_PCONP_PCQEI (1 << 18) /* Bit 18: Quadrature Encoder power/clock control */
-#define SYSCON_PCONP_PCI2C1 (1 << 19) /* Bit 19: I2C1 power/clock control */
- /* Bit 20: Reserved */
-#define SYSCON_PCONP_PCSSP0 (1 << 21) /* Bit 21: SSP0 power/clock control */
-#define SYSCON_PCONP_PCTIM2 (1 << 22) /* Bit 22: Timer 2 power/clock control */
-#define SYSCON_PCONP_PCTIM3 (1 << 23) /* Bit 23: Timer 3 power/clock control */
-#define SYSCON_PCONP_PCUART2 (1 << 24) /* Bit 24: UART 2 power/clock control */
-#define SYSCON_PCONP_PCUART3 (1 << 25) /* Bit 25: UART 3 power/clock control */
-#define SYSCON_PCONP_PCI2C2 (1 << 26) /* Bit 26: I2C 2 power/clock control */
-#define SYSCON_PCONP_PCI2S (1 << 27) /* Bit 27: I2S power/clock control */
- /* Bit 28: Reserved */
-#define SYSCON_PCONP_PCGPDMA (1 << 29) /* Bit 29: GPDMA function power/clock control */
-#define SYSCON_PCONP_PCENET (1 << 30) /* Bit 30: Ethernet block power/clock control */
-#define SYSCON_PCONP_PCUSB (1 << 31) /* Bit 31: USB power/clock control */
-
-/* More clocking and power control -- Utility */
-
-#define SYSCON_CLKOUTCFG_SEL_SHIFT (0) /* Bits 0-3: Selects clock source for CLKOUT */
-#define SYSCON_CLKOUTCFG_SEL_MASK (15 << SYSCON_CLKOUTCFG_SEL_SHIFT)
-# define SYSCON_CLKOUTCFG_SEL_CPU (0 << SYSCON_CLKOUTCFG_SEL_SHIFT) /* CLKOUT source=CPU clock */
-# define SYSCON_CLKOUTCFG_SEL_MAIN (1 << SYSCON_CLKOUTCFG_SEL_SHIFT) /* CLKOUT source=main osc */
-# define SYSCON_CLKOUTCFG_SEL_INTRC (2 << SYSCON_CLKOUTCFG_SEL_SHIFT) /* CLKOUT source=internal RC osc */
-# define SYSCON_CLKOUTCFG_SEL_USB (3 << SYSCON_CLKOUTCFG_SEL_SHIFT) /* CLKOUT source=USB clock */
-# define SYSCON_CLKOUTCFG_SEL_RTC (4 << SYSCON_CLKOUTCFG_SEL_SHIFT) /* CLKOUT source=RTC osc */
-#define SYSCON_CLKOUTCFG_DIV_SHIFT (4) /* Bits 4-7: CLKOUT divisor */
-#define SYSCON_CLKOUTCFG_DIV_MASK (15 << SYSCON_CLKOUTCFG_DIV_SHIFT)
-# define SYSCON_CLKOUTCFG_DIV(n) ((n-1) << SYSCON_CLKOUTCFG_DIV_SHIFT) /* n=1..16 */
-#define SYSCON_CLKOUTCFG_EN (1 << 8) /* Bit 8: CLKOUT enable control */
-#define SYSCON_CLKOUTCFG_ACT (1 << 9) /* Bit 9: CLKOUT activity indication */
- /* Bits 10-31: Reserved */
-/* System control registers -- External Interrupts */
-/* External Interrupt Flag register */
-
-#define SYSCON_EXTINT_EINT0 (1 << 0) /* Bit 0: EINT0 */
-#define SYSCON_EXTINT_EINT1 (1 << 1) /* Bit 1: EINT1 */
-#define SYSCON_EXTINT_EINT2 (1 << 2) /* Bit 2: EINT2 */
-#define SYSCON_EXTINT_EINT3 (1 << 3) /* Bit 3: EINT3 */
- /* Bits 4-31: Reserved */
-/* External Interrupt Mode register */
-
-#define SYSCON_EXTMODE_EINT0 (1 << 0) /* Bit 0: 1=EINT0 edge sensitive */
-#define SYSCON_EXTMODE_EINT1 (1 << 1) /* Bit 1: 1=EINT1 edge sensitive */
-#define SYSCON_EXTMODE_EINT2 (1 << 2) /* Bit 2: 1=EINT2 edge sensitive */
-#define SYSCON_EXTMODE_EINT3 (1 << 3) /* Bit 3: 1=EINT3 edge sensitive */
- /* Bits 4-31: Reserved */
-/* External Interrupt Polarity register */
-
-#define SYSCON_EXTPOLAR_EINT0 (1 << 0) /* Bit 0: 1=EINT0 high active/rising edge */
-#define SYSCON_EXTPOLAR_EINT1 (1 << 1) /* Bit 1: 1=EINT1 high active/rising edge */
-#define SYSCON_EXTPOLAR_EINT2 (1 << 2) /* Bit 2: 1=EINT2 high active/rising edge */
-#define SYSCON_EXTPOLAR_EINT3 (1 << 3) /* Bit 3: 1=EINT3 high active/rising edge */
- /* Bits 4-31: Reserved */
-/* System control registers -- Reset */
-/* Reset Source Identification Register */
-
-#define SYSCON_RSID_POR (1 << 0) /* Bit 0: Power on reset */
-#define SYSCON_RSID_EXTR (1 << 1) /* Bit 1: external RESET signal */
-#define SYSCON_RSID_WDTR (1 << 2) /* Bit 2: Watchdog Timer time out w/WDTRESET */
-#define SYSCON_RSID_BODR (1 << 3) /* Bit 3: Brown out detection */
- /* Bits 4-31: Reserved */
-/* System control registers -- Syscon Miscellaneous Registers */
-
- /* Bits 0-3: Reserved */
-#define SYSCON_SCS_OSCRS (1 << 4) /* Bit 4: Main oscillator range select */
-#define SYSCON_SCS_OSCEN (1 << 5) /* Bit 5: Main oscillator enable */
-#define SYSCON_SCS_OSCSTAT (1 << 6) /* Bit 6: Main oscillator status */
- /* Bits 7-31: Reserved */
-/* Device Interrupt Registers */
-/* USB Interrupt Status register */
-
-#define SYSCON_USBINTST_REQLP (1 << 0) /* Bit 0: Low priority interrupt line status */
-#define SYSCON_USBINTST_REQHP (1 << 1) /* Bit 1: High priority interrupt line status */
-#define SYSCON_USBINTST_REQDMA (1 << 2) /* Bit 2: DMA interrupt line status */
-#define SYSCON_USBINTST_HOSTINT (1 << 3) /* Bit 3: USB host interrupt line status */
-#define SYSCON_USBINTST_ATXINT (1 << 4) /* Bit 4: External ATX interrupt line status */
-#define SYSCON_USBINTST_OTGINT (1 << 5) /* Bit 5: OTG interrupt line status */
-#define SYSCON_USBINTST_I2CINT (1 << 6) /* Bit 6: I2C module interrupt line status */
- /* Bit 7: Reserved */
-#define SYSCON_USBINTST_NEEDCLK (1 << 8) /* Bit 8: USB need clock indicator */
- /* Bits 9-30: Reserved */
-#define SYSCON_USBINTST_ENINTS (1 << 31) /* Bit 31: Enable all USB interrupts */
-
-/* DMA Request Select Register */
-
-#define SYSCON_DMAREQSEL_INP8 (1 << 0) /* Bit 0: Input 8 0=UART0 TX 1=Timer 0 match 0 */
-#define SYSCON_DMAREQSEL_INP9 (1 << 1) /* Bit 1: Input 8 0=UART0 RX 1=Timer 0 match 1 */
-#define SYSCON_DMAREQSEL_INP10 (1 << 2) /* Bit 2: Input 8 0=UART1 TX 1=Timer 1 match 0 */
-#define SYSCON_DMAREQSEL_INP11 (1 << 3) /* Bit 3: Input 8 0=UART1 RX 1=Timer 1 match 1 */
-#define SYSCON_DMAREQSEL_INP12 (1 << 4) /* Bit 4: Input 8 0=UART2 TX 1=Timer 2 match 0 */
-#define SYSCON_DMAREQSEL_INP13 (1 << 5) /* Bit 5: Input 8 0=UART2 RX 1=Timer 2 match 1 */
-#define SYSCON_DMAREQSEL_INP14 (1 << 6) /* Bit 6: Input 8 0=UART3 TX 1=Timer 3 match 0 */
-#define SYSCON_DMAREQSEL_INP15 (1 << 7) /* Bit 7: Input 8 0=UART3 RX 1=Timer 3 match 1 */
- /* Bits 8-31: Reserved */
-
-/************************************************************************************
- * Public Types
- ************************************************************************************/
-
-/************************************************************************************
- * Public Data
- ************************************************************************************/
-
-/************************************************************************************
- * Public Functions
- ************************************************************************************/
-
-#endif /* __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC176X_SYSCON_H */
diff --git a/arch/arm/src/lpc17xx/hardware/lpc178x_iocon.h b/arch/arm/src/lpc17xx/hardware/lpc178x_iocon.h
deleted file mode 100644
index bb49cd13a87..00000000000
--- a/arch/arm/src/lpc17xx/hardware/lpc178x_iocon.h
+++ /dev/null
@@ -1,375 +0,0 @@
-/************************************************************************************
- * arch/arm/src/lpc17xx/hardware/lpc178x_iocon.h
- *
- * Copyright (C) 2013 Gregory Nutt. All rights reserved.
- * Author: Rommel Marcelo
- * Gregory Nutt
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. 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.
- * 3. Neither the name NuttX 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 THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- ************************************************************************************/
-
-#ifndef __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC178X_IOCON_H
-#define __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC178X_IOCON_H
-
-/************************************************************************************
- * Included Files
- ************************************************************************************/
-
-#include
-
-#include "chip.h"
-#include "hardware/lpc17_memorymap.h"
-
-/************************************************************************************
- * Pre-processor Definitions
- ************************************************************************************/
-
-/* Register offsets *****************************************************************/
-
-#define LPC17_IOCON_PP_OFFSET(p) ((unsigned int)(p) << 2)
-#define LPC17_IOCON_PP0_OFFSET (0x0000) /* IOCON Port(n) register 0 */
-#define LPC17_IOCON_PP1_OFFSET (0x0004) /* IOCON Port(n) register 1 */
-#define LPC17_IOCON_PP2_OFFSET (0x0008) /* IOCON Port(n) register 2 */
-#define LPC17_IOCON_PP3_OFFSET (0x000c) /* IOCON Port(n) register 3 */
-#define LPC17_IOCON_PP4_OFFSET (0x0010) /* IOCON Port(n) register 4 */
-#define LPC17_IOCON_PP5_OFFSET (0x0014) /* IOCON Port(n) register 5 */
-#define LPC17_IOCON_PP6_OFFSET (0x0018) /* IOCON Port(n) register 6 */
-#define LPC17_IOCON_PP7_OFFSET (0x001c) /* IOCON Port(n) register 7 */
-#define LPC17_IOCON_PP8_OFFSET (0x0020) /* IOCON Port(n) register 8 */
-#define LPC17_IOCON_PP9_OFFSET (0x0024) /* IOCON Port(n) register 9 */
-#define LPC17_IOCON_PP10_OFFSET (0x0028) /* IOCON Port(n) register 10 */
-#define LPC17_IOCON_PP11_OFFSET (0x002c) /* IOCON Port(n) register 11 */
-#define LPC17_IOCON_PP12_OFFSET (0x0030) /* IOCON Port(n) register 12 */
-#define LPC17_IOCON_PP13_OFFSET (0x0034) /* IOCON Port(n) register 13 */
-#define LPC17_IOCON_PP14_OFFSET (0x0038) /* IOCON Port(n) register 14 */
-#define LPC17_IOCON_PP15_OFFSET (0x003c) /* IOCON Port(n) register 15 */
-#define LPC17_IOCON_PP16_OFFSET (0x0040) /* IOCON Port(n) register 16 */
-#define LPC17_IOCON_PP17_OFFSET (0x0044) /* IOCON Port(n) register 17 */
-#define LPC17_IOCON_PP18_OFFSET (0x0048) /* IOCON Port(n) register 18 */
-#define LPC17_IOCON_PP19_OFFSET (0x004c) /* IOCON Port(n) register 19 */
-#define LPC17_IOCON_PP20_OFFSET (0x0050) /* IOCON Port(n) register 20 */
-#define LPC17_IOCON_PP21_OFFSET (0x0054) /* IOCON Port(n) register 21 */
-#define LPC17_IOCON_PP22_OFFSET (0x0058) /* IOCON Port(n) register 22 */
-#define LPC17_IOCON_PP23_OFFSET (0x005c) /* IOCON Port(n) register 23 */
-#define LPC17_IOCON_PP24_OFFSET (0x0060) /* IOCON Port(n) register 24 */
-#define LPC17_IOCON_PP25_OFFSET (0x0064) /* IOCON Port(n) register 25 */
-#define LPC17_IOCON_PP26_OFFSET (0x0068) /* IOCON Port(n) register 26 */
-#define LPC17_IOCON_PP27_OFFSET (0x006c) /* IOCON Port(n) register 27 */
-#define LPC17_IOCON_PP28_OFFSET (0x0070) /* IOCON Port(n) register 28 */
-#define LPC17_IOCON_PP29_OFFSET (0x0074) /* IOCON Port(n) register 29 */
-#define LPC17_IOCON_PP30_OFFSET (0x0078) /* IOCON Port(n) register 30 */
-#define LPC17_IOCON_PP31_OFFSET (0x007c) /* IOCON Port(n) register 31 */
-
-/* Register addresses ***************************************************************/
-
-#define LPC17_IOCON_P_BASE(b) (LPC17_IOCON_BASE + ((unsigned int)(b) << 7))
-#define LPC17_IOCON_P0_BASE (LPC17_IOCON_BASE + 0x0000)
-#define LPC17_IOCON_P1_BASE (LPC17_IOCON_BASE + 0x0080)
-#define LPC17_IOCON_P2_BASE (LPC17_IOCON_BASE + 0x0100)
-#define LPC17_IOCON_P3_BASE (LPC17_IOCON_BASE + 0x0180)
-#define LPC17_IOCON_P4_BASE (LPC17_IOCON_BASE + 0x0200)
-#define LPC17_IOCON_P5_BASE (LPC17_IOCON_BASE + 0x0280)
-
-#define LPC17_IOCON_P(b,p) (LPC17_IOCON_P_BASE(b) + LPC17_IOCON_PP_OFFSET(p))
-
-#define LPC17_IOCON_P0_0 (LPC17_IOCON_P0_BASE + LPC17_IOCON_PP0_OFFSET)
-#define LPC17_IOCON_P0_1 (LPC17_IOCON_P0_BASE + LPC17_IOCON_PP1_OFFSET)
-#define LPC17_IOCON_P0_2 (LPC17_IOCON_P0_BASE + LPC17_IOCON_PP2_OFFSET)
-#define LPC17_IOCON_P0_3 (LPC17_IOCON_P0_BASE + LPC17_IOCON_PP3_OFFSET)
-#define LPC17_IOCON_P0_4 (LPC17_IOCON_P0_BASE + LPC17_IOCON_PP4_OFFSET)
-#define LPC17_IOCON_P0_5 (LPC17_IOCON_P0_BASE + LPC17_IOCON_PP5_OFFSET)
-#define LPC17_IOCON_P0_6 (LPC17_IOCON_P0_BASE + LPC17_IOCON_PP6_OFFSET)
-#define LPC17_IOCON_P0_7 (LPC17_IOCON_P0_BASE + LPC17_IOCON_PP7_OFFSET)
-#define LPC17_IOCON_P0_8 (LPC17_IOCON_P0_BASE + LPC17_IOCON_PP8_OFFSET)
-#define LPC17_IOCON_P0_9 (LPC17_IOCON_P0_BASE + LPC17_IOCON_PP9_OFFSET)
-#define LPC17_IOCON_P0_10 (LPC17_IOCON_P0_BASE + LPC17_IOCON_PP10_OFFSET)
-#define LPC17_IOCON_P0_11 (LPC17_IOCON_P0_BASE + LPC17_IOCON_PP11_OFFSET)
-#define LPC17_IOCON_P0_12 (LPC17_IOCON_P0_BASE + LPC17_IOCON_PP12_OFFSET)
-#define LPC17_IOCON_P0_13 (LPC17_IOCON_P0_BASE + LPC17_IOCON_PP13_OFFSET)
-#define LPC17_IOCON_P0_14 (LPC17_IOCON_P0_BASE + LPC17_IOCON_PP14_OFFSET)
-#define LPC17_IOCON_P0_15 (LPC17_IOCON_P0_BASE + LPC17_IOCON_PP15_OFFSET)
-#define LPC17_IOCON_P0_16 (LPC17_IOCON_P0_BASE + LPC17_IOCON_PP16_OFFSET)
-#define LPC17_IOCON_P0_17 (LPC17_IOCON_P0_BASE + LPC17_IOCON_PP17_OFFSET)
-#define LPC17_IOCON_P0_18 (LPC17_IOCON_P0_BASE + LPC17_IOCON_PP18_OFFSET)
-#define LPC17_IOCON_P0_19 (LPC17_IOCON_P0_BASE + LPC17_IOCON_PP19_OFFSET)
-#define LPC17_IOCON_P0_20 (LPC17_IOCON_P0_BASE + LPC17_IOCON_PP20_OFFSET)
-#define LPC17_IOCON_P0_21 (LPC17_IOCON_P0_BASE + LPC17_IOCON_PP21_OFFSET)
-#define LPC17_IOCON_P0_22 (LPC17_IOCON_P0_BASE + LPC17_IOCON_PP22_OFFSET)
-#define LPC17_IOCON_P0_23 (LPC17_IOCON_P0_BASE + LPC17_IOCON_PP23_OFFSET)
-#define LPC17_IOCON_P0_24 (LPC17_IOCON_P0_BASE + LPC17_IOCON_PP24_OFFSET)
-#define LPC17_IOCON_P0_25 (LPC17_IOCON_P0_BASE + LPC17_IOCON_PP25_OFFSET)
-#define LPC17_IOCON_P0_26 (LPC17_IOCON_P0_BASE + LPC17_IOCON_PP26_OFFSET)
-#define LPC17_IOCON_P0_27 (LPC17_IOCON_P0_BASE + LPC17_IOCON_PP27_OFFSET)
-#define LPC17_IOCON_P0_28 (LPC17_IOCON_P0_BASE + LPC17_IOCON_PP28_OFFSET)
-#define LPC17_IOCON_P0_29 (LPC17_IOCON_P0_BASE + LPC17_IOCON_PP29_OFFSET)
-#define LPC17_IOCON_P0_30 (LPC17_IOCON_P0_BASE + LPC17_IOCON_PP30_OFFSET)
-#define LPC17_IOCON_P0_31 (LPC17_IOCON_P0_BASE + LPC17_IOCON_PP31_OFFSET)
-
-#define LPC17_IOCON_P1_0 (LPC17_IOCON_P1_BASE + LPC17_IOCON_PP0_OFFSET)
-#define LPC17_IOCON_P1_1 (LPC17_IOCON_P1_BASE + LPC17_IOCON_PP1_OFFSET)
-#define LPC17_IOCON_P1_2 (LPC17_IOCON_P1_BASE + LPC17_IOCON_PP2_OFFSET)
-#define LPC17_IOCON_P1_3 (LPC17_IOCON_P1_BASE + LPC17_IOCON_PP3_OFFSET)
-#define LPC17_IOCON_P1_4 (LPC17_IOCON_P1_BASE + LPC17_IOCON_PP4_OFFSET)
-#define LPC17_IOCON_P1_5 (LPC17_IOCON_P1_BASE + LPC17_IOCON_PP5_OFFSET)
-#define LPC17_IOCON_P1_6 (LPC17_IOCON_P1_BASE + LPC17_IOCON_PP6_OFFSET)
-#define LPC17_IOCON_P1_7 (LPC17_IOCON_P1_BASE + LPC17_IOCON_PP7_OFFSET)
-#define LPC17_IOCON_P1_8 (LPC17_IOCON_P1_BASE + LPC17_IOCON_PP8_OFFSET)
-#define LPC17_IOCON_P1_9 (LPC17_IOCON_P1_BASE + LPC17_IOCON_PP9_OFFSET)
-#define LPC17_IOCON_P1_10 (LPC17_IOCON_P1_BASE + LPC17_IOCON_PP10_OFFSET)
-#define LPC17_IOCON_P1_11 (LPC17_IOCON_P1_BASE + LPC17_IOCON_PP11_OFFSET)
-#define LPC17_IOCON_P1_12 (LPC17_IOCON_P1_BASE + LPC17_IOCON_PP12_OFFSET)
-#define LPC17_IOCON_P1_13 (LPC17_IOCON_P1_BASE + LPC17_IOCON_PP13_OFFSET)
-#define LPC17_IOCON_P1_14 (LPC17_IOCON_P1_BASE + LPC17_IOCON_PP14_OFFSET)
-#define LPC17_IOCON_P1_15 (LPC17_IOCON_P1_BASE + LPC17_IOCON_PP15_OFFSET)
-#define LPC17_IOCON_P1_16 (LPC17_IOCON_P1_BASE + LPC17_IOCON_PP16_OFFSET)
-#define LPC17_IOCON_P1_17 (LPC17_IOCON_P1_BASE + LPC17_IOCON_PP17_OFFSET)
-#define LPC17_IOCON_P1_18 (LPC17_IOCON_P1_BASE + LPC17_IOCON_PP18_OFFSET)
-#define LPC17_IOCON_P1_19 (LPC17_IOCON_P1_BASE + LPC17_IOCON_PP19_OFFSET)
-#define LPC17_IOCON_P1_20 (LPC17_IOCON_P1_BASE + LPC17_IOCON_PP20_OFFSET)
-#define LPC17_IOCON_P1_21 (LPC17_IOCON_P1_BASE + LPC17_IOCON_PP21_OFFSET)
-#define LPC17_IOCON_P1_22 (LPC17_IOCON_P1_BASE + LPC17_IOCON_PP22_OFFSET)
-#define LPC17_IOCON_P1_23 (LPC17_IOCON_P1_BASE + LPC17_IOCON_PP23_OFFSET)
-#define LPC17_IOCON_P1_24 (LPC17_IOCON_P1_BASE + LPC17_IOCON_PP24_OFFSET)
-#define LPC17_IOCON_P1_25 (LPC17_IOCON_P1_BASE + LPC17_IOCON_PP25_OFFSET)
-#define LPC17_IOCON_P1_26 (LPC17_IOCON_P1_BASE + LPC17_IOCON_PP26_OFFSET)
-#define LPC17_IOCON_P1_27 (LPC17_IOCON_P1_BASE + LPC17_IOCON_PP27_OFFSET)
-#define LPC17_IOCON_P1_28 (LPC17_IOCON_P1_BASE + LPC17_IOCON_PP28_OFFSET)
-#define LPC17_IOCON_P1_29 (LPC17_IOCON_P1_BASE + LPC17_IOCON_PP29_OFFSET)
-#define LPC17_IOCON_P1_30 (LPC17_IOCON_P1_BASE + LPC17_IOCON_PP30_OFFSET)
-#define LPC17_IOCON_P1_31 (LPC17_IOCON_P1_BASE + LPC17_IOCON_PP31_OFFSET)
-
-#define LPC17_IOCON_P2_0 (LPC17_IOCON_P2_BASE + LPC17_IOCON_PP0_OFFSET)
-#define LPC17_IOCON_P2_1 (LPC17_IOCON_P2_BASE + LPC17_IOCON_PP1_OFFSET)
-#define LPC17_IOCON_P2_2 (LPC17_IOCON_P2_BASE + LPC17_IOCON_PP2_OFFSET)
-#define LPC17_IOCON_P2_3 (LPC17_IOCON_P2_BASE + LPC17_IOCON_PP3_OFFSET)
-#define LPC17_IOCON_P2_4 (LPC17_IOCON_P2_BASE + LPC17_IOCON_PP4_OFFSET)
-#define LPC17_IOCON_P2_5 (LPC17_IOCON_P2_BASE + LPC17_IOCON_PP5_OFFSET)
-#define LPC17_IOCON_P2_6 (LPC17_IOCON_P2_BASE + LPC17_IOCON_PP6_OFFSET)
-#define LPC17_IOCON_P2_7 (LPC17_IOCON_P2_BASE + LPC17_IOCON_PP7_OFFSET)
-#define LPC17_IOCON_P2_8 (LPC17_IOCON_P2_BASE + LPC17_IOCON_PP8_OFFSET)
-#define LPC17_IOCON_P2_9 (LPC17_IOCON_P2_BASE + LPC17_IOCON_PP9_OFFSET)
-#define LPC17_IOCON_P2_10 (LPC17_IOCON_P2_BASE + LPC17_IOCON_PP10_OFFSET)
-#define LPC17_IOCON_P2_11 (LPC17_IOCON_P2_BASE + LPC17_IOCON_PP11_OFFSET)
-#define LPC17_IOCON_P2_12 (LPC17_IOCON_P2_BASE + LPC17_IOCON_PP12_OFFSET)
-#define LPC17_IOCON_P2_13 (LPC17_IOCON_P2_BASE + LPC17_IOCON_PP13_OFFSET)
-#define LPC17_IOCON_P2_14 (LPC17_IOCON_P2_BASE + LPC17_IOCON_PP14_OFFSET)
-#define LPC17_IOCON_P2_15 (LPC17_IOCON_P2_BASE + LPC17_IOCON_PP15_OFFSET)
-#define LPC17_IOCON_P2_16 (LPC17_IOCON_P2_BASE + LPC17_IOCON_PP16_OFFSET)
-#define LPC17_IOCON_P2_17 (LPC17_IOCON_P2_BASE + LPC17_IOCON_PP17_OFFSET)
-#define LPC17_IOCON_P2_18 (LPC17_IOCON_P2_BASE + LPC17_IOCON_PP18_OFFSET)
-#define LPC17_IOCON_P2_19 (LPC17_IOCON_P2_BASE + LPC17_IOCON_PP19_OFFSET)
-#define LPC17_IOCON_P2_20 (LPC17_IOCON_P2_BASE + LPC17_IOCON_PP20_OFFSET)
-#define LPC17_IOCON_P2_21 (LPC17_IOCON_P2_BASE + LPC17_IOCON_PP21_OFFSET)
-#define LPC17_IOCON_P2_22 (LPC17_IOCON_P2_BASE + LPC17_IOCON_PP22_OFFSET)
-#define LPC17_IOCON_P2_23 (LPC17_IOCON_P2_BASE + LPC17_IOCON_PP23_OFFSET)
-#define LPC17_IOCON_P2_24 (LPC17_IOCON_P2_BASE + LPC17_IOCON_PP24_OFFSET)
-#define LPC17_IOCON_P2_25 (LPC17_IOCON_P2_BASE + LPC17_IOCON_PP25_OFFSET)
-#define LPC17_IOCON_P2_26 (LPC17_IOCON_P2_BASE + LPC17_IOCON_PP26_OFFSET)
-#define LPC17_IOCON_P2_27 (LPC17_IOCON_P2_BASE + LPC17_IOCON_PP27_OFFSET)
-#define LPC17_IOCON_P2_28 (LPC17_IOCON_P2_BASE + LPC17_IOCON_PP28_OFFSET)
-#define LPC17_IOCON_P2_29 (LPC17_IOCON_P2_BASE + LPC17_IOCON_PP29_OFFSET)
-#define LPC17_IOCON_P2_30 (LPC17_IOCON_P2_BASE + LPC17_IOCON_PP30_OFFSET)
-#define LPC17_IOCON_P2_31 (LPC17_IOCON_P2_BASE + LPC17_IOCON_PP31_OFFSET)
-
-#define LPC17_IOCON_P3_0 (LPC17_IOCON_P3_BASE + LPC17_IOCON_PP0_OFFSET)
-#define LPC17_IOCON_P3_1 (LPC17_IOCON_P3_BASE + LPC17_IOCON_PP1_OFFSET)
-#define LPC17_IOCON_P3_2 (LPC17_IOCON_P3_BASE + LPC17_IOCON_PP2_OFFSET)
-#define LPC17_IOCON_P3_3 (LPC17_IOCON_P3_BASE + LPC17_IOCON_PP3_OFFSET)
-#define LPC17_IOCON_P3_4 (LPC17_IOCON_P3_BASE + LPC17_IOCON_PP4_OFFSET)
-#define LPC17_IOCON_P3_5 (LPC17_IOCON_P3_BASE + LPC17_IOCON_PP5_OFFSET)
-#define LPC17_IOCON_P3_6 (LPC17_IOCON_P3_BASE + LPC17_IOCON_PP6_OFFSET)
-#define LPC17_IOCON_P3_7 (LPC17_IOCON_P3_BASE + LPC17_IOCON_PP7_OFFSET)
-#define LPC17_IOCON_P3_8 (LPC17_IOCON_P3_BASE + LPC17_IOCON_PP8_OFFSET)
-#define LPC17_IOCON_P3_9 (LPC17_IOCON_P3_BASE + LPC17_IOCON_PP9_OFFSET)
-#define LPC17_IOCON_P3_10 (LPC17_IOCON_P3_BASE + LPC17_IOCON_PP10_OFFSET)
-#define LPC17_IOCON_P3_11 (LPC17_IOCON_P3_BASE + LPC17_IOCON_PP11_OFFSET)
-#define LPC17_IOCON_P3_12 (LPC17_IOCON_P3_BASE + LPC17_IOCON_PP12_OFFSET)
-#define LPC17_IOCON_P3_13 (LPC17_IOCON_P3_BASE + LPC17_IOCON_PP13_OFFSET)
-#define LPC17_IOCON_P3_14 (LPC17_IOCON_P3_BASE + LPC17_IOCON_PP14_OFFSET)
-#define LPC17_IOCON_P3_15 (LPC17_IOCON_P3_BASE + LPC17_IOCON_PP15_OFFSET)
-#define LPC17_IOCON_P3_16 (LPC17_IOCON_P3_BASE + LPC17_IOCON_PP16_OFFSET)
-#define LPC17_IOCON_P3_17 (LPC17_IOCON_P3_BASE + LPC17_IOCON_PP17_OFFSET)
-#define LPC17_IOCON_P3_18 (LPC17_IOCON_P3_BASE + LPC17_IOCON_PP18_OFFSET)
-#define LPC17_IOCON_P3_19 (LPC17_IOCON_P3_BASE + LPC17_IOCON_PP19_OFFSET)
-#define LPC17_IOCON_P3_20 (LPC17_IOCON_P3_BASE + LPC17_IOCON_PP20_OFFSET)
-#define LPC17_IOCON_P3_21 (LPC17_IOCON_P3_BASE + LPC17_IOCON_PP21_OFFSET)
-#define LPC17_IOCON_P3_22 (LPC17_IOCON_P3_BASE + LPC17_IOCON_PP22_OFFSET)
-#define LPC17_IOCON_P3_23 (LPC17_IOCON_P3_BASE + LPC17_IOCON_PP23_OFFSET)
-#define LPC17_IOCON_P3_24 (LPC17_IOCON_P3_BASE + LPC17_IOCON_PP24_OFFSET)
-#define LPC17_IOCON_P3_25 (LPC17_IOCON_P3_BASE + LPC17_IOCON_PP25_OFFSET)
-#define LPC17_IOCON_P3_26 (LPC17_IOCON_P3_BASE + LPC17_IOCON_PP26_OFFSET)
-#define LPC17_IOCON_P3_27 (LPC17_IOCON_P3_BASE + LPC17_IOCON_PP27_OFFSET)
-#define LPC17_IOCON_P3_28 (LPC17_IOCON_P3_BASE + LPC17_IOCON_PP28_OFFSET)
-#define LPC17_IOCON_P3_29 (LPC17_IOCON_P3_BASE + LPC17_IOCON_PP29_OFFSET)
-#define LPC17_IOCON_P3_30 (LPC17_IOCON_P3_BASE + LPC17_IOCON_PP30_OFFSET)
-#define LPC17_IOCON_P3_31 (LPC17_IOCON_P3_BASE + LPC17_IOCON_PP31_OFFSET)
-
-#define LPC17_IOCON_P4_0 (LPC17_IOCON_P4_BASE + LPC17_IOCON_PP0_OFFSET)
-#define LPC17_IOCON_P4_1 (LPC17_IOCON_P4_BASE + LPC17_IOCON_PP1_OFFSET)
-#define LPC17_IOCON_P4_2 (LPC17_IOCON_P4_BASE + LPC17_IOCON_PP2_OFFSET)
-#define LPC17_IOCON_P4_3 (LPC17_IOCON_P4_BASE + LPC17_IOCON_PP3_OFFSET)
-#define LPC17_IOCON_P4_4 (LPC17_IOCON_P4_BASE + LPC17_IOCON_PP4_OFFSET)
-#define LPC17_IOCON_P4_5 (LPC17_IOCON_P4_BASE + LPC17_IOCON_PP5_OFFSET)
-#define LPC17_IOCON_P4_6 (LPC17_IOCON_P4_BASE + LPC17_IOCON_PP6_OFFSET)
-#define LPC17_IOCON_P4_7 (LPC17_IOCON_P4_BASE + LPC17_IOCON_PP7_OFFSET)
-#define LPC17_IOCON_P4_8 (LPC17_IOCON_P4_BASE + LPC17_IOCON_PP8_OFFSET)
-#define LPC17_IOCON_P4_9 (LPC17_IOCON_P4_BASE + LPC17_IOCON_PP9_OFFSET)
-#define LPC17_IOCON_P4_10 (LPC17_IOCON_P4_BASE + LPC17_IOCON_PP10_OFFSET)
-#define LPC17_IOCON_P4_11 (LPC17_IOCON_P4_BASE + LPC17_IOCON_PP11_OFFSET)
-#define LPC17_IOCON_P4_12 (LPC17_IOCON_P4_BASE + LPC17_IOCON_PP12_OFFSET)
-#define LPC17_IOCON_P4_13 (LPC17_IOCON_P4_BASE + LPC17_IOCON_PP13_OFFSET)
-#define LPC17_IOCON_P4_14 (LPC17_IOCON_P4_BASE + LPC17_IOCON_PP14_OFFSET)
-#define LPC17_IOCON_P4_15 (LPC17_IOCON_P4_BASE + LPC17_IOCON_PP15_OFFSET)
-#define LPC17_IOCON_P4_16 (LPC17_IOCON_P4_BASE + LPC17_IOCON_PP16_OFFSET)
-#define LPC17_IOCON_P4_17 (LPC17_IOCON_P4_BASE + LPC17_IOCON_PP17_OFFSET)
-#define LPC17_IOCON_P4_18 (LPC17_IOCON_P4_BASE + LPC17_IOCON_PP18_OFFSET)
-#define LPC17_IOCON_P4_19 (LPC17_IOCON_P4_BASE + LPC17_IOCON_PP19_OFFSET)
-#define LPC17_IOCON_P4_20 (LPC17_IOCON_P4_BASE + LPC17_IOCON_PP20_OFFSET)
-#define LPC17_IOCON_P4_21 (LPC17_IOCON_P4_BASE + LPC17_IOCON_PP21_OFFSET)
-#define LPC17_IOCON_P4_22 (LPC17_IOCON_P4_BASE + LPC17_IOCON_PP22_OFFSET)
-#define LPC17_IOCON_P4_23 (LPC17_IOCON_P4_BASE + LPC17_IOCON_PP23_OFFSET)
-#define LPC17_IOCON_P4_24 (LPC17_IOCON_P4_BASE + LPC17_IOCON_PP24_OFFSET)
-#define LPC17_IOCON_P4_25 (LPC17_IOCON_P4_BASE + LPC17_IOCON_PP25_OFFSET)
-#define LPC17_IOCON_P4_26 (LPC17_IOCON_P4_BASE + LPC17_IOCON_PP26_OFFSET)
-#define LPC17_IOCON_P4_27 (LPC17_IOCON_P4_BASE + LPC17_IOCON_PP27_OFFSET)
-#define LPC17_IOCON_P4_28 (LPC17_IOCON_P4_BASE + LPC17_IOCON_PP28_OFFSET)
-#define LPC17_IOCON_P4_29 (LPC17_IOCON_P4_BASE + LPC17_IOCON_PP29_OFFSET)
-#define LPC17_IOCON_P4_30 (LPC17_IOCON_P4_BASE + LPC17_IOCON_PP30_OFFSET)
-#define LPC17_IOCON_P4_31 (LPC17_IOCON_P4_BASE + LPC17_IOCON_PP31_OFFSET)
-
-#define LPC17_IOCON_P5_0 (LPC17_IOCON_P5_BASE + LPC17_IOCON_PP0_OFFSET)
-#define LPC17_IOCON_P5_1 (LPC17_IOCON_P5_BASE + LPC17_IOCON_PP1_OFFSET)
-#define LPC17_IOCON_P5_2 (LPC17_IOCON_P5_BASE + LPC17_IOCON_PP2_OFFSET)
-#define LPC17_IOCON_P5_3 (LPC17_IOCON_P5_BASE + LPC17_IOCON_PP3_OFFSET)
-#define LPC17_IOCON_P5_4 (LPC17_IOCON_P5_BASE + LPC17_IOCON_PP4_OFFSET)
-#define LPC17_IOCON_P5_5 (LPC17_IOCON_P5_BASE + LPC17_IOCON_PP5_OFFSET)
-#define LPC17_IOCON_P5_6 (LPC17_IOCON_P5_BASE + LPC17_IOCON_PP6_OFFSET)
-#define LPC17_IOCON_P5_7 (LPC17_IOCON_P5_BASE + LPC17_IOCON_PP7_OFFSET)
-#define LPC17_IOCON_P5_8 (LPC17_IOCON_P5_BASE + LPC17_IOCON_PP8_OFFSET)
-#define LPC17_IOCON_P5_9 (LPC17_IOCON_P5_BASE + LPC17_IOCON_PP9_OFFSET)
-#define LPC17_IOCON_P5_10 (LPC17_IOCON_P5_BASE + LPC17_IOCON_PP10_OFFSET)
-#define LPC17_IOCON_P5_11 (LPC17_IOCON_P5_BASE + LPC17_IOCON_PP11_OFFSET)
-#define LPC17_IOCON_P5_12 (LPC17_IOCON_P5_BASE + LPC17_IOCON_PP12_OFFSET)
-#define LPC17_IOCON_P5_13 (LPC17_IOCON_P5_BASE + LPC17_IOCON_PP13_OFFSET)
-#define LPC17_IOCON_P5_14 (LPC17_IOCON_P5_BASE + LPC17_IOCON_PP14_OFFSET)
-#define LPC17_IOCON_P5_15 (LPC17_IOCON_P5_BASE + LPC17_IOCON_PP15_OFFSET)
-#define LPC17_IOCON_P5_16 (LPC17_IOCON_P5_BASE + LPC17_IOCON_PP16_OFFSET)
-#define LPC17_IOCON_P5_17 (LPC17_IOCON_P5_BASE + LPC17_IOCON_PP17_OFFSET)
-#define LPC17_IOCON_P5_18 (LPC17_IOCON_P5_BASE + LPC17_IOCON_PP18_OFFSET)
-#define LPC17_IOCON_P5_19 (LPC17_IOCON_P5_BASE + LPC17_IOCON_PP19_OFFSET)
-#define LPC17_IOCON_P5_20 (LPC17_IOCON_P5_BASE + LPC17_IOCON_PP20_OFFSET)
-#define LPC17_IOCON_P5_21 (LPC17_IOCON_P5_BASE + LPC17_IOCON_PP21_OFFSET)
-#define LPC17_IOCON_P5_22 (LPC17_IOCON_P5_BASE + LPC17_IOCON_PP22_OFFSET)
-#define LPC17_IOCON_P5_23 (LPC17_IOCON_P5_BASE + LPC17_IOCON_PP23_OFFSET)
-#define LPC17_IOCON_P5_24 (LPC17_IOCON_P5_BASE + LPC17_IOCON_PP24_OFFSET)
-#define LPC17_IOCON_P5_25 (LPC17_IOCON_P5_BASE + LPC17_IOCON_PP25_OFFSET)
-#define LPC17_IOCON_P5_26 (LPC17_IOCON_P5_BASE + LPC17_IOCON_PP26_OFFSET)
-#define LPC17_IOCON_P5_27 (LPC17_IOCON_P5_BASE + LPC17_IOCON_PP27_OFFSET)
-#define LPC17_IOCON_P5_28 (LPC17_IOCON_P5_BASE + LPC17_IOCON_PP28_OFFSET)
-#define LPC17_IOCON_P5_29 (LPC17_IOCON_P5_BASE + LPC17_IOCON_PP29_OFFSET)
-#define LPC17_IOCON_P5_30 (LPC17_IOCON_P5_BASE + LPC17_IOCON_PP30_OFFSET)
-#define LPC17_IOCON_P5_31 (LPC17_IOCON_P5_BASE + LPC17_IOCON_PP31_OFFSET)
-
-/* Register bit definitions *********************************************************/
-/* IOCON pin function select */
-
-#define IOCON_FUNC_GPIO (0)
-#define IOCON_FUNC_ALT1 (1)
-#define IOCON_FUNC_ALT2 (2)
-#define IOCON_FUNC_ALT3 (3)
-#define IOCON_FUNC_ALT4 (4)
-#define IOCON_FUNC_ALT5 (5)
-#define IOCON_FUNC_ALT6 (6)
-#define IOCON_FUNC_ALT7 (7)
-
-#define IOCON_FUNC_SHIFT (0) /* Bits 0-2: All types */
-#define IOCON_FUNC_MASK (7 << IOCON_FUNC_SHIFT)
-#define IOCON_MODE_SHIFT (3) /* Bits 3-4: Type D,A,W */
-#define IOCON_MODE_MASK (3 << IOCON_MODE_SHIFT )
-#define IOCON_HYS_SHIFT (5) /* Bit 5: Type D,W */
-#define IOCON_HYS_MASK (1 << IOCON_HYS_SHIFT)
-#define IOCON_INV_SHIFT (6) /* Bit 6: Type D,A,I,W */
-#define IOCON_INV_MASK (1 << IOCON_INV_SHIFT)
-#define IOCON_ADMODE_SHIFT (7) /* Bit 7: Type A */
-#define IOCON_ADMODE_MASK (1 << IOCON_ADMODE_SHIFT)
-#define IOCON_FILTER_SHIFT (8) /* Bit 8: Type A */
-#define IOCON_FILTER_MASK (1 << IOCON_FILTER_SHIFT)
-#define IOCON_I2CHS_SHIFT (8) /* Bit 8: Type I */
-#define IOCON_I2CHS_MASK (1 << IOCON_I2CHS_SHIFT)
-#define IOCON_SLEW_SHIFT (9) /* Bit 9: Type W */
-#define IOCON_SLEW_MASK (1 << IOCON_SLEW_SHIFT)
-#define IOCON_HIDRIVE_SHIFT (9) /* Bit 9: Type I */
-#define IOCON_HIDRIVE_MASK (1 << IOCON_HIDRIVE_SHIFT)
-#define IOCON_OD_SHIFT (10) /* Bit 10: Type D,A,W */
-#define IOCON_OD_MASK (1 << IOCON_OD_SHIFT)
-#define IOCON_DACEN_SHIFT (16) /* Bit 16: Type A */
-#define IOCON_DACEN_MASK (1 << IOCON_DACEN_SHIFT)
-
-/* Pin modes */
-
-#define IOCON_MODE_FLOAT (0) /* 00: pin has neither pull-up nor pull-down */
-#define IOCON_MODE_PD (1) /* 01: pin has a pull-down resistor enabled */
-#define IOCON_MODE_PU (2) /* 10: pin has a pull-up resistor enabled */
-#define IOCON_MODE_RM (3) /* 11: pin has repeater mode enabled */
-
-/* Pin types */
-
-#define IOCON_TYPE_D_MASK (0x0000067f) /* All ports except where ADC/DAC, USB, I2C is present */
-#define IOCON_TYPE_A_MASK (0x000105df) /* USB/ADC/DAC P0:12-13, P0:23-26, P1:30-31 */
-#define IOCON_TYPE_U_MASK (0x00000007) /* USB P0:29 to 31 */
-#define IOCON_TYPE_I_MASK (0x00000347) /* I2C/USB P0:27-28, P5:2-3 */
-#define IOCON_TYPE_W_MASK (0x000007ff) /* I2S P0:7-9 */
-
-/* Slew rate modes */
-
-#define IOCON_SLEWMODE_NORMAL (0 << IOCON_SLEW_SHIFT)
-#define IOCON_SLEWMODE_FAST (1 << IOCON_SLEW_SHIFT)
-
-/* I2C modes */
-
-#define IOCON_I2CMODE_SHIFT (IOCON_I2CHS_SHIFT)
-#define IOCON_I2CMODE_MASK (3 << IOCON_I2CMODE_SHIFT)
-# define IOCON_I2CMODE_FAST (0 << IOCON_I2CMODE_SHIFT)
-# define IOCON_I2CMODE_FASTPLUS (1 << IOCON_I2CMODE_SHIFT)/* */
-# define IOCON_I2CMODE_HIOPENDRAIN (2 << IOCON_I2CMODE_SHIFT)/* */
-# define IOCON_I2CMODE_OPENDRAIN (3 << IOCON_I2CMODE_SHIFT)/* */
-
-/************************************************************************************
- * Public Types
- ************************************************************************************/
-
-/************************************************************************************
- * Public Data
- ************************************************************************************/
-
-/************************************************************************************
- * Public Functions
- ************************************************************************************/
-
-#endif /* __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC178X_IOCON_H */
diff --git a/arch/arm/src/lpc17xx/hardware/lpc178x_memorymap.h b/arch/arm/src/lpc17xx/hardware/lpc178x_memorymap.h
deleted file mode 100644
index 76a87f182ca..00000000000
--- a/arch/arm/src/lpc17xx/hardware/lpc178x_memorymap.h
+++ /dev/null
@@ -1,158 +0,0 @@
-/************************************************************************************
- * arch/arm/src/lpc17xx/hardware/lpc178x_memorymap.h
- *
- * Copyright (C) 2013 Gregory Nutt. All rights reserved.
- * Authors: Rommel Marcelo
- * Gregory Nutt
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. 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.
- * 3. Neither the name NuttX 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 THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- ************************************************************************************/
-
-#ifndef __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC178X_MEMORYMAP_H
-#define __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC178X_MEMORYMAP_H
-
-/************************************************************************************
- * Included Files
- ************************************************************************************/
-
-#include
-
-#include "chip.h"
-
-/************************************************************************************
- * Pre-processor Definitions
- ************************************************************************************/
-/* Memory Map ***********************************************************************/
-
-#define LPC17_FLASH_BASE 0x00000000 /* -0x1fffffff: On-chip non-volatile memory */
-#define LPC17_SRAM_BASE 0x10000000 /* -0x10007fff: On-chip SRAM (devices <=32Kb) */
-#define LPC17_ROM_BASE 0x1fff0000 /* -0x1fffffff: 8Kb Boot ROM with flash services */
-#define LPC17_AHBSRAM_BASE 0x20000000 /* -0x3fffffff: On-chip Peripheral SRAM (devices >32Kb) */
-# define LPC17_SRAM_BANK0 0x20000000 /* -0x20003fff: On-chip Peripheral SRAM Bank0 (devices >=32Kb) */
-# define LPC17_SRAM_BANK1 0x20004000 /* -0x20007fff: On-chip Peripheral SRAM Bank1 (devices 64Kb) */
-#define LPC17_AHB_BASE 0x20080000 /* -0x2008ffff: DMA Controller, Ethernet, and USB */
-#define LPC17_SPIFI_BASE 0x28000000
-#define LPC17_APB_BASE 0x40000000 /* -0x5fffffff: APB Peripherals */
-# define LPC17_APB0_BASE 0x40000000 /* -0x4007ffff: APB0 Peripherals */
-# define LPC17_APB1_BASE 0x40080000 /* -0x400fffff: APB1 Peripherals */
-
-/* Off chip Memory via External Memory Interface */
-
-#define LPC17_EXTRAM_BASE 0x80000000 /* */
-# define LPC17_EXTSRAM_CS0 0x80000000 /* Chip select 0 /up to 64MB/ */
-# define LPC17_EXTSRAM_CS1 0x90000000 /* Chip select 1 /up to 64MB/ */
-# define LPC17_EXTSRAM_CS2 0x98000000 /* Chip select 2 /up to 64MB/ */
-# define LPC17_EXTSRAM_CS3 0x9c000000 /* Chip select 3 /up to 64MB/ */
-
-# define LPC17_EXTDRAM_CS0 0xa0000000 /* Chip select 0 /up to 256MB/ */
-# define LPC17_EXTDRAM_CS1 0xb0000000 /* Chip select 1 /up to 256MB/ */
-# define LPC17_EXTDRAM_CS2 0xc0000000 /* Chip select 2 /up to 256MB/ */
-# define LPC17_EXTDRAM_CS3 0xd0000000 /* Chip select 3 /up to 256MB/ */
-
-#define LPC17_CORTEXM3_BASE 0xe0000000 /* -0xe00fffff: (see armv7-m/nvic.h) */
-#define LPC17_SCS_BASE 0xe000e000
-#define LPC17_DEBUGMCU_BASE 0xe0042000
-
-/* AHB SRAM Bank sizes **************************************************************/
-
-#define LPC17_BANK0_SIZE (16*1024) /* Size of AHB SRAM Bank0 (if present) */
-#define LPC17_BANK1_SIZE (16*1024) /* Size of AHB SRAM Bank1 (if present) */
-
-/* APB0 Peripherals *****************************************************************/
-
-#define LPC17_WDT_BASE 0x40000000 /* -0x40003fff: Watchdog timer */
-#define LPC17_TMR0_BASE 0x40004000 /* -0x40007fff: Timer 0 */
-#define LPC17_TMR1_BASE 0x40008000 /* -0x4000bfff: Timer 1 */
-#define LPC17_UART0_BASE 0x4000c000 /* -0x4000ffff: UART 0 */
-#define LPC17_UART1_BASE 0x40010000 /* -0x40013fff: UART 1 */
-#define LPC17_PWM0_BASE 0x40014000 /* -0x40017fff: PWM 0 */
-#define LPC17_PWM1_BASE 0x40018000 /* -0x4001bfff: PWM 1 */
-#define LPC17_I2C0_BASE 0x4001c000 /* -0x4001ffff: I2C 0 */
- /* -0x40023fff: Reserved */
-#define LPC17_RTC_BASE 0x40024000 /* -0x40027fff: RTC + backup registers */
-#define LPC17_GPIOINT_BASE 0x40028000 /* -0x4002bfff: GPIO interrupts */
-#define LPC17_IOCON_BASE 0x4002c000 /* -0x4002ffff: Pin connect block */
-#define LPC17_SSP1_BASE 0x40030000 /* -0x40033fff: SSP 1 */
-#define LPC17_ADC_BASE 0x40034000 /* -0x40037fff: ADC */
-#define LPC17_CANAFRAM_BASE 0x40038000 /* -0x4003bfff: CAN acceptance filter (AF) RAM */
-#define LPC17_CANAF_BASE 0x4003c000 /* -0x4003ffff: CAN acceptance filter (AF) registers */
-#define LPC17_CAN_BASE 0x40040000 /* -0x40043fff: CAN common registers */
-#define LPC17_CAN1_BASE 0x40044000 /* -0x40047fff: CAN controller l */
-#define LPC17_CAN2_BASE 0x40048000 /* -0x4004bfff: CAN controller 2 */
- /* -0x4005bfff: Reserved */
-#define LPC17_I2C1_BASE 0x4005c000 /* -0x4005ffff: I2C 1 */
- /* -0x4007ffff: Reserved */
-
-/* APB1 Peripherals *****************************************************************/
-
- /* -0x40087fff: Reserved */
-#define LPC17_SSP0_BASE 0x40088000 /* -0x4008bfff: SSP 0 */
-#define LPC17_DAC_BASE 0x4008c000 /* -0x4008ffff: DAC */
-#define LPC17_TMR2_BASE 0x40090000 /* -0x40093fff: Timer 2 */
-#define LPC17_TMR3_BASE 0x40094000 /* -0x40097fff: Timer 3 */
-#define LPC17_UART2_BASE 0x40098000 /* -0x4009bfff: UART 2 */
-#define LPC17_UART3_BASE 0x4009c000 /* -0x4009ffff: UART 3 */
-#define LPC17_I2C2_BASE 0x400a0000 /* -0x400a3fff: I2C 2 */
-#define LPC17_UART4_BASE 0x400a4000 /* -0x400a7fff: UART4 */
-#define LPC17_I2S_BASE 0x400a8000 /* -0x400abfff: I2S */
-#define LPC17_SSP2_BASE 0x400ac000 /* -0x400affff: SSP2 */
- /* -0x400b3fff: Reserved */
- /* -0x400b7fff: Reserved */
-#define LPC17_MCPWM_BASE 0x400b8000 /* -0x400bbfff: Motor control PWM */
-#define LPC17_QEI_BASE 0x400bc000 /* -0x400bffff: Quadrature encoder interface */
-#define LPC17_MCI_BASE 0x400c0000 /* -0x400fbfff: SD interface */
-#define LPC17_SYSCON_BASE 0x400fc000 /* -0x400fffff: System control */
-
-/* AHB Peripherals ******************************************************************/
-
-#define LPC17_GPDMA_BASE 0x20080000 /* GPDMA controller */
-#define LPC17_ETH_BASE 0x20084000 /* Ethernet controller */
-#define LPC17_LCD_BASE 0x20088000 /* LCD controller */
-#define LPC17_USB_BASE 0x2008c000 /* USB controller */
-#define LPC17_CRC_BASE 0x20090000 /* CRC engine */
-#define LPC17_GPIO_BASE 0x20098000 /* GPIO */
-#define LPC17_EMC_BASE 0x2009c000 /* External Memory Controller */
-
-/* EEPROM */
-
-#define LPC17_EEPROM_BASE 0x00200000 /* EEPROM controller */
-
-/************************************************************************************
- * Public Types
- ************************************************************************************/
-
-/************************************************************************************
- * Public Data
- ************************************************************************************/
-
-/************************************************************************************
- * Public Functions
- ************************************************************************************/
-
-#endif /* __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC178X_MEMORYMAP_H */
diff --git a/arch/arm/src/lpc17xx/hardware/lpc178x_syscon.h b/arch/arm/src/lpc17xx/hardware/lpc178x_syscon.h
deleted file mode 100644
index b6701ce6c2c..00000000000
--- a/arch/arm/src/lpc17xx/hardware/lpc178x_syscon.h
+++ /dev/null
@@ -1,636 +0,0 @@
-/****************************************************************************************************
- * arch/arm/src/lpc17xx/hardware/lpc178x_syscon.h
- *
- * Copyright (C) 2013 Gregory Nutt. All rights reserved.
- * Authors: Rommel Marcelo
- * Gregory Nutt
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. 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.
- * 3. Neither the name NuttX 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 THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- ****************************************************************************************************/
-
-#ifndef __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC178X_SYSCON_H
-#define __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC178X_SYSCON_H
-
-/****************************************************************************************************
- * Included Files
- ****************************************************************************************************/
-
-#include
-
-#include "chip.h"
-#include "hardware/lpc17_memorymap.h"
-
-/****************************************************************************************************
- * Pre-processor Definitions
- ****************************************************************************************************/
-
-/* Register offsets *********************************************************************************/
-/* Flash accelerator module */
-
-#define LPC17_SYSCON_FLASHCFG_OFFSET 0x0000 /* Flash Accelerator Configuration Register */
-
-/* Memory Mapping Control register (MEMMAP - 0x400F C040) */
-
-#define LPC17_SYSCON_MEMMAP_OFFSET 0x0040 /* Memory Mapping Control Register */
-
-/* Clocking and power control - Phase locked loops */
-
-#define LPC17_SYSCON_PLL0CON_OFFSET 0x0080 /* PLL0 Control Register */
-#define LPC17_SYSCON_PLL0CFG_OFFSET 0x0084 /* PLL0 Configuration Register */
-#define LPC17_SYSCON_PLL0STAT_OFFSET 0x0088 /* PLL0 Status Register */
-#define LPC17_SYSCON_PLL0FEED_OFFSET 0x008c /* PLL0 Feed Register */
-
-#define LPC17_SYSCON_PLL1CON_OFFSET 0x00a0 /* PLL1 Control Register */
-#define LPC17_SYSCON_PLL1CFG_OFFSET 0x00a4 /* PLL1 Configuration Register */
-#define LPC17_SYSCON_PLL1STAT_OFFSET 0x00a8 /* PLL1 Status Register */
-#define LPC17_SYSCON_PLL1FEED_OFFSET 0x00ac /* PLL1 Feed Register */
-
-/* Clocking and power control - Peripheral power control registers */
-
-#define LPC17_SYSCON_PCON_OFFSET 0x00c0 /* Power Control Register */
-#define LPC17_SYSCON_PCONP_OFFSET 0x00c4 /* Power Control for Peripherals Register */
-
-/* Clocking and power control -- Clock dividers */
-
-#define LPC17_SYSCON_EMCCLKSEL_OFFSET 0x0100 /* EMC Clock Selection Register */
-#define LPC17_SYSCON_CCLKSEL_OFFSET 0x0104 /* CPU Clock Selection Register */
-#define LPC17_SYSCON_USBCLKSEL_OFFSET 0x0108 /* USB Clock Selection Register */
-
-/* 0x400f c110 - 0x400f c114: CAN Wake and Sleep Registers */
-
-/* Clocking and power control -- Clock source selection */
-
-#define LPC17_SYSCON_CLKSRCSEL_OFFSET 0x010c /* Clock Source Select Register */
-#define LPC17_SYSCON_CANSLEEPCLR_OFFSET 0x0110 /* CAN Channel Sleep State Register */
-#define LPC17_SYSCON_CANWAKEFLAGS_OFFSET 0x0114 /* CAN Channel Wake-Up State Register */
-
-/* System control registers -- External Interrupts */
-
-#define LPC17_SYSCON_EXTINT_OFFSET 0x0140 /* External Interrupt Flag Register */
-#define LPC17_SYSCON_EXTMODE_OFFSET 0x0148 /* External Interrupt Mode register */
-#define LPC17_SYSCON_EXTPOLAR_OFFSET 0x014c /* External Interrupt Polarity Register */
-
-/* System control registers -- Reset */
-
-#define LPC17_SYSCON_RSID_OFFSET 0x0180 /* Reset Source Identification Register */
-
-/* System control registers -- Syscon Miscellaneous Registers */
-
-#define LPC17_SYSCON_MATRIXARB_OFFSET 0x0188 /* Matrix Arbitration Register */
-#define LPC17_SYSCON_SCS_OFFSET 0x01a0 /* System Control and Status */
-#define LPC17_SYSCON_PCLKSEL_OFFSET 0x01a8 /* Peripheral Clock Selection Register */
-#define LPC17_SYSCON_PBOOST_OFFSET 0x01b0 /* Power Boost Register */
-#define LPC17_SYSCON_SPIFICLKSEL_OFFSET 0x01b4 /* SPIFI Clock Selection Register */
-#define LPC17_SYSCON_LCDCFG_OFFSET 0x01b8 /* LCD Clock Configuration Register */
-
-/* Device Interrupt Registers (Might be a error in the User Manual, might be at 0x5000c1c0) */
-
-#define LPC17_SYSCON_USBINTST_OFFSET 0x01c0 /* USB Interrupt Status */
-
-/* DMA Request Select Register */
-
-#define LPC17_SYSCON_DMAREQSEL_OFFSET 0x01c4 /* Selects between UART and timer DMA requests */
-
-/* More clocking and power control -- Utility */
-
-#define LPC17_SYSCON_CLKOUTCFG_OFFSET 0x01c8 /* Clock Output Configuration Register */
-
-/* Peripheral Reset Control */
-
-#define LPC17_SYSCON_RSTCON0_OFFSET 0x01cc /* Individual Peripheral Reset Control Bits */
-#define LPC17_SYSCON_RSTCON1_OFFSET 0x01d0 /* Individual Peripheral Reset Control Bits */
-
-/* EMC Clock Control and Calibration */
-
-#define LPC17_SYSCON_EMCDLYCTL_OFFSET 0x01dc /* Programmable Delays for SDRAM Operation */
-#define LPC17_SYSCON_EMCCAL_OFFSET 0x01e0 /* Calibration Counter for EMCDLYCTL */
-
-
-/* Register addresses *******************************************************************************/
-/* Flash accelerator module */
-
-#define LPC17_SYSCON_FLASHCFG (LPC17_SYSCON_BASE+LPC17_SYSCON_FLASHCFG_OFFSET)
-
-/* Memory Mapping Control register (MEMMAP - 0x400F C040) */
-
-#define LPC17_SYSCON_MEMMAP (LPC17_SYSCON_BASE+LPC17_SYSCON_MEMMAP_OFFSET)
-
-/* Clocking and power control - Phase locked loops */
-
-#define LPC17_SYSCON_PLL0CON (LPC17_SYSCON_BASE+LPC17_SYSCON_PLL0CON_OFFSET)
-#define LPC17_SYSCON_PLL0CFG (LPC17_SYSCON_BASE+LPC17_SYSCON_PLL0CFG_OFFSET)
-#define LPC17_SYSCON_PLL0STAT (LPC17_SYSCON_BASE+LPC17_SYSCON_PLL0STAT_OFFSET)
-#define LPC17_SYSCON_PLL0FEED (LPC17_SYSCON_BASE+LPC17_SYSCON_PLL0FEED_OFFSET)
-
-#define LPC17_SYSCON_PLL1CON (LPC17_SYSCON_BASE+LPC17_SYSCON_PLL1CON_OFFSET)
-#define LPC17_SYSCON_PLL1CFG (LPC17_SYSCON_BASE+LPC17_SYSCON_PLL1CFG_OFFSET)
-#define LPC17_SYSCON_PLL1STAT (LPC17_SYSCON_BASE+LPC17_SYSCON_PLL1STAT_OFFSET)
-#define LPC17_SYSCON_PLL1FEED (LPC17_SYSCON_BASE+LPC17_SYSCON_PLL1FEED_OFFSET)
-
-/* Clocking and power control - Peripheral power control registers */
-
-#define LPC17_SYSCON_PCON (LPC17_SYSCON_BASE+LPC17_SYSCON_PCON_OFFSET)
-#define LPC17_SYSCON_PCONP (LPC17_SYSCON_BASE+LPC17_SYSCON_PCONP_OFFSET)
-
-/* Clocking and power control -- Clock dividers */
-
-#define LPC17_SYSCON_EMCCLKSEL (LPC17_SYSCON_BASE+LPC17_SYSCON_EMCCLKSEL_OFFSET)
-#define LPC17_SYSCON_CCLKSEL (LPC17_SYSCON_BASE+LPC17_SYSCON_CCLKSEL_OFFSET)
-#define LPC17_SYSCON_USBCLKSEL (LPC17_SYSCON_BASE+LPC17_SYSCON_USBCLKSEL_OFFSET)
-
-/* 0x400f c110 - 0x400f c114: CAN Wake and Sleep Registers */
-
-/* Clocking and power control -- Clock source selection */
-
-#define LPC17_SYSCON_CLKSRCSEL (LPC17_SYSCON_BASE+LPC17_SYSCON_CLKSRCSEL_OFFSET)
-#define LPC17_SYSCON_CANSLEEPCLR (LPC17_SYSCON_BASE+LPC17_SYSCON_CANSLEEPCLR_OFFSET)
-#define LPC17_SYSCON_CANWAKEFLAGS (LPC17_SYSCON_BASE+LPC17_SYSCON_CANWAKEFLAGS_OFFSET)
-
-/* System control registers -- External Interrupts */
-
-#define LPC17_SYSCON_EXTINT (LPC17_SYSCON_BASE+LPC17_SYSCON_EXTINT_OFFSET)
-
-#define LPC17_SYSCON_EXTMODE (LPC17_SYSCON_BASE+LPC17_SYSCON_EXTMODE_OFFSET)
-#define LPC17_SYSCON_EXTPOLAR (LPC17_SYSCON_BASE+LPC17_SYSCON_EXTPOLAR_OFFSET)
-
-/* System control registers -- Reset */
-
-#define LPC17_SYSCON_RSID (LPC17_SYSCON_BASE+LPC17_SYSCON_RSID_OFFSET)
-
-/* System control registers -- Syscon Miscellaneous Registers */
-
-#define LPC17_SYSCON_MATRIXARB (LPC17_SYSCON_BASE+LPC17_SYSCON_MATRIXARB_OFFSET)
-#define LPC17_SYSCON_SCS (LPC17_SYSCON_BASE+LPC17_SYSCON_SCS_OFFSET)
-#define LPC17_SYSCON_PCLKSEL (LPC17_SYSCON_BASE+LPC17_SYSCON_PCLKSEL_OFFSET)
-#define LPC17_SYSCON_PBOOST (LPC17_SYSCON_BASE+LPC17_SYSCON_PBOOST_OFFSET)
-#define LPC17_SYSCON_SPIFICLKSEL (LPC17_SYSCON_BASE+LPC17_SYSCON_SPIFICLKSEL_OFFSET)
-#define LPC17_SYSCON_LCDCFG (LPC17_SYSCON_BASE+LPC17_SYSCON_LCDCFG_OFFSET)
-
-/* Device Interrupt Registers (Might be a error in the User Manual, might be at 0x5000c1c0) */
-
-#define LPC17_SYSCON_USBINTST (LPC17_SYSCON_BASE+LPC17_SYSCON_USBINTST_OFFSET)
-
-/* DMA Request Select Register */
-
-#define LPC17_SYSCON_DMAREQSEL (LPC17_SYSCON_BASE+LPC17_SYSCON_DMAREQSEL_OFFSET)
-
-/* More clocking and power control -- Utility */
-
-#define LPC17_SYSCON_CLKOUTCFG (LPC17_SYSCON_BASE+LPC17_SYSCON_CLKOUTCFG_OFFSET)
-
-
-/* Peripheral Reset Control */
-
-#define LPC17_SYSCON_RSTCON0 (LPC17_SYSCON_BASE+LPC17_SYSCON_RSTCON0_OFFSET)
-#define LPC17_SYSCON_RSTCON1 (LPC17_SYSCON_BASE+LPC17_SYSCON_RSTCON1_OFFSET)
-
-/* EMC Clock Control and Calibration */
-
-#define LPC17_SYSCON_EMCDLYCTL (LPC17_SYSCON_BASE+LPC17_SYSCON_EMCDLYCTL_OFFSET)
-#define LPC17_SYSCON_EMCCAL (LPC17_SYSCON_BASE+LPC17_SYSCON_EMCCAL_OFFSET)
-
-/* Register bit definitions *************************************************************************/
-/* Flash accelerator module */
- /* Bits 0-11: Reserved */
-#define SYSCON_FLASHCFG_TIM_SHIFT (12) /* Bits 12-15: FLASHTIM Flash access time */
-#define SYSCON_FLASHCFG_TIM_MASK (15 << SYSCON_FLASHCFG_TIM_SHIFT)
-# define SYSCON_FLASHCFG_TIM_0 (0) /* 1 CPU clock <= 20 MHz CPU clock */
-# define SYSCON_FLASHCFG_TIM_1 (1 << SYSCON_FLASHCFG_TIM_SHIFT) /* 2 CPU clock <= 40 MHz CPU clock */
-# define SYSCON_FLASHCFG_TIM_2 (2 << SYSCON_FLASHCFG_TIM_SHIFT) /* 3 CPU clock <= 60 MHz CPU clock */
-# define SYSCON_FLASHCFG_TIM_3 (3 << SYSCON_FLASHCFG_TIM_SHIFT) /* 4 CPU clock <= 80 MHz CPU clock */
-# define SYSCON_FLASHCFG_TIM_4 (4 << SYSCON_FLASHCFG_TIM_SHIFT) /* 5 CPU clock <= 100 MHz CPU clock
- * (Up to 120 Mhz for LPC1788x) */
-# define SYSCON_FLASHCFG_TIM_5 (5 << SYSCON_FLASHCFG_TIM_SHIFT) /* "safe" setting for any conditions */
- /* Bits 16-31: Reserved */
-/* Memory Mapping Control register (MEMMAP - 0x400F C040) */
-
-#define SYSCON_MEMMAP_MAP (1 << 0) /* Bit 0:
- * 0:Boot mode. A portion of the Boot ROM is mapped to address 0.
- * 1:User mode. The on-chip Flash memory is mapped to address 0 */
- /* Bits 1-31: Reserved */
-/* Clocking and power control -- Clock source selection */
-
-#define SYSCON_CLKSRCSEL_SHIFT (0) /* Bits 0: Clock selection */
-#define SYSCON_CLKSRCSEL_MASK (1 << SYSCON_CLKSRCSEL_SHIFT)
-# define SYSCON_CLKSRCSEL_INTRC (0 << SYSCON_CLKSRCSEL_SHIFT) /* PLL0 source = internal RC oscillator */
-# define SYSCON_CLKSRCSEL_MAIN (1 << SYSCON_CLKSRCSEL_SHIFT) /* PLL0 source = main oscillator */
- /* Bits 1-31: Reserved */
-/* Clocking and power control - Phase locked loops */
-/* PLL0/1 Control register */
-
-#define SYSCON_PLLCON_PLLE (1 << 0) /* Bit 0: PLL Enable */
- /* Bits 1-31: Reserved */
-/* PLL0/1 Configuration register */
-
-#define SYSCON_PLLCFG_MSEL_SHIFT (0) /* Bit 0-4: PLL Multiplier value */
-#define SYSCON_PLLCFG_MSEL_MASK (0x1f << SYSCON_PLLCFG_MSEL_SHIFT)
-#define SYSCON_PLLCFG_PSEL_SHIFT (5) /* Bit 5-6: PLL Pre-Divider value */
-#define SYSCON_PLLCFG_PSEL_MASK (3 << SYSCON_PLLCFG_PSEL_SHIFT)
-
-/* PLL0/1 Status register */
-
-#define SYSCON_PLLSTAT_MSEL_SHIFT (0) /* Bit 0-4: PLLMultiplier value readback */
-#define SYSCON_PLLSTAT_MSEL_MASK (0x1f << SYSCON_PLLSTAT_MSEL_SHIFT)
-#define SYSCON_PLLSTAT_PSEL_SHIFT (5) /* Bit 5-6: PLL Pre-Divider value readback */
-#define SYSCON_PLLSTAT_PSEL_MASK (3 << SYSCON_PLLSTAT_PSEL_SHIFT)
- /* Bit 7: Reserved */
-#define SYSCON_PLLSTAT_PLLE (1 << 8) /* Bit 8: PLL enable readback */
-#define SYSCON_PLLSTAT_PLLC (1 << 9) /* Bit 9: PLL connect readback */
-#define SYSCON_PLLSTAT_PLOCK (1 << 10) /* Bit 10: PLL lock status */
- /* Bits 11-31: Reserved */
-/* PLL0/1 Feed register */
-
-#define SYSCON_PLLFEED_SHIFT (0) /* Bit 0-7: PLL0/1 feed sequence */
-#define SYSCON_PLLFEED_MASK (0xff << SYSCON_PLLFEED_SHIFT)
- /* Bits 8-31: Reserved */
-/* Clocking and power control -- Clock dividers */
-
-/* EMC Clock Selection Register */
-
-#define SYSCON_EMCDIV (1 << 0) /* Bit 0: EMC Clock rate relative to CPU */
- /* 0: EMC uses same clock as CPU */
- /* 1: EMC uses half the rate of CPU */
- /* Bits 1-31: Reserved */
-/* EMC Clock Selection Register */
-
-#define SYSCON_EMCCLKSEL_CCLK_DIV2 (1 << 0) /* Bit 0: 1=EMC used CPU clock / 2 */
-#define SYSCON_EMCCLKSEL_CCLK_DIV1 (0) /* 0=EMC used CPU clock */
-
-/* CPU Clock Selection Register */
-
-#define SYSCON_CCLKSEL_CCLKDIV_SHIFT (0) /* 0-4: Divide value for CPU clock (CCLK) */
-#define SYSCON_CCLKSEL_CCLKDIV_MASK (0x1f << SYSCON_CCLKSEL_CCLKDIV_SHIFT)
-# define SYSCON_CCLKSEL_CCLKDIV(n) ((n-1) << SYSCON_CCLKSEL_CCLKDIV_SHIFT) /* n = 2 - 31 */
- /* Bits 5-7: Reserved */
-#define SYSCON_CCLKSEL_CCLKSEL (1 << 8) /* Bit 8: Select input clock to CPU clock divider */
- /* 0: Sysclk used as input to CCLKDIV */
- /* 1: Main PLL used as input to CCLKDIV */
- /* Bits 9-31: Reserved */
-/* USB Clock Selection register */
-
-#define SYSCON_USBCLKSEL_USBDIV_SHIFT (0) /* Bits 0-4: PLL0/1 divide value USB clock */
-#define SYSCON_USBCLKSEL_USBDIV_MASK (0x1f << SYSCON_USBCLKSEL_USBDIV_SHIFT)
-# define SYSCON_USBCLKSEL_USBDIV_DIV1 (1 << SYSCON_USBCLKSEL_USBDIV_SHIFT) /* PLL0/1 output must be 48MHz */
-# define SYSCON_USBCLKSEL_USBDIV_DIV2 (2 << SYSCON_USBCLKSEL_USBDIV_SHIFT) /* PLL0/1 output must be 96MHz */
-# define SYSCON_USBCLKSEL_USBDIV_DIV3 (3 << SYSCON_USBCLKSEL_USBDIV_SHIFT) /* PLL0/1 output must be 144MHz */
- /* Bits 5-7: Reserved */
-#define SYSCON_USBCLKSEL_USBSEL_SHIFT (8) /* Bits 8-9: Input clock to USBDIV */
-#define SYSCON_USBCLKSEL_USBSEL_MASK (3 << SYSCON_USBCLKSEL_USBSEL_SHIFT)
-#define SYSCON_USBCLKSEL_USBSEL_PLL0 (1 << SYSCON_USBCLKSEL_USBSEL_SHIFT) /* 01: PLL0 is used as input clock to USBDIV */
-#define SYSCON_USBCLKSEL_USBSEL_PLL1 (2 << SYSCON_USBCLKSEL_USBSEL_SHIFT) /* 10: PLL1 is used as input clock to USBDIV */
- /* 11: unused */
- /* Bits 10-31: Reserved */
-/* CAN0/1 Sleep Clear Register */
- /* Bit 0: Reserved */
-#define SYSCON_CANSLEEPCLR_SHIFT (1) /* Bits 1-2: CAN0/1 Sleep Status and Control */
-#define SYSCON_CANSLEEPCLR_MASK (3 << SYSCON_CANSLEEPCLR_SHIFT) /* */
-#define SYSCON_CANSLEEPCLR_CAN1 (1 << SYSCON_CANSLEEPCLR_SHIFT) /* CAN1 Sleep Status */
-#define SYSCON_CANSLEEPCLR_CAN2 (2 << SYSCON_CANSLEEPCLR_SHIFT) /* CAN2 Sleep Status */
- /* Read 1: CAN channel in sleep mode */
- /* Write 1: CAN channel clocks restored */
- /* Bits 3-31: Reserved */
-/* CAN0/1 WakeUp Flags Register */
- /* Bit 0: Reserved */
-#define SYSCON_CANWAKEFLAGS_SHIFT (1) /* Bits 1-2: CAN0/1 WakeUp Status */
-#define SYSCON_CANWAKEFLAGS_MASK (3 << SYSCON_CANWAKEFLAGS_SHIFT) /* */
-#define SYSCON_CANWAKEFLAGS_CAN1 (1 << SYSCON_CANWAKEFLAGS_SHIFT) /* CAN1 WakeUp Status */
-#define SYSCON_CANWAKEFLAGS_CAN2 (2 << SYSCON_CANWAKEFLAGS_SHIFT) /* CAN2 WakeUp Status */
- /* Read 1: CAN channel falling edge occur on receive line */
- /* Write 1: CAN channel clears wakeup flag bit */
- /* Bits 3-31: Reserved */
-/* Peripheral Clock Selection register */
-/* PCLK is common to all peripheral */
-
-#define SYSCON_PCLKSEL_PCLKDIV_SHIFT (0) /* Bits 0-4: Clock divide value for all APB peripherals */
-#define SYSCON_PCLKSEL_PCLKDIV_MASK (0x1f << SYSCON_PCLKSEL_PCLKDIV_SHIFT)
-# define SYSCON_PCLKSEL_PCLKDIV(n) ((n) & SYSCON_PCLKSEL_PCLKDIV_MASK) /* n = 1 - 31 */
- /* Bits 5-31: Reserved */
-/* Power Boost Control Register */
-
-#define SYSCON_PBOOST_BOOST_SHIFT (0) /* Bits 0-1: Boost control bits */
-#define SYSCON_PBOOST_BOOST_MASK (3 << SYSCON_PBOOST_BOOST_SHIFT)
-#define SYSCON_PBOOST_BOOST_OFF (0) /* Boost OFF, operation must be below 100MHz */
-#define SYSCON_PBOOST_BOOST_ON (3) /* Boost ON, operation upto 120MHz allowed */
- /* Bits 2-31: Reserved */
-/* SPIFI Clock Selection Register */
-
-#define SYSCON_SPIFICLKSEL_SPIFIDIV_SHIFT (0) /* Bits 0-4: divide value for SPIFI clock */
-#define SYSCON_SPIFICLKSEL_SPIFIDIV_MASK (0x1f << SYSCON_SPIFICLKSEL_SPIFIDIV_SHIFT)
-# define SYSCON_SPIFICLKSEL_SPIFIDIV(n) ((n-1) << SYSCON_SPIFICLKSEL_SPIFIDIV_SHIFT) /* n = 2 - 31 */
- /* Bits 5-7: Reserved */
-#define SYSCON_SPIFICLKSEL_SPIFISEL_SHIFT (8) /* Bits 8-9: Selects input clock for SPIFI clock divider */
-#define SYSCON_SPIFICLKSEL_SPIFISEL_MASK (3 << SYSCON_SPIFICLKSEL_SPIFISEL_SHIFT)
-#define SYSCON_SPIFICLKSEL_SPIFISEL_SYSCLK (0) /* Sysclk used as input to SPIFIDIV */
-#define SYSCON_SPIFICLKSEL_SPIFISEL_PLL0 (1 << SYSCON_SPIFICLKSEL_SPIFISEL_SHIFT) /* Main PLL used as input to SPIFIDIV */
-#define SYSCON_SPIFICLKSEL_SPIFISEL_PLL1 (2 << SYSCON_SPIFICLKSEL_SPIFISEL_SHIFT) /* Alt PLL used as input to SPIFIDIV */
- /* Bits 10-31: Reserved */
-/* LCD Configuration Register */
-
-#define SYSCON_LCDCFG_CLKDIV_SHIFT (0) /* Bits 0-4: LCD Panel clock prescaler */
-#define SYSCON_LCDCFG_CLKDIV_MASK (0x1f << SYSCON_LCDCFG_CLKDIV_SHIFT)
-#define SYSCON_LCDCFG_CLKDIV(n) ((n-1) << SYSCON_LCDCFG_CLKDIV_SHIFT) /* n = 1 - 32 */
- /* Bits 5-31: Reserved */
-/* Clocking and power control - Peripheral power control registers */
-/* Power Control Register */
-
-#define SYSCON_PCON_PM0 (1 << 0) /* Bit 0: Power mode control bit 0 */
-#define SYSCON_PCON_PM1 (1 << 1) /* Bit 1: Power mode control bit 1 */
-#define SYSCON_PCON_BODRPM (1 << 2) /* Bit 2: Brown-Out Reduced Power Mode */
-#define SYSCON_PCON_BOGD (1 << 3) /* Bit 3: Brown-Out Global Disable */
-#define SYSCON_PCON_BORD (1 << 4) /* Bit 4: Brown-Out Reset Disable */
- /* Bits 5-7: Reserved */
-#define SYSCON_PCON_SMFLAG (1 << 8) /* Bit 8: Sleep Mode entry flag */
-#define SYSCON_PCON_DSFLAG (1 << 9) /* Bit 9: Deep Sleep entry flag */
-#define SYSCON_PCON_PDFLAG (1 << 10) /* Bit 10: Power-down entry flag */
-#define SYSCON_PCON_DPDFLAG (1 << 11) /* Bit 11: Deep Power-down entry flag */
- /* Bits 12-31: Reserved */
-/* Power Control for Peripherals Register */
-
-#define SYSCON_PCONP_PCLCD (1 << 0) /* Bit 0: LCD power/clock control */
-#define SYSCON_PCONP_PCTIM0 (1 << 1) /* Bit 1: Timer/Counter 0 power/clock control */
-#define SYSCON_PCONP_PCTIM1 (1 << 2) /* Bit 2: Timer/Counter 1 power/clock control */
-#define SYSCON_PCONP_PCUART0 (1 << 3) /* Bit 3: UART0 power/clock control */
-#define SYSCON_PCONP_PCUART1 (1 << 4) /* Bit 4: UART1 power/clock control */
-#define SYSCON_PCONP_PCPWM0 (1 << 5) /* Bit 5: PWM0 power/clock control */
-#define SYSCON_PCONP_PCPWM1 (1 << 6) /* Bit 6: PWM1 power/clock control */
-#define SYSCON_PCONP_PCI2C0 (1 << 7) /* Bit 7: I2C0 power/clock control */
-#define SYSCON_PCONP_PCSPI (1 << 8) /* Bit 8: SPI power/clock control */
-#define SYSCON_PCONP_PCRTC (1 << 9) /* Bit 9: RTC power/clock control */
-#define SYSCON_PCONP_PCSSP1 (1 << 10) /* Bit 10: SSP 1 power/clock control */
-#define SYSCON_PCONP_PCEMC (1 << 11) /* Bit 11: External Memory */
-#define SYSCON_PCONP_PCADC (1 << 12) /* Bit 12: A/D converter (ADC) power/clock control */
-#define SYSCON_PCONP_PCCAN1 (1 << 13) /* Bit 13: CAN Controller 1 power/clock control */
-#define SYSCON_PCONP_PCCAN2 (1 << 14) /* Bit 14: CAN Controller 2 power/clock control */
-#define SYSCON_PCONP_PCGPIO (1 << 15) /* Bit 15: GPIOs power/clock enable */
-#define SYSCON_PCONP_PCSPIFI (1 << 16) /* Bit 16: SPI Flash Interface power/clock control */
-#define SYSCON_PCONP_PCMCPWM (1 << 17) /* Bit 17: Motor Control PWM */
-#define SYSCON_PCONP_PCQEI (1 << 18) /* Bit 18: Quadrature Encoder power/clock control */
-#define SYSCON_PCONP_PCI2C1 (1 << 19) /* Bit 19: I2C1 power/clock control */
-#define SYSCON_PCONP_PCSSP2 (1 << 20) /* Bit 20: SSP2 power/clock control */
-#define SYSCON_PCONP_PCSSP0 (1 << 21) /* Bit 21: SSP0 power/clock control */
-#define SYSCON_PCONP_PCTIM2 (1 << 22) /* Bit 22: Timer 2 power/clock control */
-#define SYSCON_PCONP_PCTIM3 (1 << 23) /* Bit 23: Timer 3 power/clock control */
-#define SYSCON_PCONP_PCUART2 (1 << 24) /* Bit 24: UART 2 power/clock control */
-#define SYSCON_PCONP_PCUART3 (1 << 25) /* Bit 25: UART 3 power/clock control */
-#define SYSCON_PCONP_PCI2C2 (1 << 26) /* Bit 26: I2C 2 power/clock control */
-#define SYSCON_PCONP_PCI2S (1 << 27) /* Bit 27: I2S power/clock control */
-#define SYSCON_PCONP_PCSDC (1 << 28) /* Bit 28: SD Card power/clock control */
-#define SYSCON_PCONP_PCGPDMA (1 << 29) /* Bit 29: GPDMA function power/clock control */
-#define SYSCON_PCONP_PCENET (1 << 30) /* Bit 30: Ethernet block power/clock control */
-#define SYSCON_PCONP_PCUSB (1 << 31) /* Bit 31: USB power/clock control */
-
-/* More clocking and power control -- Utility */
-
-#define SYSCON_CLKOUTCFG_SEL_SHIFT (0) /* Bits 0-3: Selects clock source for CLKOUT */
-#define SYSCON_CLKOUTCFG_SEL_MASK (15 << SYSCON_CLKOUTCFG_SEL_SHIFT)
-# define SYSCON_CLKOUTCFG_SEL_CPU (0 << SYSCON_CLKOUTCFG_SEL_SHIFT) /* CLKOUT source=CPU clock */
-# define SYSCON_CLKOUTCFG_SEL_MAIN (1 << SYSCON_CLKOUTCFG_SEL_SHIFT) /* CLKOUT source=main osc */
-# define SYSCON_CLKOUTCFG_SEL_INTRC (2 << SYSCON_CLKOUTCFG_SEL_SHIFT) /* CLKOUT source=internal RC osc */
-# define SYSCON_CLKOUTCFG_SEL_USB (3 << SYSCON_CLKOUTCFG_SEL_SHIFT) /* CLKOUT source=USB clock */
-# define SYSCON_CLKOUTCFG_SEL_RTC (4 << SYSCON_CLKOUTCFG_SEL_SHIFT) /* CLKOUT source=RTC osc */
-# define SYSCON_CLKOUTCFG_SEL_SPIFI (5 << SYSCON_CLKOUTCFG_SEL_SHIFT) /* CLKOUT source=SPIFI osc */
-#define SYSCON_CLKOUTCFG_DIV_SHIFT (4) /* Bits 4-7: CLKOUT divisor */
-#define SYSCON_CLKOUTCFG_DIV_MASK (15 << SYSCON_CLKOUTCFG_DIV_SHIFT)
-# define SYSCON_CLKOUTCFG_DIV(n) ((n-1) << SYSCON_CLKOUTCFG_DIV_SHIFT) /* n=1..16 */
-#define SYSCON_CLKOUTCFG_EN (1 << 8) /* Bit 8: CLKOUT enable control */
-#define SYSCON_CLKOUTCFG_ACT (1 << 9) /* Bit 9: CLKOUT activity indication */
- /* Bits 10-31: Reserved */
-/* System control registers -- External Interrupts */
-/* External Interrupt Flag register */
-
-#define SYSCON_EXTINT_EINT0 (1 << 0) /* Bit 0: EINT0 */
-#define SYSCON_EXTINT_EINT1 (1 << 1) /* Bit 1: EINT1 */
-#define SYSCON_EXTINT_EINT2 (1 << 2) /* Bit 2: EINT2 */
-#define SYSCON_EXTINT_EINT3 (1 << 3) /* Bit 3: EINT3 */
- /* Bits 4-31: Reserved */
-/* External Interrupt Mode register */
-
-#define SYSCON_EXTMODE_EINT0 (1 << 0) /* Bit 0: 1=EINT0 edge sensitive */
-#define SYSCON_EXTMODE_EINT1 (1 << 1) /* Bit 1: 1=EINT1 edge sensitive */
-#define SYSCON_EXTMODE_EINT2 (1 << 2) /* Bit 2: 1=EINT2 edge sensitive */
-#define SYSCON_EXTMODE_EINT3 (1 << 3) /* Bit 3: 1=EINT3 edge sensitive */
- /* Bits 4-31: Reserved */
-/* External Interrupt Polarity register */
-
-#define SYSCON_EXTPOLAR_EINT0 (1 << 0) /* Bit 0: 1=EINT0 high active/rising edge */
-#define SYSCON_EXTPOLAR_EINT1 (1 << 1) /* Bit 1: 1=EINT1 high active/rising edge */
-#define SYSCON_EXTPOLAR_EINT2 (1 << 2) /* Bit 2: 1=EINT2 high active/rising edge */
-#define SYSCON_EXTPOLAR_EINT3 (1 << 3) /* Bit 3: 1=EINT3 high active/rising edge */
- /* Bits 4-31: Reserved */
-/* System control registers -- Reset */
-/* Reset Source Identification Register */
-
-#define SYSCON_RSID_POR (1 << 0) /* Bit 0: Power on reset */
-#define SYSCON_RSID_EXTR (1 << 1) /* Bit 1: external RESET signal */
-#define SYSCON_RSID_WDTR (1 << 2) /* Bit 2: Watchdog Timer time out w/WDTRESET */
-#define SYSCON_RSID_BODR (1 << 3) /* Bit 3: Brown out detection */
-#define SYSCON_RSID_SYSRESET (1 << 4) /* Bit 4: System Reset */
-#define SYSCON_RSID_LOCKUP (1 << 5) /* Bit 5: Lockup Reset */
- /* Bits 6-31: Reserved */
-/* System control registers -- Matrix Arbitration Priorities */
-
-# define SYSCON_MATRIXARB_PRI_LOWEST (0)
-# define SYSCON_MATRIXARB_PRI_LOW (1)
-# define SYSCON_MATRIXARB_PRI_HIGH (2)
-# define SYSCON_MATRIXARB_PRI_HIGHEST (3)
-
-#define SYSCON_MATRIXARB_PRI_ICODE_SHIFT (0) /* Bits 0-1: I-Code bus priority (should be lower than D-Code) */
-#define SYSCON_MATRIXARB_PRI_ICODE_MASK (3 << SYSCON_MATRIXARB_PRI_ICODE_SHIFT)
-# define SYSCON_MATRIXARB_PRI_ICODE(n) ((n) << SYSCON_MATRIXARB_PRI_ICODE_SHIFT)
-#define SYSCON_MATRIXARB_PRI_DCODE_SHIFT (2) /* Bits 2-3: D-Code bus priority */
-#define SYSCON_MATRIXARB_PRI_DCODE_MASK (3 << SYSCON_MATRIXARB_PRI_DCODE_SHIFT)
-# define SYSCON_MATRIXARB_PRI_DCODE(n) ((n) << SYSCON_MATRIXARB_PRI_DCODE_SHIFT)
-#define SYSCON_MATRIXARB_PRI_SYS_SHIFT (4) /* Bits 4-5: System bus priority */
-#define SYSCON_MATRIXARB_PRI_SYS_MASK (3 << SYSCON_MATRIXARB_PRI_SYS_SHIFT)
-# define SYSCON_MATRIXARB_PRI_SYS(n) ((n) << SYSCON_MATRIXARB_PRI_SYS_SHIFT)
-#define SYSCON_MATRIXARB_PRI_GPDMA_SHIFT (6) /* Bits 6-7: General Purpose DMA priority */
-#define SYSCON_MATRIXARB_PRI_GPDMA_MASK (3 << SYSCON_MATRIXARB_PRI_GPDMA_SHIFT)
-# define SYSCON_MATRIXARB_PRI_GPDMA(n) ((n) << SYSCON_MATRIXARB_PRI_GPDMA_SHIFT)
-#define SYSCON_MATRIXARB_PRI_ETH_SHIFT (8) /* Bits 8-9: Ethernet DMA priority */
-#define SYSCON_MATRIXARB_PRI_ETH_MASK (3 << SYSCON_MATRIXARB_PRI_ETH_SHIFT)
-# define SYSCON_MATRIXARB_PRI_ETH(n) ((n) << SYSCON_MATRIXARB_PRI_ETH_SHIFT)
-#define SYSCON_MATRIXARB_PRI_LCD_SHIFT (10) /* Bits 10-11: LCD DMA priority */
-#define SYSCON_MATRIXARB_PRI_LCD_MASK (3 << SYSCON_MATRIXARB_PRI_LCD_SHIFT)
-# define SYSCON_MATRIXARB_PRI_LCD(n) ((n) << SYSCON_MATRIXARB_PRI_LCD_SHIFT)
-#define SYSCON_MATRIXARB_PRI_USB_SHIFT (12) /* Bits 12-13: USB DMA priority */
-#define SYSCON_MATRIXARB_PRI_USB_MASK (3 << SYSCON_MATRIXARB_PRI_USB_SHIFT)
-# define SYSCON_MATRIXARB_PRI_USB(n) ((n) << SYSCON_MATRIXARB_PRI_USB_SHIFT)
- /* Bits 14-15: Reserved */
-#define SYSCON_MATRIXARB_ROM_LAT_SHIFT (16) /* Bit 16: ROM Latency select (should always be zero) */
-#define SYSCON_MATRIXARB_ROM_LAT (1 << SYSCON_MATRIXARB_ROM_LAT_SHIFT)
- /* Bits 17-31: Reserved */
-
-#define SYSCON_MATRIXARB_PRI_MASK (0x00013fff)
-
-/* System control registers -- Syscon Miscellaneous Registers */
-
-#define SYSCON_SCS_EMCSC (1 << 0) /* Bit 0: EMC shift control */
-#define SYSCON_SCS_EMCRD (1 << 1) /* Bit 1: EMC reset disable */
-#define SYSCON_SCS_EMCBC (1 << 2) /* Bit 2: EMC burst control */
-#define SYSCON_SCS_MCIPWRAL (1 << 3) /* Bit 3: MCI power active level */
-#define SYSCON_SCS_OSCRS (1 << 4) /* Bit 4: Main oscillator range select */
-#define SYSCON_SCS_OSCEN (1 << 5) /* Bit 5: Main oscillator enable */
-#define SYSCON_SCS_OSCSTAT (1 << 6) /* Bit 6: Main oscillator status */
- /* Bits 7-31: Reserved */
-/* Device Interrupt Registers */
-/* USB Interrupt Status register */
-
-#define SYSCON_USBINTST_REQLP (1 << 0) /* Bit 0: Low priority interrupt line status */
-#define SYSCON_USBINTST_REQHP (1 << 1) /* Bit 1: High priority interrupt line status */
-#define SYSCON_USBINTST_REQDMA (1 << 2) /* Bit 2: DMA interrupt line status */
-#define SYSCON_USBINTST_HOSTINT (1 << 3) /* Bit 3: USB host interrupt line status */
-#define SYSCON_USBINTST_ATXINT (1 << 4) /* Bit 4: External ATX interrupt line status */
-#define SYSCON_USBINTST_OTGINT (1 << 5) /* Bit 5: OTG interrupt line status */
-#define SYSCON_USBINTST_I2CINT (1 << 6) /* Bit 6: I2C module interrupt line status */
- /* Bit 7: Reserved */
-#define SYSCON_USBINTST_NEEDCLK (1 << 8) /* Bit 8: USB need clock indicator */
- /* Bits 9-30: Reserved */
-#define SYSCON_USBINTST_ENINTS (1 << 31) /* Bit 31: Enable all USB interrupts */
-
-/* DMA Request Select Register */
-
-#define SYSCON_DMAREQSEL_INP0 (1 << 0) /* Bit 0: Input 0 0=unused 1=Timer 0 match 0 */
-#define SYSCON_DMAREQSEL_INP1 (1 << 1) /* Bit 1: Input 1 0=SD 1=Timer 0 match 1 */
-#define SYSCON_DMAREQSEL_INP2 (1 << 2) /* Bit 2: Input 2 0=SSP0 TX 1=Timer 1 match 0 */
-#define SYSCON_DMAREQSEL_INP3 (1 << 3) /* Bit 3: Input 3 0=SSP0 RX 1=Timer 1 match 1 */
-#define SYSCON_DMAREQSEL_INP4 (1 << 4) /* Bit 4: Input 4 0=SSP1 TX 1=Timer 2 match 0 */
-#define SYSCON_DMAREQSEL_INP5 (1 << 5) /* Bit 5: Input 5 0=SSP1 RX 1=Timer 2 match 1 */
-#define SYSCON_DMAREQSEL_INP6 (1 << 6) /* Bit 6: Input 6 0=SSP2 TX 1=I2S0 */
-#define SYSCON_DMAREQSEL_INP7 (1 << 7) /* Bit 7: Input 7 0=SSP2 RX 1=I2S1 */
- /* Bits 8-9: Reserved */
-#define SYSCON_DMAREQSEL_INP10 (1 << 10) /* Bit 10: Input 10 0=UART0 TX 1=UART3 TX */
-#define SYSCON_DMAREQSEL_INP11 (1 << 11) /* Bit 11: Input 11 0=UART0 RX 1=UART3 RX */
-#define SYSCON_DMAREQSEL_INP12 (1 << 12) /* Bit 12: Input 12 0=UART1 TX 1=UART4 TX */
-#define SYSCON_DMAREQSEL_INP13 (1 << 13) /* Bit 13: Input 13 0=UART1 RX 1=UART4 RX */
-#define SYSCON_DMAREQSEL_INP14 (1 << 14) /* Bit 14: Input 14 0=UART2 TX 1=Timer 3 match 0 */
-#define SYSCON_DMAREQSEL_INP15 (1 << 15) /* Bit 15: Input 15 0=UART2 RX 1=Timer 3 match 1 */
- /* Bits 16-31: Reserved */
-/* Reset Control Register 0 */
-
-#define SYSCON_RSTCON0_RSTLCD (1 << 0) /* LCD controller reset control bit */
-#define SYSCON_RSTCON0_RSTTIM0 (1 << 1) /* Timer/Counter 0 reset control bit */
-#define SYSCON_RSTCON0_RSTTIM1 (1 << 2) /* Timer/Counter 1 reset control bit */
-#define SYSCON_RSTCON0_RSTUART0 (1 << 3) /* UART0 reset control bit */
-#define SYSCON_RSTCON0_RSTUART1 (1 << 4) /* UART1 reset control bit */
-#define SYSCON_RSTCON0_RSTPWM0 (1 << 5) /* PWM0 reset control bit */
-#define SYSCON_RSTCON0_RSTPWM1 (1 << 6) /* PWM1 reset control bit */
-#define SYSCON_RSTCON0_RSTI2C0 (1 << 7) /* The I2C0 interface reset control bit */
-#define SYSCON_RSTCON0_RSTUART4 (1 << 8) /* UART4 reset control bit */
-#define SYSCON_RSTCON0_RSTRTC (1 << 9) /* RTC and Event Monitor/Recorder reset control bit. RTC reset is limited */
-#define SYSCON_RSTCON0_RSTSSP1 (1 << 10) /* The SSP 1 interface reset control bit */
-#define SYSCON_RSTCON0_RSTEMC (1 << 11) /* External Memory Controller reset control bit */
-#define SYSCON_RSTCON0_RSTADC (1 << 12) /* A/D converter (ADC) reset control bit */
-#define SYSCON_RSTCON0_RSTCAN1 (1 << 13) /* CAN Controller 1 reset control bit */
- /* Note: The CAN acceptance filter may be reset by 0
- * a separate bit in the RSTCON1 register. */
-#define SYSCON_RSTCON0_RSTCAN2 (1 << 14) /* CAN Controller 2 reset control bit */
- /* Note: The CAN acceptance filter may be reset by 0
- * a separate bit in the RSTCON1 register */
-#define SYSCON_RSTCON0_RSTGPIO (1 << 15) /* Reset control bit for GPIO, and GPIO interrupts */
- /* Note: IOCON may be reset by a 0
- * separate bit in the RSTCON1 register */
-#define SYSCON_RSTCON0_RSTSPIFI (1 << 16) /* SPI Flash Interface reset control bit (LPC1773 only) */
-#define SYSCON_RSTCON0_RSTMCPWM (1 << 17) /* Motor Control PWM reset control bit */
-#define SYSCON_RSTCON0_RSTQEI (1 << 18) /* Quadrature Encoder Interface reset control bit */
-#define SYSCON_RSTCON0_RSTI2C1 (1 << 19) /* The I2C1 interface reset control bit */
-#define SYSCON_RSTCON0_RSTSSP2 (1 << 20) /* The SSP2 interface reset control bit */
-#define SYSCON_RSTCON0_RSTSSP0 (1 << 21) /* The SSP0 interface reset control bit */
-#define SYSCON_RSTCON0_RSTTIM2 (1 << 22) /* Timer 2 reset control bit */
-#define SYSCON_RSTCON0_RSTTIM3 (1 << 23) /* Timer 3 reset control bit */
-#define SYSCON_RSTCON0_RSTUART2 (1 << 24) /* UART 2 reset control bit */
-#define SYSCON_RSTCON0_RSTUART3 (1 << 25) /* UART 3 reset control bit */
-#define SYSCON_RSTCON0_RSTI2C2 (1 << 26) /* I2C2 interface reset control bit.*/
-#define SYSCON_RSTCON0_RSTI2S (1 << 27) /* I2S interface reset control bit */
-#define SYSCON_RSTCON0_RSTSDC (1 << 28) /* SD Card interface reset control bit */
-#define SYSCON_RSTCON0_RSTGPDMA (1 << 29) /* GPDMA function reset control bit */
-
-#define SYSCON_RSTCON0_RSTENET (1 << 30) /* Ethernet block reset control bit */
-#define SYSCON_RSTCON0_RSTUSB (1 << 31) /* USB interface reset control bit */
-
-/* Reset Control Register 1 */
-
-#define SYSCON_RSTCON1_RSTIOCON (1 << 0) /* Reset control bit for the IOCON registers */
-#define SYSCON_RSTCON1_RSTDAC (1 << 1) /* D/A converter (DAC) reset control bit */
-#define SYSCON_RSTCON1_RSTCANACC (1 << 2) /* CAN acceptance filter reset control bit */
- /* Bits 3-31: Reserved */
-/* Delay Control Register - EMC */
- /* Delay values multiplied by 250 picoseconds */
-#define SYSCON_EMCDLYCTL_CMDDLY_SHIFT (0) /* Bits 0-4: Delay value for EMC outputs in command delayed mode */
-#define SYSCON_EMCDLYCTL_CMDDLY_MASK (0x1f << SYSCON_EMCDLYCTL_CMDDLY_SHIFT)
-# define SYSCON_EMCDLYCTL_CMDDLY(n) ((n-1) << SYSCON_EMCDLYCTL_CMDDLY_SHIFT) /* n = 3 - 32 */
- /* Bits 5-7: Reserved */
-#define SYSCON_EMCDLYCTL_FBCLKDLY_SHIFT (8) /* Bits 8-12: Delay value for the feedback clock that controls input data sampling */
-#define SYSCON_EMCDLYCTL_FBCLKDLY_MASK (0x1f << SYSCON_EMCDLYCTL_FBCLKDLY_SHIFT)
-#define SYSCON_EMCDLYCTL_FBCLKDLY(n) ((n-1)<< SYSCON_EMCDLYCTL_FBCLKDLY_SHIFT) /* n = 3 - 32 */
- /* Bits 13-15: Reserved */
-#define SYSCON_EMCDLYCTL_CLKOUT0DLY_SHIFT (16) /* Bits 16-20: Delay value for the CLKOUT0 output */
-#define SYSCON_EMCDLYCTL_CLKOUT0DLY_MASK (0x1f << SYSCON_EMCDLYCTL_CLKOUT0DLY_SHIFT)
-# define SYSCON_EMCDLYCTL_CLKOUT0DLY(n) ((n-1) << SYSCON_EMCDLYCTL_CLKOUT0DLY_SHIFT) /* n = 3 - 32 */
- /* Bits 21-23: Reserved */
-#define SYSCON_EMCDLYCTL_CLKOUT1DLY_SHIFT (24) /* Bits 24-28: Delay value for the CLKOUT1 output */
-#define SYSCON_EMCDLYCTL_CLKOUT1DLY_MASK (0x1f << SYSCON_EMCDLYCTL_CLKOUT1DLY_SHIFT)
-# define SYSCON_EMCDLYCTL_CLKOUT1DLY(n) ((n-1) << SYSCON_EMCDLYCTL_CLKOUT1DLY_SHIFT) /* n = 3 - 32 */
- /* Bits 29-31: Reserved */
-/* Calibration Register - EMC */
-
-#define SYSCON_EMCCAL_CALVALUE_SHIFT (0) /* Bits 0-7: Ring oscillator count during 32 clocks of Internal RC */
-#define SYSCON_EMCCAL_CALVALUE_MASK (0xff << SYSCON_EMCCAL_CALVALUE_SHIFT)
- /* Bits 8-13: Reserved */
-#define SYSCON_EMCCAL_START_SHIFT (14) /* Bit 14: Start control bit for EMC calibration counter */
-#define SYSCON_EMCCAL_START_MASK (1 << SYSCON_EMCCAL_START_SHIFT)
-# define SYSCON_EMCCAL_START (1) /* Automatically cleared when measurement is done */
-#define SYSCON_EMCCAL_DONE_SHIFT (15) /* Bit 15: Measurement completetion flag bit */
-#define SYSCON_EMCCAL_DONE_MASK (1 << SYSCON_EMCCAL_DONE_SHIFT)
- /* Automatically cleared when START bit is set */
- /* Bits 16-31: Reserved */
-
-/* Compatibility Definitions ************************************************************************/
-/* Need in lpc17_clockconfig.h for compatibility with the LPC176x family: */
-
-#define SYSCON_PLLCON_PLLC (0) /* Bit does not exist in LPC178x family */
-#define SYSCON_PLL0STAT_PLLE SYSCON_PLLSTAT_PLLE /* PLL enable readback */
-#define SYSCON_PLL0STAT_PLLC SYSCON_PLLSTAT_PLLC /* PLL connect readback */
-#define SYSCON_PLL0STAT_PLOCK SYSCON_PLLSTAT_PLOCK /* PLL lock status */
-#define SYSCON_PLL1STAT_PLLE SYSCON_PLLSTAT_PLLE /* PLL enable readback */
-#define SYSCON_PLL1STAT_PLLC SYSCON_PLLSTAT_PLLC /* PLL connect readback */
-#define SYSCON_PLL1STAT_PLOCK SYSCON_PLLSTAT_PLOCK /* PLL lock status */
-
-/****************************************************************************************************
- * Public Types
- ****************************************************************************************************/
-
-/****************************************************************************************************
- * Public Data
- ****************************************************************************************************/
-
-/****************************************************************************************************
- * Public Functions
- ****************************************************************************************************/
-
-#endif /* __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC178X_SYSCON_H */
diff --git a/arch/arm/src/lpc17xx/hardware/lpc17_can.h b/arch/arm/src/lpc17xx/hardware/lpc17_can.h
deleted file mode 100644
index 2a9172ada94..00000000000
--- a/arch/arm/src/lpc17xx/hardware/lpc17_can.h
+++ /dev/null
@@ -1,510 +0,0 @@
-/************************************************************************************
- * arch/arm/src/lpc17xx/hardware/lpc17_can.h
- *
- * Copyright (C) 2010-2012, 2013 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. 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.
- * 3. Neither the name NuttX 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 THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- ************************************************************************************/
-
-#ifndef __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC17_CHIP_CAN_H
-#define __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC17_CHIP_CAN_H
-
-/************************************************************************************
- * Included Files
- ************************************************************************************/
-
-#include
-
-#include "chip.h"
-#include "hardware/lpc17_memorymap.h"
-
-/************************************************************************************
- * Pre-processor Definitions
- ************************************************************************************/
-
-/* Register offsets *****************************************************************/
-/* CAN acceptance filter registers */
-
-#define LPC17_CANAF_AFMR_OFFSET 0x0000 /* Acceptance Filter Register */
-#define LPC17_CANAF_SFFSA_OFFSET 0x0004 /* Standard Frame Individual Start Address Register */
-#define LPC17_CANAF_SFFGRPSA_OFFSET 0x0008 /* Standard Frame Group Start Address Register */
-#define LPC17_CANAF_EFFSA_OFFSET 0x000c /* Extended Frame Start Address Register */
-#define LPC17_CANAF_EFFGRPSA_OFFSET 0x0010 /* Extended Frame Group Start Address Register */
-#define LPC17_CANAF_EOT_OFFSET 0x0014 /* End of AF Tables register */
-#define LPC17_CANAF_LUTERRAD_OFFSET 0x0018 /* LUT Error Address register */
-#define LPC17_CANAF_LUTERR_OFFSET 0x001c /* LUT Error Register */
-#define LPC17_CANAF_FCANIE_OFFSET 0x0020 /* FullCAN interrupt enable register */
-#define LPC17_CANAF_FCANIC0_OFFSET 0x0024 /* FullCAN interrupt and capture register 0 */
-#define LPC17_CANAF_FCANIC1_OFFSET 0x0028 /* FullCAN interrupt and capture register 1 */
-
-/* Central CAN registers */
-
-#define LPC17_CAN_TXSR_OFFSET 0x0000 /* CAN Central Transmit Status Register */
-#define LPC17_CAN_RXSR_OFFSET 0x0004 /* CAN Central Receive Status Register */
-#define LPC17_CAN_MSR_OFFSET 0x0008 /* CAN Central Miscellaneous Register */
-
-/* CAN1/2 registers */
-
-#define LPC17_CAN_MOD_OFFSET 0x0000 /* CAN operating mode */
-#define LPC17_CAN_CMR_OFFSET 0x0004 /* Command bits */
-#define LPC17_CAN_GSR_OFFSET 0x0008 /* Controller Status and Error Counters */
-#define LPC17_CAN_ICR_OFFSET 0x000c /* Interrupt and capure register */
-#define LPC17_CAN_IER_OFFSET 0x0010 /* Interrupt Enable */
-#define LPC17_CAN_BTR_OFFSET 0x0014 /* Bus Timing */
-#define LPC17_CAN_EWL_OFFSET 0x0018 /* Error Warning Limit */
-#define LPC17_CAN_SR_OFFSET 0x001c /* Status Register */
-#define LPC17_CAN_RFS_OFFSET 0x0020 /* Receive frame status */
-#define LPC17_CAN_RID_OFFSET 0x0024 /* Received Identifier */
-#define LPC17_CAN_RDA_OFFSET 0x0028 /* Received data bytes 1-4 */
-#define LPC17_CAN_RDB_OFFSET 0x002c /* Received data bytes 5-8 */
-#define LPC17_CAN_TFI1_OFFSET 0x0030 /* Transmit frame info (Tx Buffer 1) */
-#define LPC17_CAN_TID1_OFFSET 0x0034 /* Transmit Identifier (Tx Buffer 1) */
-#define LPC17_CAN_TDA1_OFFSET 0x0038 /* Transmit data bytes 1-4 (Tx Buffer 1) */
-#define LPC17_CAN_TDB1_OFFSET 0x003c /* Transmit data bytes 5-8 (Tx Buffer 1) */
-#define LPC17_CAN_TFI2_OFFSET 0x0040 /* Transmit frame info (Tx Buffer 2) */
-#define LPC17_CAN_TID2_OFFSET 0x0044 /* Transmit Identifier (Tx Buffer 2) */
-#define LPC17_CAN_TDA2_OFFSET 0x0048 /* Transmit data bytes 1-4 (Tx Buffer 2) */
-#define LPC17_CAN_TDB2_OFFSET 0x004c /* Transmit data bytes 5-8 (Tx Buffer 2) */
-#define LPC17_CAN_TFI3_OFFSET 0x0050 /* Transmit frame info (Tx Buffer 3) */
-#define LPC17_CAN_TID3_OFFSET 0x0054 /* Transmit Identifier (Tx Buffer 3) */
-#define LPC17_CAN_TDA3_OFFSET 0x0058 /* Transmit data bytes 1-4 (Tx Buffer 3) */
-#define LPC17_CAN_TDB3_OFFSET 0x005c /* Transmit data bytes 5-8 (Tx Buffer 3) */
-
-/* Register addresses ***************************************************************/
-/* CAN acceptance filter registers */
-
-#define LPC17_CANAF_AFMR (LPC17_CANAF_BASE+LPC17_CANAF_AFMR_OFFSET)
-#define LPC17_CANAF_SFFSA (LPC17_CANAF_BASE+LPC17_CANAF_SFFSA_OFFSET)
-#define LPC17_CANAF_SFFGRPSA (LPC17_CANAF_BASE+LPC17_CANAF_SFFGRPSA_OFFSET)
-#define LPC17_CANAF_EFFSA (LPC17_CANAF_BASE+LPC17_CANAF_EFFSA_OFFSET)
-#define LPC17_CANAF_EFFGRPSA (LPC17_CANAF_BASE+LPC17_CANAF_EFFGRPSA_OFFSET)
-#define LPC17_CANAF_EOT (LPC17_CANAF_BASE+LPC17_CANAF_EOT_OFFSET)
-#define LPC17_CANAF_LUTERRAD (LPC17_CANAF_BASE+LPC17_CANAF_LUTERRAD_OFFSET)
-#define LPC17_CANAF_LUTERR (LPC17_CANAF_BASE+LPC17_CANAF_LUTERR_OFFSET)
-#define LPC17_CANAF_FCANIE (LPC17_CANAF_BASE+LPC17_CANAF_FCANIE_OFFSET)
-#define LPC17_CANAF_FCANIC0 (LPC17_CANAF_BASE+LPC17_CANAF_FCANIC0_OFFSET)
-#define LPC17_CANAF_FCANIC1 (LPC17_CANAF_BASE+LPC17_CANAF_FCANIC1_OFFSET)
-
-/* Central CAN registers */
-
-#define LPC17_CAN_TXSR (LPC17_CAN_BASE+LPC17_CAN_TXSR_OFFSET)
-#define LPC17_CAN_RXSR (LPC17_CAN_BASE+LPC17_CAN_RXSR_OFFSET)
-#define LPC17_CAN_MSR (LPC17_CAN_BASE+LPC17_CAN_MSR_OFFSET)
-
-/* CAN1/2 registers */
-
-#define LPC17_CAN1_MOD (LPC17_CAN1_BASE+LPC17_CAN_MOD_OFFSET)
-#define LPC17_CAN1_CMR (LPC17_CAN1_BASE+LPC17_CAN_CMR_OFFSET)
-#define LPC17_CAN1_GSR (LPC17_CAN1_BASE+LPC17_CAN_GSR_OFFSET)
-#define LPC17_CAN1_ICR (LPC17_CAN1_BASE+LPC17_CAN_ICR_OFFSET)
-#define LPC17_CAN1_IER (LPC17_CAN1_BASE+LPC17_CAN_IER_OFFSET)
-#define LPC17_CAN1_BTR (LPC17_CAN1_BASE+LPC17_CAN_BTR_OFFSET)
-#define LPC17_CAN1_EWL (LPC17_CAN1_BASE+LPC17_CAN_EWL_OFFSET)
-#define LPC17_CAN1_SR (LPC17_CAN1_BASE+LPC17_CAN_SR_OFFSET)
-#define LPC17_CAN1_RFS (LPC17_CAN1_BASE+LPC17_CAN_RFS_OFFSET)
-#define LPC17_CAN1_RID (LPC17_CAN1_BASE+LPC17_CAN_RID_OFFSET)
-#define LPC17_CAN1_RDA (LPC17_CAN1_BASE+LPC17_CAN_RDA_OFFSET)
-#define LPC17_CAN1_RDB (LPC17_CAN1_BASE+LPC17_CAN_RDB_OFFSET)
-#define LPC17_CAN1_TFI1 (LPC17_CAN1_BASE+LPC17_CAN_TFI1_OFFSET)
-#define LPC17_CAN1_TID1 (LPC17_CAN1_BASE+LPC17_CAN_TID1_OFFSET)
-#define LPC17_CAN1_TDA1 (LPC17_CAN1_BASE+LPC17_CAN_TDA1_OFFSET)
-#define LPC17_CAN1_TDB1 (LPC17_CAN1_BASE+LPC17_CAN_TDB1_OFFSET)
-#define LPC17_CAN1_TFI2 (LPC17_CAN1_BASE+LPC17_CAN_TFI2_OFFSET)
-#define LPC17_CAN1_TID2 (LPC17_CAN1_BASE+LPC17_CAN_TID2_OFFSET)
-#define LPC17_CAN1_TDA2 (LPC17_CAN1_BASE+LPC17_CAN_TDA2_OFFSET)
-#define LPC17_CAN1_TDB2 (LPC17_CAN1_BASE+LPC17_CAN_TDB2_OFFSET)
-#define LPC17_CAN1_TFI3 (LPC17_CAN1_BASE+LPC17_CAN_TFI3_OFFSET)
-#define LPC17_CAN1_TID3 (LPC17_CAN1_BASE+LPC17_CAN_TID3_OFFSET)
-#define LPC17_CAN1_TDA3 (LPC17_CAN1_BASE+LPC17_CAN_TDA3_OFFSET)
-#define LPC17_CAN1_TDB3 (LPC17_CAN1_BASE+LPC17_CAN_TDB3_OFFSET)
-
-#define LPC17_CAN2_MOD (LPC17_CAN2_BASE+LPC17_CAN_MOD_OFFSET)
-#define LPC17_CAN2_CMR (LPC17_CAN2_BASE+LPC17_CAN_CMR_OFFSET)
-#define LPC17_CAN2_GSR (LPC17_CAN2_BASE+LPC17_CAN_GSR_OFFSET)
-#define LPC17_CAN2_ICR (LPC17_CAN2_BASE+LPC17_CAN_ICR_OFFSET)
-#define LPC17_CAN2_IER (LPC17_CAN2_BASE+LPC17_CAN_IER_OFFSET)
-#define LPC17_CAN2_BTR (LPC17_CAN2_BASE+LPC17_CAN_BTR_OFFSET)
-#define LPC17_CAN2_EWL (LPC17_CAN2_BASE+LPC17_CAN_EWL_OFFSET)
-#define LPC17_CAN2_SR (LPC17_CAN2_BASE+LPC17_CAN_SR_OFFSET)
-#define LPC17_CAN2_RFS (LPC17_CAN2_BASE+LPC17_CAN_RFS_OFFSET)
-#define LPC17_CAN2_RID (LPC17_CAN2_BASE+LPC17_CAN_RID_OFFSET)
-#define LPC17_CAN2_RDA (LPC17_CAN2_BASE+LPC17_CAN_RDA_OFFSET)
-#define LPC17_CAN2_RDB (LPC17_CAN2_BASE+LPC17_CAN_RDB_OFFSET)
-#define LPC17_CAN2_TFI1 (LPC17_CAN2_BASE+LPC17_CAN_TFI1_OFFSET)
-#define LPC17_CAN2_TID1 (LPC17_CAN2_BASE+LPC17_CAN_TID1_OFFSET)
-#define LPC17_CAN2_TDA1 (LPC17_CAN2_BASE+LPC17_CAN_TDA1_OFFSET)
-#define LPC17_CAN2_TDB1 (LPC17_CAN2_BASE+LPC17_CAN_TDB1_OFFSET)
-#define LPC17_CAN2_TFI2 (LPC17_CAN2_BASE+LPC17_CAN_TFI2_OFFSET)
-#define LPC17_CAN2_TID2 (LPC17_CAN2_BASE+LPC17_CAN_TID2_OFFSET)
-#define LPC17_CAN2_TDA2 (LPC17_CAN2_BASE+LPC17_CAN_TDA2_OFFSET)
-#define LPC17_CAN2_TDB2 (LPC17_CAN2_BASE+LPC17_CAN_TDB2_OFFSET)
-#define LPC17_CAN2_TFI3 (LPC17_CAN2_BASE+LPC17_CAN_TFI3_OFFSET)
-#define LPC17_CAN2_TID3 (LPC17_CAN2_BASE+LPC17_CAN_TID3_OFFSET)
-#define LPC17_CAN2_TDA3 (LPC17_CAN2_BASE+LPC17_CAN_TDA3_OFFSET)
-#define LPC17_CAN2_TDB3 (LPC17_CAN2_BASE+LPC17_CAN_TDB3_OFFSET)
-
-/* Register bit definitions *********************************************************/
-/* CAN acceptance filter registers */
-/* Acceptance Filter Register */
-
-#define CANAF_AFMR_ACCOFF (1 << 0) /* Bit 0: AF non-operational; All RX messages ignored */
-#define CANAF_AFMR_ACCBP (1 << 1) /* Bit 1: AF bypass: All RX messages accepted */
-#define CANAF_AFMR_EFCAN (1 << 2) /* Bit 2: Enable Full CAN mode */
- /* Bits 3-31: Reserved */
-/* Standard Frame Individual Start Address Register */
- /* Bits 0-1: Reserved */
-#define CANAF_SFFSA_SHIFT (2) /* Bits 2-10: Address of Standard Identifiers in AF Lookup RAM */
-#define CANAF_SFFSA_MASK (0x01ff << CANAF_SFFSA_SHIFT)
- /* Bits 11-31: Reserved */
-/* Standard Frame Group Start Address Register */
- /* Bits 0-1: Reserved */
-#define CANAF_SFFGRPSA_SHIFT (2) /* Bits 2-10: Address of grouped Standard Identifiers in AF Lookup RAM */
-#define CANAF_SFFGRPSA_MASK (0x01ff << CANAF_SFFGRPSA_SHIFT)
- /* Bits 11-31: Reserved */
-/* Extended Frame Start Address Register */
- /* Bits 0-1: Reserved */
-#define CANAF_EFFSA_SHIFT (2) /* Bits 2-10: Address of Extended Identifiers in AF Lookup RAM */
-#define CANAF_EFFSA_MASK (0x01ff << CANAF_EFFSA_SHIFT)
- /* Bits 11-31: Reserved */
-/* Extended Frame Group Start Address Register */
- /* Bits 0-1: Reserved */
-#define CANAF_EFFGRPSA_SHIFT (2) /* Bits 2-10: Address of grouped Extended Identifiers in AF Lookup RAM */
-#define CANAF_EFFGRPSA_MASK (0x01ff << CANAF_EFFGRPSA_SHIFT)
- /* Bits 11-31: Reserved */
-/* End of AF Tables register */
- /* Bits 0-1: Reserved */
-#define CANAF_EOT_SHIFT (2) /* Bits 2-10: Last active address in last active AF table */
-#define CANAF_EOT_MASK (0x01ff << CANAF_EOT_SHIFT)
- /* Bits 11-31: Reserved */
-/* LUT Error Address register */
- /* Bits 0-1: Reserved */
-#define CANAF_LUTERRAD_SHIFT (2) /* Bits 2-10: Address in AF Lookup RAM of error */
-#define CANAF_LUTERRAD_MASK (0x01ff << CANAF_EOT_SHIFT)
- /* Bits 11-31: Reserved */
-/* LUT Error Register */
-
-#define CANAF_LUTERR_LUTERR (1 << 0) /* Bit 0: AF error in AF RAM tables */
- /* Bits 1-31: Reserved */
-/* FullCAN interrupt enable register */
-
-#define CANAF_FCANIE_FCANIE (1 << 0) /* Bit 0: Global FullCAN Interrupt Enable */
- /* Bits 1-31: Reserved */
-
-/* FullCAN interrupt and capture register 0 */
-
-#define CANAF_FCANIC0_INTPND(n) (1 << (n)) /* n=0,1,2,... 31 */
-
-/* FullCAN interrupt and capture register 1 */
-
-#define CANAF_FCANIC1_INTPND(n) (1 << ((n)-32)) /* n=32,33,...63 */
-
-/* Central CAN registers */
-/* CAN Central Transmit Status Register */
-
-#define CAN_TXSR_TS1 (1 << 0) /* Bit 0: CAN1 sending */
-#define CAN_TXSR_TS2 (1 << 1) /* Bit 1: CAN2 sending */
- /* Bits 2-7: Reserved */
-#define CAN_TXSR_TBS1 (1 << 8) /* Bit 8: All 3 CAN1 TX buffers available */
-#define CAN_TXSR_TBS2 (1 << 9) /* Bit 9: All 3 CAN2 TX buffers available */
- /* Bits 10-15: Reserved */
-#define CAN_TXSR_TCS1 (1 << 16) /* Bit 16: All CAN1 xmissions completed */
-#define CAN_TXSR_TCS2 (1 << 17) /* Bit 17: All CAN2 xmissions completed */
- /* Bits 18-31: Reserved */
-/* CAN Central Receive Status Register */
-
-#define CAN_RXSR_RS1 (1 << 0) /* Bit 0: CAN1 receiving */
-#define CAN_RXSR_RS2 (1 << 1) /* Bit 1: CAN2 receiving */
- /* Bits 2-7: Reserved */
-#define CAN_RXSR_RB1 (1 << 8) /* Bit 8: CAN1 received message available */
-#define CAN_RXSR_RB2 (1 << 9) /* Bit 9: CAN2 received message available */
- /* Bits 10-15: Reserved */
-#define CAN_RXSR_DOS1 (1 << 16) /* Bit 16: All CAN1 message lost */
-#define CAN_RXSR_DOS2 (1 << 17) /* Bit 17: All CAN2 message lost */
- /* Bits 18-31: Reserved */
-/* CAN Central Miscellaneous Register */
-
-#define CAN_MSR_E1 (1 << 0) /* Bit 0: CAN1 error counters at limit */
-#define CAN_MSR_E2 (1 << 1) /* Bit 1: CAN2 error counters at limit */
- /* Bits 2-7: Reserved */
-#define CAN_MSR_BS1 (1 << 8) /* Bit 8: CAN1 busy */
-#define CAN_MSR_BS2 (1 << 9) /* Bit 7: CAN2 busy */
- /* Bits 10-31: Reserved */
-/* CAN1/2 registers */
-/* CAN operating mode */
-
-#define CAN_MOD_RM (1 << 0) /* Bit 0: Reset Mode */
-#define CAN_MOD_LOM (1 << 1) /* Bit 1: Listen Only Mode */
-#define CAN_MOD_STM (1 << 2) /* Bit 2: Self Test Mode */
-#define CAN_MOD_TPM (1 << 3) /* Bit 3: Transmit Priority Mode */
-#define CAN_MOD_SM (1 << 4) /* Bit 4: Sleep Mode */
-#define CAN_MOD_RPM (1 << 5) /* Bit 5: Receive Polarity Mode */
- /* Bit 6: Reserved */
-#define CAN_MOD_TM (1 << 7) /* Bit 7: Test Mode */
- /* Bits 8-31: Reserved */
-/* Command bits */
-
-#define CAN_CMR_TR (1 << 0) /* Bit 0: Transmission Request */
-#define CAN_CMR_AT (1 << 1) /* Bit 1: Abort Transmission */
-#define CAN_CMR_RRB (1 << 2) /* Bit 2: Release Receive Buffer */
-#define CAN_CMR_CDO (1 << 3) /* Bit 3: Clear Data Overrun */
-#define CAN_CMR_SRR (1 << 4) /* Bit 4: Self Reception Request */
-#define CAN_CMR_STB1 (1 << 5) /* Bit 5: Select Tx Buffer 1 */
-#define CAN_CMR_STB2 (1 << 6) /* Bit 6: Select Tx Buffer 2 */
-#define CAN_CMR_STB3 (1 << 7) /* Bit 7: Select Tx Buffer 3 */
- /* Bits 8-31: Reserved */
-/* Controller Status and Error Counters */
-
-#define CAN_GSR_RBS (1 << 0) /* Bit 0: Receive Buffer Status */
-#define CAN_GSR_DOS (1 << 1) /* Bit 1: Data Overrun Status */
-#define CAN_GSR_TBS (1 << 2) /* Bit 2: Transmit Buffer Status */
-#define CAN_GSR_TCS (1 << 3) /* Bit 3: Transmit Complete Status */
-#define CAN_GSR_RS (1 << 4) /* Bit 4: Receive Status */
-#define CAN_GSR_TS (1 << 5) /* Bit 5: Transmit Status */
-#define CAN_GSR_ES (1 << 6) /* Bit 6: Error Status */
-#define CAN_GSR_BS (1 << 7) /* Bit 7: Bus Status */
- /* Bits 8-15: Reserved */
-#define CAN_GSR_RXERR_SHIFT (16) /* Bits 16-23: Rx Error Counter */
-#define CAN_GSR_RXERR_MASK (0xff << CAN_GSR_RXERR_SHIFT)
-#define CAN_GSR_TXERR_SHIFT (24) /* Bits 24-31: Tx Error Counter */
-#define CAN_GSR_TXERR_MASK (0xff << CAN_GSR_TXERR_SHIFT)
-
-/* Interrupt and capture register */
-
-#define CAN_ICR_RI (1 << 0) /* Bit 0: Receive Interrupt */
-#define CAN_ICR_TI1 (1 << 1) /* Bit 1: Transmit Interrupt 1 */
-#define CAN_ICR_EI (1 << 2) /* Bit 2: Error Warning Interrupt */
-#define CAN_ICR_DOI (1 << 3) /* Bit 3: Data Overrun Interrupt */
-#define CAN_ICR_WUI (1 << 4) /* Bit 4: Wake-Up Interrupt */
-#define CAN_ICR_EPI (1 << 5) /* Bit 5: Error Passive Interrupt */
-#define CAN_ICR_ALI (1 << 6) /* Bit 6: Arbitration Lost Interrupt */
-#define CAN_ICR_BEI (1 << 7) /* Bit 7: Bus Error Interrupt */
-#define CAN_ICR_IDI (1 << 8) /* Bit 8: ID Ready Interrupt */
-#define CAN_ICR_TI2 (1 << 9) /* Bit 9: Transmit Interrupt 2 */
-#define CAN_ICR_TI3 (1 << 10) /* Bit 10: Transmit Interrupt 3 */
- /* Bits 11-15: Reserved */
-#define CAN_ICR_ERRBIT_SHIFT (16) /* Bits 16-20: Error Code Capture */
-#define CAN_ICR_ERRBIT_MASK (0x1f << CAN_ICR_ERRBIT_SHIFT)
-# define CAN_ICR_ERRBIT_SOF (3 << CAN_ICR_ERRBIT_SHIFT) /* Start of Frame */
-# define CAN_ICR_ERRBIT_ID28 (2 << CAN_ICR_ERRBIT_SHIFT) /* ID28 ... ID21 */
-# define CAN_ICR_ERRBIT_SRTR (4 << CAN_ICR_ERRBIT_SHIFT) /* SRTR Bit */
-# define CAN_ICR_ERRBIT_IDE (5 << CAN_ICR_ERRBIT_SHIFT) /* DE bit */
-# define CAN_ICR_ERRBIT_ID20 (6 << CAN_ICR_ERRBIT_SHIFT) /* ID20 ... ID18 */
-# define CAN_ICR_ERRBIT_ID17 (7 << CAN_ICR_ERRBIT_SHIFT) /* ID17 ... 13 */
-# define CAN_ICR_ERRBIT_CRC (8 << CAN_ICR_ERRBIT_SHIFT) /* CRC Sequence */
-# define CAN_ICR_ERRBIT_DATA (10 << CAN_ICR_ERRBIT_SHIFT) /* Data Field */
-# define CAN_ICR_ERRBIT_LEN (11 << CAN_ICR_ERRBIT_SHIFT) /* Data Length Code */
-# define CAN_ICR_ERRBIT_ RTR (12 << CAN_ICR_ERRBIT_SHIFT) /* RTR Bit */
-# define CAN_ICR_ERRBIT_ID4 (14 << CAN_ICR_ERRBIT_SHIFT) /* ID4 ... ID0 */
-# define CAN_ICR_ERRBIT_ID12 (15 << CAN_ICR_ERRBIT_SHIFT) /* ID12 ... ID5 */
-# define CAN_ICR_ERRBIT_AERR (17 << CAN_ICR_ERRBIT_SHIFT) /* Active Error Flag */
-# define CAN_ICR_ERRBIT_INTERMSN (18 << CAN_ICR_ERRBIT_SHIFT) /* Intermission */
-# define CAN_ICR_ERRBIT_DOM (19 << CAN_ICR_ERRBIT_SHIFT) /* Tolerate Dominant Bits */
-# define CAN_ICR_ERRBIT_PERR (22 << CAN_ICR_ERRBIT_SHIFT) /* Passive Error Flag */
-# define CAN_ICR_ERRBIT_ERRDLM (23 << CAN_ICR_ERRBIT_SHIFT) /* Error Delimiter */
-# define CAN_ICR_ERRBIT_CRCDLM (24 << CAN_ICR_ERRBIT_SHIFT) /* CRC Delimiter */
-# define CAN_ICR_ERRBIT_ACKSLT (25 << CAN_ICR_ERRBIT_SHIFT) /* Acknowledge Slot */
-# define CAN_ICR_ERRBIT_EOF (26 << CAN_ICR_ERRBIT_SHIFT) /* End of Frame */
-# define CAN_ICR_ERRBIT_ACKDLM (27 << CAN_ICR_ERRBIT_SHIFT) /* Acknowledge Delimiter */
-# define CAN_ICR_ERRBIT_OVLD (28 << CAN_ICR_ERRBIT_SHIFT) /* Overload flag */
-#define CAN_ICR_ERRDIR (1 << 21) /* Bit 21: Direction bit at time of error */
-#define CAN_ICR_ERRC_SHIFT (22) /* Bits 22-23: Type of error */
-#define CAN_ICR_ERRC_MASK (3 << CAN_ICR_ERRC_SHIFT)
-# define CAN_ICR_ERRC_BIT (0 << CAN_ICR_ERRC_SHIFT)
-# define CAN_ICR_ERRC_FORM (1 << CAN_ICR_ERRC_SHIFT)
-# define CAN_ICR_ERRC_STUFF (2 << CAN_ICR_ERRC_SHIFT)
-# define CAN_ICR_ERRC_OTHER (3 << CAN_ICR_ERRC_SHIFT)
-#define CAN_ICR_ALCBIT_SHIFT (24) /* Bits 24-31: Bit number within frame */
-#define CAN_ICR_ALCBIT_MASK (0xff << CAN_ICR_ALCBIT_SHIFT)
-
-/* Interrupt Enable */
-
-#define CAN_IER_RIE (1 << 0) /* Bit 0: Receiver Interrupt Enable */
-#define CAN_IER_TIE1 (1 << 1) /* Bit 1: Transmit Interrupt Enable for Buffer1 */
-#define CAN_IER_EIE (1 << 2) /* Bit 2: Error Warning Interrupt Enable */
-#define CAN_IER_DOIE (1 << 3) /* Bit 3: Data Overrun Interrupt Enable */
-#define CAN_IER_WUIE (1 << 4) /* Bit 4: Wake-Up Interrupt Enable */
-#define CAN_IER_EPIE (1 << 5) /* Bit 5: Error Passive Interrupt Enable */
-#define CAN_IER_ALIE (1 << 6) /* Bit 6: Arbitration Lost Interrupt Enable */
-#define CAN_IER_BEIE (1 << 7) /* Bit 7: Bus Error Interrupt */
-#define CAN_IER_IDIE (1 << 8) /* Bit 8: ID Ready Interrupt Enable */
-#define CAN_IER_TIE2 (1 << 9) /* Bit 9: Transmit Interrupt Enable for Buffer2 */
-#define CAN_IER_TIE3 (1 << 10) /* Bit 10: Transmit Interrupt Enable for Buffer3 */
- /* Bits 11-31: Reserved */
-/* Bus Timing */
-
-#define CAN_BTR_BRP_SHIFT (0) /* Bits 0-9: Baud Rate Prescaler */
-#define CAN_BTR_BRP_MASK (0x3ff << CAN_BTR_BRP_SHIFT)
- /* Bits 10-13: Reserved */
-#define CAN_BTR_SJW_SHIFT (14) /* Bits 14-15: Synchronization Jump Width */
-#define CAN_BTR_SJW_MASK (3 << CAN_BTR_SJW_SHIFT)
-#define CAN_BTR_TSEG1_SHIFT (16) /* Bits 16-19: Sync to sample delay */
-#define CAN_BTR_TSEG1_MASK (15 << CAN_BTR_TSEG1_SHIFT)
-#define CAN_BTR_TSEG2_SHIFT (20) /* Bits 20-22: smaple to next delay */
-#define CAN_BTR_TSEG2_MASK (7 << CAN_BTR_TSEG2_SHIFT)
-#define CAN_BTR_SAM (1 << 23) /* Bit 23: Sampling */
- /* Bits 24-31: Reserved */
-
-#define CAN_BTR_BRP_MAX (1024) /* Maximum BTR value (without decrement) */
-#define CAN_BTR_TSEG1_MAX (16) /* Maximum TSEG1 value (without decrement) */
-#define CAN_BTR_TSEG2_MAX (8) /* Maximum TSEG2 value (without decrement) */
-
-/* Error Warning Limit */
-
-#define CAN_EWL_SHIFT (0) /* Bits 0-7: Error warning limit */
-#define CAN_EWL_MASK (0xff << CAN_EWL_SHIFT)
- /* Bits 8-31: Reserved */
-/* Status Register */
-
-#define CAN_SR_RBS1 (1 << 0) /* Bit 0: Receive Buffer Status */
-#define CAN_SR_DOS1 (1 << 1) /* Bit 1: Data Overrun Status */
-#define CAN_SR_TBS1 (1 << 2) /* Bit 2: Transmit Buffer Status 1 */
-#define CAN_SR_TCS1 (1 << 3) /* Bit 3: Transmission Complete Status */
-#define CAN_SR_RS1 (1 << 4) /* Bit 4: Receive Status */
-#define CAN_SR_TS1 (1 << 5) /* Bit 5: Transmit Status 1 */
-#define CAN_SR_ES1 (1 << 6) /* Bit 6: Error Status */
-#define CAN_SR_BS1 (1 << 7) /* Bit 7: Bus Status */
-#define CAN_SR_RBS2 (1 << 8) /* Bit 8: Receive Buffer Status */
-#define CAN_SR_DOS2 (1 << 9) /* Bit 9: Data Overrun Status */
-#define CAN_SR_TBS2 (1 << 10) /* Bit 10: Transmit Buffer Status 2 */
-#define CAN_SR_TCS2 (1 << 11) /* Bit 11: Transmission Complete Status */
-#define CAN_SR_RS2 (1 << 12) /* Bit 12: Receive Status */
-#define CAN_SR_TS2 (1 << 13) /* Bit 13: Transmit Status 2 */
-#define CAN_SR_ES2 (1 << 14) /* Bit 14: Error Status */
-#define CAN_SR_BS2 (1 << 15) /* Bit 15: Bus Status */
-#define CAN_SR_RBS3 (1 << 16) /* Bit 16: Receive Buffer Status */
-#define CAN_SR_DOS3 (1 << 17) /* Bit 17: Data Overrun Status */
-#define CAN_SR_TBS3 (1 << 18) /* Bit 18: Transmit Buffer Status 3 */
-#define CAN_SR_TCS3 (1 << 19) /* Bit 19: Transmission Complete Status */
-#define CAN_SR_RS3 (1 << 20) /* Bit 20: Receive Status */
-#define CAN_SR_TS3 (1 << 21) /* Bit 21: Transmit Status 3 */
-#define CAN_SR_ES3 (1 << 22) /* Bit 22: Error Status */
-#define CAN_SR_BS3 (1 << 23) /* Bit 23: Bus Status */
- /* Bits 24-31: Reserved */
-/* Receive frame status */
-
-#define CAN_RFS_ID_SHIFT (0) /* Bits 0-9: ID Index */
-#define CAN_RFS_ID_MASK (0x03ff << CAN_RFS_ID_SHIFT)
-#define CAN_RFS_BP (1 << 10) /* Bit 10: Received in AF Bypass mode */
- /* Bits 11-15: Reserved */
-#define CAN_RFS_DLC_SHIFT (16) /* Bits 16-19: Message Data Length Code (DLC) */
-#define CAN_RFS_DLC_MASK (15 << CAN_RFS_DLC_SHIFT)
- /* Bits 20-29: Reserved */
-#define CAN_RFS_RTR (1 << 30) /* Bit 30: Message Remote Transmission Request */
-#define CAN_RFS_FF (1 << 31) /* Bit 31: Message 29-bit vs 11-bit ID */
-
-/* Received Identifier */
-
-#define CAN_RID_ID11_MASK (0x7ff) /* Bits 0-10: 11-bit Identifier (FF=0) */
- /* Bits 11-31: Reserved */
-#define CAN_RID_ID29_MASK (0x1fffffff) /* Bits 0-28: 29-bit Identifiter (FF=1) */
- /* Bits 29-31: Reserved */
-/* Received data bytes 1-4 */
-
-#define CAN_RDA_DATA1_SHIFT (0) /* Bits 0-7: If CANRFS >= 1 */
-#define CAN_RDA_DATA1_MASK (0x0ff << CAN_RDA_DATA1_SHIFT)
-#define CAN_RDA_DATA2_SHIFT (8) /* Bits 8-15: If CANRFS >= 2 */
-#define CAN_RDA_DATA2_MASK (0x0ff << CAN_RDA_DATA2_SHIFT)
-#define CAN_RDA_DATA3_SHIFT (16) /* Bits 16-23: If CANRFS >= 3 */
-#define CAN_RDA_DATA3_MASK (0x0ff << CAN_RDA_DATA3_SHIFT)
-#define CAN_RDA_DATA4_SHIFT (24) /* Bits 24-31: If CANRFS >= 4 */
-#define CAN_RDA_DATA4_MASK (0x0ff << CAN_RDA_DATA4_SHIFT)
-
-/* Received data bytes 5-8 */
-
-#define CAN_RDB_DATA5_SHIFT (0) /* Bits 0-7: If CANRFS >= 5 */
-#define CAN_RDB_DATA5_MASK (0x0ff << CAN_RDB_DATA5_SHIFT)
-#define CAN_RDB_DATA6_SHIFT (8) /* Bits 8-15: If CANRFS >= 6 */
-#define CAN_RDB_DATA6_MASK (0x0ff << CAN_RDB_DATA6_SHIFT)
-#define CAN_RDB_DATA7_SHIFT (16) /* Bits 16-23: If CANRFS >= 7 */
-#define CAN_RDB_DATA7_MASK (0x0ff << CAN_RDB_DATA7_SHIFT)
-#define CAN_RDB_DATA8_SHIFT (24) /* Bits 24-31: If CANRFS >= 8 */
-#define CAN_RDB_DATA8_MASK (0x0ff << CAN_RDB_DATA8_SHIFT)
-
-/* Transmit frame info (Tx Buffer 1), Transmit frame info (Tx Buffer 2), and
- * Transmit frame info (Tx Buffer 3) common bit field definitions
- */
-
-#define CAN_TFI_PRIO_SHIFT (0) /* Bits 0-7: TX buffer priority */
-#define CAN_TFI_PRIO_MASK (0xff << CAN_TFI_PRIO_SHIFT)
- /* Bits 8-15: Reserved */
-#define CAN_TFI_DLC_SHIFT (16) /* Bits 16-19: TX Data Length Code */
-#define CAN_TFI_DLC_MASK (15 << CAN_TFI_DLC_SHIFT)
- /* Bits 20-29: Reserved */
-#define CAN_TFI_RTR (1 << 30) /* Bit 30: TX RTR bit */
-#define CAN_TFI_FF (1 << 31) /* Bit 31: Message 29-bit vs 11-bit ID */
-
-/* Transmit Identifier (Tx Buffer 1), Transmit Identifier (Tx Buffer 2), and
- * Transmit Identifier (Tx Buffer 3) common bit field definitions.
- */
-
-#define CAN_TID_ID11_MASK (0x7ff) /* Bits 0-10: 11-bit Identifier (FF=0) */
- /* Bits 11-31: Reserved */
-#define CAN_TID_ID29_MASK (0x1fffffff) /* Bits 0-28: 29-bit Identifiter (FF=1) */
- /* Bits 29-31: Reserved */
-
-/* Transmit data bytes 1-4 (Tx Buffer 1), Transmit data bytes 1-4 (Tx Buffer 2), and
- * Transmit data bytes 1-4 (Tx Buffer 3) common bit field definitions.
- */
-
-#define CAN_TDA_DATA1_SHIFT (0) /* Bits 0-7: RTR=0 && DLC >= 1 */
-#define CAN_TDA_DATA1_MASK (0x0ff << CAN_TDA_DATA1_SHIFT)
-#define CAN_TDA_DATA2_SHIFT (8) /* Bits 8-15: RTR=0 && DLC >= 2 */
-#define CAN_TDA_DATA2_MASK (0x0ff << CAN_TDA_DATA2_SHIFT)
-#define CAN_TDA_DATA3_SHIFT (16) /* Bits 16-23: RTR=0 && DLC >= 3 */
-#define CAN_TDA_DATA3_MASK (0x0ff << CAN_TDA_DATA3_SHIFT)
-#define CAN_TDA_DATA4_SHIFT (24) /* Bits 24-31: RTR=0 && DLC >= 4 */
-#define CAN_TDA_DATA4_MASK (0x0ff << CAN_TDA_DATA4_SHIFT)
-
-/* Transmit data bytes 5-8 (Tx Buffer 1), Transmit data bytes 5-8 (Tx Buffer 2), and
- * Transmit data bytes 5-8 (Tx Buffer 3) common bit field definitions.
- */
-
-#define CAN_RDB_DATA5_SHIFT (0) /* Bits 0-7: RTR=0 && DLC >= 5 */
-#define CAN_RDB_DATA5_MASK (0x0ff << CAN_RDB_DATA5_SHIFT)
-#define CAN_RDB_DATA6_SHIFT (8) /* Bits 8-15: RTR=0 && DLC >= 6 */
-#define CAN_RDB_DATA6_MASK (0x0ff << CAN_RDB_DATA6_SHIFT)
-#define CAN_RDB_DATA7_SHIFT (16) /* Bits 16-23: RTR=0 && DLC >= 7 */
-#define CAN_RDB_DATA7_MASK (0x0ff << CAN_RDB_DATA7_SHIFT)
-#define CAN_RDB_DATA8_SHIFT (24) /* Bits 24-31: RTR=0 && DLC >= 8 */
-#define CAN_RDB_DATA8_MASK (0x0ff << CAN_RDB_DATA8_SHIFT)
-
-/************************************************************************************
- * Public Types
- ************************************************************************************/
-
-/************************************************************************************
- * Public Data
- ************************************************************************************/
-
-/************************************************************************************
- * Public Functions
- ************************************************************************************/
-
-#endif /* __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC17_CHIP_CAN_H */
diff --git a/arch/arm/src/lpc17xx/hardware/lpc17_eeprom.h b/arch/arm/src/lpc17xx/hardware/lpc17_eeprom.h
deleted file mode 100644
index d202cb73175..00000000000
--- a/arch/arm/src/lpc17xx/hardware/lpc17_eeprom.h
+++ /dev/null
@@ -1,186 +0,0 @@
-/************************************************************************************
- * arch/arm/src/lpc17xx/hardware/lpc17_eeprom.h
- *
- * Copyright (C) 2013 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. 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.
- * 3. Neither the name NuttX 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 THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- ************************************************************************************/
-
-#ifndef __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC17_EEPROM_H
-#define __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC17_EEPROM_H
-
-/************************************************************************************
- * Included Files
- ************************************************************************************/
-
-#include
-
-#include "chip.h"
-#include "hardware/lpc17_memorymap.h"
-
-/************************************************************************************
- * Pre-processor Definitions
- ************************************************************************************/
-
-/* Register offsets *****************************************************************/
-
-#define LPC17_EEPROM_EECMD_OFFSET 0x0080 /* Command register */
-#define LPC17_EEPROM_EEADDR_OFFSET 0x0084 /* Address register */
-#define LPC17_EEPROM_EEWDATA_OFFSET 0x0088 /* Write Data register */
-#define LPC17_EEPROM_EERDATA_OFFSET 0x008c /* Read Data register */
-#define LPC17_EEPROM_EEWSTATE_OFFSET 0x0090 /* Wait state register */
-#define LPC17_EEPROM_EECLKDIV_OFFSET 0x0094 /* Clock divider register */
-#define LPC17_EEPROM_EEPWRDWN_OFFSET 0x0098 /* Power down register */
-
-#define LPC17_EEPROM_INTSTAT_OFFSET 0x0fe0 /* Interrupt status */
-#define LPC17_EEPROM_INTEN_OFFSET 0x0fe4 /* Interrupt enable */
-#define LPC17_EEPROM_INTSTATCLR_OFFSET 0x0fe8 /* Interrupt status clear */
-#define LPC17_EEPROM_INTENCLR_OFFSET 0x0fd8 /* Interrupt enable clear */
-#define LPC17_EEPROM_INTENSET_OFFSET 0x0fdc /* Interrupt enable set */
-#define LPC17_EEPROM_INTSTATSET_OFFSET 0x0fec /* Interrupt status set */
-
-#define LPC17_EEPROM_EECMD (LPC17_EEPROM_BASE+LPC17_EEPROM_EECMD_OFFSET)
-#define LPC17_EEPROM_EEADDR (LPC17_EEPROM_BASE+LPC17_EEPROM_EEADDR_OFFSET)
-#define LPC17_EEPROM_EEWDATA (LPC17_EEPROM_BASE+LPC17_EEPROM_EEWDATA_OFFSET)
-#define LPC17_EEPROM_EERDATA (LPC17_EEPROM_BASE+LPC17_EEPROM_EERDATA_OFFSET)
-#define LPC17_EEPROM_EEWSTATE (LPC17_EEPROM_BASE+LPC17_EEPROM_EEWSTATE_OFFSET)
-#define LPC17_EEPROM_EECLKDIV (LPC17_EEPROM_BASE+LPC17_EEPROM_EECLKDIV_OFFSET)
-#define LPC17_EEPROM_EEPWRDWN (LPC17_EEPROM_BASE+LPC17_EEPROM_EEPWRDWN_OFFSET)
-
-#define LPC17_EEPROM_INTSTAT (LPC17_EEPROM_BASE+LPC17_EEPROM_INTSTAT_OFFSET)
-#define LPC17_EEPROM_INTEN (LPC17_EEPROM_BASE+LPC17_EEPROM_INTEN_OFFSET)
-#define LPC17_EEPROM_INTSTATCLR (LPC17_EEPROM_BASE+LPC17_EEPROM_INTSTATCLR_OFFSET)
-#define LPC17_EEPROM_INTENCLR (LPC17_EEPROM_BASE+LPC17_EEPROM_INTENCLR_OFFSET)
-#define LPC17_EEPROM_INTENSET (LPC17_EEPROM_BASE+LPC17_EEPROM_INTENSET_OFFSET)
-#define LPC17_EEPROM_INTSTATSET (LPC17_EEPROM_BASE+LPC17_EEPROM_INTSTATSET_OFFSET)
-
-/* EECMD - EEPROM Command Register */
-
-#define EEPROM_CMD_SHIFT (0) /* Bit 0-2: Command */
-#define EEPROM_CMD_MASK (7 << EEPROM_CMD_SHIFT)
-# define EECMD_READ8 (0) /* 000: 8bit read */
-# define EECMD_READ16 (1) /* 001: 16bit read */
-# define EECMD_READ32 (2) /* 010: 32bit read */
-# define EECMD_WRITE8 (3) /* 011: 8bit write */
-# define EECMD_WRITE16 (4) /* 100: 16bit write */
-# define EECMD_WRITE32 (5) /* 101: 32bit write */
-# define EEMCD_ERASE (6) /* 110: erase/program page */
- /* 111: Reserved */
-#define EEPROM_RDPREFETCH (1 << 3) /* Bit 3: Read data prefetch bit */
- /* Bits 4-31: Reserved */
-/* EEADDR - EEPROM Address Register */
-
-#define EEPROM_ADDR_SHIFT (0) /* Bits 0-11: Address */
-#define EEPROM_ADDR_MASK (0x7ff << EEPROM_EEADDR_ADDR_SHIFT)
- /* Bits 12-31: Reserved */
-/* EEPROM Read/Write Data Registers */
-/* R/W registers has no bitfields, data read/write
- * must conforms to the expected sizes
- */
-
-/* EEWSTATE - EEPROM Wait State Register */
-
-#define EEPROM_WSTATE_PHASE3_SHIFT (0) /* Bits 0-7: Wait states 3 (minus 1 encoded) */
-#define EEPROM_WSTATE_PHASE3_MASK (0xff << EEWSTATE_PHASE3_SHIFT)
-#define EEPROM_WSTATE_PHASE2_SHIFT (8) /* Bits 8-15: Wait states 2 (minus 1 encoded) */
-#define EEPROM_WSTATE_PHASE2_MASK (0xff << EEWSTATE_PHASE2_SHIFT)
-#define EEPROM_WSTATE_PHASE1_SHIFT (16) /* Bits 16-23: Wait states 1 (minus 1 encoded) */
-#define EEPROM_WSTATE_PHASE1_MASK (0xff << EEWSTATE_PHASE1_SHIFT)
- /* Bits 24-31: Reserved */
-
-/* EECLKDIV - EEPROM Clock Divider Register */
-
-#define EEPROM_CLKDIV_SHIFT (0) /* Bits 0-15: Division factor (minus 1 encoded) */
-#define EEPROM_CLKDIV_MASK (0xffff << EECLKDIV_CLKDIV_SHIFT)
- /* Bits 16-31: Reserved */
-
-/* EEPWRDWN - EEPROM Power Down Register */
-
-#define EEPROM_PWRDWN (1) /* Bit 0: Power down mode bit */
- /* Bits 1-31: Reserved */
-
-/* EEPROM Interrupt Registers ******************************************/
-
-/* INTEN - Interrupt Enable Register */
-
- /* Bits 0-25: Reserved */
-#define EEPROM_INTEN_RW_DONE (1 << 26) /* Bit 26: Read/Write finished interrupt bit */
- /* Bit 27: Reserved */
-#define EEPROM_INTEN_PROG_DONE (1 << 28) /* Bit 28: Program finished interrupt bit */
- /* Bits 29-31: Reserved */
-
-/* INTENCLR - Interrupt Enable Clear Register */
- /* Bits 0-25: Reserved */
-#define EEPROM_INTENCLR_RWCLR_EN (1 << 26) /* Bit 26: Clear R/W interrupt enable bit */
- /* Bits27: Reserved */
-#define EEPROM_INTENCLR_PROG1CLR_EN (1 << 28) /* Bit 28: Clear program interrupt bit */
- /* Bits 29-31: Reserved */
-
-/* INTENSET - Interrupt Enable Set Register */
- /* Bits 0-25: Reserved */
-#define EEPROM_INTENSET_RWSET_EN (1 << 26) /* Bit 26: Set Read/Write finished interrupt bit */
- /* Bit 27: Reserved */
-#define EEPROM_INTENSET_PROG1SET_EN (1 << 28) /* Bit 28: Set program interrupt bit */
- /* Bits 29-31: Reserved */
-
-/* INTSTAT - Interrupt Status Register */
- /* Bits 0-25: Reserved */
-#define EEPROM_INTSTAT_RW_END (1 << 26) /* Bit 26: Read/Write done status bit */
- /* Bit 27: Reserved */
-#define EEPROM_INTSTAT_PROG1_END (1 << 28) /* Bit 28: Program done status bit */
- /* Bits 29-31: Reserved */
-
-/* INTSTATCLR - Interrupt Status Clear Register */
- /* Bits 0-25: Reserved */
-#define EEPROM_INTSTATCLR_RW_CLR (1 << 26) /* Bit 26: Set Read/Write finished interrupt bit */
- /* Bit 27: Reserved */
-#define EEPROM_INTSTATCLR_PROG_1CLR (1 << 28) /* Bit 28: Set program interrupt bit */
- /* Bits 29-31: Reserved */
-
-/* INTSTATSET - Interrupt Status Set Register */
- /* Bits 0-25: Reserved */
-#define EEPROM_INTSTATSET_RW_SET (1 << 26) /* Bit 26: Read/Write done status bit */
- /* Bit 27: Reserved */
-#define EEPROM_INTSTATSET_PROG1_SET (1 << 28) /* Bit 28: Program done status bit */
- /* Bits 29-31: Reserved */
-
-/************************************************************************************
- * Public Types
- ************************************************************************************/
-
-/************************************************************************************
- * Public Data
- ************************************************************************************/
-
-/************************************************************************************
- * Public Functions
- ************************************************************************************/
-
-#endif /* __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC17_EEPROM_H */
diff --git a/arch/arm/src/lpc17xx/hardware/lpc17_emc.h b/arch/arm/src/lpc17xx/hardware/lpc17_emc.h
deleted file mode 100644
index 11e30a0cf4b..00000000000
--- a/arch/arm/src/lpc17xx/hardware/lpc17_emc.h
+++ /dev/null
@@ -1,350 +0,0 @@
-/****************************************************************************************************
- * arch/arm/src/lpc17xx/hardware/lpc17_emc
- *
- * Copyright (C) 2013 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. 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.
- * 3. Neither the name NuttX 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 THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- ****************************************************************************************************/
-
-#ifndef __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC17_EMC_H
-#define __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC17_EMC_H
-
-/****************************************************************************************************
- * Included Files
- ****************************************************************************************************/
-
-#include
-
-#include "chip.h"
-#include "hardware/lpc17_memorymap.h"
-
-/****************************************************************************************************
- * Pre-processor Definitions
- ****************************************************************************************************/
-/* Register Offsets */
-
-#define LPC17_EMC_CONTROL_OFFSET 0x0000 /* EMC Control register */
-#define LPC17_EMC_STATUS_OFFSET 0x0004 /* EMC Status register */
-#define LPC17_EMC_CONFIG_OFFSET 0x0008 /* EMC Configuration register */
-#define LPC17_EMC_DYNAMICCONTROL_OFFSET 0x0020 /* Dynamic Memory Control register */
-#define LPC17_EMC_DYNAMICREFRESH_OFFSET 0x0024 /* Dynamic Memory Refresh Timer register */
-#define LPC17_EMC_DYNAMICREADCONFIG_OFFSET 0x0028 /* Dynamic Memory Read Configuration register */
-#define LPC17_EMC_DYNAMICRP_OFFSET 0x0030 /* Dynamic Memory Precharge Command Period register */
-#define LPC17_EMC_DYNAMICRAS_OFFSET 0x0034 /* Dynamic Memory Active to Precharge Command Period register */
-#define LPC17_EMC_DYNAMICSREX_OFFSET 0x0038 /* Dynamic Memory Self-refresh Exit Time register */
-#define LPC17_EMC_DYNAMICAPR_OFFSET 0x003c /* Dynamic Memory Last Data Out to Active Time register */
-#define LPC17_EMC_DYNAMICDAL_OFFSET 0x0040 /* Dynamic Memory Data-in to Active Command Time register */
-#define LPC17_EMC_DYNAMICWR_OFFSET 0x0044 /* Dynamic Memory Write Recovery Time register */
-#define LPC17_EMC_DYNAMICRC_OFFSET 0x0048 /* Dynamic Memory Active to Active Command Period register */
-#define LPC17_EMC_DYNAMICRFC_OFFSET 0x004c /* Dynamic Memory Auto-refresh Period register */
-#define LPC17_EMC_DYNAMICXSR_OFFSET 0x0050 /* Dynamic Memory Exit Self-refresh register */
-#define LPC17_EMC_DYNAMICRRD_OFFSET 0x0054 /* Dynamic Memory Active Bank A to Active Bank B Time register */
-#define LPC17_EMC_DYNAMICMRD_OFFSET 0x0058 /* Dynamic Memory Load Mode register to Active Command Time */
-#define LPC17_EMC_STATICEXTENDEDWAIT_OFFSET 0x0080 /* Static Memory Extended Wait register */
-
-#define LPC17_EMC_DYNAMICCONFIG0_OFFSET 0x0100 /* Dynamic Memory Configuration register 0 */
-#define LPC17_EMC_DYNAMICRASCAS0_OFFSET 0x0104 /* Dynamic Memory RAS & CAS Delay register 0 */
-
-#define LPC17_EMC_DYNAMICCONFIG1_OFFSET 0x0120 /* Dynamic Memory Configuration register 1 */
-#define LPC17_EMC_DYNAMICRASCAS1_OFFSET 0x0124 /* Dynamic Memory RAS & CAS Delay register 1 */
-
-#define LPC17_EMC_DYNAMICCONFIG2_OFFSET 0x0140 /* Dynamic Memory Configuration register 2 */
-#define LPC17_EMC_DYNAMICRASCAS2_OFFSET 0x0144 /* Dynamic Memory RAS & CAS Delay register 2 */
-
-#define LPC17_EMC_DYNAMICCONFIG3_OFFSET 0x0160 /* Dynamic Memory Configuration register 3 */
-#define LPC17_EMC_DYNAMICRASCAS3_OFFSET 0x0164 /* Dynamic Memory RAS & CAS Delay register 3 */
-
-#define LPC17_EMC_STATICCONFIG0_OFFSET 0x0200 /* Static Memory Configuration register 0 */
-#define LPC17_EMC_STATICWAITWEN0_OFFSET 0x0204 /* Static Memory Write Enable Delay register 0 */
-#define LPC17_EMC_STATICWAITOEN0_OFFSET 0x0208 /* Static Memory Output Enable Delay registers 0 */
-#define LPC17_EMC_STATICWAITRD0_OFFSET 0x020c /* Static Memory Read Delay register 0 */
-#define LPC17_EMC_STATICWAITPAGE0_OFFSET 0x0210 /* Static Memory Page Mode Read Delay register 0*/
-#define LPC17_EMC_STATICWAITWR0_OFFSET 0x0214 /* Static Memory Write Delay register 0 */
-#define LPC17_EMC_STATICWAITTURN0_OFFSET 0x0218 /* Static Memory Turn Round Delay register 0 */
-
-#define LPC17_EMC_STATICCONFIG1_OFFSET 0x0220 /* Static Memory Configuration register 1 */
-#define LPC17_EMC_STATICWAITWEN1_OFFSET 0x0224 /* Static Memory Write Enable Delay register 1 */
-#define LPC17_EMC_STATICWAITOEN1_OFFSET 0x0228 /* Static Memory Output Enable Delay register 1 */
-#define LPC17_EMC_STATICWAITRD1_OFFSET 0x022c /* Static Memory Read Delay register 1 */
-#define LPC17_EMC_STATICWAITPAGE1_OFFSET 0x0230 /* Static Memory Page Mode Read Delay register 1 */
-#define LPC17_EMC_STATICWAITWR1_OFFSET 0x0234 /* Static Memory Write Delay register 1 */
-#define LPC17_EMC_STATICWAITTURN1_OFFSET 0x0238 /* Static Memory Turn Round Delay register 1 */
-
-#define LPC17_EMC_STATICCONFIG2_OFFSET 0x0240 /* Static Memory Configuration register 2 */
-#define LPC17_EMC_STATICWAITWEN2_OFFSET 0x0244 /* Static Memory Write Enable Delay register 2 */
-#define LPC17_EMC_STATICWAITOEN2_OFFSET 0x0248 /* Static Memory Output Enable Delay register 2 */
-#define LPC17_EMC_STATICWAITRD2_OFFSET 0x024c /* Static Memory Read Delay register 2 */
-#define LPC17_EMC_STATICWAITPAGE2_OFFSET 0x0250 /* Static Memory Page Mode Read Delay registers 3 */
-#define LPC17_EMC_STATICWAITWR2_OFFSET 0x0254 /* Static Memory Write Delay register 2 */
-#define LPC17_EMC_EMCSTATICWAITTURN2_OFFSET 0x0258 /* Static Memory Turn Round Delay register 2 */
-
-#define LPC17_EMC_STATICCONFIG3_OFFSET 0x0260 /* Static Memory Configuration register 3 */
-#define LPC17_EMC_STATICWAITWEN3_OFFSET 0x0264 /* Static Memory Write Enable Delay register 3 */
-#define LPC17_EMC_STATICWAITOEN3_OFFSET 0x0268 /* Static Memory Output Enable Delay register 3 */
-#define LPC17_EMC_STATICWAITRD3_OFFSET 0x026c /* Static Memory Read Delay register 3 */
-#define LPC17_EMC_STATICWAITPAGE3_OFFSET 0x0270 /* Static Memory Page Mode Read Delay register 4 */
-#define LPC17_EMC_STATICWAITWR3_OFFSET 0x0274 /* Static Memory Write Delay register 3 */
-#define LPC17_EMC_STATICWAITTURN3_OFFSET 0x0278 /* Static Memory Turn Round Delay register 3 */
-
-/* Register Addresses */
-
-#define LPC17_EMC_CONTROL (LPC17_EMC_BASE+LPC17_EMC_CONTROL_OFFSET)
-#define LPC17_EMC_STATUS (LPC17_EMC_BASE+LPC17_EMC_STATUS_OFFSET)
-#define LPC17_EMC_CONFIG (LPC17_EMC_BASE+LPC17_EMC_CONFIG_OFFSET)
-#define LPC17_EMC_DYNAMICCONTROL (LPC17_EMC_BASE+LPC17_EMC_DYNAMICCONTROL_OFFSET)
-#define LPC17_EMC_DYNAMICREFRESH (LPC17_EMC_BASE+LPC17_EMC_DYNAMICREFRESH_OFFSET)
-#define LPC17_EMC_DYNAMICREADCONFIG (LPC17_EMC_BASE+LPC17_EMC_DYNAMICREADCONFIG_OFFSET)
-#define LPC17_EMC_DYNAMICRP (LPC17_EMC_BASE+LPC17_EMC_DYNAMICRP_OFFSET)
-#define LPC17_EMC_DYNAMICRAS (LPC17_EMC_BASE+LPC17_EMC_DYNAMICRAS_OFFSET)
-#define LPC17_EMC_DYNAMICSREX (LPC17_EMC_BASE+LPC17_EMC_DYNAMICSREX_OFFSET)
-#define LPC17_EMC_DYNAMICAPR (LPC17_EMC_BASE+LPC17_EMC_DYNAMICAPR_OFFSET)
-#define LPC17_EMC_DYNAMICDAL (LPC17_EMC_BASE+LPC17_EMC_DYNAMICDAL_OFFSET)
-#define LPC17_EMC_DYNAMICWR (LPC17_EMC_BASE+LPC17_EMC_DYNAMICWR_OFFSET)
-#define LPC17_EMC_DYNAMICRC (LPC17_EMC_BASE+LPC17_EMC_DYNAMICRC_OFFSET)
-#define LPC17_EMC_DYNAMICRFC (LPC17_EMC_BASE+LPC17_EMC_DYNAMICRFC_OFFSET)
-#define LPC17_EMC_DYNAMICXSR (LPC17_EMC_BASE+LPC17_EMC_DYNAMICXSR_OFFSET)
-#define LPC17_EMC_DYNAMICRRD (LPC17_EMC_BASE+LPC17_EMC_DYNAMICRRD_OFFSET)
-#define LPC17_EMC_DYNAMICMRD (LPC17_EMC_BASE+LPC17_EMC_DYNAMICMRD_OFFSET)
-#define LPC17_EMC_STATICEXTENDEDWAIT (LPC17_EMC_BASE+LPC17_EMC_STATICEXTENDEDWAIT_OFFSET)
-
-#define LPC17_EMC_DYNAMICCONFIG0 (LPC17_EMC_BASE+LPC17_EMC_DYNAMICCONFIG0_OFFSET)
-#define LPC17_EMC_DYNAMICRASCAS0 (LPC17_EMC_BASE+LPC17_EMC_DYNAMICRASCAS0_OFFSET)
-
-#define LPC17_EMC_DYNAMICCONFIG1 (LPC17_EMC_BASE+LPC17_EMC_DYNAMICCONFIG1_OFFSET)
-#define LPC17_EMC_DYNAMICRASCAS1 (LPC17_EMC_BASE+LPC17_EMC_DYNAMICRASCAS1_OFFSET)
-
-#define LPC17_EMC_DYNAMICCONFIG2 (LPC17_EMC_BASE+LPC17_EMC_DYNAMICCONFIG2_OFFSET)
-#define LPC17_EMC_DYNAMICRASCAS2 (LPC17_EMC_BASE+LPC17_EMC_DYNAMICRASCAS2_OFFSET)
-
-#define LPC17_EMC_DYNAMICCONFIG3 (LPC17_EMC_BASE+LPC17_EMC_DYNAMICCONFIG3_OFFSET)
-#define LPC17_EMC_DYNAMICRASCAS3 (LPC17_EMC_BASE+LPC17_EMC_DYNAMICRASCAS3_OFFSET)
-
-#define LPC17_EMC_STATICCONFIG0 (LPC17_EMC_BASE+LPC17_EMC_STATICCONFIG0_OFFSET)
-#define LPC17_EMC_STATICWAITWEN0 (LPC17_EMC_BASE+LPC17_EMC_STATICWAITWEN0_OFFSET)
-#define LPC17_EMC_STATICWAITOEN0 (LPC17_EMC_BASE+LPC17_EMC_STATICWAITOEN0_OFFSET)
-#define LPC17_EMC_STATICWAITRD0 (LPC17_EMC_BASE+LPC17_EMC_STATICWAITRD0_OFFSET)
-#define LPC17_EMC_STATICWAITPAGE0 (LPC17_EMC_BASE+LPC17_EMC_STATICWAITPAGE0_OFFSET)
-#define LPC17_EMC_STATICWAITWR0 (LPC17_EMC_BASE+LPC17_EMC_STATICWAITWR0_OFFSET)
-#define LPC17_EMC_STATICWAITTURN0 (LPC17_EMC_BASE+LPC17_EMC_STATICWAITTURN0_OFFSET)
-
-#define LPC17_EMC_STATICCONFIG1 (LPC17_EMC_BASE+LPC17_EMC_STATICCONFIG1_OFFSET)
-#define LPC17_EMC_STATICWAITWEN1 (LPC17_EMC_BASE+LPC17_EMC_STATICWAITWEN1_OFFSET)
-#define LPC17_EMC_STATICWAITOEN1 (LPC17_EMC_BASE+LPC17_EMC_STATICWAITOEN1_OFFSET)
-#define LPC17_EMC_STATICWAITRD (LPC17_EMC_BASE+LPC17_EMC_STATICWAITRD1_OFFSET)
-#define LPC17_EMC_STATICWAITPAGE1 (LPC17_EMC_BASE+LPC17_EMC_STATICWAITPAGE1_OFFSET)
-#define LPC17_EMC_STATICWAITWR1 (LPC17_EMC_BASE+LPC17_EMC_STATICWAITWR1_OFFSET)
-#define LPC17_EMC_STATICWAITTURN1 (LPC17_EMC_BASE+LPC17_EMC_STATICWAITTURN1_OFFSET)
-
-#define LPC17_EMC_STATICCONFIG2 (LPC17_EMC_BASE+LPC17_EMC_STATICCONFIG2_OFFSET)
-#define LPC17_EMC_STATICWAITWEN2 (LPC17_EMC_BASE+LPC17_EMC_STATICWAITWEN2_OFFSET)
-#define LPC17_EMC_STATICWAITOEN2 (LPC17_EMC_BASE+LPC17_EMC_STATICWAITOEN2_OFFSET)
-#define LPC17_EMC_STATICWAITRD2 (LPC17_EMC_BASE+LPC17_EMC_STATICWAITRD2_OFFSET)
-#define LPC17_EMC_STATICWAITPAGE2 (LPC17_EMC_BASE+LPC17_EMC_STATICWAITPAGE2_OFFSET)
-#define LPC17_EMC_STATICWAITWR2 (LPC17_EMC_BASE+LPC17_EMC_STATICWAITWR2_OFFSET)
-#define LPC17_EMC_EMCSTATICWAITTURN2 (LPC17_EMC_BASE+LPC17_EMC_EMCSTATICWAITTURN2_OFFSET)
-
-#define LPC17_EMC_STATICCONFIG3 (LPC17_EMC_BASE+LPC17_EMC_STATICCONFIG3_OFFSET)
-#define LPC17_EMC_STATICWAITWEN3 (LPC17_EMC_BASE+LPC17_EMC_STATICWAITWEN3_OFFSET)
-#define LPC17_EMC_STATICWAITOEN3 (LPC17_EMC_BASE+LPC17_EMC_STATICWAITOEN3_OFFSET)
-#define LPC17_EMC_STATICWAITRD3 (LPC17_EMC_BASE+LPC17_EMC_STATICWAITRD3_OFFSET)
-#define LPC17_EMC_STATICWAITPAGE3 (LPC17_EMC_BASE+LPC17_EMC_STATICWAITPAGE3_OFFSET)
-#define LPC17_EMC_STATICWAITWR3 (LPC17_EMC_BASE+LPC17_EMC_STATICWAITWR3_OFFSET)
-#define LPC17_EMC_STATICWAITTURN3 (LPC17_EMC_BASE+LPC17_EMC_STATICWAITTURN3_OFFSET)
-
-/* Register Bitfield Definitions */
-
-/* EMC Control register */
-
-#define EMC_CONTROL_E (1 << 0) /* Bit 0: EMC Enable */
-#define EMC_CONTROL_M (1 << 1) /* Bit 1: Address mirror */
-#define EMC_CONTROL_L (1 << 2) /* Bit 2: Low-power mode */
-
-/* EMC Status register */
-
-#define EMC_STATUS_B (1 << 0) /* Bit 0: Busy */
-#define EMC_STATUS_S (1 << 1) /* Bit 1: Write buffer status */
-#define EMC_STATUS_SA (1 << 2) /* Bit 2: Self-refresh acknowledge */
-
-/* EMC Configuration register */
-
-#define EMC_CONFIG_EM (1 << 0) /* Bit 0: Endian mode */
-#define EMC_CONFIG_CLKR (1 << 8) /* Bit 8: CCLK:CLKOUT ratio */
-
-/* Dynamic Memory Control register */
-
-#define EMC_DYNAMICCONTROL_CE (1 << 0) /* Bit 0: Dynamic memory clock enable */
-#define EMC_DYNAMICCONTROL_CS (1 << 1) /* Bit 1: Dynamic memory clock control */
-#define EMC_DYNAMICCONTROL_SR (1 << 2) /* Bit 2: Self-refresh request */
-#define EMC_DYNAMICCONTROL_MMC (1 << 5) /* Bit 5: Memory clock control */
-#define EMC_DYNAMICCONTROL_I_SHIFT (7) /* Bits 7-8: SDRAM initialization */
-#define EMC_DYNAMICCONTROL_I_MASK (3 << EMC_DYNAMICCONTROL_I_SHIFT)
-# define EMC_DYNAMICCONTROL_I_NORMAL (0 << EMC_DYNAMICCONTROL_I_SHIFT) /* SDRAM NORMAL operation command */
-# define EMC_DYNAMICCONTROL_I_MODE (1 << EMC_DYNAMICCONTROL_I_SHIFT) /* SDRAM MODE command */
-# define EMC_DYNAMICCONTROL_I_PALL (2 << EMC_DYNAMICCONTROL_I_SHIFT) /* SDRAM PALL (precharge all) command */
-# define EMC_DYNAMICCONTROL_I_NOP (3 << EMC_DYNAMICCONTROL_I_SHIFT) /* SDRAM NOP (no operation) command) */
-
-/* Dynamic Memory Refresh Timer register */
-
-#define EMC_DYNAMICREFRESH_MASK (0x000007ff) /* Bits 0-10: REFRESH Refresh timer */
-
-/* Dynamic Memory Read Configuration register */
-
-#define EMC_DYNAMICREADCONFIG_RD_SHIFT (0) /* Bits 0-1: Read data strategy */
-#define EMC_DYNAMICREADCONFIG_RD_MASK (3 << EMC_DYNAMICREADCONFIG_RD_SHIFT)
-# define EMC_DYNAMICREADCONFIG_RD_CLKOUT (0 << EMC_DYNAMICREADCONFIG_RD_SHIFT) /* Clock out delayed strategy */
-# define EMC_DYNAMICREADCONFIG_RD_CMD (1 << EMC_DYNAMICREADCONFIG_RD_SHIFT) /* Command delayed strategy */
-# define EMC_DYNAMICREADCONFIG_RD_CMD1 (2 << EMC_DYNAMICREADCONFIG_RD_SHIFT) /* Command delayed strategy + 1 cycle */
-# define EMC_DYNAMICREADCONFIG_RD_CMD2 (3 << EMC_DYNAMICREADCONFIG_RD_SHIFT) /* Command delayed strategy + 2 cycles */
-
-/* Dynamic Memory Precharge Command Period register */
-
-#define EMC_DYNAMICRP_TRP_MASK (0x0000000f) /* Bits 0-3: Precharge command period */
-
-/* Dynamic Memory Active to Precharge Command Period register */
-
-#define EMC_DYNAMICRAS_TRAS_MASK (0x0000000f) /* Bits 0-3: Active to precharge command period */
-
-/* Dynamic Memory Self-refresh Exit Time register */
-
-#define EMC_DYNAMICSREX_TSREX_MASK (0x0000000f) /* Bits 0-3: Self-refresh exit time */
-
-/* Dynamic Memory Last Data Out to Active Time register */
-
-#define EMC_DYNAMICAPR_TAPR_MASK (0x0000000f) /* Bits 0-3: Last-data-out to active command time */
-
-/* Dynamic Memory Data-in to Active Command Time register */
-
-#define EMC_DYNAMICDAL_TDAL_MASK (0x0000000f) /* Bits 0-3: Data-in to active command */
-
-/* Dynamic Memory Write Recovery Time register */
-
-#define EMC_DYNAMICWR_TWR_MASK (0x0000000f) /* Bits 0-3: Write recovery time */
-
-/* Dynamic Memory Active to Active Command Period register */
-
-#define EMC_DYNAMICRC_TRC_MASK (0x0000001f) /* Bits 0-4: Active to active command period */
-
-/* Dynamic Memory Auto-refresh Period register */
-
-#define EMC_DYNAMICRFC_TRFC_MASK (0x0000001f) /* Bits 0-4: Auto-refresh period and auto-refresh to active command period */
-
-/* Dynamic Memory Exit Self-refresh register */
-
-#define EMC_DYNAMICXSR_TXSR_MASK (0x0000001f) /* Bits 0-4: Exit self-refresh to active command time */
-
-/* Dynamic Memory Active Bank A to Active Bank B Time register */
-
-#define EMC_DYNAMICRRD_TRRD_MASK (0x0000000f) /* Bits 0-3: Active bank A to active bank B latency */
-
-/* Dynamic Memory Load Mode register to Active Command Time */
-
-#define EMC_DYNAMICMRD_TMRD_MASK (0x0000000f) /* Bits 0-3: Load mode register to active command time */
-
-/* Static Memory Extended Wait register */
-
-#define EMC_STATICEXTENDEDWAIT_MASK (0x000003ff) /* Bits 0-9: Extended wait time out */
-
-/* Dynamic Memory Configuration registers (0-3) */
-
-#define EMC_DYNAMICCONFIG_MD_SHIFT (3) /* Bits 3-4: Memory device */
-#define EMC_DYNAMICCONFIG_MD_MASK (3 << EMC_DYNAMICCONFIG_MD_SHIFT)
-# define EMC_DYNAMICCONFIG_MD_SDRAM (0 << EMC_DYNAMICCONFIG_MD_SHIFT) /* SDRAM */
-# define EMC_DYNAMICCONFIG_MD_LOWPOWER (1 << EMC_DYNAMICCONFIG_MD_SHIFT) /* Low-power SDRAM */
-#define EMC_DYNAMICCONFIG_AM0_SHIFT (7) /* Bits 7-12: */
-#define EMC_DYNAMICCONFIG_AM0_MASK (63 << EMC_DYNAMICCONFIG_AM0_SHIFT)
-# define EMC_DYNAMICCONFIG_AM0(n) ((n) << EMC_DYNAMICCONFIG_AM0_SHIFT)
-#define EMC_DYNAMICCONFIG_AM1 (1 << 14) /* Bit 14: */
-#define EMC_DYNAMICCONFIG_B (1 << 19) /* Bit 19: Buffer enable */
-#define EMC_DYNAMICCONFIG_P (1 << 20) /* Bit 20: Write protect */
-
-/* Dynamic Memory RAS & CAS Delay registers (0-3) */
-
-#define EMC_DYNAMICRASCAS_RAS_SHIFT (0) /* Bits 0-1: RAS latency (active to read/write delay) */
-#define EMC_DYNAMICRASCAS_RAS_MASK (3 << EMC_DYNAMICRASCAS_RAS_SHIFT)
-# define EMC_DYNAMICRASCAS_RAS_1CCLK (1 << EMC_DYNAMICRASCAS_RAS_SHIFT) /* One CCLK cycle */
-# define EMC_DYNAMICRASCAS_RAS_2CCLK (2 << EMC_DYNAMICRASCAS_RAS_SHIFT) /* Two CCLK cycles */
-# define EMC_DYNAMICRASCAS_RAS_3CCLK (3 << EMC_DYNAMICRASCAS_RAS_SHIFT) /* Three CCLK cycles */
-#define EMC_DYNAMICRASCAS_CAS_SHIFT (8) /* Bits 8-9: CAS latency */
-#define EMC_DYNAMICRASCAS_CAS_MASK (3 << EMC_DYNAMICRASCAS_CAS_SHIFT)
-# define EMC_DYNAMICRASCAS_CAS_1CCLK (1 << EMC_DYNAMICRASCAS_CAS_SHIFT) /* One CCLK cycle */
-# define EMC_DYNAMICRASCAS_CAS_2CCLK (2 << EMC_DYNAMICRASCAS_CAS_SHIFT) /* Two CCLK cycles */
-# define EMC_DYNAMICRASCAS_CAS_3CCLK (3 << EMC_DYNAMICRASCAS_CAS_SHIFT) /* Three CCLK cycles */
-
-/* Static Memory Configuration registers (0-3) */
-
-#define EMC_STATICCONFIG_MW_SHIFT (0) /* Bits 0-1: Memory width */
-#define EMC_STATICCONFIG_MW_MASK (3 << EMC_STATICCONFIG_MW_SHIFT)
-# define EMC_STATICCONFIG_MW_8BIT (0 << EMC_STATICCONFIG_MW_SHIFT)
-# define EMC_STATICCONFIG_MW_16BIT (1 << EMC_STATICCONFIG_MW_SHIFT)
-# define EMC_STATICCONFIG_MW_32BIT (2 << EMC_STATICCONFIG_MW_SHIFT)
-#define EMC_STATICCONFIG_PM (1 << 3) /* Bit 3: Page mode */
-#define EMC_STATICCONFIG_PC (1 << 6) /* Bit 6: Chip select polarity */
-#define EMC_STATICCONFIG_PB (1 << 7) /* Bit 7: Byte lane state */
-#define EMC_STATICCONFIG_EW (1 << 8) /* Bit 8: Extended wait */
-#define EMC_STATICCONFIG_B (1 << 19) /* Bit 19: Buffer enable */
-#define EMC_STATICCONFIG_P (1 << 20) /* Bit 20: Write protect */
-
-/* Static Memory Write Enable Delay registers (0-3) */
-
-#define EMC_STATICWAITWEN_MASK (0x0000000f) /* Bits 0-3: Wait write enable */
-
-/* Static Memory Output Enable Delay registers (0-3) */
-
-#define EMC_STATICWAITOEN_MASK (0x0000000f) /* Bits 0-3: Wait output enable */
-
-/* Static Memory Read Delay registers (0-3) */
-
-#define EMC_STATICWAITRD_MASK (0x0000001f) /* Bits 0-4: Exit self-refresh to active command time */
-
-/* Static Memory Page Mode Read Delay registers (0-3) */
-
-#define EMC_STATICWAITPAGE_MASK (0x0000001f) /* Bits 0-4: Asynchronous page mode read after the first read wait states */
-
-/* Static Memory Write Delay registers (0-3) */
-
-#define EMC_STATICWAITWR_MASK (0x0000001f) /* Bits 0-4: Write wait states */
-
-/* Static Memory Turn Round Delay registers (0-3) */
-
-#define EMC_STATICWAITTURN_MASK (0x0000000f) /* Bits 0-3: Bus turn-around cycles */
-
-/****************************************************************************************************
- * Public Types
- ****************************************************************************************************/
-
-/****************************************************************************************************
- * Public Data
- ****************************************************************************************************/
-
-/****************************************************************************************************
- * Public Functions
- ****************************************************************************************************/
-
-#endif /* __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC17_EMC_H */
diff --git a/arch/arm/src/lpc17xx/hardware/lpc17_ethernet.h b/arch/arm/src/lpc17xx/hardware/lpc17_ethernet.h
deleted file mode 100644
index f60e5530f8b..00000000000
--- a/arch/arm/src/lpc17xx/hardware/lpc17_ethernet.h
+++ /dev/null
@@ -1,597 +0,0 @@
-/************************************************************************************
- * arch/arm/src/lpc17xx/hardware/lpc17_ethernet.h
- *
- * Copyright (C) 2010, 2013 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. 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.
- * 3. Neither the name NuttX 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 THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- ************************************************************************************/
-
-#ifndef __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC17_ETHERNET_H
-#define __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC17_ETHERNET_H
-
-/************************************************************************************
- * Included Files
- ************************************************************************************/
-
-#include
-
-#include "chip.h"
-#include "hardware/lpc17_memorymap.h"
-
-/************************************************************************************
- * Pre-processor Definitions
- ************************************************************************************/
-
-/* Register offsets *****************************************************************/
-/* MAC registers */
-
-#define LPC17_ETH_MAC1_OFFSET 0x0000 /* MAC configuration register 1 */
-#define LPC17_ETH_MAC2_OFFSET 0x0004 /* MAC configuration register 2 */
-#define LPC17_ETH_IPGT_OFFSET 0x0008 /* Back-to-Back Inter-Packet-Gap register */
-#define LPC17_ETH_IPGR_OFFSET 0x000c /* Non Back-to-Back Inter-Packet-Gap register */
-#define LPC17_ETH_CLRT_OFFSET 0x0010 /* Collision window / Retry register */
-#define LPC17_ETH_MAXF_OFFSET 0x0014 /* Maximum Frame register */
-#define LPC17_ETH_SUPP_OFFSET 0x0018 /* PHY Support register */
-#define LPC17_ETH_TEST_OFFSET 0x001c /* Test register */
-#define LPC17_ETH_MCFG_OFFSET 0x0020 /* MII Mgmt Configuration register */
-#define LPC17_ETH_MCMD_OFFSET 0x0024 /* MII Mgmt Command register */
-#define LPC17_ETH_MADR_OFFSET 0x0028 /* MII Mgmt Address register */
-#define LPC17_ETH_MWTD_OFFSET 0x002c /* MII Mgmt Write Data register */
-#define LPC17_ETH_MRDD_OFFSET 0x0030 /* MII Mgmt Read Data register */
-#define LPC17_ETH_MIND_OFFSET 0x0034 /* MII Mgmt Indicators register */
-#define LPC17_ETH_SA0_OFFSET 0x0040 /* Station Address 0 register */
-#define LPC17_ETH_SA1_OFFSET 0x0044 /* Station Address 1 register */
-#define LPC17_ETH_SA2_OFFSET 0x0048 /* Station Address 2 register */
-
-/* Control registers */
-
-#define LPC17_ETH_CMD_OFFSET 0x0100 /* Command register */
-#define LPC17_ETH_STAT_OFFSET 0x0104 /* Status register */
-#define LPC17_ETH_RXDESC_OFFSET 0x0108 /* Receive descriptor base address register */
-#define LPC17_ETH_RXSTAT_OFFSET 0x010c /* Receive status base address register */
-#define LPC17_ETH_RXDESCNO_OFFSET 0x0110 /* Receive number of descriptors register */
-#define LPC17_ETH_RXPRODIDX_OFFSET 0x0114 /* Receive produce index register */
-#define LPC17_ETH_RXCONSIDX_OFFSET 0x0118 /* Receive consume index register */
-#define LPC17_ETH_TXDESC_OFFSET 0x011c /* Transmit descriptor base address register */
-#define LPC17_ETH_TXSTAT_OFFSET 0x0120 /* Transmit status base address register */
-#define LPC17_ETH_TXDESCRNO_OFFSET 0x0124 /* Transmit number of descriptors register */
-#define LPC17_ETH_TXPRODIDX_OFFSET 0x0128 /* Transmit produce index register */
-#define LPC17_ETH_TXCONSIDX_OFFSET 0x012c /* Transmit consume index register */
-#define LPC17_ETH_TSV0_OFFSET 0x0158 /* Transmit status vector 0 register */
-#define LPC17_ETH_TSV1_OFFSET 0x015c /* Transmit status vector 1 register */
-#define LPC17_ETH_RSV_OFFSET 0x0160 /* Receive status vector register */
-#define LPC17_ETH_FCCNTR_OFFSET 0x0170 /* Flow control counter register */
-#define LPC17_ETH_FCSTAT_OFFSET 0x0174 /* Flow control status register */
-
-/* Rx filter registers */
-
-#define LPC17_ETH_RXFLCTRL_OFFSET 0x0200 /* Receive filter control register */
-#define LPC17_ETH_RXFLWOLST_OFFSET 0x0204 /* Receive filter WoL status register */
-#define LPC17_ETH_RXFLWOLCLR_OFFSET 0x0208 /* Receive filter WoL clear register */
-#define LPC17_ETH_HASHFLL_OFFSET 0x0210 /* Hash filter table LSBs register */
-#define LPC17_ETH_HASHFLH_OFFSET 0x0214 /* Hash filter table MSBs register */
-
-/* Module control registers */
-
-#define LPC17_ETH_INTST_OFFSET 0x0fe0 /* Interrupt status register */
-#define LPC17_ETH_INTEN_OFFSET 0x0fe4 /* Interrupt enable register */
-#define LPC17_ETH_INTCLR_OFFSET 0x0fe8 /* Interrupt clear register */
-#define LPC17_ETH_INTSET_OFFSET 0x0fec /* Interrupt set register */
-#define LPC17_ETH_PWRDOWN_OFFSET 0x0ff4 /* Power-down register */
-
-/* Register addresses ***************************************************************/
-/* MAC registers */
-
-#define LPC17_ETH_MAC1 (LPC17_ETH_BASE+LPC17_ETH_MAC1_OFFSET)
-#define LPC17_ETH_MAC2 (LPC17_ETH_BASE+LPC17_ETH_MAC2_OFFSET)
-#define LPC17_ETH_IPGT (LPC17_ETH_BASE+LPC17_ETH_IPGT_OFFSET)
-#define LPC17_ETH_IPGR (LPC17_ETH_BASE+LPC17_ETH_IPGR_OFFSET)
-#define LPC17_ETH_CLRT (LPC17_ETH_BASE+LPC17_ETH_CLRT_OFFSET)
-#define LPC17_ETH_MAXF (LPC17_ETH_BASE+LPC17_ETH_MAXF_OFFSET)
-#define LPC17_ETH_SUPP (LPC17_ETH_BASE+LPC17_ETH_SUPP_OFFSET)
-#define LPC17_ETH_TEST (LPC17_ETH_BASE+LPC17_ETH_TEST_OFFSET)
-#define LPC17_ETH_MCFG (LPC17_ETH_BASE+LPC17_ETH_MCFG_OFFSET)
-#define LPC17_ETH_MCMD (LPC17_ETH_BASE+LPC17_ETH_MCMD_OFFSET)
-#define LPC17_ETH_MADR (LPC17_ETH_BASE+LPC17_ETH_MADR_OFFSET)
-#define LPC17_ETH_MWTD (LPC17_ETH_BASE+LPC17_ETH_MWTD_OFFSET)
-#define LPC17_ETH_MRDD (LPC17_ETH_BASE+LPC17_ETH_MRDD_OFFSET)
-#define LPC17_ETH_MIND (LPC17_ETH_BASE+LPC17_ETH_MIND_OFFSET)
-#define LPC17_ETH_SA0 (LPC17_ETH_BASE+LPC17_ETH_SA0_OFFSET)
-#define LPC17_ETH_SA1 (LPC17_ETH_BASE+LPC17_ETH_SA1_OFFSET)
-#define LPC17_ETH_SA2 (LPC17_ETH_BASE+LPC17_ETH_SA2_OFFSET)
-
-/* Control registers */
-
-#define LPC17_ETH_CMD (LPC17_ETH_BASE+LPC17_ETH_CMD_OFFSET)
-#define LPC17_ETH_STAT (LPC17_ETH_BASE+LPC17_ETH_STAT_OFFSET)
-#define LPC17_ETH_RXDESC (LPC17_ETH_BASE+LPC17_ETH_RXDESC_OFFSET)
-#define LPC17_ETH_RXSTAT (LPC17_ETH_BASE+LPC17_ETH_RXSTAT_OFFSET)
-#define LPC17_ETH_RXDESCNO (LPC17_ETH_BASE+LPC17_ETH_RXDESCNO_OFFSET)
-#define LPC17_ETH_RXPRODIDX (LPC17_ETH_BASE+LPC17_ETH_RXPRODIDX_OFFSET)
-#define LPC17_ETH_RXCONSIDX (LPC17_ETH_BASE+LPC17_ETH_RXCONSIDX_OFFSET)
-#define LPC17_ETH_TXDESC (LPC17_ETH_BASE+LPC17_ETH_TXDESC_OFFSET)
-#define LPC17_ETH_TXSTAT (LPC17_ETH_BASE+LPC17_ETH_TXSTAT_OFFSET)
-#define LPC17_ETH_TXDESCRNO (LPC17_ETH_BASE+LPC17_ETH_TXDESCRNO_OFFSET)
-#define LPC17_ETH_TXPRODIDX (LPC17_ETH_BASE+LPC17_ETH_TXPRODIDX_OFFSET)
-#define LPC17_ETH_TXCONSIDX (LPC17_ETH_BASE+LPC17_ETH_TXCONSIDX_OFFSET)
-#define LPC17_ETH_TSV0 (LPC17_ETH_BASE+LPC17_ETH_TSV0_OFFSET)
-#define LPC17_ETH_TSV1 (LPC17_ETH_BASE+LPC17_ETH_TSV1_OFFSET)
-#define LPC17_ETH_RSV (LPC17_ETH_BASE+LPC17_ETH_RSV_OFFSET)
-#define LPC17_ETH_FCCNTR (LPC17_ETH_BASE+LPC17_ETH_FCCNTR_OFFSET)
-#define LPC17_ETH_FCSTAT (LPC17_ETH_BASE+LPC17_ETH_FCSTAT_OFFSET)
-
-/* Rx filter registers */
-
-#define LPC17_ETH_RXFLCTRL (LPC17_ETH_BASE+LPC17_ETH_RXFLCTRL_OFFSET)
-#define LPC17_ETH_RXFLWOLST (LPC17_ETH_BASE+LPC17_ETH_RXFLWOLST_OFFSET)
-#define LPC17_ETH_RXFLWOLCLR (LPC17_ETH_BASE+LPC17_ETH_RXFLWOLCLR_OFFSET)
-#define LPC17_ETH_HASHFLL (LPC17_ETH_BASE+LPC17_ETH_HASHFLL_OFFSET)
-#define LPC17_ETH_HASHFLH (LPC17_ETH_BASE+LPC17_ETH_HASHFLH_OFFSET)
-
-/* Module control registers */
-
-#define LPC17_ETH_INTST (LPC17_ETH_BASE+LPC17_ETH_INTST_OFFSET)
-#define LPC17_ETH_INTEN (LPC17_ETH_BASE+LPC17_ETH_INTEN_OFFSET)
-#define LPC17_ETH_INTCLR (LPC17_ETH_BASE+LPC17_ETH_INTCLR_OFFSET)
-#define LPC17_ETH_INTSET (LPC17_ETH_BASE+LPC17_ETH_INTSET_OFFSET)
-#define LPC17_ETH_PWRDOWN (LPC17_ETH_BASE+LPC17_ETH_PWRDOWN_OFFSET)
-
-/* Register bit definitions *********************************************************/
-/* MAC registers */
-/* MAC configuration register 1 (MAC1) */
-
-#define ETH_MAC1_RE (1 << 0) /* Bit 0: Receive enable */
-#define ETH_MAC1_PARF (1 << 1) /* Bit 1: Passall all receive frames */
-#define ETH_MAC1_RFC (1 << 2) /* Bit 2: RX flow control */
-#define ETH_MAC1_TFC (1 << 3) /* Bit 3: TX flow control */
-#define ETH_MAC1_LPBK (1 << 4) /* Bit 4: Loopback */
- /* Bits 5-7: Reserved */
-#define ETH_MAC1_TXRST (1 << 8) /* Bit 8: Reset TX */
-#define ETH_MAC1_MCSTXRST (1 << 9) /* Bit 9: Reset MCS/TX */
-#define ETH_MAC1_RXRST (1 << 10) /* Bit 10: Reset RX */
-#define ETH_MAC1_MCSRXRST (1 << 11) /* Bit 11: Reset MCS/RX */
- /* Bits 12-13: Reserved */
-#define ETH_MAC1_SIMRST (1 << 14) /* Bit 14: Simulation reset */
-#define ETH_MAC1_SOFTRST (1 << 15) /* Bit 15: Soft reset */
- /* Bits 16-31: Reserved */
-/* MAC configuration register 2 (MAC2) */
-
-#define ETH_MAC2_FD (1 << 0) /* Bit 0: Full duplex */
-#define ETH_MAC2_FLC (1 << 1) /* Bit 1: Frame length checking */
-#define ETH_MAC2_HFE (1 << 2) /* Bit 2: Huge frame enable */
-#define ETH_MAC2_DCRC (1 << 3) /* Bit 3: Delayed CRC */
-#define ETH_MAC2_CRCEN (1 << 4) /* Bit 4: CRC enable */
-#define ETH_MAC2_PADCRCEN (1 << 5) /* Bit 5: Pad/CRC enable */
-#define ETH_MAC2_VLANPADEN (1 << 6) /* Bit 6: VLAN pad enable */
-#define ETH_MAC2_AUTOPADEN (1 << 7) /* Bit 7: Auto detect pad enable */
-#define ETH_MAC2_PPE (1 << 8) /* Bit 8: Pure preamble enforcement */
-#define ETH_MAC2_LPE (1 << 9) /* Bit 9: Long preamble enforcement */
- /* Bits 10-11: Reserved */
-#define ETH_MAC2_NBKOFF (1 << 12) /* Bit 12: No backoff */
-#define ETH_MAC2_BPNBKOFF (1 << 13) /* Bit 13: Back pressure/no backoff */
-#define ETH_MAC2_EXDEF (1 << 14) /* Bit 14: Excess defer */
- /* Bits 15-31: Reserved */
-/* Back-to-Back Inter-Packet-Gap register (IPGT) */
-
-#define ETH_IPGT_SHIFT (0) /* Bits 0-6 */
-#define ETH_IPGT_MASK (0x7f << ETH_IPGT_SHIFT)
- /* Bits 7-31: Reserved */
-/* Non Back-to-Back Inter-Packet-Gap register (IPGR) */
-
-#define ETH_IPGR_GAP2_SHIFT (0) /* Bits 0-6: Gap part 2 */
-#define ETH_IPGR_GAP2_MASK (0x7f << ETH_IPGR_GAP2_SHIFT)
- /* Bit 7: Reserved */
-#define ETH_IPGR_GAP1_SHIFT (8) /* Bits 8-18: Gap part 1 */
-#define ETH_IPGR_GAP1_MASK (0x7f << ETH_IPGR_GAP2_SHIFT)
- /* Bits 15-31: Reserved */
-/* Collision window / Retry register (CLRT) */
-
-#define ETH_CLRT_RMAX_SHIFT (0) /* Bits 0-3: Retransmission maximum */
-#define ETH_CLRT_RMAX_MASK (15 << ETH_CLRT_RMAX_SHIFT)
- /* Bits 4-7: Reserved */
-#define ETH_CLRT_COLWIN_SHIFT (8) /* Bits 8-13: Collision window */
-#define ETH_CLRT_COLWIN_MASK (0x3f << ETH_CLRT_COLWIN_SHIFT)
- /* Bits 14-31: Reserved */
-/* Maximum Frame register (MAXF) */
-
-#define ETH_MAXF_SHIFT (0) /* Bits 0-15 */
-#define ETH_MAXF_MASK (0xffff << ETH_MAXF_SHIFT)
- /* Bits 16-31: Reserved */
-/* PHY Support register (SUPP) */
- /* Bits 0-7: Reserved */
-#define ETH_SUPP_SPEED (1 << 8) /* Bit 8: 0=10Bps 1=100Bps */
- /* Bits 9-31: Reserved */
-/* Test register (TEST) */
-
-#define ETH_TEST_SPQ (1 << 0) /* Bit 0: Shortcut pause quanta */
-#define ETH_TEST_TP (1 << 1) /* Bit 1: Test pause */
-#define ETH_TEST_TBP (1 << 2) /* Bit 2: Test packpressure */
- /* Bits 3-31: Reserved */
-/* MII Mgmt Configuration register (MCFG) */
-
-#define ETH_MCFG_SCANINC (1 << 0) /* Bit 0: Scan increment */
-#define ETH_MCFG_SUPPRE (1 << 1) /* Bit 1: Suppress preamble */
-#define ETH_MCFG_CLKSEL_SHIFT (2) /* Bits 2-5: Clock select */
-#define ETH_MCFG_CLKSEL_MASK (15 << ETH_MCFG_CLKSEL_SHIFT)
-# define ETH_MCFG_CLKSEL_DIV4 (0 << ETH_MCFG_CLKSEL_SHIFT)
-# define ETH_MCFG_CLKSEL_DIV6 (2 << ETH_MCFG_CLKSEL_SHIFT)
-# define ETH_MCFG_CLKSEL_DIV8 (3 << ETH_MCFG_CLKSEL_SHIFT)
-# define ETH_MCFG_CLKSEL_DIV10 (4 << ETH_MCFG_CLKSEL_SHIFT)
-# define ETH_MCFG_CLKSEL_DIV14 (5 << ETH_MCFG_CLKSEL_SHIFT)
-# define ETH_MCFG_CLKSEL_DIV20 (6 << ETH_MCFG_CLKSEL_SHIFT)
-# define ETH_MCFG_CLKSEL_DIV28 (7 << ETH_MCFG_CLKSEL_SHIFT)
-# define ETH_MCFG_CLKSEL_DIV36 (8 << ETH_MCFG_CLKSEL_SHIFT)
-# define ETH_MCFG_CLKSEL_DIV40 (9 << ETH_MCFG_CLKSEL_SHIFT)
-# define ETH_MCFG_CLKSEL_DIV44 (10 << ETH_MCFG_CLKSEL_SHIFT)
-# define ETH_MCFG_CLKSEL_DIV48 (11 << ETH_MCFG_CLKSEL_SHIFT)
-# define ETH_MCFG_CLKSEL_DIV52 (12 << ETH_MCFG_CLKSEL_SHIFT)
-# define ETH_MCFG_CLKSEL_DIV56 (13 << ETH_MCFG_CLKSEL_SHIFT)
-# define ETH_MCFG_CLKSEL_DIV60 (14 << ETH_MCFG_CLKSEL_SHIFT)
-# define ETH_MCFG_CLKSEL_DIV64 (15 << ETH_MCFG_CLKSEL_SHIFT)
- /* Bits 6-14: Reserved */
-#define ETH_MCFG_MIIRST (1 << 15) /* Bit 15: Reset MII mgmt */
- /* Bits 16-31: Reserved */
-/* MII Mgmt Command register (MCMD) */
-
-#define ETH_MCMD_READ (1 << 0) /* Bit 0: Single read cycle */
-#define ETH_MCMD_SCAN (1 << 1) /* Bit 1: Continuous read cycles */
- /* Bits 2-31: Reserved */
-#define ETH_MCMD_WRITE (0)
-
-/* MII Mgmt Address register (MADR) */
-
-#define ETH_MADR_REGADDR_SHIFT (0) /* Bits 0-4: Register address */
-#define ETH_MADR_REGADDR_MASK (31 << ETH_MADR_REGADDR_SHIFT)
- /* Bits 7-5: Reserved */
-#define ETH_MADR_PHYADDR_SHIFT (8) /* Bits 8-12: PHY address */
-#define ETH_MADR_PHYADDR_MASK (31 << ETH_MADR_PHYADDR_SHIFT)
- /* Bits 13-31: Reserved */
-/* MII Mgmt Write Data register (MWTD) */
-
-#define ETH_MWTD_SHIFT (0) /* Bits 0-15 */
-#define ETH_MWTD_MASK (0xffff << ETH_MWTD_SHIFT)
- /* Bits 16-31: Reserved */
-/* MII Mgmt Read Data register (MRDD) */
-
-#define ETH_MRDD_SHIFT (0) /* Bits 0-15 */
-#define ETH_MRDD_MASK (0xffff << ETH_MRDD_SHIFT)
- /* Bits 16-31: Reserved */
-/* MII Mgmt Indicators register (MIND) */
-
-#define ETH_MIND_BUSY (1 << 0) /* Bit 0: Busy */
-#define ETH_MIND_SCANNING (1 << 1) /* Bit 1: Scanning */
-#define ETH_MIND_NVALID (1 << 2) /* Bit 2: Not valid */
-#define ETH_MIND_MIIFAIL (1 << 3) /* Bit 3: MII link fail */
- /* Bits 4-31: Reserved */
-/* Station Address 0 register (SA0) */
-
-#define ETH_SA0_OCTET2_SHIFT (0) /* Bits 0-7: Station address 2nd octet */
-#define ETH_SA0_OCTET2_MASK (0xff << ETH_SA0_OCTET2_SHIFT)
-#define ETH_SA0_OCTET1_SHIFT (8) /* Bits 8-15: Station address 1st octet */
-#define ETH_SA0_OCTET1_MASK (0xff << ETH_SA0_OCTET1_SHIFT)
- /* Bits 16-31: Reserved */
-/* Station Address 1 register (SA1) */
-
-#define ETH_SA1_OCTET4_SHIFT (0) /* Bits 0-7: Station address 4th octet */
-#define ETH_SA1_OCTET4_MASK (0xff << ETH_SA0_OCTET4_SHIFT)
-#define ETH_SA1_OCTET3_SHIFT (8) /* Bits 8-15: Station address 3rd octet */
-#define ETH_SA1_OCTET3_MASK (0xff << ETH_SA0_OCTET3_SHIFT)
- /* Bits 16-31: Reserved */
-/* Station Address 2 register (SA2) */
-
-#define ETH_SA2_OCTET6_SHIFT (0) /* Bits 0-7: Station address 5th octet */
-#define ETH_SA2_OCTET6_MASK (0xff << ETH_SA0_OCTET6_SHIFT)
-#define ETH_SA2_OCTET5_SHIFT (8) /* Bits 8-15: Station address 6th octet */
-#define ETH_SA2_OCTET5_MASK (0xff << ETH_SA0_OCTET5_SHIFT)
- /* Bits 16-31: Reserved */
-/* Control registers */
-/* Command register (CMD) */
-
-#define ETH_CMD_RXEN (1 << 0) /* Bit 0: Receive enable */
-#define ETH_CMD_TXEN (1 << 1) /* Bit 1: Transmit enable */
- /* Bit 2: Reserved */
-#define ETH_CMD_REGRST (1 << 3) /* Bit 3: Reset host registers */
-#define ETH_CMD_TXRST (1 << 4) /* Bit 4: Reset transmit datapath */
-#define ETH_CMD_RXRST (1 << 5) /* Bit 5: Reset receive datapath */
-#define ETH_CMD_PRFRAME (1 << 6) /* Bit 6: Pass run frame */
-#define ETH_CMD_PRFILTER (1 << 7) /* Bit 7: Pass RX filter */
-#define ETH_CMD_TXFC (1 << 8) /* Bit 8: TX flow control */
-#define ETH_CMD_RMII (1 << 9) /* Bit 9: RMII mode */
-#define ETH_CMD_FD (1 << 10) /* Bit 10: Full duplex */
- /* Bits 11-31: Reserved */
-/* Status register */
-
-#define ETH_STAT_RX (1 << 0) /* Bit 0: RX status */
-#define ETH_STAT_TX (1 << 1) /* Bit 1: TX status */
- /* Bits 2-31: Reserved */
-/* Receive descriptor base address register (RXDESC)
- *
- * The receive descriptor base address is a byte address aligned to a word
- * boundary i.e. LSB 1:0 are fixed to 00. The register contains the lowest
- * address in the array of descriptors.
- */
-
-/* Receive status base address register (RXSTAT)
- *
- * The receive status base address is a byte address aligned to a double word
- * boundary i.e. LSB 2:0 are fixed to 000.
- */
-
-/* Receive number of descriptors register (RXDESCNO) */
-
-#define ETH_RXDESCNO_SHIFT (0) /* Bits 0-15 */
-#define ETH_RXDESCNO_MASK (0xffff << ETH_RXDESCNO_SHIFT)
- /* Bits 16-31: Reserved */
-/* Receive produce index register (RXPRODIDX) */
-
-#define ETH_RXPRODIDX_SHIFT (0) /* Bits 0-15 */
-#define ETH_RXPRODIDX_MASK (0xffff << ETH_RXPRODIDX_SHIFT)
- /* Bits 16-31: Reserved */
-/* Receive consume index register (RXCONSIDX) */
-
-#define ETH_RXCONSIDX_SHIFT (0) /* Bits 0-15 */
-#define ETH_RXCONSIDX_MASK (0xffff << ETH_RXPRODIDX_SHIFT)
- /* Bits 16-31: Reserved */
-/* Transmit descriptor base address register (TXDESC)
- *
- * The transmit descriptor base address is a byte address aligned to a word
- * boundary i.e. LSB 1:0 are fixed to 00. The register contains the lowest
- * address in the array of descriptors.
- */
-
-/* Transmit status base address register (TXSTAT)
- *
- * The transmit status base address is a byte address aligned to a word
- * boundary i.e. LSB1:0 are fixed to 00. The register contains the lowest
- * address in the array of statuses.
- */
-
-/* Transmit number of descriptors register (TXDESCRNO) */
-
-#define ETH_TXDESCRNO_SHIFT (0) /* Bits 0-15 */
-#define ETH_TXDESCRNO_MASK (0xffff << ETH_TXDESCRNO_SHIFT)
- /* Bits 16-31: Reserved */
-/* Transmit produce index register (TXPRODIDX) */
-
-#define ETH_TXPRODIDX_SHIFT (0) /* Bits 0-15 */
-#define ETH_TXPRODIDX_MASK (0xffff << ETH_TXPRODIDX_SHIFT)
- /* Bits 16-31: Reserved */
-/* Transmit consume index register (TXCONSIDX) */
-
-#define ETH_TXCONSIDX_SHIFT (0) /* Bits 0-15 */
-#define ETH_TXCONSIDX_MASK (0xffff << ETH_TXPRODIDX_SHIFT)
- /* Bits 16-31: Reserved */
-/* Transmit status vector 0 register (TSV0) */
-
-#define ETH_TSV0_CRCERR (1 << 0) /* Bit 0: CRC error */
-#define ETH_TSV0_LENCHKERR (1 << 1) /* Bit 1: Length check error */
-#define ETH_TSV0_LENOOR (1 << 2) /* Bit 2: Length out of range */
-#define ETH_TSV0_DONE (1 << 3) /* Bit 3: Done */
-#define ETH_TSV0_MCAST (1 << 4) /* Bit 4: Multicast */
-#define ETH_TSV0_BCAST (1 << 5) /* Bit 5: Broadcast */
-#define ETH_TSV0_PKTDEFER (1 << 6) /* Bit 6: Packet Defer */
-#define ETH_TSV0_EXCDEFER (1 << 7) /* Bit 7: Excessive Defer */
-#define ETH_TSV0_EXCCOL (1 << 8) /* Bit 8: Excessive Collision */
-#define ETH_TSV0_LATECOL (1 << 9) /* Bit 9: Late Collision */
-#define ETH_TSV0_GIANT (1 << 10) /* Bit 10: Giant */
-#define ETH_TSV0_UNDRUN (1 << 11) /* Bit 11: Underrun */
-#define ETH_TSV0_TOTBYTES_SHIFT (12) /* Bits 12-27:Total bytes */
-#define ETH_TSV0_TOTBYTES_MASK (0xffff << ETH_TSV0_TOTBYTES_SHIFT)
-#define ETH_TSV0_CTLFRAME (1 << 28) /* Bit 28: Control frame */
-#define ETH_TSV0_PAUSE (1 << 29) /* Bit 29: Pause */
-#define ETH_TSV0_BP (1 << 30) /* Bit 30: Backpressure */
-#define ETH_TSV0_VLAN (1 << 31) /* Bit 31: VLAN */
-
-/* Transmit status vector 1 register (TSV1) */
-
-#define ETH_TSV1_TXCNT_SHIFT (0) /* Bits 0-15: Transmit byte count */
-#define ETH_TSV1_TXCNT_MASK (0xffff << ETH_TSV1_TXCNT_SHIFT)
-#define ETH_TSV1_COLCNT_SHIFT (16) /* Bits 16-19: Transmit collision count */
-#define ETH_TSV1_COLCNT_MASK (15 << ETH_TSV1_COLCNT_SHIFT)
- /* Bits 20-31: Reserved */
-/* Receive status vector register (RSV) */
-
-#define ETH_RSV_RXCNT_SHIFT (0) /* Bits 0-15: Received byte count */
-#define ETH_RSV_RXCNT_MASK (0xffff << ETH_RSV_RXCNT_SHIFT)
-#define ETH_RSV_PKTPI (1 << 16) /* Bit 16: Packet previously ignored */
-#define ETH_RSV_RXEPS (1 << 17) /* Bit 17: RXDV event previously seen */
-#define ETH_RSV_CEPS (1 << 18) /* Bit 18: Carrier event previously seen */
-#define ETH_RSV_RXCV (1 << 19) /* Bit 19: Receive code violation */
-#define ETH_RSV_CRCERR (1 << 20) /* Bit 20: CRC error */
-#define ETH_RSV_LENCHKERR (1 << 21) /* Bit 21: Length check error */
-#define ETH_RSV_LENOOR (1 << 22) /* Bit 22: Length out of range */
-#define ETH_RSV_RXOK (1 << 23) /* Bit 23: Receive OK */
-#define ETH_RSV_MCAST (1 << 24) /* Bit 24: Multicast */
-#define ETH_RSV_BCAST (1 << 25) /* Bit 25: Broadcast */
-#define ETH_RSV_DRIBNIB (1 << 26) /* Bit 26: Dribble Nibble */
-#define ETH_RSV_CTLFRAME (1 << 27) /* Bit 27: Control frame */
-#define ETH_RSV_PAUSE (1 << 28) /* Bit 28: Pause */
-#define ETH_RSV_UNSUPOP (1 << 29) /* Bit 29: Unsupported Opcode */
-#define ETH_RSV_VLAN (1 << 30) /* Bit 30: VLAN */
- /* Bit 31: Reserved */
-/* Flow control counter register (FCCNTR) */
-
-#define ETH_FCCNTR_MCOUNT_SHIFT (0) /* Bits 0-15: Mirror count */
-#define ETH_FCCNTR_MCOUNT_MASK (0xffff << ETH_FCCNTR_MCOUNT_SHIFT)
-#define ETH_FCCNTR_PTMR_SHIFT (16) /* Bits 16-31: Pause timer */
-#define ETH_FCCNTR_PTMR_MASK (0xffff << ETH_FCCNTR_PTMR_SHIFT)
-
-/* Flow control status register (FCSTAT) */
-
-#define ETH_FCSTAT_MCOUNT_SHIFT (0) /* Bits 0-15: Current mirror count */
-#define ETH_FCSTAT_MCOUNT_MASK (0xffff << ETH_FCSTAT_MCOUNT_SHIFT)
- /* Bits 16-31: Reserved */
-/* Rx filter registers */
-/* Receive filter control register (RXFLCTRL) */
-
-#define ETH_RXFLCTRL_UCASTEN (1 << 0) /* Bit 0: Accept all unicast frames */
-#define ETH_RXFLCTRL_BCASTEN (1 << 1) /* Bit 1: Accept all broadcast frames */
-#define ETH_RXFLCTRL_MCASTEN (1 << 2) /* Bit 2: Accept all multicast frames */
-#define ETH_RXFLCTRL_UCASTHASHEN (1 << 3) /* Bit 3: Accept hashed unicast */
-#define ETH_RXFLCTRL_MCASTHASHEN (1 << 4) /* Bit 4: Accect hashed multicast */
-#define ETH_RXFLCTRL_PERFEN (1 << 5) /* Bit 5: Accept perfect dest match */
- /* Bits 6-11: Reserved */
-#define ETH_RXFLCTRL_MPKTEN (1 << 12) /* Bit 12: Magic pkt filter WoL int */
-#define ETH_RXFLCTRL_RXFILEN (1 << 13) /* Bit 13: Perfect match WoL interrupt */
- /* Bits 14-31: Reserved */
-/* Receive filter WoL status register (RXFLWOLST) AND
- * Receive filter WoL clear register (RXFLWOLCLR)
- */
-
-#define ETH_RXFLWOL_UCAST (1 << 0) /* Bit 0: Unicast frame WoL */
-#define ETH_RXFLWOL_BCAST (1 << 1) /* Bit 1: Broadcast frame WoL */
-#define ETH_RXFLWOL_MCAST (1 << 2) /* Bit 2: Multicast frame WoL */
-#define ETH_RXFLWOL_UCASTHASH (1 << 3) /* Bit 3: Unicast hash filter WoL */
-#define ETH_RXFLWOL_MCASTHASH (1 << 4) /* Bit 4: Multiicast hash filter WoL */
-#define ETH_RXFLWOL_PERF (1 << 5) /* Bit 5: Perfect addr match WoL */
- /* Bit 6: Reserved */
-#define ETH_RXFLWOL_RXFIL (1 << 7) /* Bit 7: Receive filter WoL */
-#define ETH_RXFLWOL_MPKT (1 << 8) /* Bit 8: Magic pkt filter WoL */
- /* Bits 9-31: Reserved */
-/* Hash filter table LSBs register (HASHFLL) AND Hash filter table MSBs register
-* (HASHFLH) Are registers containing a 32-bit value with no bitfield.
- */
-
-/* Module control registers */
-/* Interrupt status register (INTST), Interrupt enable register (INTEN), Interrupt
- * clear register (INTCLR), and Interrupt set register (INTSET) common bit field
- * definition:
- */
-
-#define ETH_INT_RXOVR (1 << 0) /* Bit 0: RX overrun interrupt */
-#define ETH_INT_RXERR (1 << 1) /* Bit 1: RX error interrupt */
-#define ETH_INT_RXFIN (1 << 2) /* Bit 2: RX finished interrupt */
-#define ETH_INT_RXDONE (1 << 3) /* Bit 3: RX done interrupt */
-#define ETH_INT_TXUNR (1 << 4) /* Bit 4: TX underrun interrupt */
-#define ETH_INT_TXERR (1 << 5) /* Bit 5: TX error interrupt */
-#define ETH_INT_TXFIN (1 << 6) /* Bit 6: TX finished interrupt */
-#define ETH_INT_TXDONE (1 << 7) /* Bit 7: TX done interrupt */
- /* Bits 8-11: Reserved */
-#define ETH_INT_SOFT (1 << 12) /* Bit 12: Soft interrupt */
-#define ETH_INT_WKUP (1 << 13) /* Bit 13: Wakeup interrupt */
- /* Bits 14-31: Reserved */
-/* Power-down register */
- /* Bits 0-30: Reserved */
-#define ETH_PWRDOWN_MACAHB (1 << 31) /* Power down MAC/AHB */
-
-/* Descriptors Offsets **************************************************************/
-
-/* Tx descriptor offsets */
-
-#define LPC17_TXDESC_PACKET 0x00 /* Base address of the Tx data buffer */
-#define LPC17_TXDESC_CONTROL 0x04 /* Control Information */
-#define LPC17_TXDESC_SIZE 0x08 /* Size in bytes of one Tx descriptor */
-
-/* Tx status offsets */
-
-#define LPC17_TXSTAT_INFO 0x00 /* Transmit status return flags */
-#define LPC17_TXSTAT_SIZE 0x04 /* Size in bytes of one Tx status */
-
-/* Rx descriptor offsets */
-
-#define LPC17_RXDESC_PACKET 0x00 /* Base address of the Rx data buffer */
-#define LPC17_RXDESC_CONTROL 0x04 /* Control Information */
-#define LPC17_RXDESC_SIZE 0x08 /* Size in bytes of one Rx descriptor */
-
-/* Rx status offsets */
-
-#define LPC17_RXSTAT_INFO 0x00 /* Receive status return flags */
-#define LPC17_RXSTAT_HASHCRC 0x04 /* Dest and source hash CRC */
-#define LPC17_RXSTAT_SIZE 0x08 /* Size in bytes of one Rx status */
-
-/* Descriptor Bit Definitions *******************************************************/
-
-/* Tx descriptor bit definitions */
-
-#define TXDESC_CONTROL_SIZE_SHIFT (0) /* Bits 0-10: Size of data buffer */
-#define TXDESC_CONTROL_SIZE_MASK (0x7ff << RXDESC_CONTROL_SIZE_SHIFT)
-
-#define TXDESC_CONTROL_OVERRIDE (1 << 26 /* Bit 26: Per-frame override */
-#define TXDESC_CONTROL_HUGE (1 << 27) /* Bit 27: Enable huge frame size */
-#define TXDESC_CONTROL_PAD (1 << 28) /* Bit 28: Pad short frames */
-#define TXDESC_CONTROL_CRC (1 << 29) /* Bit 29: Append CRC */
-#define TXDESC_CONTROL_LAST (1 << 30) /* Bit 30: Last descriptor of a fragment */
-#define TXDESC_CONTROL_INT (1 << 31) /* Bit 31: Generate TxDone interrupt */
-
-/* Tx status bit definitions */
-
-#define TXSTAT_INFO_COLCNT_SHIFT (21) /* Bits 21-24: Number of collisions */
-#define TXSTAT_INFO_COLCNT_MASK (15 << TXSTAT_INFO_COLCNT_SHIFT)
-#define TXSTAT_INFO_DEFER (1 << 25) /* Bit 25: Packet deffered */
-#define TXSTAT_INFO_EXCESSDEFER (1 << 26) /* Bit 26: Excessive packet defferals */
-#define TXSTAT_INFO_EXCESSCOL (1 << 27) /* Bit 27: Excessive packet collisions */
-#define TXSTAT_INFO_LATECOL (1 << 28) /* Bit 28: Out of window collision */
-#define TXSTAT_INFO_UNDERRUN (1 << 29) /* Bit 29: Tx underrun */
-#define TXSTAT_INFO_NODESC (1 << 30) /* Bit 29: No Tx descriptor available */
-#define TXSTAT_INFO_ERROR (1 << 31) /* Bit 31: OR of other error conditions */
-
-/* Rx descriptor bit definitions */
-
-#define RXDESC_CONTROL_SIZE_SHIFT (0) /* Bits 0-10: Size of data buffer */
-#define RXDESC_CONTROL_SIZE_MASK (0x7ff << RXDESC_CONTROL_SIZE_SHIFT)
-#define RXDESC_CONTROL_INT (1 << 31) /* Bit 31: Generate RxDone interrupt */
-
-/* Rx status bit definitions */
-
-#define RXSTAT_SAHASHCRC_SHIFT (0) /* Bits 0-8: Hash CRC calculated from the source address */
-#define RXSTAT_SAHASHCRC_MASK (0x1ff << RXSTAT_SAHASHCRC_SHIFT)
-#define RXSTAT_DAHASHCRC_SHIFT (16) /* Bits 16-24: Hash CRC calculated from the dest address */
-#define RXSTAT_DAHASHCRC_MASK (0x1ff << RXSTAT_DAHASHCRC_SHIFT)
-
-#define RXSTAT_INFO_RXSIZE_SHIFT (0) /* Bits 0-10: Size of actual data transferred */
-#define RXSTAT_INFO_RXSIZE_MASK (0x7ff << RXSTAT_INFO_RXSIZE_SHIFT)
-#define RXSTAT_INFO_CONTROL (1 << 18) /* Bit 18: This is a control frame */
-#define RXSTAT_INFO_VLAN (1 << 19) /* Bit 19: This is a VLAN frame */
-#define RXSTAT_INFO_FAILFILTER (1 << 20) /* Bit 20: Frame failed Rx filter */
-#define RXSTAT_INFO_MULTICAST (1 << 21) /* Bit 21: This is a multicast frame */
-#define RXSTAT_INFO_BROADCAST (1 << 22) /* Bit 22: This is a broadcast frame */
-#define RXSTAT_INFO_CRCERROR (1 << 23) /* Bit 23: Received frame had a CRC error */
-#define RXSTAT_INFO_SYMBOLERROR (1 << 24) /* Bit 24: PHY reported bit error */
-#define RXSTAT_INFO_LENGTHERROR (1 << 25) /* Bit 25: Invalid frame length */
-#define RXSTAT_INFO_RANGEERROR (1 << 26) /* Bit 26: Exceeds maximum packet size */
-#define RXSTAT_INFO_ALIGNERROR (1 << 27) /* Bit 27: Alignment error */
-#define RXSTAT_INFO_OVERRUN (1 << 28) /* Bit 28: Receive overrun error */
-#define RXSTAT_INFO_NODESC (1 << 29) /* Bit 29: No Rx descriptor available */
-#define RXSTAT_INFO_LASTFLAG (1 << 30) /* Bit 30: Last fragment of a frame */
-#define RXSTAT_INFO_ERROR (1 << 31) /* Bit 31: OR of other error conditions */
-
-/************************************************************************************
- * Public Types
- ************************************************************************************/
-
-/************************************************************************************
- * Public Data
- ************************************************************************************/
-
-/************************************************************************************
- * Public Functions
- ************************************************************************************/
-
-#endif /* __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC17_ETHERNET_H */
diff --git a/arch/arm/src/lpc17xx/hardware/lpc17_gpdma.h b/arch/arm/src/lpc17xx/hardware/lpc17_gpdma.h
deleted file mode 100644
index 4a1f25bf91c..00000000000
--- a/arch/arm/src/lpc17xx/hardware/lpc17_gpdma.h
+++ /dev/null
@@ -1,597 +0,0 @@
-/************************************************************************************
- * arch/arm/src/lpc17xx/hardware/lpc17_gpdma.h
- *
- * Copyright (C) 2010, 2013 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. 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.
- * 3. Neither the name NuttX 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 THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- ************************************************************************************/
-
-#ifndef __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC17_GPDMA_H
-#define __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC17_GPDMA_H
-
-/************************************************************************************
- * Included Files
- ************************************************************************************/
-
-#include
-
-#include "chip.h"
-#include "hardware/lpc17_memorymap.h"
-
-/************************************************************************************
- * Pre-processor Definitions
- ************************************************************************************/
-/* Register offsets *****************************************************************/
-
-/* General registers (see also LPC17_SYSCON_DMAREQSEL_OFFSET in lpc17_syscon.h) */
-
-#define LPC17_DMA_INTST_OFFSET 0x0000 /* DMA Interrupt Status Register */
-#define LPC17_DMA_INTTCST_OFFSET 0x0004 /* DMA Interrupt Terminal Count Request Status Register */
-#define LPC17_DMA_INTTCCLR_OFFSET 0x0008 /* DMA Interrupt Terminal Count Request Clear Register */
-#define LPC17_DMA_INTERRST_OFFSET 0x000c /* DMA Interrupt Error Status Register */
-#define LPC17_DMA_INTERRCLR_OFFSET 0x0010 /* DMA Interrupt Error Clear Register */
-#define LPC17_DMA_RAWINTTCST_OFFSET 0x0014 /* DMA Raw Interrupt Terminal Count Status Register */
-#define LPC17_DMA_RAWINTERRST_OFFSET 0x0018 /* DMA Raw Error Interrupt Status Register */
-#define LPC17_DMA_ENBLDCHNS_OFFSET 0x001c /* DMA Enabled Channel Register */
-#define LPC17_DMA_SOFTBREQ_OFFSET 0x0020 /* DMA Software Burst Request Register */
-#define LPC17_DMA_SOFTSREQ_OFFSET 0x0024 /* DMA Software Single Request Register */
-#define LPC17_DMA_SOFTLBREQ_OFFSET 0x0028 /* DMA Software Last Burst Request Register */
-#define LPC17_DMA_SOFTLSREQ_OFFSET 0x002c /* DMA Software Last Single Request Register */
-#define LPC17_DMA_CONFIG_OFFSET 0x0030 /* DMA Configuration Register */
-#define LPC17_DMA_SYNC_OFFSET 0x0034 /* DMA Synchronization Register */
-
-/* Channel Registers */
-
-#define LPC17_NDMACH 8 /* Eight DMA channels */
-#define LPC17_DMA_CHAN_OFFSET(n) (0x0100 + ((n) << 5)) /* n=0,1,...,(LPC17_NDMACH-1) */
-
-#define LPC17_DMACH_SRCADDR_OFFSET 0x0000 /* DMA Channel Source Address Register */
-#define LPC17_DMACH_DESTADDR_OFFSET 0x0004 /* DMA Channel Destination Address Register */
-#define LPC17_DMACH_LLI_OFFSET 0x0008 /* DMA Channel Linked List Item Register */
-#define LPC17_DMACH_CONTROL_OFFSET 0x000c /* DMA Channel Control Register */
-#define LPC17_DMACH_CONFIG_OFFSET 0x0010 /* DMA Channel Configuration Register */
-
-#define LPC17_DMACH0_SRCADDR_OFFSET (0x100+LPC17_DMACH_SRCADDR_OFFSET)
-#define LPC17_DMACH0_DESTADDR_OFFSET (0x100+LPC17_DMACH_DESTADDR_OFFSET)
-#define LPC17_DMACH0_LLI_OFFSET (0x100+LPC17_DMACH_LLI_OFFSET)
-#define LPC17_DMACH0_CONTROL_OFFSET (0x100+LPC17_DMACH_CONTROL_OFFSET)
-#define LPC17_DMACH0_CONFIG_OFFSET (0x100+LPC17_DMACH_CONFIG_OFFSET)
-
-#define LPC17_DMACH1_SRCADDR_OFFSET (0x120+LPC17_DMACH_SRCADDR_OFFSET)
-#define LPC17_DMACH1_DESTADDR_OFFSET (0x120+LPC17_DMACH_DESTADDR_OFFSET)
-#define LPC17_DMACH1_LLI_OFFSET (0x120+LPC17_DMACH_LLI_OFFSET)
-#define LPC17_DMACH1_CONTROL_OFFSET (0x120+LPC17_DMACH_CONTROL_OFFSET)
-#define LPC17_DMACH1_CONFIG_OFFSET (0x120+LPC17_DMACH_CONFIG_OFFSET)
-
-#define LPC17_DMACH2_SRCADDR_OFFSET (0x140+LPC17_DMACH_SRCADDR_OFFSET)
-#define LPC17_DMACH2_DESTADDR_OFFSET (0x140+LPC17_DMACH_DESTADDR_OFFSET)
-#define LPC17_DMACH2_LLI_OFFSET (0x140+LPC17_DMACH_LLI_OFFSET)
-#define LPC17_DMACH2_CONTROL_OFFSET (0x140+LPC17_DMACH_CONTROL_OFFSET)
-#define LPC17_DMACH2_CONFIG_OFFSET (0x140+LPC17_DMACH_CONFIG_OFFSET)
-
-#define LPC17_DMACH3_SRCADDR_OFFSET (0x160+LPC17_DMACH_SRCADDR_OFFSET)
-#define LPC17_DMACH3_DESTADDR_OFFSET (0x160+LPC17_DMACH_DESTADDR_OFFSET)
-#define LPC17_DMACH3_LLI_OFFSET (0x160+LPC17_DMACH_LLI_OFFSET)
-#define LPC17_DMACH3_CONTROL_OFFSET (0x160+LPC17_DMACH_CONTROL_OFFSET)
-#define LPC17_DMACH3_CONFIG_OFFSET (0x160+LPC17_DMACH_CONFIG_OFFSET)
-
-#define LPC17_DMACH4_SRCADDR_OFFSET (0x180+LPC17_DMACH_SRCADDR_OFFSET)
-#define LPC17_DMACH4_DESTADDR_OFFSET (0x180+LPC17_DMACH_DESTADDR_OFFSET)
-#define LPC17_DMACH4_LLI_OFFSET (0x180+LPC17_DMACH_LLI_OFFSET)
-#define LPC17_DMACH4_CONTROL_OFFSET (0x180+LPC17_DMACH_CONTROL_OFFSET)
-#define LPC17_DMACH4_CONFIG_OFFSET (0x180+LPC17_DMACH_CONFIG_OFFSET)
-
-#define LPC17_DMACH5_SRCADDR_OFFSET (0x1a0+LPC17_DMACH_SRCADDR_OFFSET)
-#define LPC17_DMACH5_DESTADDR_OFFSET (0x1a0+LPC17_DMACH_DESTADDR_OFFSET)
-#define LPC17_DMACH5_LLI_OFFSET (0x1a0+LPC17_DMACH_LLI_OFFSET)
-#define LPC17_DMACH5_CONTROL_OFFSET (0x1a0+LPC17_DMACH_CONTROL_OFFSET)
-#define LPC17_DMACH5_CONFIG_OFFSET (0x1a0+LPC17_DMACH_CONFIG_OFFSET)
-
-#define LPC17_DMACH6_SRCADDR_OFFSET (0x1c0+LPC17_DMACH_SRCADDR_OFFSET)
-#define LPC17_DMACH6_DESTADDR_OFFSET (0x1c0+LPC17_DMACH_DESTADDR_OFFSET)
-#define LPC17_DMACH6_LLI_OFFSET (0x1c0+LPC17_DMACH_LLI_OFFSET)
-#define LPC17_DMACH6_CONTROL_OFFSET (0x1c0+LPC17_DMACH_CONTROL_OFFSET)
-#define LPC17_DMACH6_CONFIG_OFFSET (0x1c0+LPC17_DMACH_CONFIG_OFFSET)
-
-#define LPC17_DMACH7_SRCADDR_OFFSET (0x1e0+LPC17_DMACH_SRCADDR_OFFSET)
-#define LPC17_DMACH7_DESTADDR_OFFSET (0x1e0+LPC17_DMACH_DESTADDR_OFFSET)
-#define LPC17_DMACH7_LLI_OFFSET (0x1e0+LPC17_DMACH_LLI_OFFSET)
-#define LPC17_DMACH7_CONTROL_OFFSET (0x1e0+LPC17_DMACH_CONTROL_OFFSET)
-#define LPC17_DMACH7_CONFIG_OFFSET (0x1e0+LPC17_DMACH_CONFIG_OFFSET)
-
-/* Register addresses ***************************************************************/
-/* General registers (see also LPC17_SYSCON_DMAREQSEL in lpc17_syscon.h) */
-
-#define LPC17_DMA_INTST (LPC17_GPDMA_BASE+LPC17_DMA_INTST_OFFSET)
-#define LPC17_DMA_INTTCST (LPC17_GPDMA_BASE+LPC17_DMA_INTTCST_OFFSET)
-#define LPC17_DMA_INTTCCLR (LPC17_GPDMA_BASE+LPC17_DMA_INTTCCLR_OFFSET)
-#define LPC17_DMA_INTERRST (LPC17_GPDMA_BASE+LPC17_DMA_INTERRST_OFFSET)
-#define LPC17_DMA_INTERRCLR (LPC17_GPDMA_BASE+LPC17_DMA_INTERRCLR_OFFSET)
-#define LPC17_DMA_RAWINTTCST (LPC17_GPDMA_BASE+LPC17_DMA_RAWINTTCST_OFFSET)
-#define LPC17_DMA_RAWINTERRST (LPC17_GPDMA_BASE+LPC17_DMA_RAWINTERRST_OFFSET)
-#define LPC17_DMA_ENBLDCHNS (LPC17_GPDMA_BASE+LPC17_DMA_ENBLDCHNS_OFFSET)
-#define LPC17_DMA_SOFTBREQ (LPC17_GPDMA_BASE+LPC17_DMA_SOFTBREQ_OFFSET)
-#define LPC17_DMA_SOFTSREQ (LPC17_GPDMA_BASE+LPC17_DMA_SOFTSREQ_OFFSET)
-#define LPC17_DMA_SOFTLBREQ (LPC17_GPDMA_BASE+LPC17_DMA_SOFTLBREQ_OFFSET)
-#define LPC17_DMA_SOFTLSREQ (LPC17_GPDMA_BASE+LPC17_DMA_SOFTLSREQ_OFFSET)
-#define LPC17_DMA_CONFIG (LPC17_GPDMA_BASE+LPC17_DMA_CONFIG_OFFSET)
-#define LPC17_DMA_SYNC (LPC17_GPDMA_BASE+LPC17_DMA_SYNC_OFFSET)
-
-/* Channel Registers */
-
-#define LPC17_DMACH_BASE(n) (LPC17_GPDMA_BASE+LPC17_DMA_CHAN_OFFSET(n))
-
-#define LPC17_DMACH_SRCADDR(n) (LPC17_DMACH_BASE(n)+LPC17_DMACH_SRCADDR_OFFSET)
-#define LPC17_DMACH_DESTADDR(n) (LPC17_DMACH_BASE(n)+LPC17_DMACH_DESTADDR_OFFSET)
-#define LPC17_DMACH_LLI(n) (LPC17_DMACH_BASE(n)+LPC17_DMACH_LLI_OFFSET)
-#define LPC17_DMACH_CONTROL(n) (LPC17_DMACH_BASE(n)+LPC17_DMACH_CONTROL_OFFSET)
-#define LPC17_DMACH_CONFIG(n) (LPC17_DMACH_BASE(n)+LPC17_DMACH_CONFIG_OFFSET)
-
-#define LPC17_DMACH0_SRCADDR (LPC17_GPDMA_BASE+LPC17_DMACH0_SRCADDR_OFFSET)
-#define LPC17_DMACH0_DESTADDR (LPC17_GPDMA_BASE+LPC17_DMACH0_DESTADDR_OFFSET)
-#define LPC17_DMACH0_LLI (LPC17_GPDMA_BASE+LPC17_DMACH0_LLI_OFFSET)
-#define LPC17_DMACH0_CONTROL (LPC17_GPDMA_BASE+LPC17_DMACH0_CONTROL_OFFSET)
-#define LPC17_DMACH0_CONFIG (LPC17_GPDMA_BASE+LPC17_DMACH0_CONFIG_OFFSET)
-
-#define LPC17_DMACH1_SRCADDR (LPC17_GPDMA_BASE+LPC17_DMACH1_SRCADDR_OFFSET)
-#define LPC17_DMACH1_DESTADDR (LPC17_GPDMA_BASE+LPC17_DMACH1_DESTADDR_OFFSET)
-#define LPC17_DMACH1_LLI (LPC17_GPDMA_BASE+LPC17_DMACH1_LLI_OFFSET)
-#define LPC17_DMACH1_CONTROL (LPC17_GPDMA_BASE+LPC17_DMACH1_CONTROL_OFFSET)
-#define LPC17_DMACH1_CONFIG (LPC17_GPDMA_BASE+LPC17_DMACH1_CONFIG_OFFSET)
-
-#define LPC17_DMACH2_SRCADDR (LPC17_GPDMA_BASE+LPC17_DMACH2_SRCADDR_OFFSET)
-#define LPC17_DMACH2_DESTADDR (LPC17_GPDMA_BASE+LPC17_DMACH2_DESTADDR_OFFSET)
-#define LPC17_DMACH2_LLI (LPC17_GPDMA_BASE+LPC17_DMACH2_LLI_OFFSET)
-#define LPC17_DMACH2_CONTROL (LPC17_GPDMA_BASE+LPC17_DMACH2_CONTROL_OFFSET)
-#define LPC17_DMACH2_CONFIG (LPC17_GPDMA_BASE+LPC17_DMACH2_CONFIG_OFFSET)
-
-#define LPC17_DMACH3_SRCADDR (LPC17_GPDMA_BASE+LPC17_DMACH3_SRCADDR_OFFSET)
-#define LPC17_DMACH3_DESTADDR (LPC17_GPDMA_BASE+LPC17_DMACH3_DESTADDR_OFFSET)
-#define LPC17_DMACH3_LLI (LPC17_GPDMA_BASE+LPC17_DMACH3_LLI_OFFSET)
-#define LPC17_DMACH3_CONTROL (LPC17_GPDMA_BASE+LPC17_DMACH3_CONTROL_OFFSET)
-#define LPC17_DMACH3_CONFIG (LPC17_GPDMA_BASE+LPC17_DMACH3_CONFIG_OFFSET)
-
-#define LPC17_DMACH4_SRCADDR (LPC17_GPDMA_BASE+LPC17_DMACH4_SRCADDR_OFFSET)
-#define LPC17_DMACH4_DESTADDR (LPC17_GPDMA_BASE+LPC17_DMACH4_DESTADDR_OFFSET)
-#define LPC17_DMACH4_LLI (LPC17_GPDMA_BASE+LPC17_DMACH4_LLI_OFFSET)
-#define LPC17_DMACH4_CONTROL (LPC17_GPDMA_BASE+LPC17_DMACH4_CONTROL_OFFSET)
-#define LPC17_DMACH4_CONFIG (LPC17_GPDMA_BASE+LPC17_DMACH4_CONFIG_OFFSET)
-
-#define LPC17_DMACH5_SRCADDR (LPC17_GPDMA_BASE+LPC17_DMACH5_SRCADDR_OFFSET)
-#define LPC17_DMACH5_DESTADDR (LPC17_GPDMA_BASE+LPC17_DMACH5_DESTADDR_OFFSET)
-#define LPC17_DMACH5_LLI (LPC17_GPDMA_BASE+LPC17_DMACH5_LLI_OFFSET)
-#define LPC17_DMACH5_CONTROL (LPC17_GPDMA_BASE+LPC17_DMACH5_CONTROL_OFFSET)
-#define LPC17_DMACH5_CONFIG (LPC17_GPDMA_BASE+LPC17_DMACH5_CONFIG_OFFSET)
-
-#define LPC17_DMACH6_SRCADDR (LPC17_GPDMA_BASE+LPC17_DMACH6_SRCADDR_OFFSET)
-#define LPC17_DMACH6_DESTADDR (LPC17_GPDMA_BASE+LPC17_DMACH6_DESTADDR_OFFSET)
-#define LPC17_DMACH6_LLI (LPC17_GPDMA_BASE+LPC17_DMACH6_LLI_OFFSET)
-#define LPC17_DMACH6_CONTROL (LPC17_GPDMA_BASE+LPC17_DMACH6_CONTROL_OFFSET)
-#define LPC17_DMACH6_CONFIG (LPC17_GPDMA_BASE+LPC17_DMACH6_CONFIG_OFFSET)
-
-#define LPC17_DMACH7_SRCADDR (LPC17_GPDMA_BASE+LPC17_DMACH7_SRCADDR_OFFSET)
-#define LPC17_DMACH7_DESTADDR (LPC17_GPDMA_BASE+LPC17_DMACH7_DESTADDR_OFFSET)
-#define LPC17_DMACH7_LLI (LPC17_GPDMA_BASE+LPC17_DMACH7_LLI_OFFSET)
-#define LPC17_DMACH7_CONTROL (LPC17_GPDMA_BASE+LPC17_DMACH7_CONTROL_OFFSET)
-#define LPC17_DMACH7_CONFIG (LPC17_GPDMA_BASE+LPC17_DMACH7_CONFIG_OFFSET)
-
-/* Register bit definitions *********************************************************/
-/* DMA Request Connections **********************************************************/
-
-#define LPC17_NDMAREQ (16) /* The number of DMA requests */
-#if defined(LPC176x)
-/* Request Numbers */
-
-# define DMA_REQ_SSP0TX (0)
-# define DMA_REQ_SSP0RX (1)
-# define DMA_REQ_SSP1TX (2)
-# define DMA_REQ_SSP1RX (3)
-
-# define DMA_REQ_ADC (4)
-
-# define DMA_REQ_I2SCH0 (5)
-# define DMA_REQ_I2SCH1 (6)
-
-# define DMA_REQ_DAC (7)
-
-# define DMA_REQ_UART0TX (8) /* DMASEL08=0*/
-# define DMA_REQ_UART0RX (9) /* DMASEL09=0*/
-# define DMA_REQ_UART1TX (10) /* DMASEL010=0*/
-# define DMA_REQ_UART1RX (11) /* DMASEL011=0*/
-# define DMA_REQ_UART2TX (12) /* DMASEL012=0*/
-# define DMA_REQ_UART2RX (13) /* DMASEL013=0*/
-# define DMA_REQ_UART3TX (14) /* DMASEL014=0*/
-# define DMA_REQ_UART3RX (15) /* DMASEL015=0*/
-
-# define DMA_REQ_MAT0p0 (8) /* DMASEL08=1 */
-# define DMA_REQ_MAT0p1 (9) /* DMASEL09=1 */
-# define DMA_REQ_MAT1p0 (10) /* DMASEL010=1 */
-# define DMA_REQ_MAT1p1 (11) /* DMASEL011=1 */
-# define DMA_REQ_MAT2p0 (12) /* DMASEL012=1 */
-# define DMA_REQ_MAT2p1 (13) /* DMASEL013=1 */
-# define DMA_REQ_MAT3p0 (14) /* DMASEL014=1 */
-# define DMA_REQ_MAT3p1 (15) /* DMASEL015=1 */
-
-/* DMASEL values. For the LPC176x family, only request numbers 8-15 have
- * DMASEL bits.
- */
-
-# define DMA_DMASEL_SSP0TX (0) /* Not applicable */
-# define DMA_DMASEL_SSP0RX (0) /* Not applicable */
-# define DMA_DMASEL_SSP1TX (0) /* Not applicable */
-# define DMA_DMASEL_SSP1RX (0) /* Not applicable */
-
-# define DMA_DMASEL_ADC (0) /* Not applicable */
-
-# define DMA_DMASEL_I2SCH0 (0) /* Not applicable */
-# define DMA_DMASEL_I2SCH1 (0) /* Not applicable */
-
-# define DMA_DMASEL_DAC (0) /* Not applicable */
-
-# define DMA_DMASEL_UART0TX (0)
-# define DMA_DMASEL_UART0RX (0)
-# define DMA_DMASEL_UART1TX (0)
-# define DMA_DMASEL_UART1RX (0)
-# define DMA_DMASEL_UART2TX (0)
-# define DMA_DMASEL_UART2RX (0)
-# define DMA_DMASEL_UART3TX (0)
-# define DMA_DMASEL_UART3RX (0)
-
-# define DMA_DMASEL_MAT0p0 (1)
-# define DMA_DMASEL_MAT0p1 (1)
-# define DMA_DMASEL_MAT1p0 (1)
-# define DMA_DMASEL_MAT1p1 (1)
-# define DMA_DMASEL_MAT2p0 (1)
-# define DMA_DMASEL_MAT2p1 (1)
-# define DMA_DMASEL_MAT3p0 (1)
-# define DMA_DMASEL_MAT3p1 (1)
-
-#elif defined(LPC178x)
-/* Request Numbers */
-
-# define DMA_REQ_SDCARD (1) /* DMASEL01=0 */
-
-# define DMA_REQ_SSP0TX (2) /* DMASEL02=0 */
-# define DMA_REQ_SSP0RX (3) /* DMASEL03=0 */
-# define DMA_REQ_SSP1TX (4) /* DMASEL04=0 */
-# define DMA_REQ_SSP1RX (5) /* DMASEL05=0 */
-# define DMA_REQ_SSP2TX (6) /* DMASEL06=0 */
-# define DMA_REQ_SSP2RX (7) /* DMASEL07=0 */
-
-# define DMA_REQ_MAT0p0 (0) /* DMASEL00=1 */
-# define DMA_REQ_MAT0p1 (1) /* DMASEL01=1 */
-# define DMA_REQ_MAT1p0 (2) /* DMASEL02=1 */
-# define DMA_REQ_MAT1p1 (3) /* DMASEL03=1 */
-# define DMA_REQ_MAT2p0 (4) /* DMASEL04=1 */
-# define DMA_REQ_MAT2p1 (5) /* DMASEL05=1 */
-# define DMA_REQ_MAT3p0 (14) /* DMASEL14=1 */
-# define DMA_REQ_MAT3p1 (15) /* DMASEL15=1 */
-
-# define DMA_REQ_I2SCH0 (6) /* DMASEL06=1 */
-# define DMA_REQ_I2SCH1 (7) /* DMASEL07=1 */
-
-# define DMA_REQ_ADC (8) /* Not applicable */
-# define DMA_REQ_DAC (9) /* Not applicable */
-
-# define DMA_REQ_UART0TX (10) /* DMASEL10=0 */
-# define DMA_REQ_UART0RX (11) /* DMASEL11=0 */
-# define DMA_REQ_UART1TX (12) /* DMASEL12=0 */
-# define DMA_REQ_UART1RX (13) /* DMASEL13=0 */
-# define DMA_REQ_UART2TX (14) /* DMASEL14=0 */
-# define DMA_REQ_UART2RX (15) /* DMASEL15=0 */
-# define DMA_REQ_UART3TX (10) /* DMASEL10=1 */
-# define DMA_REQ_UART3RX (11) /* DMASEL11=1 */
-# define DMA_REQ_UART4TX (12) /* DMASEL12=1 */
-# define DMA_REQ_UART4RX (13) /* DMASEL13=1 */
-
-/* DMASEL values */
-
-# define DMA_DMASEL_SDCARD (0)
-
-# define DMA_DMASEL_SSP0TX (0)
-# define DMA_DMASEL_SSP0RX (0)
-# define DMA_DMASEL_SSP1TX (0)
-# define DMA_DMASEL_SSP1RX (0)
-# define DMA_DMASEL_SSP2TX (0)
-# define DMA_DMASEL_SSP2RX (0)
-
-# define DMA_DMASEL_MAT0p0 (1)
-# define DMA_DMASEL_MAT0p1 (1)
-# define DMA_DMASEL_MAT1p0 (1)
-# define DMA_DMASEL_MAT1p1 (1)
-# define DMA_DMASEL_MAT2p0 (1)
-# define DMA_DMASEL_MAT2p1 (1)
-# define DMA_DMASEL_MAT3p0 (1)
-# define DMA_DMASEL_MAT3p1 (1)
-
-# define DMA_DMASEL_I2SCH0 (1)
-# define DMA_DMASEL_I2SCH1 (1)
-
-# define DMA_DMASEL_ADC (0) /* Not applicable */
-# define DMA_DMASEL_DAC (0) /* Not applicable */
-
-# define DMA_DMASEL_UART0TX (0)
-# define DMA_DMASEL_UART0RX (0)
-# define DMA_DMASEL_UART1TX (0)
-# define DMA_DMASEL_UART1RX (0)
-# define DMA_DMASEL_UART2TX (0)
-# define DMA_DMASEL_UART2RX (0)
-# define DMA_DMASEL_UART3TX (1)
-# define DMA_DMASEL_UART3RX (1)
-# define DMA_DMASEL_UART4TX (1)
-# define DMA_DMASEL_UART4RX (1)
-#endif
-
-/* General registers (see also LPC17_SYSCON_DMAREQSEL in lpc17_syscon.h) */
-/* Fach of the following registers, bits 0-7 controls DMA channels 9-7,
- * respectively. Bits 8-31 are reserved.
- *
- * DMA Interrupt Status Register
- * DMA Interrupt Terminal Count Request Status Register
- * DMA Interrupt Terminal Count Request Clear Register
- * DMA Interrupt Error Status Register
- * DMA Interrupt Error Clear Register
- * DMA Raw Interrupt Terminal Count Status Register
- * DMA Raw Error Interrupt Status Register
- * DMA Enabled Channel Register
- */
-
-#define DMACH(n) (1 << (n)) /* n=0,1,...7 */
-#define DMACH_ALL (0xff)
-
-/* For each of the following registers, bits 0-15 represent a set of encoded
- * DMA sources. Bits 16-31 are reserved in each case.
- *
- * DMA Software Burst Request Register
- * DMA Software Single Request Register
- * DMA Software Last Burst Request Register
- * DMA Software Last Single Request Register
- * DMA Synchronization Register
- */
-
-#if defined(LPC176x)
-# define DMA_REQ_SSP0TX_BIT (1 << DMA_REQ_SSP0TX)
-# define DMA_REQ_SSP0RX_BIT (1 << DMA_REQ_SSP0RX)
-# define DMA_REQ_SSP1TX_BIT (1 << DMA_REQ_SSP1TX)
-# define DMA_REQ_SSP1RX_BIT (1 << DMA_REQ_SSP0RX)
-# define DMA_REQ_ADC_BIT (1 << DMA_REQ_ADC)
-# define DMA_REQ_I2SCH0_BIT (1 << DMA_REQ_I2SCH0)
-# define DMA_REQ_I2SCH1_BIT (1 << DMA_REQ_I2SCH1)
-# define DMA_REQ_DAC_BIT (1 << DMA_REQ_DAC)
-
-# define DMA_REQ_UART0TX_BIT (1 << DMA_REQ_UART0TX)
-# define DMA_REQ_UART0RX_BIT (1 << DMA_REQ_UART0RX)
-# define DMA_REQ_UART1TX_BIT (1 << DMA_REQ_UART1TX)
-# define DMA_REQ_UART1RX_BIT (1 << DMA_REQ_UART1RX)
-# define DMA_REQ_UART2TX_BIT (1 << DMA_REQ_UART2TX)
-# define DMA_REQ_UART2RX_BIT (1 << DMA_REQ_UART2RX)
-# define DMA_REQ_UART3TX_BIT (1 << DMA_REQ_UART3TX)
-# define DMA_REQ_UART3RX_BIT (1 << DMA_REQ_UART3RX)
-
-# define DMA_REQ_MAT0p0_BIT (1 << DMA_REQ_MAT0p0)
-# define DMA_REQ_MAT0p1_BIT (1 << DMA_REQ_MAT0p1)
-# define DMA_REQ_MAT1p0_BIT (1 << DMA_REQ_MAT1p0)
-# define DMA_REQ_MAT1p1_BIT (1 << DMA_REQ_MAT1p1)
-# define DMA_REQ_MAT2p0_BIT (1 << DMA_REQ_MAT2p0)
-# define DMA_REQ_MAT2p1_BIT (1 << DMA_REQ_MAT2p1)
-# define DMA_REQ_MAT3p0_BIT (1 << DMA_REQ_MAT3p0)
-# define DMA_REQ_MAT3p1_BIT (1 << DMA_REQ_MAT3p1)
-#elif defined(LPC178x)
-# define DMA_REQ_SDCARD_BIT (1 << DMA_REQ_SDCARD)
-
-# define DMA_REQ_SSP0TX_BIT (1 << DMA_REQ_SSP0TX)
-# define DMA_REQ_SSP0RX_BIT (1 << DMA_REQ_SSP0RX)
-# define DMA_REQ_SSP1TX_BIT (1 << DMA_REQ_SSP1TX)
-# define DMA_REQ_SSP1RX_BIT (1 << DMA_REQ_SSP1RX)
-# define DMA_REQ_SSP2TX_BIT (1 << DMA_REQ_SSP2TX)
-# define DMA_REQ_SSP2RX_BIT (1 << DMA_REQ_SSP2RX)
-
-# define DMA_REQ_MAT0p0_BIT (1 << DMA_REQ_MAT0p0)
-# define DMA_REQ_MAT0p1_BIT (1 << DMA_REQ_MAT0p1)
-# define DMA_REQ_MAT1p0_BIT (1 << DMA_REQ_MAT1p0)
-# define DMA_REQ_MAT1p1_BIT (1 << DMA_REQ_MAT1p1)
-# define DMA_REQ_MAT2p0_BIT (1 << DMA_REQ_MAT2p0)
-# define DMA_REQ_MAT2p1_BIT (1 << DMA_REQ_MAT2p1)
-# define DMA_REQ_MAT3p0_BIT (1 << DMA_REQ_MAT3p0)
-# define DMA_REQ_MAT3p1_BIT (1 << DMA_REQ_MAT3p1)
-
-# define DMA_REQ_I2SCH0_BIT (1 << DMA_REQ_I2SCH0)
-# define DMA_REQ_I2SCH1_BIT (1 << DMA_REQ_I2SCH1)
-
-# define DMA_REQ_ADC_BIT (1 << DMA_REQ_ADC)
-# define DMA_REQ_DAC_BIT (1 << DMA_REQ_DAC)
-
-# define DMA_REQ_UART0TX_BIT (1 << DMA_REQ_UART0TX)
-# define DMA_REQ_UART0RX_BIT (1 << DMA_REQ_UART0RX)
-# define DMA_REQ_UART1TX_BIT (1 << DMA_REQ_UART1TX)
-# define DMA_REQ_UART1RX_BIT (1 << DMA_REQ_UART1RX)
-# define DMA_REQ_UART2TX_BIT (1 << DMA_REQ_UART2TX)
-# define DMA_REQ_UART2RX_BIT (1 << DMA_REQ_UART2RX)
-# define DMA_REQ_UART3TX_BIT (1 << DMA_REQ_UART3TX)
-# define DMA_REQ_UART3RX_BIT (1 << DMA_REQ_UART3RX)
-# define DMA_REQ_UART4TX_BIT (1 << DMA_REQ_UART4TX)
-# define DMA_REQ_UART4RX_BIT (1 << DMA_REQ_UART4RX)
-#endif
-
-/* DMA Configuration Register */
-
-#define DMA_CONFIG_E (1 << 0) /* Bit 0: DMA Controller enable */
-#define DMA_CONFIG_M (1 << 1) /* Bit 1: AHB Master endianness configuration */
- /* Bits 2-31: Reserved */
-/* Channel Registers */
-
-/* DMA Channel Source Address Register (Bits 0-31: Source Address) */
-/* DMA Channel Destination Address Register Bits 0-31: Destination Address) */
-/* DMA Channel Linked List Item Register (Bits 0-31: Address of next link list
- * item. Bits 0-1 must be zero.
- */
-
-/* DMA Channel Control Register */
-
-#define DMACH_CONTROL_XFRSIZE_SHIFT (0) /* Bits 0-11: Transfer size */
-#define DMACH_CONTROL_XFRSIZE_MASK (0x0fff << DMACH_CONTROL_XFRSIZE_SHIFT)
-# define DMACH_CONTROL_XFRSIZE(n) ((n) << DMACH_CONTROL_XFRSIZE_SHIFT)
-#define DMACH_CONTROL_SBSIZE_SHIFT (12) /* Bits 12-14: Source burst size */
-#define DMACH_CONTROL_SBSIZE_MASK (7 << DMACH_CONTROL_SBSIZE_SHIFT)
-# define DMACH_CONTROL_SBSIZE_1 (0 << DMACH_CONTROL_SBSIZE_SHIFT)
-# define DMACH_CONTROL_SBSIZE_4 (1 << DMACH_CONTROL_SBSIZE_SHIFT)
-# define DMACH_CONTROL_SBSIZE_8 (2 << DMACH_CONTROL_SBSIZE_SHIFT)
-# define DMACH_CONTROL_SBSIZE_16 (3 << DMACH_CONTROL_SBSIZE_SHIFT)
-# define DMACH_CONTROL_SBSIZE_32 (4 << DMACH_CONTROL_SBSIZE_SHIFT)
-# define DMACH_CONTROL_SBSIZE_64 (5 << DMACH_CONTROL_SBSIZE_SHIFT)
-# define DMACH_CONTROL_SBSIZE_128 (6 << DMACH_CONTROL_SBSIZE_SHIFT)
-# define DMACH_CONTROL_SBSIZE_256 (7 << DMACH_CONTROL_SBSIZE_SHIFT)
-#define DMACH_CONTROL_DBSIZE_SHIFT (15) /* Bits 15-17: Destination burst size */
-#define DMACH_CONTROL_DBSIZE_MASK (7 << DMACH_CONTROL_DBSIZE_SHIFT)
-# define DMACH_CONTROL_DBSIZE_1 (0 << DMACH_CONTROL_DBSIZE_SHIFT)
-# define DMACH_CONTROL_DBSIZE_4 (1 << DMACH_CONTROL_DBSIZE_SHIFT)
-# define DMACH_CONTROL_DBSIZE_8 (2 << DMACH_CONTROL_DBSIZE_SHIFT)
-# define DMACH_CONTROL_DBSIZE_16 (3 << DMACH_CONTROL_DBSIZE_SHIFT)
-# define DMACH_CONTROL_DBSIZE_32 (4 << DMACH_CONTROL_DBSIZE_SHIFT)
-# define DMACH_CONTROL_DBSIZE_64 (5 << DMACH_CONTROL_DBSIZE_SHIFT)
-# define DMACH_CONTROL_DBSIZE_128 (6 << DMACH_CONTROL_DBSIZE_SHIFT)
-# define DMACH_CONTROL_DBSIZE_256 (7 << DMACH_CONTROL_DBSIZE_SHIFT)
-#define DMACH_CONTROL_SWIDTH_SHIFT (18) /* Bits 18-20: Source transfer width */
-#define DMACH_CONTROL_SWIDTH_MASK (7 << DMACH_CONTROL_SWIDTH_SHIFT)
-# define DMACH_CONTROL_SWIDTH_8BIT (0 << DMACH_CONTROL_SWIDTH_SHIFT) /* Byte (8-bit) */
-# define DMACH_CONTROL_SWIDTH_16BIT (1 << DMACH_CONTROL_SWIDTH_SHIFT) /* Halfword (16-bit) */
-# define DMACH_CONTROL_SWIDTH_32BIT (2 << DMACH_CONTROL_SWIDTH_SHIFT) /* Word (32-bit) */
-#define DMACH_CONTROL_DWIDTH_SHIFT (21) /* Bits 21-23: Destination transfer width */
-#define DMACH_CONTROL_DWIDTH_MASK (7 << DMACH_CONTROL_DWIDTH_SHIFT)
-# define DMACH_CONTROL_DWIDTH_8BIT (0 << DMACH_CONTROL_DWIDTH_SHIFT) /* Byte (8-bit) */
-# define DMACH_CONTROL_DWIDTH_16BIT (1 << DMACH_CONTROL_DWIDTH_SHIFT) /* Halfword (16-bit) */
-# define DMACH_CONTROL_DWIDTH_32BIT (2 << DMACH_CONTROL_DWIDTH_SHIFT) /* Word (32-bit) */
-#define DMACH_CONTROL_SI (1 << 26) /* Bit 26: Source increment */
-#define DMACH_CONTROL_DI (1 << 27) /* Bit 27: Destination increment */
-#define DMACH_CONTROL_PROT1 (1 << 28) /* Bit 28: User/priviledged mode */
-#define DMACH_CONTROL_PROT2 (1 << 29) /* Bit 29: Bufferable */
-#define DMACH_CONTROL_PROT3 (1 << 30) /* Bit 30: Cacheable */
-#define DMACH_CONTROL_I (1 << 31) /* Bit 31: Terminal count interrupt enable */
-
-/* DMA Channel Configuration Register */
-
-#define DMACH_CONFIG_E (1 << 0) /* Bit 0: Channel enable */
-#define DMACH_CONFIG_SRCPER_SHIFT (1) /* Bits 1-5: Source peripheral */
-#define DMACH_CONFIG_SRCPER_MASK (31 << DMACH_CONFIG_SRCPER_SHIFT)
-# define DMACH_CONFIG_SRCPER_SDCARD (DMA_REQ_SDCARD << DMACH_CONFIG_SRCPER_SHIFT)
-# define DMACH_CONFIG_SRCPER_SSP0TX (DMA_REQ_SSP0TX << DMACH_CONFIG_SRCPER_SHIFT)
-# define DMACH_CONFIG_SRCPER_SSP0RX (DMA_REQ_SSP0RX << DMACH_CONFIG_SRCPER_SHIFT)
-# define DMACH_CONFIG_SRCPER_SSP1TX (DMA_REQ_SSP1TX << DMACH_CONFIG_SRCPER_SHIFT)
-# define DMACH_CONFIG_SRCPER_SSP1RX (DMA_REQ_SSP1RX << DMACH_CONFIG_SRCPER_SHIFT)
-# define DMACH_CONFIG_SRCPER_SSP2TX (DMA_REQ_SSP2TX << DMACH_CONFIG_SRCPER_SHIFT)
-# define DMACH_CONFIG_SRCPER_SSP2RX (DMA_REQ_SSP2RX << DMACH_CONFIG_SRCPER_SHIFT)
-# define DMACH_CONFIG_SRCPER_I2SCH0 (DMA_REQ_I2SCH0 << DMACH_CONFIG_SRCPER_SHIFT)
-# define DMACH_CONFIG_SRCPER_I2SCH1 (DMA_REQ_I2SCH1 << DMACH_CONFIG_SRCPER_SHIFT)
-# define DMACH_CONFIG_SRCPER_ADC (DMA_REQ_ADC << DMACH_CONFIG_SRCPER_SHIFT)
-# define DMACH_CONFIG_SRCPER_DAC (DMA_REQ_DAC << DMACH_CONFIG_SRCPER_SHIFT)
-# define DMACH_CONFIG_SRCPER_UART0TX (DMA_REQ_UART0TX << DMACH_CONFIG_SRCPER_SHIFT)
-# define DMACH_CONFIG_SRCPER_UART0RX (DMA_REQ_UART0RX << DMACH_CONFIG_SRCPER_SHIFT)
-# define DMACH_CONFIG_SRCPER_UART1TX (DMA_REQ_UART1TX << DMACH_CONFIG_SRCPER_SHIFT)
-# define DMACH_CONFIG_SRCPER_UART1RX (DMA_REQ_UART1RX << DMACH_CONFIG_SRCPER_SHIFT)
-# define DMACH_CONFIG_SRCPER_UART2TX (DMA_REQ_UART2TX << DMACH_CONFIG_SRCPER_SHIFT)
-# define DMACH_CONFIG_SRCPER_UART2RX (DMA_REQ_UART2RX << DMACH_CONFIG_SRCPER_SHIFT)
-# define DMACH_CONFIG_SRCPER_UART3TX (DMA_REQ_UART3TX << DMACH_CONFIG_SRCPER_SHIFT)
-# define DMACH_CONFIG_SRCPER_UART3RX (DMA_REQ_UART3RX << DMACH_CONFIG_SRCPER_SHIFT)
-# define DMACH_CONFIG_SRCPER_UART4TX (DMA_REQ_UART4TX << DMACH_CONFIG_SRCPER_SHIFT)
-# define DMACH_CONFIG_SRCPER_UART4RX (DMA_REQ_UART4RX << DMACH_CONFIG_SRCPER_SHIFT)
-# define DMACH_CONFIG_SRCPER_MAT0p0 (DMA_REQ_MAT0p0 << DMACH_CONFIG_SRCPER_SHIFT)
-# define DMACH_CONFIG_SRCPER_MAT0p1 (DMA_REQ_MAT0p1 << DMACH_CONFIG_SRCPER_SHIFT)
-# define DMACH_CONFIG_SRCPER_MAT1p0 (DMA_REQ_MAT1p0 << DMACH_CONFIG_SRCPER_SHIFT)
-# define DMACH_CONFIG_SRCPER_MAT1p1 (DMA_REQ_MAT1p1 << DMACH_CONFIG_SRCPER_SHIFT)
-# define DMACH_CONFIG_SRCPER_MAT2p0 (DMA_REQ_MAT2p0 << DMACH_CONFIG_SRCPER_SHIFT)
-# define DMACH_CONFIG_SRCPER_MAT2p1 (DMA_REQ_MAT2p1 << DMACH_CONFIG_SRCPER_SHIFT)
-# define DMACH_CONFIG_SRCPER_MAT3p0 (DMA_REQ_MAT3p0 << DMACH_CONFIG_SRCPER_SHIFT)
-# define DMACH_CONFIG_SRCPER_MAT3p1 (DMA_REQ_MAT3p1 << DMACH_CONFIG_SRCPER_SHIFT)
-#define DMACH_CONFIG_DSTPER_SHIFT (6) /* Bits 6-10: Destination peripheral */
-#define DMACH_CONFIG_DSTPER_MASK (31 << DMACH_CONFIG_DSTPER_SHIFT)
-# define DMACH_CONFIG_DSTPER_SDCARD (DMA_REQ_SDCARD << DMACH_CONFIG_DSTPER_SHIFT)
-# define DMACH_CONFIG_DSTPER_SSP0TX (DMA_REQ_SSP0TX << DMACH_CONFIG_DSTPER_SHIFT)
-# define DMACH_CONFIG_DSTPER_SSP0RX (DMA_REQ_SSP0RX << DMACH_CONFIG_DSTPER_SHIFT)
-# define DMACH_CONFIG_DSTPER_SSP1TX (DMA_REQ_SSP1TX << DMACH_CONFIG_DSTPER_SHIFT)
-# define DMACH_CONFIG_DSTPER_SSP1RX (DMA_REQ_SSP1RX << DMACH_CONFIG_DSTPER_SHIFT)
-# define DMACH_CONFIG_DSTPER_SSP2TX (DMA_REQ_SSP2TX << DMACH_CONFIG_DSTPER_SHIFT)
-# define DMACH_CONFIG_DSTPER_SSP2RX (DMA_REQ_SSP2RX << DMACH_CONFIG_DSTPER_SHIFT)
-# define DMACH_CONFIG_DSTPER_I2SCH0 (DMA_REQ_I2SCH0 << DMACH_CONFIG_DSTPER_SHIFT)
-# define DMACH_CONFIG_DSTPER_I2SCH1 (DMA_REQ_I2SCH1 << DMACH_CONFIG_DSTPER_SHIFT)
-# define DMACH_CONFIG_DSTPER_ADC (DMA_REQ_ADC << DMACH_CONFIG_DSTPER_SHIFT)
-# define DMACH_CONFIG_DSTPER_DAC (DMA_REQ_DAC << DMACH_CONFIG_DSTPER_SHIFT)
-# define DMACH_CONFIG_DSTPER_UART0TX (DMA_REQ_UART0TX << DMACH_CONFIG_DSTPER_SHIFT)
-# define DMACH_CONFIG_DSTPER_UART0RX (DMA_REQ_UART0RX << DMACH_CONFIG_DSTPER_SHIFT)
-# define DMACH_CONFIG_DSTPER_UART1TX (DMA_REQ_UART1TX << DMACH_CONFIG_DSTPER_SHIFT)
-# define DMACH_CONFIG_DSTPER_UART1RX (DMA_REQ_UART1RX << DMACH_CONFIG_DSTPER_SHIFT)
-# define DMACH_CONFIG_DSTPER_UART2TX (DMA_REQ_UART2TX << DMACH_CONFIG_DSTPER_SHIFT)
-# define DMACH_CONFIG_DSTPER_UART2RX (DMA_REQ_UART2RX << DMACH_CONFIG_DSTPER_SHIFT)
-# define DMACH_CONFIG_DSTPER_UART3TX (DMA_REQ_UART3TX << DMACH_CONFIG_DSTPER_SHIFT)
-# define DMACH_CONFIG_DSTPER_UART3RX (DMA_REQ_UART3RX << DMACH_CONFIG_DSTPER_SHIFT)
-# define DMACH_CONFIG_DSTPER_UART4TX (DMA_REQ_UART4TX << DMACH_CONFIG_DSTPER_SHIFT)
-# define DMACH_CONFIG_DSTPER_UART4RX (DMA_REQ_UART4RX << DMACH_CONFIG_DSTPER_SHIFT)
-# define DMACH_CONFIG_DSTPER_MAT0p0 (DMA_REQ_MAT0p0 << DMACH_CONFIG_DSTPER_SHIFT)
-# define DMACH_CONFIG_DSTPER_MAT0p1 (DMA_REQ_MAT0p1 << DMACH_CONFIG_DSTPER_SHIFT)
-# define DMACH_CONFIG_DSTPER_MAT1p0 (DMA_REQ_MAT1p0 << DMACH_CONFIG_DSTPER_SHIFT)
-# define DMACH_CONFIG_DSTPER_MAT1p1 (DMA_REQ_MAT1p1 << DMACH_CONFIG_DSTPER_SHIFT)
-# define DMACH_CONFIG_DSTPER_MAT2p0 (DMA_REQ_MAT2p0 << DMACH_CONFIG_DSTPER_SHIFT)
-# define DMACH_CONFIG_DSTPER_MAT2p1 (DMA_REQ_MAT2p1 << DMACH_CONFIG_DSTPER_SHIFT)
-# define DMACH_CONFIG_DSTPER_MAT3p0 (DMA_REQ_MAT3p0 << DMACH_CONFIG_DSTPER_SHIFT)
-# define DMACH_CONFIG_DSTPER_MAT3p1 (DMA_REQ_MAT3p1 << DMACH_CONFIG_DSTPER_SHIFT)
-#define DMACH_CONFIG_XFRTYPE_SHIFT (11) /* Bits 11-13: Type of transfer */
-#define DMACH_CONFIG_XFRTYPE_MASK (7 << DMACH_CONFIG_XFRTYPE_SHIFT)
- /* Flow controller = DMA controller */
-# define DMACH_CONFIG_XFRTYPE_M2M (0 << DMACH_CONFIG_XFRTYPE_SHIFT) /* Memory to memory */
-# define DMACH_CONFIG_XFRTYPE_M2P (1 << DMACH_CONFIG_XFRTYPE_SHIFT) /* Memory to peripheral */
-# define DMACH_CONFIG_XFRTYPE_P2M (2 << DMACH_CONFIG_XFRTYPE_SHIFT) /* Peripheral to memory */
-# define DMACH_CONFIG_XFRTYPE_P2P (3 << DMACH_CONFIG_XFRTYPE_SHIFT) /* Peripheral to peripheral */
-#ifdef LPC178x
- /* Flow controller = Dest peripheral */
-# define DMACH_CONFIG_XFRTYPE_M2M_DC (4 << DMACH_CONFIG_XFRTYPE_SHIFT) /* Memory to memory */
-# define DMACH_CONFIG_XFRTYPE_M2P_DC (5 << DMACH_CONFIG_XFRTYPE_SHIFT) /* Memory to peripheral */
- /* Flow controller = Source peripheral */
-# define DMACH_CONFIG_XFRTYPE_P2M_SC (6 << DMACH_CONFIG_XFRTYPE_SHIFT) /* Peripheral to memory */
-# define DMACH_CONFIG_XFRTYPE_P2P_SC (7 << DMACH_CONFIG_XFRTYPE_SHIFT) /* Peripheral to peripheral */
-#endif
-#define DMACH_CONFIG_IE (1 << 14) /* Bit 14: Interrupt error mask */
-#define DMACH_CONFIG_ITC (1 << 15) /* Bit 15: Terminal count interrupt mask */
-#define DMACH_CONFIG_L (1 << 16) /* Bit 16: Lock */
-#define DMACH_CONFIG_A (1 << 17) /* Bit 17: Active */
-#define DMACH_CONFIG_H (1 << 18) /* Bit 18: Halt */
- /* Bits 19-31: Reserved */
-
-/************************************************************************************
- * Public Types
- ************************************************************************************/
-
-/************************************************************************************
- * Public Data
- ************************************************************************************/
-
-/************************************************************************************
- * Public Functions
- ************************************************************************************/
-
-#endif /* __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC17_GPDMA_H */
diff --git a/arch/arm/src/lpc17xx/hardware/lpc17_gpio.h b/arch/arm/src/lpc17xx/hardware/lpc17_gpio.h
deleted file mode 100644
index 2e9891058b1..00000000000
--- a/arch/arm/src/lpc17xx/hardware/lpc17_gpio.h
+++ /dev/null
@@ -1,210 +0,0 @@
-/************************************************************************************
- * arch/arm/src/lpc17xx/hardware/lpc17_gpio.h
- *
- * Copyright (C) 2010, 2013 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. 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.
- * 3. Neither the name NuttX 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 THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- ************************************************************************************/
-
-#ifndef __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC17_CHIP_GPIO_H
-#define __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC17_CHIP_GPIO_H
-
-/************************************************************************************
- * Included Files
- ************************************************************************************/
-
-#include
-
-#include "chip.h"
-#include "hardware/lpc17_memorymap.h"
-
-/************************************************************************************
- * Pre-processor Definitions
- ************************************************************************************/
-
-/* Register offsets *****************************************************************/
-/* GPIO block register offsets ******************************************************/
-
-#define LPC17_FIO0_OFFSET 0x0000
-#define LPC17_FIO1_OFFSET 0x0020
-#define LPC17_FIO2_OFFSET 0x0040
-#define LPC17_FIO3_OFFSET 0x0060
-#define LPC17_FIO4_OFFSET 0x0080
-#ifdef LPC178x
-# define LPC17_FIO5_OFFSET 0x00a0
-#endif
-
-#define LPC17_FIO_DIR_OFFSET 0x0000 /* Fast GPIO Port Direction control */
-#define LPC17_FIO_MASK_OFFSET 0x0010 /* Fast Mask register for ports */
-#define LPC17_FIO_PIN_OFFSET 0x0014 /* Fast Port Pin value registers */
-#define LPC17_FIO_SET_OFFSET 0x0018 /* Fast Port Output Set registers */
-#define LPC17_FIO_CLR_OFFSET 0x001c /* Fast Port Output Clear register */
-
-/* GPIO interrupt block register offsets ********************************************/
-
-#define LPC17_GPIOINT_OFFSET(n) (0x10*(n) + 0x80)
-#define LPC17_GPIOINT0_OFFSET 0x0080
-#define LPC17_GPIOINT2_OFFSET 0x00a0
-
-#define LPC17_GPIOINT_IOINTSTATUS_OFFSET 0x0000 /* GPIO overall Interrupt Status */
-#define LPC17_GPIOINT_INTSTATR_OFFSET 0x0004 /* GPIO Interrupt Status Rising edge */
-#define LPC17_GPIOINT_INTSTATF_OFFSET 0x0008 /* GPIO Interrupt Status Falling edge */
-#define LPC17_GPIOINT_INTCLR_OFFSET 0x000c /* GPIO Interrupt Clear */
-#define LPC17_GPIOINT_INTENR_OFFSET 0x0010 /* GPIO Interrupt Enable Rising edge */
-#define LPC17_GPIOINT_INTENF_OFFSET 0x0014 /* GPIO Interrupt Enable Falling edge */
-
-/* Register addresses ***************************************************************/
-/* GPIO block register addresses ****************************************************/
-
-#define LPC17_FIO_BASE(n) (LPC17_GPIO_BASE+LPC17_GPIOINT_OFFSET(n))
-#define LPC17_FIO0_BASE (LPC17_GPIO_BASE+LPC17_FIO0_OFFSET)
-#define LPC17_FIO1_BASE (LPC17_GPIO_BASE+LPC17_FIO1_OFFSET)
-#define LPC17_FIO2_BASE (LPC17_GPIO_BASE+LPC17_FIO2_OFFSET)
-#define LPC17_FIO3_BASE (LPC17_GPIO_BASE+LPC17_FIO3_OFFSET)
-#define LPC17_FIO4_BASE (LPC17_GPIO_BASE+LPC17_FIO4_OFFSET)
-#ifdef LPC178x
-# define LPC17_FIO5_BASE (LPC17_GPIO_BASE+LPC17_FIO5_OFFSET)
-#endif
-
-#define LPC17_FIO_DIR(n) (LPC17_FIO_BASE(n)+LPC17_FIO_DIR_OFFSET)
-#define LPC17_FIO_MASK(n) (LPC17_FIO_BASE(n)+LPC17_FIO_MASK_OFFSET)
-#define LPC17_FIO_PIN(n) (LPC17_FIO_BASE(n)+LPC17_FIO_PIN_OFFSET)
-#define LPC17_FIO_SET(n) (LPC17_FIO_BASE(n)+LPC17_FIO_SET_OFFSET)
-#define LPC17_FIO_CLR(n) (LPC17_FIO_BASE(n)+LPC17_FIO_CLR_OFFSET)
-
-#define LPC17_FIO0_DIR (LPC17_FIO0_BASE+LPC17_FIO_DIR_OFFSET)
-#define LPC17_FIO0_MASK (LPC17_FIO0_BASE+LPC17_FIO_MASK_OFFSET)
-#define LPC17_FIO0_PIN (LPC17_FIO0_BASE+LPC17_FIO_PIN_OFFSET)
-#define LPC17_FIO0_SET (LPC17_FIO0_BASE+LPC17_FIO_SET_OFFSET)
-#define LPC17_FIO0_CLR (LPC17_FIO0_BASE+LPC17_FIO_CLR_OFFSET)
-
-#define LPC17_FIO1_DIR (LPC17_FIO1_BASE+LPC17_FIO_DIR_OFFSET)
-#define LPC17_FIO1_MASK (LPC17_FIO1_BASE+LPC17_FIO_MASK_OFFSET)
-#define LPC17_FIO1_PIN (LPC17_FIO1_BASE+LPC17_FIO_PIN_OFFSET)
-#define LPC17_FIO1_SET (LPC17_FIO1_BASE+LPC17_FIO_SET_OFFSET)
-#define LPC17_FIO1_CLR (LPC17_FIO1_BASE+LPC17_FIO_CLR_OFFSET)
-
-#define LPC17_FIO2_DIR (LPC17_FIO2_BASE+LPC17_FIO_DIR_OFFSET)
-#define LPC17_FIO2_MASK (LPC17_FIO2_BASE+LPC17_FIO_MASK_OFFSET)
-#define LPC17_FIO2_PIN (LPC17_FIO2_BASE+LPC17_FIO_PIN_OFFSET)
-#define LPC17_FIO2_SET (LPC17_FIO2_BASE+LPC17_FIO_SET_OFFSET)
-#define LPC17_FIO2_CLR (LPC17_FIO2_BASE+LPC17_FIO_CLR_OFFSET)
-
-#define LPC17_FIO3_DIR (LPC17_FIO3_BASE+LPC17_FIO_DIR_OFFSET)
-#define LPC17_FIO3_MASK (LPC17_FIO3_BASE+LPC17_FIO_MASK_OFFSET)
-#define LPC17_FIO3_PIN (LPC17_FIO3_BASE+LPC17_FIO_PIN_OFFSET)
-#define LPC17_FIO3_SET (LPC17_FIO3_BASE+LPC17_FIO_SET_OFFSET)
-#define LPC17_FIO3_CLR (LPC17_FIO3_BASE+LPC17_FIO_CLR_OFFSET)
-
-#define LPC17_FIO4_DIR (LPC17_FIO4_BASE+LPC17_FIO_DIR_OFFSET)
-#define LPC17_FIO4_MASK (LPC17_FIO4_BASE+LPC17_FIO_MASK_OFFSET)
-#define LPC17_FIO4_PIN (LPC17_FIO4_BASE+LPC17_FIO_PIN_OFFSET)
-#define LPC17_FIO4_SET (LPC17_FIO4_BASE+LPC17_FIO_SET_OFFSET)
-#define LPC17_FIO4_CLR (LPC17_FIO4_BASE+LPC17_FIO_CLR_OFFSET)
-
-#ifdef LPC178x
-# define LPC17_FIO5_DIR (LPC17_FIO5_BASE+LPC17_FIO_DIR_OFFSET)
-# define LPC17_FIO5_MASK (LPC17_FIO5_BASE+LPC17_FIO_MASK_OFFSET)
-# define LPC17_FIO5_PIN (LPC17_FIO5_BASE+LPC17_FIO_PIN_OFFSET)
-# define LPC17_FIO5_SET (LPC17_FIO5_BASE+LPC17_FIO_SET_OFFSET)
-# define LPC17_FIO5_CLR (LPC17_FIO5_BASE+LPC17_FIO_CLR_OFFSET)
-#endif
-
-/* GPIO interrupt block register addresses ******************************************/
-
-#define LPC17_GPIOINTn_BASE(n) (LPC17_GPIOINT_BASE+LPC17_GPIOINT_OFFSET(n))
-#define LPC17_GPIOINT0_BASE (LPC17_GPIOINT_BASE+LPC17_GPIOINT0_OFFSET)
-#define LPC17_GPIOINT2_BASE (LPC17_GPIOINT_BASE+LPC17_GPIOINT2_OFFSET)
-
-#define LPC17_GPIOINT_IOINTSTATUS (LPC17_GPIOINT0_BASE+LPC17_GPIOINT_IOINTSTATUS_OFFSET)
-
-#define LPC17_GPIOINT_INTSTATR(n) (LPC17_GPIOINTn_BASE(n)+LPC17_GPIOINT_INTSTATR_OFFSET)
-#define LPC17_GPIOINT_INTSTATF(n) (LPC17_GPIOINTn_BASE(n)+LPC17_GPIOINT_INTSTATF_OFFSET)
-#define LPC17_GPIOINT_INTCLR(n) (LPC17_GPIOINTn_BASE(n)+LPC17_GPIOINT_INTCLR_OFFSET)
-#define LPC17_GPIOINT_INTENR(n) (LPC17_GPIOINTn_BASE(n)+LPC17_GPIOINT_INTENR_OFFSET)
-#define LPC17_GPIOINT_INTENF(n) (LPC17_GPIOINTn_BASE(n)+LPC17_GPIOINT_INTENF_OFFSET)
-
-/* Pins P0.0-31 */
-
-#define LPC17_GPIOINT0_INTSTATR (LPC17_GPIOINT0_BASE+LPC17_GPIOINT_INTSTATR_OFFSET)
-#define LPC17_GPIOINT0_INTSTATF (LPC17_GPIOINT0_BASE+LPC17_GPIOINT_INTSTATF_OFFSET)
-#define LPC17_GPIOINT0_INTCLR (LPC17_GPIOINT0_BASE+LPC17_GPIOINT_INTCLR_OFFSET)
-#define LPC17_GPIOINT0_INTENR (LPC17_GPIOINT0_BASE+LPC17_GPIOINT_INTENR_OFFSET)
-#define LPC17_GPIOINT0_INTENF (LPC17_GPIOINT0_BASE+LPC17_GPIOINT_INTENF_OFFSET)
-
-/* Pins P2.0-31 */
-
-#define LPC17_GPIOINT2_INTSTATR (LPC17_GPIOINT2_BASE+LPC17_GPIOINT_INTSTATR_OFFSET)
-#define LPC17_GPIOINT2_INTSTATF (LPC17_GPIOINT2_BASE+LPC17_GPIOINT_INTSTATF_OFFSET)
-#define LPC17_GPIOINT2_INTCLR (LPC17_GPIOINT2_BASE+LPC17_GPIOINT_INTCLR_OFFSET)
-#define LPC17_GPIOINT2_INTENR (LPC17_GPIOINT2_BASE+LPC17_GPIOINT_INTENR_OFFSET)
-#define LPC17_GPIOINT2_INTENF (LPC17_GPIOINT2_BASE+LPC17_GPIOINT_INTENF_OFFSET)
-
-/* Register bit definitions *********************************************************/
-/* GPIO block register bit definitions **********************************************/
-
-/* Fast GPIO Port Direction control registers (FIODIR) */
-/* Fast Mask register for ports (FIOMASK) */
-/* Fast Port Pin value registers using FIOMASK (FIOPIN) */
-/* Fast Port Output Set registers using FIOMASK (FIOSET) */
-/* Fast Port Output Clear register using FIOMASK (FIOCLR) */
-
-#define FIO(n) (1 << (n)) /* n=0,1,..31 */
-
-/* GPIO interrupt block register bit definitions ************************************/
-
-/* GPIO overall Interrupt Status (IOINTSTATUS) */
-#define GPIOINT_IOINTSTATUS_P0INT (1 << 0) /* Bit 0: Port 0 GPIO interrupt pending */
- /* Bit 1: Reserved */
-#define GPIOINT_IOINTSTATUS_P2INT (1 << 2) /* Bit 2: Port 2 GPIO interrupt pending */
- /* Bits 3-31: Reserved */
-
-/* GPIO Interrupt Status for Rising edge (INTSTATR)
- * GPIO Interrupt Status for Falling edge (INTSTATF)
- * GPIO Interrupt Clear (INTCLR)
- * GPIO Interrupt Enable for Rising edge (INTENR)
- * GPIO Interrupt Enable for Falling edge (INTENF)
- */
-
-#define GPIOINT(n) (1 << (n)) /* n=0,1,..31 */
-
-/************************************************************************************
- * Public Types
- ************************************************************************************/
-
-/************************************************************************************
- * Public Data
- ************************************************************************************/
-
-/************************************************************************************
- * Public Functions
- ************************************************************************************/
-
-#endif /* __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC17_CHIP_GPIO_H */
diff --git a/arch/arm/src/lpc17xx/hardware/lpc17_i2c.h b/arch/arm/src/lpc17xx/hardware/lpc17_i2c.h
deleted file mode 100644
index eb370fdd5dc..00000000000
--- a/arch/arm/src/lpc17xx/hardware/lpc17_i2c.h
+++ /dev/null
@@ -1,208 +0,0 @@
-/************************************************************************************
- * arch/arm/src/lpc17xx/hardware/lpc17_i2c.h
- *
- * Copyright (C) 2010, 2013 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. 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.
- * 3. Neither the name NuttX 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 THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- ************************************************************************************/
-
-#ifndef __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC17_I2C_H
-#define __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC17_I2C_H
-
-/************************************************************************************
- * Included Files
- ************************************************************************************/
-
-#include
-
-#include "chip.h"
-#include "hardware/lpc17_memorymap.h"
-
-/************************************************************************************
- * Pre-processor Definitions
- ************************************************************************************/
-
-/* Register offsets *****************************************************************/
-
-#define LPC17_I2C_CONSET_OFFSET 0x0000 /* I2C Control Set Register */
-#define LPC17_I2C_STAT_OFFSET 0x0004 /* I2C Status Register */
-#define LPC17_I2C_DAT_OFFSET 0x0008 /* I2C Data Register */
-#define LPC17_I2C_ADR0_OFFSET 0x000c /* I2C Slave Address Register 0 */
-#define LPC17_I2C_SCLH_OFFSET 0x0010 /* SCH Duty Cycle Register High Half Word */
-#define LPC17_I2C_SCLL_OFFSET 0x0014 /* SCL Duty Cycle Register Low Half Word */
-#define LPC17_I2C_CONCLR_OFFSET 0x0018 /* I2C Control Clear Register */
-#define LPC17_I2C_MMCTRL_OFFSET 0x001c /* Monitor mode control register */
-#define LPC17_I2C_ADR1_OFFSET 0x0020 /* I2C Slave Address Register 1 */
-#define LPC17_I2C_ADR2_OFFSET 0x0024 /* I2C Slave Address Register 2 */
-#define LPC17_I2C_ADR3_OFFSET 0x0028 /* I2C Slave Address Register 3 */
-#define LPC17_I2C_BUFR_OFFSET 0x002c /* Data buffer register */
-#define LPC17_I2C_MASK0_OFFSET 0x0030 /* I2C Slave address mask register 0 */
-#define LPC17_I2C_MASK1_OFFSET 0x0034 /* I2C Slave address mask register 1 */
-#define LPC17_I2C_MASK2_OFFSET 0x0038 /* I2C Slave address mask register 2 */
-#define LPC17_I2C_MASK3_OFFSET 0x003c /* I2C Slave address mask register */
-
-/* Register addresses ***************************************************************/
-
-#define LPC17_I2C0_CONSET (LPC17_I2C0_BASE+LPC17_I2C_CONSET_OFFSET)
-#define LPC17_I2C0_STAT (LPC17_I2C0_BASE+LPC17_I2C_STAT_OFFSET)
-#define LPC17_I2C0_DAT (LPC17_I2C0_BASE+LPC17_I2C_DAT_OFFSET)
-#define LPC17_I2C0_ADR0 (LPC17_I2C0_BASE+LPC17_I2C_ADR0_OFFSET)
-#define LPC17_I2C0_SCLH (LPC17_I2C0_BASE+LPC17_I2C_SCLH_OFFSET)
-#define LPC17_I2C0_SCLL (LPC17_I2C0_BASE+LPC17_I2C_SCLL_OFFSET)
-#define LPC17_I2C0_CONCLR (LPC17_I2C0_BASE+LPC17_I2C_CONCLR_OFFSET)
-#define LPC17_I2C0_MMCTRL (LPC17_I2C0_BASE+LPC17_I2C_MMCTRL_OFFSET)
-#define LPC17_I2C0_ADR1 (LPC17_I2C0_BASE+LPC17_I2C_ADR1_OFFSET)
-#define LPC17_I2C0_ADR2 (LPC17_I2C0_BASE+LPC17_I2C_ADR2_OFFSET)
-#define LPC17_I2C0_ADR3 (LPC17_I2C0_BASE+LPC17_I2C_ADR3_OFFSET)
-#define LPC17_I2C0_BUFR (LPC17_I2C0_BASE+LPC17_I2C_BUFR_OFFSET)
-#define LPC17_I2C0_MASK0 (LPC17_I2C0_BASE+LPC17_I2C_MASK0_OFFSET)
-#define LPC17_I2C0_MASK1 (LPC17_I2C0_BASE+LPC17_I2C_MASK1_OFFSET)
-#define LPC17_I2C0_MASK2 (LPC17_I2C0_BASE+LPC17_I2C_MASK2_OFFSET)
-#define LPC17_I2C0_MASK3 (LPC17_I2C0_BASE+LPC17_I2C_MASK3_OFFSET)
-
-#define LPC17_I2C1_CONSET (LPC17_I2C1_BASE+LPC17_I2C_CONSET_OFFSET)
-#define LPC17_I2C1_STAT (LPC17_I2C1_BASE+LPC17_I2C_STAT_OFFSET)
-#define LPC17_I2C1_DAT (LPC17_I2C1_BASE+LPC17_I2C_DAT_OFFSET)
-#define LPC17_I2C1_ADR0 (LPC17_I2C1_BASE+LPC17_I2C_ADR0_OFFSET)
-#define LPC17_I2C1_SCLH (LPC17_I2C1_BASE+LPC17_I2C_SCLH_OFFSET)
-#define LPC17_I2C1_SCLL (LPC17_I2C1_BASE+LPC17_I2C_SCLL_OFFSET)
-#define LPC17_I2C1_CONCLR (LPC17_I2C1_BASE+LPC17_I2C_CONCLR_OFFSET)
-#define LPC17_I2C1_MMCTRL (LPC17_I2C1_BASE+LPC17_I2C_MMCTRL_OFFSET)
-#define LPC17_I2C1_ADR1 (LPC17_I2C1_BASE+LPC17_I2C_ADR1_OFFSET)
-#define LPC17_I2C1_ADR2 (LPC17_I2C1_BASE+LPC17_I2C_ADR2_OFFSET)
-#define LPC17_I2C1_ADR3 (LPC17_I2C1_BASE+LPC17_I2C_ADR3_OFFSET)
-#define LPC17_I2C1_BUFR (LPC17_I2C1_BASE+LPC17_I2C_BUFR_OFFSET)
-#define LPC17_I2C1_MASK0 (LPC17_I2C1_BASE+LPC17_I2C_MASK0_OFFSET)
-#define LPC17_I2C1_MASK1 (LPC17_I2C1_BASE+LPC17_I2C_MASK1_OFFSET)
-#define LPC17_I2C1_MASK2 (LPC17_I2C1_BASE+LPC17_I2C_MASK2_OFFSET)
-#define LPC17_I2C1_MASK3 (LPC17_I2C1_BASE+LPC17_I2C_MASK3_OFFSET)
-
-#define LPC17_I2C2_CONSET (LPC17_I2C2_BASE+LPC17_I2C_CONSET_OFFSET)
-#define LPC17_I2C2_STAT (LPC17_I2C2_BASE+LPC17_I2C_STAT_OFFSET)
-#define LPC17_I2C2_DAT (LPC17_I2C2_BASE+LPC17_I2C_DAT_OFFSET)
-#define LPC17_I2C2_ADR0 (LPC17_I2C2_BASE+LPC17_I2C_ADR0_OFFSET)
-#define LPC17_I2C2_SCLH (LPC17_I2C2_BASE+LPC17_I2C_SCLH_OFFSET)
-#define LPC17_I2C2_SCLL (LPC17_I2C2_BASE+LPC17_I2C_SCLL_OFFSET)
-#define LPC17_I2C2_CONCLR (LPC17_I2C2_BASE+LPC17_I2C_CONCLR_OFFSET)
-#define LPC17_I2C2_MMCTRL (LPC17_I2C2_BASE+LPC17_I2C_MMCTRL_OFFSET)
-#define LPC17_I2C2_ADR1 (LPC17_I2C2_BASE+LPC17_I2C_ADR1_OFFSET)
-#define LPC17_I2C2_ADR2 (LPC17_I2C2_BASE+LPC17_I2C_ADR2_OFFSET)
-#define LPC17_I2C2_ADR3 (LPC17_I2C2_BASE+LPC17_I2C_ADR3_OFFSET)
-#define LPC17_I2C2_BUFR (LPC17_I2C2_BASE+LPC17_I2C_BUFR_OFFSET)
-#define LPC17_I2C2_MASK0 (LPC17_I2C2_BASE+LPC17_I2C_MASK0_OFFSET)
-#define LPC17_I2C2_MASK1 (LPC17_I2C2_BASE+LPC17_I2C_MASK1_OFFSET)
-#define LPC17_I2C2_MASK2 (LPC17_I2C2_BASE+LPC17_I2C_MASK2_OFFSET)
-#define LPC17_I2C2_MASK3 (LPC17_I2C2_BASE+LPC17_I2C_MASK3_OFFSET)
-
-/* Register bit definitions *********************************************************/
-/* I2C Control Set Register */
- /* Bits 0-1: Reserved */
-#define I2C_CONSET_AA (1 << 2) /* Bit 2: Assert acknowledge flag */
-#define I2C_CONSET_SI (1 << 3) /* Bit 3: I2C interrupt flag */
-#define I2C_CONSET_STO (1 << 4) /* Bit 4: STOP flag */
-#define I2C_CONSET_STA (1 << 5) /* Bit 5: START flag */
-#define I2C_CONSET_I2EN (1 << 6) /* Bit 6: I2C interface enable */
- /* Bits 7-31: Reserved */
-/* I2C Control Clear Register */
- /* Bits 0-1: Reserved */
-#define I2C_CONCLR_AAC (1 << 2) /* Bit 2: Assert acknowledge Clear bit */
-#define I2C_CONCLR_SIC (1 << 3) /* Bit 3: I2C interrupt Clear bit */
- /* Bit 4: Reserved */
-#define I2C_CONCLR_STAC (1 << 5) /* Bit 5: START flag Clear bit */
-#define I2C_CONCLRT_I2ENC (1 << 6) /* Bit 6: I2C interface Disable bit */
- /* Bits 7-31: Reserved */
-/* I2C Status Register
- *
- * See tables 399-402 in the "LPC17xx User Manual" (UM10360), Rev. 01, 4 January
- * 2010, NXP for definitions of status codes.
- */
-
-#define I2C_STAT_MASK (0xff) /* Bits 0-7: I2C interface status
- * Bits 0-1 always zero */
- /* Bits 8-31: Reserved */
-/* I2C Data Register */
-
-#define I2C_DAT_MASK (0xff) /* Bits 0-7: I2C data */
- /* Bits 8-31: Reserved */
-/* Monitor mode control register */
-
-#define I2C_MMCTRL_MMENA (1 << 0) /* Bit 0: Monitor mode enable */
-#define I2C_MMCTRL_ENASCL (1 << 1) /* Bit 1: SCL output enable */
-#define I2C_MMCTRL_MATCHALL (1 << 2) /* Bit 2: Select interrupt register match */
- /* Bits 3-31: Reserved */
-/* Data buffer register */
-
-#define I2C_BUFR_MASK (0xff) /* Bits 0-7: 8 MSBs of the I2DAT shift register */
- /* Bits 8-31: Reserved */
-/* I2C Slave address registers:
- *
- * I2C Slave Address Register 0
- * I2C Slave Address Register 1
- * I2C Slave Address Register 2
- * I2C Slave Address Register 3
- */
-
-#define I2C_ADR_GC (1 << 0) /* Bit 0: GC General Call enable bit */
-#define I2C_ADR_ADDR_SHIFT (1) /* Bits 1-7: I2C slave address */
-#define I2C_ADR_ADDR_MASK (0x7f << I2C_ADR_ADDR_SHIFT)
- /* Bits 8-31: Reserved */
-/* I2C Slave address mask registers:
- *
- * I2C Slave address mask register 0
- * I2C Slave address mask register 1
- * I2C Slave address mask register 2
- * I2C Slave address mask register 3
- */
- /* Bit 0: Reserved */
-#define I2C_MASK_SHIFT (1) /* Bits 1-7: I2C mask bits */
-#define I2C_MASK_MASK (0x7f << I2C_ADR_ADDR_SHIFT)
- /* Bits 8-31: Reserved */
-/* SCH Duty Cycle Register High Half Word */
-
-#define I2C_SCLH_MASK (0xffff) /* Bit 0-15: Count for SCL HIGH time period selection */
- /* Bits 16-31: Reserved */
-/* SCL Duty Cycle Register Low Half Word */
-
-#define I2C_SCLL_MASK (0xffff) /* Bit 0-15: Count for SCL LOW time period selection */
- /* Bits 16-31: Reserved */
-
-/************************************************************************************
- * Public Types
- ************************************************************************************/
-
-/************************************************************************************
- * Public Data
- ************************************************************************************/
-
-/************************************************************************************
- * Public Functions
- ************************************************************************************/
-
-#endif /* __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC17_I2C_H */
diff --git a/arch/arm/src/lpc17xx/hardware/lpc17_i2s.h b/arch/arm/src/lpc17xx/hardware/lpc17_i2s.h
deleted file mode 100644
index bb0f9ca4427..00000000000
--- a/arch/arm/src/lpc17xx/hardware/lpc17_i2s.h
+++ /dev/null
@@ -1,190 +0,0 @@
-/************************************************************************************
- * arch/arm/src/lpc17xx/hardware/lpc17_i2s
- *
- * Copyright (C) 2010, 2012 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. 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.
- * 3. Neither the name NuttX 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 THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- ************************************************************************************/
-
-#ifndef __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC17_I2S_H
-#define __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC17_I2S_H
-
-/************************************************************************************
- * Included Files
- ************************************************************************************/
-
-#include
-
-#include "chip.h"
-#include "hardware/lpc17_memorymap.h"
-
-/************************************************************************************
- * Pre-processor Definitions
- ************************************************************************************/
-
-/* Register offsets *****************************************************************/
-
-#define LPC17_I2S_DAO_OFFSET 0x0000 /* Digital Audio Output Register */
-#define LPC17_I2S_DAI_OFFSET 0x0004 /* Digital Audio Input Register */
-#define LPC17_I2S_TXFIFO_OFFSET 0x0008 /* Transmit FIFO */
-#define LPC17_I2S_RXFIFO_OFFSET 0x000c /* Receive FIFO */
-#define LPC17_I2S_STATE_OFFSET 0x0010 /* Status Feedback Register */
-#define LPC17_I2S_DMA1_OFFSET 0x0014 /* DMA Configuration Register 1 */
-#define LPC17_I2S_DMA2_OFFSET 0x0018 /* DMA Configuration Register 2 */
-#define LPC17_I2S_IRQ_OFFSET 0x001c /* Interrupt Request Control Register */
-#define LPC17_I2S_TXRATE_OFFSET 0x0020 /* Transmit MCLK divider */
-#define LPC17_I2S_RXRATE_OFFSET 0x0024 /* Receive MCLK divider */
-#define LPC17_I2S_TXBITRATE_OFFSET 0x0028 /* Transmit bit rate divider */
-#define LPC17_I2S_RXBITRATE_OFFSET 0x002c /* Receive bit rate divider */
-#define LPC17_I2S_TXMODE_OFFSET 0x0030 /* Transmit mode control */
-#define LPC17_I2S_RXMODE_OFFSET 0x0034 /* Receive mode control */
-
-/* Register addresses ***************************************************************/
-
-#define LPC17_I2S_DAO (LPC17_I2S_BASE+LPC17_I2S_DAO_OFFSET)
-#define LPC17_I2S_DAI (LPC17_I2S_BASE+LPC17_I2S_DAI_OFFSET)
-#define LPC17_I2S_TXFIFO (LPC17_I2S_BASE+LPC17_I2S_TXFIFO_OFFSET)
-#define LPC17_I2S_RXFIFO (LPC17_I2S_BASE+LPC17_I2S_RXFIFO_OFFSET)
-#define LPC17_I2S_STATE (LPC17_I2S_BASE+LPC17_I2S_STATE_OFFSET)
-#define LPC17_I2S_DMA1 (LPC17_I2S_BASE+LPC17_I2S_DMA1_OFFSET)
-#define LPC17_I2S_DMA2 (LPC17_I2S_BASE+LPC17_I2S_DMA2_OFFSET)
-#define LPC17_I2S_IRQ (LPC17_I2S_BASE+LPC17_I2S_IRQ_OFFSET)
-#define LPC17_I2S_TXRATE (LPC17_I2S_BASE+LPC17_I2S_TXRATE_OFFSET)
-#define LPC17_I2S_RXRATE (LPC17_I2S_BASE+LPC17_I2S_RXRATE_OFFSET)
-#define LPC17_I2S_TXBITRATE (LPC17_I2S_BASE+LPC17_I2S_TXBITRATE_OFFSET)
-#define LPC17_I2S_RXBITRATE (LPC17_I2S_BASE+LPC17_I2S_RXBITRATE_OFFSET)
-#define LPC17_I2S_TXMODE (LPC17_I2S_BASE+LPC17_I2S_TXMODE_OFFSET)
-#define LPC17_I2S_RXMODE (LPC17_I2S_BASE+LPC17_I2S_RXMODE_OFFSET)
-
-/* Register bit definitions *********************************************************/
-
-/* Digital Audio Output Register */
-
-#define I2S_DAO_WDWID_SHIFT (0) /* Bits 0-1: Selects the number of bytes in data */
-#define I2S_DAO_WDWID_MASK (3 << I2S_DAO_WDWID_SHIFT)
-# define I2S_DAO_WDWID_8BITS (0 << I2S_DAO_WDWID_SHIFT)
-# define I2S_DAO_WDWID_16BITS (1 << I2S_DAO_WDWID_SHIFT)
-# define I2S_DAO_WDWID_32BITS (3 << I2S_DAO_WDWID_SHIFT)
-#define I2S_DAO_MONO (1 << 2) /* Bit 2: Mono format */
-#define I2S_DAO_STOP (1 << 3) /* Bit 3: Disable FIFOs / mute mode */
-#define I2S_DAO_RESET (1 << 4) /* Bit 4: Reset TX channel and FIFO */
-#define I2S_DAO_WSSEL (1 << 5) /* Bit 5: Slave mode select */
-#define I2S_DAO_WSHALFPER_SHIFT (6) /* Bits 6-14: Word select half period minus 1 */
-#define I2S_DAO_WSHALFPER_MASK (0x01ff << I2S_DAO_WSHALFPER_SHIFT)
-#define I2S_DAO_MUTE (1 << 15) /* Bit 15: Send only zeros on channel */
- /* Bits 16-31: Reserved */
-/* Digital Audio Input Register */
-
-#define I2S_DAI_WDWID_SHIFT (0) /* Bits 0-1: Selects the number of bytes in data */
-#define I2S_DAI_WDWID_MASK (3 << I2S_DAI_WDWID_SHIFT)
-# define I2S_DAI_WDWID_8BITS (0 << I2S_DAI_WDWID_SHIFT)
-# define I2S_DAI_WDWID_16BITS (1 << I2S_DAI_WDWID_SHIFT)
-# define I2S_DAI_WDWID_32BITS (3 << I2S_DAI_WDWID_SHIFT)
-#define I2S_DAI_MONO (1 << 2) /* Bit 2: Mono format */
-#define I2S_DAI_STOP (1 << 3) /* Bit 3: Disable FIFOs / mute mode */
-#define I2S_DAI_RESET (1 << 4) /* Bit 4: Reset TX channel and FIFO */
-#define I2S_DAI_WSSEL (1 << 5) /* Bit 5: Slave mode select */
-#define I2S_DAI_WSHALFPER_SHIFT (6) /* Bits 6-14: Word select half period minus 1 */
-#define I2S_DAI_WSHALFPER_MASK (0x01ff << I2S_DAI_WSHALFPER_SHIFT)
- /* Bits 15-31: Reserved */
-/* Transmit FIFO: 8 × 32-bit transmit FIFO */
-/* Receive FIFO: 8 × 32-bit receive FIFO */
-
-/* Status Feedback Register */
-
-#define I2S_STATE_IRQ (1 << 0) /* Bit 0: Receive Transmit Interrupt */
-#define I2S_STATE_DMAREQ1 (1 << 1) /* Bit 1: Receive or Transmit DMA Request 1 */
-#define I2S_STATE_DMAREQ2 (1 << 2) /* Bit 2: Receive or Transmit DMA Request 2 */
- /* Bits 3-7: Reserved */
-#define I2S_STATE_RXLEVEL_SHIFT (8) /* Bits 8-11: Current level of the Receive FIFO */
-#define I2S_STATE_RXLEVEL_MASK (15 << I2S_STATE_RXLEVEL_SHIFT)
- /* Bits 12-15: Reserved */
-#define I2S_STATE_TXLEVEL_SHIFT (16) /* Bits 16-19: Current level of the Transmit FIFO */
-#define I2S_STATE_TXLEVEL_MASK (15 << I2S_STATE_TXLEVEL_SHIFT)
- /* Bits 20-31: Reserved */
-/* DMA Configuration Register 1 and 2 */
-
-#define I2S_DMA_RXDMAEN (1 << 0) /* Bit 0: Enable DMA1 for I2S receive */
-#define I2S_DMA_TXDMAEN (1 << 1) /* Bit 1: Enable DMA1 for I2S transmit */
- /* Bits 2-7: Reserved */
-#define I2S_DMA_RXDEPTH_SHIFT (8) /* Bits 8-11: FIFO level that triggers RX request on DMA1 */
-#define I2S_DMA_RXDEPTH_MASK (15 << I2S_DMA_RXDEPTH_SHIFT)
- /* Bits 12-15: Reserved */
-#define I2S_DMA_TXDEPTH_SHIFT (16) /* Bits 16-19: FIFO level that triggers a TX request on DMA1 */
-#define I2S_DMA_TXDEPTH_MASK (15 << I2S_DMA_TXDEPTH_SHIFT)
- /* Bits 20-31: Reserved */
-/* Interrupt Request Control Register */
-
-#define I2S_IRQ_RXEN (1 << 0) /* Bit 0: Enable I2S receive interrupt */
-#define I2S_IRQ_TXEN (1 << 1) /* Bit 1: Enable I2S transmit interrupt */
- /* Bits 2-7: Reserved */
-#define I2S_IRQ_RXDEPTH_SHIFT (8) /* Bits 8-11: Set FIFO level for irq request */
-#define I2S_IRQ_RXDEPTH_MASK (15 << I2S_IRQ_RXDEPTH_SHIFT)
- /* Bits 12-15: Reserved */
-#define I2S_IRQ_TXDEPTH_SHIFT (16) /* Bits 16-19: Set FIFO level for irq request */
-#define I2S_IRQ_TXDEPTH_MASK (15 << I2S_IRQ_TXDEPTH_SHIFT)
- /* Bits 20-31: Reserved */
-/* Transmit and Receive MCLK divider */
-
-#define I2S_RATE_YDIV_SHIFT (0) /* Bits 0-7: I2S transmit MCLK rate denominator */
-#define I2S_RATE_YDIV_MASK (0xff << I2S_RATE_YDIV_SHIFT)
-#define I2S_RATE_XDIV_SHIFT (8) /* Bits 8-15: I2S transmit MCLK rate numerator */
-#define I2S_RATE_XDIV_MASK (0xff << I2S_RATE_XDIV_SHIFT)
- /* Bits 16-31: Reserved */
-
-/* Transmit and received bit rate divider */
-
-#define I2S_BITRATE_SHIFT (0) /* Bits 0-5: I2S transmit bit rate */
-#define I2S_BITRATE_MASK (0x3f << I2S_BITRATE_SHIFT)
- /* Bits 6-31: Reserved */
-/* Transmit and Receive mode control */
-
-#define I2S_MODE_CLKSEL_SHIFT (0) /* Bits 0-1: Clock source for bit clock divider */
-#define I2S_MODE_CLKSEL_MASK (3 << I2S_MODE_CLKSEL_SHIFT)
-# define I2S_MODE_CLKSEL_FRACDIV (0 << I2S_MODE_CLKSEL_SHIFT) /* TX/RX fractional rate divider */
-# define I2S_MODE_CLKSEL_RXMCLK (2 << I2S_MODE_CLKSEL_SHIFT) /* RX_CLCK for TX_MCLK source */
-# define I2S_MODE_CLKSEL_TXMCLK (2 << I2S_MODE_CLKSEL_SHIFT) /* TX_CLCK for RX_MCLK source */
-#define I2S_MODE_4PIN (1 << 2) /* Bit 2: Transmit/Receive 4-pin mode selection */
-#define I2S_MODE_MCENA (1 << 3) /* Bit 3: Enable for the TX/RX_MCLK output */
- /* Bits 4-31: Reserved */
-
-/************************************************************************************
- * Public Types
- ************************************************************************************/
-
-/************************************************************************************
- * Public Data
- ************************************************************************************/
-
-/************************************************************************************
- * Public Functions
- ************************************************************************************/
-
-#endif /* __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC17_I2S_H */
diff --git a/arch/arm/src/lpc17xx/hardware/lpc17_lcd.h b/arch/arm/src/lpc17xx/hardware/lpc17_lcd.h
deleted file mode 100644
index af47bbd8a7e..00000000000
--- a/arch/arm/src/lpc17xx/hardware/lpc17_lcd.h
+++ /dev/null
@@ -1,346 +0,0 @@
-/************************************************************************************************
- * arch/arm/src/lpc17xx/hardware/lpc17_lcd.h
- *
- * Copyright (C) 2013 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. 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.
- * 3. Neither the name NuttX 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 THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- ************************************************************************************************/
-
-#ifndef __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC17_LCD_H
-#define __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC17_LCD_H
-
-/************************************************************************************************
- * Included Files
- ************************************************************************************************/
-
-#include
-
-#include "chip.h"
-#include "hardware/lpc17_memorymap.h"
-
-/************************************************************************************************
- * Pre-processor Definitions
- ************************************************************************************************/
-
-/* Register offsets *****************************************************************************/
-
-#define LPC17_LCD_TIMH_OFFSET (0x0000) /* Horizontal Timing Control register */
-#define LPC17_LCD_TIMV_OFFSET (0x0004) /* Vertical Timing Control register */
-#define LPC17_LCD_POL_OFFSET (0x0008) /* Clock & Signal Polarity Control register */
-#define LPC17_LCD_LE_OFFSET (0x000c) /* Line End Control register */
-#define LPC17_LCD_UPBASE_OFFSET (0x0010) /* Upper Panel Frame Base Address register */
-#define LPC17_LCD_LPBASE_OFFSET (0x0014) /* Lower Panel Frame Base Address register */
-#define LPC17_LCD_CTRL_OFFSET (0x0018) /* LCD Control register */
-#define LPC17_LCD_INTMSK_OFFSET (0x001c) /* Interrupt Mask register */
-#define LPC17_LCD_INTRAW_OFFSET (0x0020) /* Raw Interrupt Status register */
-#define LPC17_LCD_INTSTAT_OFFSET (0x0024) /* Masked Interrupt Status register */
-#define LPC17_LCD_INTCLR_OFFSET (0x0028) /* Interrupt Clear register */
-#define LPC17_LCD_UPCURR_OFFSET (0x002c) /* Upper Panel Current Address Value register */
-#define LPC17_LCD_LPCURR_OFFSET (0x0030) /* Lower Panel Current Address Value register */
-
-/* 256x16-bit Color Palette registers, n=0-127 */
-
-#define LPC17_LCD_PAL_OFFSET(n) (0x0200 + ((n) << 2))
-
-/* Cursor Image registers, n=0-255 */
-
-#define LPC17_LCD_CRSR_IMG_OFFSET(n) (0x0800 + ((n) << 2))
-
-#define LPC17_LCD_CRSR_CRTL_OFFSET (0x0c00) /* Cursor Control register */
-#define LPC17_LCD_CRSR_CFG_OFFSET (0x0c04) /* Cursor Configuration register */
-#define LPC17_LCD_CRSR_PAL0_OFFSET (0x0c08) /* Cursor Palette register 0 */
-#define LPC17_LCD_CRSR_PAL1_OFFSET (0x0c0c) /* Cursor Palette register 1 */
-#define LPC17_LCD_CRSR_XY_OFFSET (0x0c10) /* Cursor XY Position register */
-#define LPC17_LCD_CRSR_CLIP_OFFSET (0x0c14) /* Cursor Clip Position register */
-#define LPC17_LCD_CRSR_INTMSK_OFFSET (0x0c20) /* Cursor Interrupt Mask regsiter */
-#define LPC17_LCD_CRSR_INTCLR_OFFSET (0x0c24) /* Cursor Interrupt Clear register */
-#define LPC17_LCD_CRSR_INTRAW_OFFSET (0x0c28) /* Cursor Raw Interrupt Status register */
-#define LPC17_LCD_CRSR_INTSTAT_OFFSET (0x0c2c) /* Cursor Masked Interrupt Status register */
-
-/* Register Addresses ***************************************************************************/
-
-#define LPC17_LCD_TIMH (LPC17_LCD_BASE+LPC17_LCD_TIMH_OFFSET)
-#define LPC17_LCD_TIMV (LPC17_LCD_BASE+LPC17_LCD_TIMV_OFFSET)
-#define LPC17_LCD_POL (LPC17_LCD_BASE+LPC17_LCD_POL_OFFSET)
-#define LPC17_LCD_LE (LPC17_LCD_BASE+LPC17_LCD_LE_OFFSET)
-#define LPC17_LCD_UPBASE (LPC17_LCD_BASE+LPC17_LCD_UPBASE_OFFSET)
-#define LPC17_LCD_LPBASE (LPC17_LCD_BASE+LPC17_LCD_LPBASE_OFFSET)
-#define LPC17_LCD_CTRL (LPC17_LCD_BASE+LPC17_LCD_CTRL_OFFSET)
-#define LPC17_LCD_INTMSK (LPC17_LCD_BASE+LPC17_LCD_INTMSK_OFFSET)
-#define LPC17_LCD_INTRAW (LPC17_LCD_BASE+LPC17_LCD_INTRAW_OFFSET)
-#define LPC17_LCD_INTSTAT (LPC17_LCD_BASE+LPC17_LCD_INTSTAT_OFFSET)
-#define LPC17_LCD_INTCLR (LPC17_LCD_BASE+ LPC17_LCD_INTCLR_OFFSET)
-#define LPC17_LCD_UPCURR (LPC17_LCD_BASE+LPC17_LCD_UPCURR_OFFSET)
-#define LPC17_LCD_LPCURR (LPC17_LCD_BASE+LPC17_LCD_LPCURR_OFFSET)
-
-#define LPC17_LCD_PAL(n) (LPC17_LCD_BASE+LPC17_LCD_PAL_OFFSET(n))
-#define LPC17_LCD_CRSR_IMG(n) (LPC17_LCD_BASE+LPC17_LCD_CRSR_IMG_OFFSET(n))
-
-#define LPC17_LCD_CRSR_CRTL (LPC17_LCD_BASE+LPC17_LCD_CRSR_CRTL_OFFSET)
-#define LPC17_LCD_CRSR_CFG (LPC17_LCD_BASE+LPC17_LCD_CRSR_CFG_OFFSET)
-#define LPC17_LCD_CRSR_PAL0 (LPC17_LCD_BASE+LPC17_LCD_CRSR_PAL0_OFFSET)
-#define LPC17_LCD_CRSR_PAL1 (LPC17_LCD_BASE+LPC17_LCD_CRSR_PAL1_OFFSET)
-#define LPC17_LCD_CRSR_XY (LPC17_LCD_BASE+LPC17_LCD_CRSR_XY_OFFSET)
-#define LPC17_LCD_CRSR_CLIP (LPC17_LCD_BASE+LPC17_LCD_CRSR_CLIP_OFFSET)
-#define LPC17_LCD_CRSR_INTMSK (LPC17_LCD_BASE+LPC17_LCD_CRSR_INTMSK_OFFSET)
-#define LPC17_LCD_CRSR_INTCLR (LPC17_LCD_BASE+LPC17_LCD_CRSR_INTCLR_OFFSET)
-#define LPC17_LCD_CRSR_INTRAW (LPC17_LCD_BASE+LPC17_LCD_CRSR_INTRAW_OFFSET)
-#define LPC17_LCD_CRSR_INTSTAT (LPC17_LCD_BASE+LPC17_LCD_CRSR_INTSTAT_OFFSET)
-
-/* Register Bitfield Definitions ****************************************************************/
-
-/* LCD_TIMH - Horizontal Timing Register */
- /* Bits 0-1: Reserved */
-#define LCD_TIMH_PPL_SHIFT (2) /* Bits 2-7: Pixels Per Line - 16-1024ppl */
-#define LCD_TIMH_PPL_MASK (0x3f << LCD_TIMH_PPL_SHIFT)
-#define LCD_TIMH_HSW_SHIFT (8) /* Bits 8-15: Horizontal Sync Pulse Width */
-#define LCD_TIMH_HWS_MASK (0xff << LCD_TIMH_HSW_SHIFT)
-#define LCD_TIMH_HFP_SHIFT (16) /* Bits 16-23: Horizontal Front Porch */
-#define LCD_TIMH_HFP_MASK (0xff << LCD_TIMH_HFP_SHIFT)
-#define LCD_TIMH_HBP_SHIFT (24) /* Bits 24-31: Horizontal Back Porch */
-#define LCD_TIMH_HBP_MASK (0xff << LCD_TIMH_HBP_SHIFT)
-
-/* LCD_TIMV - Vertical Timing Register */
-
-#define LCD_TIMV_LPP_SHIFT (0) /* Bits 0-9: Lines Per Panel 1-1024 lpp*/
-#define LCD_TIMV_LPP_MASK (0x3ff << LCD_TIMV_LPP_SHIFT)
-#define LCD_TIMV_VSW_SHIFT (10) /* Bits 10-15: Vertical Synch Pulse Width */
-#define LCD_TIMV_VSW_MASK (0x3f << LCD_TIMV_VSW_SHIFT)
-#define LCD_TIMV_VFP_SHIFT (16) /* Bits 16-23: Vertical Front Porch */
-#define LCD_TIMV_VFP_MASK (0xff << LCD_TIMV_VFP_SHIFT)
-#define LCD_TIMV_VBP_SHIFT (24) /* Bits 24-31: Vertical Back Porch */
-#define LCD_TIMV_VBP_MASK (0xff << LCD_TIMV_VBP_SHIFT)
-
-/* LCD_POL - Clock and Signal Polarity Register */
-
-#define LCD_POL_PCDLO_SHIFT (0) /* Bits 0-4: Lower 5 bits of panel clock divisor */
-#define LCD_POL_PCDLO_MASK (0x1f << LCD_POL_PCDLO_SHIFT)
-#define LCD_POL_CLKSEL (1 << 5) /* Bit 5: Clock select- 0=PCLK, 1=LCD_CLKIN */
-#define LCD_POL_ACB_SHIFT (6) /* Bits 6-10: AC bias pin frequency */
-#define LCD_POL_ACB_MASK (0x1f << LCD_POL_ACB_SHIFT)
-#define LCD_POL_IVS (1 << 11) /* Bit 11: Invert vertical sync */
-#define LCD_POL_IHS (1 << 12) /* Bit 12: Invert horizontal sync */
-#define LCD_POL_IPC (1 << 13) /* Bit 13: Invert panel clock */
-#define LCD_POL_IOE (1 << 14) /* Bit 14: Invert output enable */
- /* Bit 15: Reserved */
-#define LCD_POL_CPL_SHIFT (16) /* Bit 16-25: Clocks per line */
-#define LCD_POL_CPL_MASK (0x3ff << LCD_POL_CPL_SHIFT)
-#define LCD_POL_BCD (1 << 26) /* Bit 26: Bypass pixel clock divider */
-#define LCD_POL_PCDHI_SHIFT (27) /* Bits 27-31: Upper 5 bits of panel clock divisor */
-#define LCD_POL_PCDHI_MASK (0x1f << LCD_POL_PCDHI_SHIFT)
-
-/* LCD_LE - Line End Control Register */
-
-#define LCD_LE_LED_SHIFT (0) /* Bits 0-6: Line End delay */
-#define LCD_LE_LED_MASK (0x7f << LCD_LE_LED_SHIFT)
- /* Bits 7-15: Reserved */
-#define LCD_LE_LEE (1 << 16) /* Bit 16: LCD line end enable */
- /* Bit 17-31: Reserved */
-/* LCD_UPBASE - Upper Panel Frame Base Address Register */
- /* Bits 0-2: Reserved */
-#define LCD_UPBASE_LCDUPBASE_SHIFT (3) /* Bits 3-31: LCD upper panel base address */
-#define LCD_UPBASE_LCDUPBASE_MASK (0x1FFFFFFF << LCD_UPBASE_LCDUPBASE_SHIFT)
-
-/* LCD_UPBASE - Lower Panel Frame Base Address Register */
- /* Bits 0-2: Reserved */
-#define LCD_UPBASE_LCDLPBASE_SHIFT (3) /* Bits 3-31: LCD lower panel base address */
-#define LCD_UPBASE_LCDLPBASE_MASK (0x1FFFFFFF << LCD_UPBASE_LCDUPBASE_SHIFT)
-
-/* LCD_CTRL - Controle Register */
-
-#define LCD_CTRL_LCDEN (1 << 0) /* Bit 0: LCD enable control bit */
-#define LCD_CTRL_LCDBPP_SHIFT (1) /* Bits 1-3: LCD bits per pixel */
-#define LCD_CTRL_LCDBPP_MASK (7 << LCD_CTRL_LCDBPP_SHIFT)
-# define LCD_CTRL_LCDBPP_1 (0 << LCD_CTRL_LCDBPP_SHIFT) /* 1 bpp */
-# define LCD_CTRL_LCDBPP_2 (1 << LCD_CTRL_LCDBPP_SHIFT) /* 2 bpp */
-# define LCD_CTRL_LCDBPP_4 (2 << LCD_CTRL_LCDBPP_SHIFT) /* 4 bpp */
-# define LCD_CTRL_LCDBPP_8 (3 << LCD_CTRL_LCDBPP_SHIFT) /* 8 bpp */
-# define LCD_CTRL_LCDBPP_16 (4 << LCD_CTRL_LCDBPP_SHIFT) /* 16 bpp */
-# define LCD_CTRL_LCDBPP_24 (5 << LCD_CTRL_LCDBPP_SHIFT) /* 24 bpp (TFT panel only) */
-# define LCD_CTRL_LCDBPP_565 (6 << LCD_CTRL_LCDBPP_SHIFT) /* 16 bpp, 5:6:5 mode */
-# define LCD_CTRL_LCDBPP_444 (7 << LCD_CTRL_LCDBPP_SHIFT) /* 12 bpp, 4:4:4 mode */
-#define LCD_CTRL_LCDBW (1 << 4) /* Bit 4: STN LCD monochrome/color selection */
-#define LCD_CTRL_LCDTFT (1 << 5) /* Bit 5: LCD TFT type selection */
-#define LCD_CTRL_LCDMONO8 (1 << 6) /* Bit 6: Monochrome LCD interface bit */
-#define LCD_CTRL_LCDDUAL (1 << 7) /* Bit 7: Single or Dual LCD panel selection */
-#define LCD_CTRL_BGR (1 << 8) /* Bit 8: Color format */
-#define LCD_CTRL_BEBO (1 << 9) /* Bit 9: Big-Endian Byte Order */
-#define LCD_CTRL_BEPO (1 << 10) /* Bit 10: Big-Endian Pixel Ordering */
-#define LCD_CTRL_LCDPWR (1 << 11) /* Bit 11: LCD Power enable */
-#define LCD_CTRL_LCDVCOMP_SHIFT (12) /* Bits 12-13: LCD Vertical compare interrupt */
-#define LCD_CTRL_LCDVCOMP_MASK (3 << LCD_CTRL_LCDVCOMP_SHIFT)
- /* Bits 14-15: Reserved */
-#define LCD_CTRL_WATERMARK (1 << 16) /* Bit 16: LCD DMA FIFO watermark level */
- /* Bits 17-31: Reserved */
-/* LCD_INTMSK - Interrupt Mask Register */
- /* Bits 0: Reserved */
-#define LCD_INTMSK_FUFIM (1 << 1) /* Bit 1: FIFO underflow interrupt enable */
-#define LCD_INTMSK_LNBUIM (1 << 2) /* Bit 2: LCD next base address interrupt enable */
-#define LCD_INTMSK_VCOMPIM (1 << 3) /* Bit 3: Vertical compare interrupt enable */
-#define LCD_INTMSK_BERIM (1 << 4) /* Bit 4: AHB Master error interrupt enable */
- /* Bits 5-31: Reserved */
-#define LCD_INTMSK_ALL (0x1e)
-
-/* LCD_INTRAW - Raw Interrupt Status Register */
- /* Bits 0: Reserved */
-#define LCD_INTRAW_FUFRIS (1 << 1) /* Bit 1: FIFO Undeflow raw interrupt status */
-#define LCD_INTRAW_LNBURIS (1 << 2) /* Bit 2: LCD Next address base update intterupt */
-#define LCD_INTRAW_VCOMPRIS (1 << 3) /* Bit 3: Vertical compare interrupt status */
-#define LCD_INTRAW_BERRAW (1 << 4) /* Bit 4: AHB Master bus error interrupt status */
- /* Bits 5-31: Reserved */
-#define LCD_INTRAW_ALL (0x1e)
-
-/* LCD_INTSTAT - Masked Interrupt Status Register */
- /* Bits 0: Reserved */
-#define LCD_INTSTAT_FUFMIS (1 << 1) /* Bit 1: FIFO Undeflow raw interrupt status */
-#define LCD_INTSTAT_LNBUMIS (1 << 2) /* Bit 2: LCD Next address base update intterupt */
-#define LCD_INTSTAT_VCOMPMIS (1 << 3) /* Bit 3: Vertical compare interrupt status */
-#define LCD_INTSTAT_BERMIS (1 << 4) /* Bit 4: AHB Master bus error interrupt status */
- /* Bits 15-31: Reserved */
-#define LCD_INTSTAT_ALL (0x1e)
-
-/* LCD_INTCLR - Interrupt Clear Register */
- /* Bits 0: Reserved */
-#define LCD_INTCLR_FUFIC (1 << 1) /* Bit 1: FIFO Undeflow raw interrupt clear */
-#define LCD_INTCLR_LNBUIC (1 << 2) /* Bit 2: LCD Next address base update intterupt */
-#define LCD_INTCLR_VCOMPIC (1 << 3) /* Bit 3: Vertical compare interrupt clear */
-#define LCD_INTCLR_BERIC (1 << 4) /* Bit 4: AHB Master bus error interrupt clear */
- /* Bits 15-31: Reserved */
-#define LCD_INTCLR_ALL (0x1e)
-
-/* Upper and Lower Panel Address register has no bitfields */
-/*
- * Upper Panel Current Address register (LCDUPCURR)
- * Lower Panel Current Address register (LCDLPCURR)
- */
-
-/* LCD_PAL - Color Palette Registers */
-
-#define LCD_PAL_R0_SHIFT (0) /* Bits 0-4: Red palette data */
-#define LCD_PAL_R0_MASK (0x1f << LCD_PAL_R0_SHIFT)
-#define LCD_PAL_G0_SHIFT (5) /* Bits 5-9: Green palette data */
-#define LCD_PAL_G0_MASK (0x1f << LCD_PAL_G0_SHIFT)
-#define LCD_PAL_B0_SHIFT (10) /* Bits 10-14: Blue paletted data */
-#define LCD_PAL_B0_MASK (0x1f << LCD_PAL_B0_SHIFT)
-#define LCD_PAL_I0 (1 << 15) /* Bit 15: Intensity/Unused bit */
-#define LCD_PAL_R1_SHIFT (16) /* Bits 16-20: Red palette data */
-#define LCD_PAL_R1_MASK (0x1f << LCD_PAL_R1_SHIFT)
-#define LCD_PAL_G1_SHIFT (21) /* Bits 21-25: Green palette data */
-#define LCD_PAL_G1_MASK (0x1f << LCD_PAL_G1_SHIFT)
-#define LCD_PAL_B1_SHIFT (26) /* Bits 26-30: Blue palette data */
-#define LCD_PAL_B1_MASK (0x1f << LCD_PAL_B1_SHIFT)
-#define LCD_PAL_I1 (1 << 31) /* Bit 31: Intensity/Unused bit */
-
-/* LCD_CRSR_IMG - Cursor Image Register - has no bitfields */
-/* The 256 words of the cursor image register defines the appearance
- * of either one 64x64 cursor, or 4 32x32 cursors.
- */
-
-/* LCD CRSR_CTRL - Cursor Control Register */
-
-#define LCD_CRSR_CTRL_CRSON (1 << 0) /* Bit 0: Cursor enable */
- /* Bits 1-3: Reserved */
-#define LCD_CRSR_CTRL_CRSRNUM_SHIFT (4) /* Bits 4-5: Cursor image number */
-#define LCD_CRSR_CTRL_CRSRNUM_MASK (3 << LCD_CRSR_CTRL_CRSRNUM1_0_SHIFT)
- /* Bits 6-31: Reserved */
-/* If the selected cursor is 32x32 */
-
-#define LCD_CURSOR0 (0)
-#define LCD_CURSOR1 (1)
-#define LCD_CURSOR2 (2)
-#define LCD_CURSOR3 (3)
-
-/* LCD CRSR_CFG - Cursor Configuration Register */
-
-#define LCD_CRSR_CFG_CRSRSIZE (1 << 0) /* Bit 0: Cursor size selection */
-#define LCD_CRSR_CFG_FRAMESYNC (1 << 1) /* Bit 1: Cursor frame sync type */
- /* Bits 2-31: Reserved */
-
-#define LCD_CURSOR_SIZE32 (0) /* 32x32 */
-#define LCD_CURSOR_SIZE64 (1) /* 64x64 */
-#define LCD_CURSOR_FRAMEASYNC (0) /* Cursor coordinates are asynchronous */
-#define LCD_CURSOR_FRAMESYNC (1) /* coordinates are synchronize to framesync pulse */
-
-/* LCD CRSR_PAL0/1 - Cursor Palette Registers */
-
-#define LCD_CRSR_PAL_RED_SHIFT (0) /* Bits 0-7: Red color componnent */
-#define LCD_CRSR_PAL_RED_MASK (0xff << LCD_CRSR_PAL0_RED_SHIFT)
-#define LCD_CRSR_PAL_GREEN_SHIFT (8) /* Bits 8-15: Green color component */
-#define LCD_CRSR_PAL_GREEN_MASK (0xff << LCD_CRSR_PAL0_GREEN_SHIFT)
-#define LCD_CRSR_PAL_BLUE_SHIFT (16) /* Bits 16-23: Blue color component */
-#define LCD_CRSR_PAL_BLUE_MASK (0xff << LCD_CRSR_PAL0_BLUE_SHIFT)
- /* Bits 24-31: Reserved */
-/* LCD CRSR_XY - Cursor XY Position Register */
-
-#define LCD_CRSR_CRSRX_SHIFT (0) /* Bits 0-9: X ordinate */
-#define LCD_CRSR_CRSRX_MASK (0x3ff << LCD_CRSR_CRSRX_SHIFT)
- /* Bits 10-15: Reserved */
-#define LCD_CRSR_CRSRY_SHIFT (16) /* Bits 16-25: Y ordinate */
-#define LCD_CRSR_CRSRY_MASK (0x3ff << LCD_CRSR_CRSRY_SHIFT)
- /* Bits 26-31: Reserved */
-/* LCD CRSR_CLIP - Cursor Clip Position Register */
-
-#define LCD_CRSR_CRSRCLIPX_SHIFT (0) /* Bits 0-5: X clip position */
-#define LCD_CRSR_CRSRCLIPX_MASK (0x3f << LCD_CRSR_CRSRCLIPX_SHIFT)
- /* Bits 6-7: Reserved */
-#define LCD_CRSR_CRSRCLIPY_SHIFT (8) /* Bits 8-13: Reserved */
-#define LCD_CRSR_CRSRCLIPY_MASK (0x3f << LCD_CRSR_CRSRCLIPY_SHIFT)
- /* Bits 14-31: Reserved */
-/* LCD CRSR_INTMSK - Cursor Interrrupt Mask Register */
-
-#define LCD_CRSR_INTMSK_CRSRIM (1 << 0) /* Bit 0: Cursor interrupt mask */
- /* Bits 1-31: Reserved */
-/* LCD CRSR_INTCLR - Cursor Interrrupt Clear Register */
-
-#define LCD_CRSR_INTCLR_CRSRIC (1 << 0) /* Bit 0: Cursor interrupt clear */
- /* Bits 1-31: Reserved */
-
-/* LCD CRSR_INTRAW - Cursor Raw Interrrupt Status Register */
-
-#define LCD_CRSR_INTRAW_CRSRRIS (1 << 0) /* Bit 0: Cursor raw interrupt status */
- /* Bits 1-31: Reserved */
-/* LCD CRSR_INTSTAT - Mask Interrrupt Status Register */
-
-#define LCD_CRSR_INTSTAT_CRSRMIS (1 << 0) /* Bit 0: Cursor mask interrupt status */
- /* Bits 1-31: Reserved */
-
-/************************************************************************************************
- * Public Types
- ************************************************************************************************/
-
-/************************************************************************************************
- * Public Data
- ************************************************************************************************/
-
-/************************************************************************************************
- * Public Functions
- ************************************************************************************************/
-
-#endif /* __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC17_LCD_H */
diff --git a/arch/arm/src/lpc17xx/hardware/lpc17_mcpwm.h b/arch/arm/src/lpc17xx/hardware/lpc17_mcpwm.h
deleted file mode 100644
index fc04e68ab9a..00000000000
--- a/arch/arm/src/lpc17xx/hardware/lpc17_mcpwm.h
+++ /dev/null
@@ -1,280 +0,0 @@
-/************************************************************************************
- * arch/arm/src/lpc17xx/hardware/lpc17_mcpwm.h
- *
- * Copyright (C) 2010, 2013 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. 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.
- * 3. Neither the name NuttX 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 THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- ************************************************************************************/
-
-#ifndef __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC17_MCPWM_H
-#define __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC17_MCPWM_H
-
-/************************************************************************************
- * Included Files
- ************************************************************************************/
-
-#include
-
-#include "chip.h"
-#include "hardware/lpc17_memorymap.h"
-
-/************************************************************************************
- * Pre-processor Definitions
- ************************************************************************************/
-
-/* Register offsets *****************************************************************/
-
-#define LPC17_MCPWM_CON_OFFSET 0x0000 /* PWM Control read address */
-#define LPC17_MCPWM_CONSET_OFFSET 0x0004 /* PWM Control set address */
-#define LPC17_MCPWM_CONCLR_OFFSET 0x0008 /* PWM Control clear address */
-#define LPC17_MCPWM_CAPCON_OFFSET 0x000c /* Capture Control read address */
-#define LPC17_MCPWM_CAPCONSET_OFFSET 0x0010 /* Capture Control set address */
-#define LPC17_MCPWM_CAPCONCLR_OFFSET 0x0014 /* Event Control clear address */
-#define LPC17_MCPWM_TC0_OFFSET 0x0018 /* Timer Counter register, channel 0 */
-#define LPC17_MCPWM_TC1_OFFSET 0x001c /* Timer Counter register, channel 1 */
-#define LPC17_MCPWM_TC2_OFFSET 0x0020 /* Timer Counter register, channel 2 */
-#define LPC17_MCPWM_LIM0_OFFSET 0x0024 /* Limit register, channel 0 */
-#define LPC17_MCPWM_LIM1_OFFSET 0x0028 /* Limit register, channel 1 */
-#define LPC17_MCPWM_LIM2_OFFSET 0x002c /* Limit register, channel 2 */
-#define LPC17_MCPWM_MAT0_OFFSET 0x0030 /* Match register, channel 0 */
-#define LPC17_MCPWM_MAT1_OFFSET 0x0034 /* Match register, channel 1 */
-#define LPC17_MCPWM_MAT2_OFFSET 0x0038 /* Match register, channel 2 */
-#define LPC17_MCPWM_DT_OFFSET 0x003c /* Dead time register */
-#define LPC17_MCPWM_CP_OFFSET 0x0040 /* Commutation Pattern register */
-#define LPC17_MCPWM_CAP0_OFFSET 0x0044 /* Capture register, channel 0 */
-#define LPC17_MCPWM_CAP1_OFFSET 0x0048 /* Capture register, channel 1 */
-#define LPC17_MCPWM_CAP2_OFFSET 0x004c /* Capture register, channel 2 */
-#define LPC17_MCPWM_INTEN_OFFSET 0x0050 /* Interrupt Enable read address */
-#define LPC17_MCPWM_INTENSET_OFFSET 0x0054 /* Interrupt Enable set address */
-#define LPC17_MCPWM_INTENCLR_OFFSET 0x0058 /* Interrupt Enable clear address */
-#define LPC17_MCPWM_CNTCON_OFFSET 0x005c /* Count Control read address */
-#define LPC17_MCPWM_CNTCONSET_OFFSET 0x0060 /* Count Control set address */
-#define LPC17_MCPWM_CNTCONCLR_OFFSET 0x0064 /* Count Control clear address */
-#define LPC17_MCPWM_INTF_OFFSET 0x0068 /* Interrupt flags read address */
-#define LPC17_MCPWM_INTFSET_OFFSET 0x006c /* Interrupt flags set address */
-#define LPC17_MCPWM_INTFCLR_OFFSET 0x0070 /* Interrupt flags clear address */
-#define LPC17_MCPWM_CAPCLR_OFFSET 0x0074 /* Capture clear address */
-
-/* Register addresses ***************************************************************/
-
-#define LPC17_MCPWM_CON (LPC17_MCPWM_BASE+LPC17_MCPWM_CON_OFFSET)
-#define LPC17_MCPWM_CONSET (LPC17_MCPWM_BASE+LPC17_MCPWM_CONSET_OFFSET)
-#define LPC17_MCPWM_CONCLR (LPC17_MCPWM_BASE+LPC17_MCPWM_CONCLR_OFFSET)
-#define LPC17_MCPWM_CAPCON (LPC17_MCPWM_BASE+LPC17_MCPWM_CAPCON_OFFSET)
-#define LPC17_MCPWM_CAPCONSET (LPC17_MCPWM_BASE+LPC17_MCPWM_CAPCONSET_OFFSET)
-#define LPC17_MCPWM_CAPCONCLR (LPC17_MCPWM_BASE+LPC17_MCPWM_CAPCONCLR_OFFSET)
-#define LPC17_MCPWM_TC0 (LPC17_MCPWM_BASE+LPC17_MCPWM_TC0_OFFSET)
-#define LPC17_MCPWM_TC1 (LPC17_MCPWM_BASE+LPC17_MCPWM_TC1_OFFSET)
-#define LPC17_MCPWM_TC2 (LPC17_MCPWM_BASE+LPC17_MCPWM_TC2_OFFSET)
-#define LPC17_MCPWM_LIM0 (LPC17_MCPWM_BASE+LPC17_MCPWM_LIM0_OFFSET)
-#define LPC17_MCPWM_LIM1 (LPC17_MCPWM_BASE+LPC17_MCPWM_LIM1_OFFSET)
-#define LPC17_MCPWM_LIM2 (LPC17_MCPWM_BASE+LPC17_MCPWM_LIM2_OFFSET)
-#define LPC17_MCPWM_MAT0 (LPC17_MCPWM_BASE+LPC17_MCPWM_MAT0_OFFSET)
-#define LPC17_MCPWM_MAT1 (LPC17_MCPWM_BASE+LPC17_MCPWM_MAT1_OFFSET)
-#define LPC17_MCPWM_MAT2 (LPC17_MCPWM_BASE+LPC17_MCPWM_MAT2_OFFSET)
-#define LPC17_MCPWM_DT (LPC17_MCPWM_BASE+LPC17_MCPWM_DT_OFFSET)
-#define LPC17_MCPWM_CP (LPC17_MCPWM_BASE+LPC17_MCPWM_CP_OFFSET)
-#define LPC17_MCPWM_CAP0 (LPC17_MCPWM_BASE+LPC17_MCPWM_CAP0_OFFSET)
-#define LPC17_MCPWM_CAP1 (LPC17_MCPWM_BASE+LPC17_MCPWM_CAP1_OFFSET)
-#define LPC17_MCPWM_CAP2 (LPC17_MCPWM_BASE+LPC17_MCPWM_CAP2_OFFSET)
-#define LPC17_MCPWM_INTEN (LPC17_MCPWM_BASE+LPC17_MCPWM_INTEN_OFFSET)
-#define LPC17_MCPWM_INTENSET (LPC17_MCPWM_BASE+LPC17_MCPWM_INTENSET_OFFSET)
-#define LPC17_MCPWM_INTENCLR (LPC17_MCPWM_BASE+LPC17_MCPWM_INTENCLR_OFFSET)
-#define LPC17_MCPWM_CNTCON (LPC17_MCPWM_BASE+LPC17_MCPWM_CNTCON_OFFSET)
-#define LPC17_MCPWM_CNTCONSET (LPC17_MCPWM_BASE+LPC17_MCPWM_CNTCONSET_OFFSET)
-#define LPC17_MCPWM_CNTCONCLR (LPC17_MCPWM_BASE+LPC17_MCPWM_CNTCONCLR_OFFSET)
-#define LPC17_MCPWM_INTF (LPC17_MCPWM_BASE+LPC17_MCPWM_INTF_OFFSET)
-#define LPC17_MCPWM_INTFSET (LPC17_MCPWM_BASE+LPC17_MCPWM_INTFSET_OFFSET)
-#define LPC17_MCPWM_INTFCLR (LPC17_MCPWM_BASE+LPC17_MCPWM_INTFCLR_OFFSET)
-#define LPC17_MCPWM_CAPCLR (LPC17_MCPWM_BASE+LPC17_MCPWM_CAPCLR_OFFSET)
-
-/* Register bit definitions *********************************************************/
-/* There are no bit field definitions for the following registers because they support
- * 32-bit values:
- *
- * - Timer Counter register, channel 0 (TC0), Timer Counter register, channel 1 (TC1),
- * and Timer Counter register, channel 2 (TC2): 32-bit Timer/Counter values for
- * channels 0, 1, 2 (no bit field definitions)
- *
- * - Limit register, channel 0 (LIM0), Limit register, channel 1 (LIM1), and Limit
- * register, channel 2 (LIM2): 32-bit Limit values for TC0, 1, 2 (no bit field
- * definitions)
- *
- * - Match register, channel 0 MAT0), Match register, channel 1 (MAT1), and Match
- * register, channel 2 (MAT2): 32-bit Match values for TC0, 1, 2 (no bit field
- * definitions).
- *
- * - Capture register, channel 0 (CAP0), Capture register, channel 1 (CAP1), and
- * Capture register, channel 2 (CAP2): 32-bit TC value at a capture event for
- * channels 0, 1, 2 (no bit field definitions)
- */
-
-/* PWM Control read address (CON), PWM Control set address (CONSET), and PWM Control
- * clear address (CONCLR) common regiser bit definitions.
- */
-
-#define MCPWM_CON_RUN0 (1 << 0) /* Bit 0: Stops/starts timer channel 0 */
-#define MCPWM_CON_CENTER0 (1 << 1) /* Bit 1: Chan 0 edge/center aligned operation */
-#define MCPWM_CON_POLA0 (1 << 2) /* Bit 2: Polarity of MCOA0 and MCOB0 */
-#define MCPWM_CON_DTE0 (1 << 3) /* Bit 3: Dead time feature control */
-#define MCPWM_CON_DISUP0 (1 << 4) /* Bit 4: Enable/disable register updates */
- /* Bits 5-7: Reserved */
-#define MCPWM_CON_RUN1 (1 << 8) /* Bit 8: Stops/starts timer channel 1 */
-#define MCPWM_CON_CENTER1 (1 << 9) /* Bit 9: Chan 1 edge/center aligned operation */
-#define MCPWM_CON_POLA1 (1 << 10) /* Bit 10: Polarity of MCOA1 and MCOB1 */
-#define MCPWM_CON_DTE1 (1 << 11) /* Bit 11: Dead time feature control */
-#define MCPWM_CON_DISUP1 (1 << 12) /* Bit 12: Enable/disable register updates */
- /* Bits 13-15: Reserved */
-#define MCPWM_CON_RUN2 (1 << 16) /* Bit 16: Stops/starts timer channel 2 */
-#define MCPWM_CON_CENTER2 (1 << 17) /* Bit 17: Chan 2 edge/center aligned operation */
-#define MCPWM_CON_POLA2 (1 << 18) /* Bit 18: Polarity of MCOA1 and MCOB1 */
-#define MCPWM_CON_DTE2 (1 << 19) /* Bit 19: Dead time feature control */
-#define MCPWM_CON_DISUP2 (1 << 20) /* Bit 20: Enable/disable register updates */
- /* Bits 21-28: Reserved */
-#define MCPWM_CON_INVBDC (1 << 29) /* Bit 29: Polarity of MCOB outputs (all channels) */
-#define MCPWM_CON_ACMODE (1 << 30) /* Bit 30: 3-phase AC mode select */
-#define MCPWM_CON_DCMODE (1 << 31) /* Bit 31: 3-phase DC mode select */
-
-/* Capture Control read address (CAPCON), Capture Control set address (CAPCONSET),
- * and Event Control clear address (CAPCONCLR) common register bit defintions
- */
-
-#define MCPWM_CAPCON_CAP0MCI0RE (1 << 0) /* Bit 0: Enable chan0 rising edge capture MCI0 */
-#define MCPWM_CAPCON_CAP0MCI0FE (1 << 1) /* Bit 1: Enable chan 0 falling edge capture MCI0 */
-#define MCPWM_CAPCON_CAP0MCI1RE (1 << 2) /* Bit 2: Enable chan 0 rising edge capture MCI1 */
-#define MCPWM_CAPCON_CAP0MCI1FE (1 << 3) /* Bit 3: Enable chan 0 falling edge capture MCI1 */
-#define MCPWM_CAPCON_CAP0MCI2RE (1 << 4) /* Bit 4: Enable chan 0 rising edge capture MCI2 */
-#define MCPWM_CAPCON_CAP0MCI2FE (1 << 5) /* Bit 5: Enable chan 0 falling edge capture MCI2 */
-#define MCPWM_CAPCON_CAP1MCI0RE (1 << 6) /* Bit 6: Enable chan 1 rising edge capture MCI0 */
-#define MCPWM_CAPCON_CAP1MCI0FE (1 << 7) /* Bit 7: Enable chan 1 falling edge capture MCI0 */
-#define MCPWM_CAPCON_CAP1MCI1RE (1 << 8) /* Bit 8: Enable chan 1 rising edge capture MCI1 */
-#define MCPWM_CAPCON_CAP1MCI1FE (1 << 9) /* Bit 9: Enable chan 1 falling edge capture MCI1 */
-#define MCPWM_CAPCON_CAP1MCI2RE (1 << 10) /* Bit 10: Enable chan 1 rising edge capture MCI2 */
-#define MCPWM_CAPCON_CAP1MCI2FE (1 << 11) /* Bit 11: Enable chan 1 falling edge capture MCI2 */
-#define MCPWM_CAPCON_CAP2MCI0RE (1 << 12) /* Bit 12: Enable chan 2 rising edge capture MCI0 */
-#define MCPWM_CAPCON_CAP2MCI0FE (1 << 13) /* Bit 13: Enable chan 2 falling edge capture MCI0 */
-#define MCPWM_CAPCON_CAP2MCI1RE (1 << 14) /* Bit 14: Enable chan 2 rising edge capture MCI1 */
-#define MCPWM_CAPCON_CAP2MCI1FE (1 << 15) /* Bit 15: Enable chan 2 falling edge capture MCI1 */
-#define MCPWM_CAPCON_CAP2MCI2RE (1 << 16) /* Bit 16: Enable chan 2 rising edge capture MCI2 */
-#define MCPWM_CAPCON_CAP2MCI2FE (1 << 17) /* Bit 17: Enable chan 2 falling edge capture MCI2 */
-#define MCPWM_CAPCON_RT0 (1 << 18) /* Bit 18: TC0 reset by chan 0 capture event */
-#define MCPWM_CAPCON_RT1 (1 << 19) /* Bit 19: TC1 reset by chan 1 capture event */
-#define MCPWM_CAPCON_RT2 (1 << 20) /* Bit 20: TC2 reset by chan 2 capture event */
-#define MCPWM_CAPCON_HNFCAP0 (1 << 21) /* Bit 21: Hardware noise filter */
-#define MCPWM_CAPCON_HNFCAP1 (1 << 22) /* Bit 22: Hardware noise filter */
-#define MCPWM_CAPCON_HNFCAP2 (1 << 23) /* Bit 23: Hardware noise filter */
- /* Bits 24-31: Reserved */
-/* Dead time register */
-
-#define MCPWM_DT_DT0_SHIFT (0) /* Bits 0-9: Dead time for channel 0 */
-#define MCPWM_DT_DT0_MASK (0x03ff << MCPWM_DT_DT0_SHIFT)
-#define MCPWM_DT_DT1_SHIFT (10) /* Bits 10-19: Dead time for channel 1 */
-#define MCPWM_DT_DT1_MASK (0x03ff << MCPWM_DT_DT1_SHIFT)
-#define MCPWM_DT_DT2_SHIFT (20) /* Bits 20-29: Dead time for channel 2 */
-#define MCPWM_DT_DT2_MASK (0x03ff << MCPWM_DT_DT2_SHIFT)
- /* Bits 30-31: reserved */
-/* Commutation Pattern register */
-
-#define MCPWM_CP_CCPA0 (1 << 0) /* Bit 0: Iinternal MCOA0 */
-#define MCPWM_CP_CCPB0 (1 << 1) /* Bit 1: MCOB0 tracks internal MCOA0 */
-#define MCPWM_CP_CCPA1 (1 << 2) /* Bit 2: MCOA1 tracks internal MCOA0 */
-#define MCPWM_CP_CCPB1 (1 << 3) /* Bit 3: MCOB1 tracks internal MCOA0 */
-#define MCPWM_CP_CCPA2 (1 << 4) /* Bit 4: MCOA2 tracks internal MCOA0 */
-#define MCPWM_CP_CCPB2 (1 << 5) /* Bit 5: MCOB2 tracks internal MCOA0 */
- /* Bits 6-31: reserved */
-
-/* Interrupt Enable read address (INTEN), Interrupt Enable set address (INTENSET),
- * Interrupt Enable clear address (INTENCLR), Interrupt flags read address (INTF),
- * Interrupt flags set address (INTFSET), and Interrupt flags clear address (INTFCLR)
- * common bit field definitions
- */
-
-#define MCPWM_INT_ILIM0 (1 << 0) /* Bit 0: Limit interrupts for channel 0 */
-#define MCPWM_INT_IMAT0 (1 << 1) /* Bit 1: Match interrupts for channel 0 */
-#define MCPWM_INT_ICAP0 (1 << 2) /* Bit 2: Capture interrupts for channel 0 */
- /* Bit 3: Reserved */
-#define MCPWM_INT_ILIM1 (1 << 4) /* Bit 4: Limit interrupts for channel 1 */
-#define MCPWM_INT_IMAT1 (1 << 5) /* Bit 5: Match interrupts for channel 1 */
-#define MCPWM_INT_ICAP1 (1 << 6) /* Bit 6: Capture interrupts for channel 1 */
- /* Bit 7: Reserved */
-#define MCPWM_INT_ILIM2 (1 << 8) /* Bit 8: Limit interrupts for channel 2 */
-#define MCPWM_INT_IMAT2 (1 << 9) /* Bit 9: Match interrupts for channel 2 */
-#define MCPWM_INT_ICAP2 (1 << 10) /* Bit 10: Capture interrupts for channel 2 */
- /* Bits 11-14: Reserved */
-#define MCPWM_INT_ABORT (1 << 15) /* Bit 15: Fast abort interrupt */
- /* Bits 16-31: Reserved */
-
-/* Count Control read address (CNTCON), Count Control set address (CNTCONSET), and
- * Count Control clear address (CNTCONCLR) common register bit definitions.
- */
-
-#define MCPWM_CNTCON_TC0MCI0RE (1 << 0) /* Bit 0: Counter 0 incr on rising edge MCI0 */
-#define MCPWM_CNTCON_TC0MCI0FE (1 << 1) /* Bit 1: Counter 0 incr onfalling edge MCI0 */
-#define MCPWM_CNTCON_TC0MCI1RE (1 << 2) /* Bit 2: Counter 0 incr onrising edge MCI1 */
-#define MCPWM_CNTCON_TC0MCI1FE (1 << 3) /* Bit 3: Counter 0 incr onfalling edge MCI1 */
-#define MCPWM_CNTCON_TC0MCI2RE (1 << 4) /* Bit 4: Counter 0 incr onrising edge MCI2 */
-#define MCPWM_CNTCON_TC0MCI2FE (1 << 5) /* Bit 5: Counter 0 incr onfalling edge MCI2 */
-#define MCPWM_CNTCON_TC1MCI0RE (1 << 6) /* Bit 6: Counter 1 incr onrising edge MCI0 */
-#define MCPWM_CNTCON_TC1MCI0FE (1 << 7) /* Bit 7: Counter 1 incr onfalling edge MCI0 */
-#define MCPWM_CNTCON_TC1MCI1RE (1 << 8) /* Bit 8: Counter 1 incr onrising edge MCI1 */
-#define MCPWM_CNTCON_TC1MCI1FE (1 << 9) /* Bit 9: Counter 1 incr onfalling edge MCI1 */
-#define MCPWM_CNTCON_TC1MCI2RE (1 << 10) /* Bit 10: Counter 1 incr onrising edge MCI2 */
-#define MCPWM_CNTCON_TC1MCI2FE (1 << 11) /* Bit 11: Counter 1 incr onfalling edge MCI2 */
-#define MCPWM_CNTCON_TC2MCI0RE (1 << 12) /* Bit 12: Counter 2 incr onrising edge MCI0 */
-#define MCPWM_CNTCON_TC2MCI0FE (1 << 13) /* Bit 13: Counter 2 incr onfalling edge MCI0 */
-#define MCPWM_CNTCON_TC2MCI1RE (1 << 14) /* Bit 14: Counter 2 incr onrising edge MCI1 */
-#define MCPWM_CNTCON_TC2MCI1FE (1 << 15) /* Bit 15: Counter 2 incr onfalling edge MCI1 */
-#define MCPWM_CNTCON_TC2MCI2RE (1 << 16) /* Bit 16: Counter 2 incr onrising edge MCI2 */
-#define MCPWM_CNTCON_TC2MCI2FE (1 << 17) /* Bit 17: Counter 2 incr onfalling edge MCI2 */
- /* Bits 28-28: Reserved */
-#define MCPWM_CNTCON_CNTR0 (1 << 29) /* Bit 29: Channel 0 counter mode */
-#define MCPWM_CNTCON_CNTR1 (1 << 30) /* Bit 30: Channel 1 counter mode */
-#define MCPWM_CNTCON_CNTR2 (1 << 31) /* Bit 31: Channel 2 counter mode */
-
-/* Capture clear address */
-
-#define MCPWM_CAPCLR_MCCLR0 (1 << 0) /* Bit 0: Clear MCCAP0 register */
-#define MCPWM_CAPCLR_MCCLR1 (1 << 1) /* Bit 1: Clear MCCAP1 register */
-#define MCPWM_CAPCLR_MCCLR2 (1 << 2) /* Bit 2: Clear MCCAP2 register */
- /* Bits 2-31: Reserved */
-
-/************************************************************************************
- * Public Types
- ************************************************************************************/
-
-/************************************************************************************
- * Public Data
- ************************************************************************************/
-
-/************************************************************************************
- * Public Functions
- ************************************************************************************/
-
-#endif /* __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC17_MCPWM_H */
diff --git a/arch/arm/src/lpc17xx/hardware/lpc17_pwm.h b/arch/arm/src/lpc17xx/hardware/lpc17_pwm.h
deleted file mode 100644
index 4c158c9d0cf..00000000000
--- a/arch/arm/src/lpc17xx/hardware/lpc17_pwm.h
+++ /dev/null
@@ -1,223 +0,0 @@
-/************************************************************************************
- * arch/arm/src/lpc17xx/hardware/lpc17_pwm.h
- *
- * Copyright (C) 2010 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. 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.
- * 3. Neither the name NuttX 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 THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- ************************************************************************************/
-
-#ifndef __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC17_PWM_H
-#define __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC17_PWM_H
-
-/************************************************************************************
- * Included Files
- ************************************************************************************/
-
-#include
-
-#include "chip.h"
-#include "hardware/lpc17_memorymap.h"
-
-/************************************************************************************
- * Pre-processor Definitions
- ************************************************************************************/
-
-/* Register offsets *****************************************************************/
-
-#define LPC17_PWM_IR_OFFSET 0x0000 /* Interrupt Register */
-#define LPC17_PWM_TCR_OFFSET 0x0004 /* Timer Control Register */
-#define LPC17_PWM_TC_OFFSET 0x0008 /* Timer Counter */
-#define LPC17_PWM_PR_OFFSET 0x000c /* Prescale Register */
-#define LPC17_PWM_PC_OFFSET 0x0010 /* Prescale Counter */
-#define LPC17_PWM_MCR_OFFSET 0x0014 /* Match Control Register */
-#define LPC17_PWM_MR0_OFFSET 0x0018 /* Match Register 0 */
-#define LPC17_PWM_MR1_OFFSET 0x001c /* Match Register 1 */
-#define LPC17_PWM_MR2_OFFSET 0x0020 /* Match Register 2 */
-#define LPC17_PWM_MR3_OFFSET 0x0024 /* Match Register 3 */
-#define LPC17_PWM_CCR_OFFSET 0x0028 /* Capture Control Register */
-#define LPC17_PWM_CR0_OFFSET 0x002c /* Capture Register 0 */
-#define LPC17_PWM_CR1_OFFSET 0x0030 /* Capture Register 1 */
-#define LPC17_PWM_CR2_OFFSET 0x0034 /* Capture Register 2 */
-#define LPC17_PWM_CR3_OFFSET 0x0038 /* Capture Register 3 */
-#define LPC17_PWM_MR4_OFFSET 0x0040 /* Match Register 4 */
-#define LPC17_PWM_MR5_OFFSET 0x0044 /* Match Register 5 */
-#define LPC17_PWM_MR6_OFFSET 0x0048 /* Match Register 6 */
-#define LPC17_PWM_PCR_OFFSET 0x004c /* PWM Control Register */
-#define LPC17_PWM_LER_OFFSET 0x0050 /* Load Enable Register */
-#define LPC17_PWM_CTCR_OFFSET 0x0070 /* Counter/Timer Control Register */
-
-/* Register addresses ***************************************************************/
-
-#define LPC17_PWM1_IR (LPC17_PWM1_BASE+LPC17_PWM_IR_OFFSET)
-#define LPC17_PWM1_TCR (LPC17_PWM1_BASE+LPC17_PWM_TCR_OFFSET)
-#define LPC17_PWM1_TC (LPC17_PWM1_BASE+LPC17_PWM_TC_OFFSET)
-#define LPC17_PWM1_PR (LPC17_PWM1_BASE+LPC17_PWM_PR_OFFSET)
-#define LPC17_PWM1_PC (LPC17_PWM1_BASE+LPC17_PWM_PC_OFFSET)
-#define LPC17_PWM1_MCR (LPC17_PWM1_BASE+LPC17_PWM_MCR_OFFSET)
-#define LPC17_PWM1_MR0 (LPC17_PWM1_BASE+LPC17_PWM_MR0_OFFSET)
-#define LPC17_PWM1_MR1 (LPC17_PWM1_BASE+LPC17_PWM_MR1_OFFSET)
-#define LPC17_PWM1_MR2 (LPC17_PWM1_BASE+LPC17_PWM_MR2_OFFSET)
-#define LPC17_PWM1_MR3 (LPC17_PWM1_BASE+LPC17_PWM_MR3_OFFSET)
-#define LPC17_PWM1_MR4 (LPC17_PWM1_BASE+LPC17_PWM_MR4_OFFSET)
-#define LPC17_PWM1_MR5 (LPC17_PWM1_BASE+LPC17_PWM_MR5_OFFSET)
-#define LPC17_PWM1_MR6 (LPC17_PWM1_BASE+LPC17_PWM_MR6_OFFSET)
-#define LPC17_PWM1_CCR (LPC17_PWM1_BASE+LPC17_PWM_CCR_OFFSET)
-#define LPC17_PWM1_CR0 (LPC17_PWM1_BASE+LPC17_PWM_CR0_OFFSET)
-#define LPC17_PWM1_CR1 (LPC17_PWM1_BASE+LPC17_PWM_CR1_OFFSET)
-#define LPC17_PWM1_CR2 (LPC17_PWM1_BASE+LPC17_PWM_CR2_OFFSET)
-#define LPC17_PWM1_CR3 (LPC17_PWM1_BASE+LPC17_PWM_CR3_OFFSET)
-#define LPC17_PWM1_PCR (LPC17_PWM1_BASE+LPC17_PWM_PCR_OFFSET)
-#define LPC17_PWM1_LER (LPC17_PWM1_BASE+LPC17_PWM_LER_OFFSET)
-#define LPC17_PWM1_CTCR (LPC17_PWM1_BASE+LPC17_PWM_CTCR_OFFSET)
-
-/* Register bit definitions *********************************************************/
-/* Registers holding 32-bit numeric values (no bit field definitions):
- *
- * Timer Counter (TC)
- * Prescale Register (PR)
- * Prescale Counter (PC)
- * Match Register 0 (MR0)
- * Match Register 1 (MR1)
- * Match Register 2 (MR2)
- * Match Register 3 (MR3)
- * Match Register 4 (MR3)
- * Match Register 5 (MR3)
- * Match Register 6 (MR3)
- * Capture Register 0 (CR0)
- * Capture Register 1 (CR1)
- * Capture Register 1 (CR2)
- * Capture Register 1 (CR3)
- */
-
-/* Interrupt Register */
-
-#define PWM_IR_MR0 (1 << 0) /* Bit 0: PWM match channel 0 interrupt */
-#define PWM_IR_MR1 (1 << 1) /* Bit 1: PWM match channel 1 interrupt */
-#define PWM_IR_MR2 (1 << 2) /* Bit 2: PWM match channel 2 interrupt */
-#define PWM_IR_MR3 (1 << 3) /* Bit 3: PWM match channel 3 interrupt */
-#define PWM_IR_CAP0 (1 << 4) /* Bit 4: Capture input 0 interrupt */
-#define PWM_IR_CAP1 (1 << 5) /* Bit 5: Capture input 1 interrupt */
- /* Bits 6-7: Reserved */
-#define PWM_IR_MR4 (1 << 8) /* Bit 8: PWM match channel 4 interrupt */
-#define PWM_IR_MR5 (1 << 9) /* Bit 9: PWM match channel 5 interrupt */
-#define PWM_IR_MR6 (1 << 10) /* Bit 10: PWM match channel 6 interrupt */
- /* Bits 11-31: Reserved */
-/* Timer Control Register */
-
-#define PWM_TCR_CNTREN (1 << 0) /* Bit 0: Counter Enable */
-#define PWM_TCR_CNTRRST (1 << 1) /* Bit 1: Counter Reset */
- /* Bit 2: Reserved */
-#define PWM_TCR_PWMEN (1 << 3) /* Bit 3: PWM Enable */
- /* Bits 4-31: Reserved */
-/* Match Control Register */
-
-#define PWM_MCR_MR0I (1 << 0) /* Bit 0: Interrupt on MR0 */
-#define PWM_MCR_MR0R (1 << 1) /* Bit 1: Reset on MR0 */
-#define PWM_MCR_MR0S (1 << 2) /* Bit 2: Stop on MR0 */
-#define PWM_MCR_MR1I (1 << 3) /* Bit 3: Interrupt on MR1 */
-#define PWM_MCR_MR1R (1 << 4) /* Bit 4: Reset on MR1 */
-#define PWM_MCR_MR1S (1 << 5) /* Bit 5: Stop on MR1 */
-#define PWM_MCR_MR2I (1 << 6) /* Bit 6: Interrupt on MR2 */
-#define PWM_MCR_MR2R (1 << 7) /* Bit 7: Reset on MR2 */
-#define PWM_MCR_MR2S (1 << 8) /* Bit 8: Stop on MR2 */
-#define PWM_MCR_MR3I (1 << 9) /* Bit 9: Interrupt on MR3 */
-#define PWM_MCR_MR3R (1 << 10) /* Bit 10: Reset on MR3 */
-#define PWM_MCR_MR3S (1 << 11) /* Bit 11: Stop on MR3 */
-#define PWM_MCR_MR4I (1 << 12) /* Bit 12: Interrupt on MR4 */
-#define PWM_MCR_MR4R (1 << 13) /* Bit 13: Reset on MR4 */
-#define PWM_MCR_MR4S (1 << 14) /* Bit 14: Stop on MR4 */
-#define PWM_MCR_MR5I (1 << 15) /* Bit 15: Interrupt on MR5 */
-#define PWM_MCR_MR5R (1 << 16) /* Bit 16: Reset on MR5*/
-#define PWM_MCR_MR5S (1 << 17) /* Bit 17: Stop on MR5 */
-#define PWM_MCR_MR6I (1 << 18) /* Bit 18: Interrupt on MR6 */
-#define PWM_MCR_MR6R (1 << 19) /* Bit 19: Reset on MR6 */
-#define PWM_MCR_MR6S (1 << 20) /* Bit 20: Stop on MR6 */
- /* Bits 21-31: Reserved */
-/* Capture Control Register (Where are CAP2 and 3?) */
-
-#define PWM_CCR_CAP0RE (1 << 0) /* Bit 0: Capture on CAPn.0 rising edge */
-#define PWM_CCR_CAP0FE (1 << 1) /* Bit 1: Capture on CAPn.0 falling edg */
-#define PWM_CCR_CAP0I (1 << 2) /* Bit 2: Interrupt on CAPn.0 */
-#define PWM_CCR_CAP1RE (1 << 3) /* Bit 3: Capture on CAPn.1 rising edge */
-#define PWM_CCR_CAP1FE (1 << 4) /* Bit 4: Capture on CAPn.1 falling edg */
-#define PWM_CCR_CAP1I (1 << 5) /* Bit 5: Interrupt on CAPn.1 */
- /* Bits 6-31: Reserved */
-/* PWM Control Register */
- /* Bits 0-1: Reserved */
-#define PWM_PCR_SEL2 (1 << 2) /* Bit 2: PWM2 single edge controlled mode */
-#define PWM_PCR_SEL3 (1 << 3) /* Bit 3: PWM3 single edge controlled mode */
-#define PWM_PCR_SEL4 (1 << 4) /* Bit 4: PWM4 single edge controlled mode */
-#define PWM_PCR_SEL5 (1 << 5) /* Bit 5: PWM5 single edge controlled mode */
-#define PWM_PCR_SEL6 (1 << 6) /* Bit 6: PWM6 single edge controlled mode */
- /* Bits 7-8: Reserved */
-#define PWM_PCR_ENA1 (1 << 9) /* Bit 9: Enable PWM1 output */
-#define PWM_PCR_ENA2 (1 << 10) /* Bit 10: Enable PWM2 output */
-#define PWM_PCR_ENA3 (1 << 11) /* Bit 11: Enable PWM3 output */
-#define PWM_PCR_ENA4 (1 << 12) /* Bit 12: Enable PWM4 output */
-#define PWM_PCR_ENA5 (1 << 13) /* Bit 13: Enable PWM5 output */
-#define PWM_PCR_ENA6 (1 << 14) /* Bit 14: Enable PWM6 output */
- /* Bits 15-31: Reserved */
-/* Load Enable Register */
-
-#define PWM_LER_M0EN (1 << 0) /* Bit 0: Enable PWM Match 0 Latch */
-#define PWM_LER_M1EN (1 << 1) /* Bit 1: Enable PWM Match 1 Latch */
-#define PWM_LER_M2EN (1 << 2) /* Bit 2: Enable PWM Match 2 Latch */
-#define PWM_LER_M3EN (1 << 3) /* Bit 3: Enable PWM Match 3 Latch */
-#define PWM_LER_M4EN (1 << 4) /* Bit 4: Enable PWM Match 4 Latch */
-#define PWM_LER_M5EN (1 << 5) /* Bit 5: Enable PWM Match 5 Latch */
-#define PWM_LER_M6EN (1 << 6) /* Bit 6: Enable PWM Match 6 Latch */
- /* Bits 7-31: Reserved */
-/* Counter/Timer Control Register */
-
-#define PWM_CTCR_MODE_SHIFT (0) /* Bits 0-1: Counter/Timer Mode */
-#define PWM_CTCR_MODE_MASK (3 << PWM_CTCR_MODE_SHIFT)
-# define PWM_CTCR_MODE_TIMER (0 << PWM_CTCR_MODE_SHIFT) /* Timer Mode, prescal match */
-# define PWM_CTCR_MODE_CNTRRE (1 << PWM_CTCR_MODE_SHIFT) /* Counter Mode, CAP rising edge */
-# define PWM_CTCR_MODE_CNTRFE (2 << PWM_CTCR_MODE_SHIFT) /* Counter Mode, CAP falling edge */
-# define PWM_CTCR_MODE_CNTRBE (3 << PWM_CTCR_MODE_SHIFT) /* Counter Mode, CAP both edges */
-#define PWM_CTCR_INPSEL_SHIFT (2) /* Bits 2-3: Count Input Select */
-#define PWM_CTCR_INPSEL_MASK (3 << PWM_CTCR_INPSEL_SHIFT)
-# define PWM_CTCR_INPSEL_CAPNp0 (0 << PWM_CTCR_INPSEL_SHIFT) /* CAPn.0 for TIMERn */
-# define PWM_CTCR_INPSEL_CAPNp1 (1 << PWM_CTCR_INPSEL_SHIFT) /* CAPn.0 for TIMERn */
- /* Bits 4-31: Reserved */
-
-/************************************************************************************
- * Public Types
- ************************************************************************************/
-
-/************************************************************************************
- * Public Data
- ************************************************************************************/
-
-/************************************************************************************
- * Public Functions
- ************************************************************************************/
-
-#endif /* __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC17_PWM_H */
diff --git a/arch/arm/src/lpc17xx/hardware/lpc17_qei.h b/arch/arm/src/lpc17xx/hardware/lpc17_qei.h
deleted file mode 100644
index ab3e3fb98ac..00000000000
--- a/arch/arm/src/lpc17xx/hardware/lpc17_qei.h
+++ /dev/null
@@ -1,214 +0,0 @@
-/********************************************************************************************
- * arch/arm/src/lpc17xx/hardware/lpc17_qei.h
- *
- * Copyright (C) 2010, 2013 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. 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.
- * 3. Neither the name NuttX 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 THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- ********************************************************************************************/
-
-#ifndef __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC17_QEI_H
-#define __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC17_QEI_H
-
-/********************************************************************************************
- * Included Files
- ********************************************************************************************/
-
-#include
-
-#include "chip.h"
-#include "hardware/lpc17_memorymap.h"
-
-/********************************************************************************************
- * Pre-processor Definitions
- ********************************************************************************************/
-
-/* Register offsets *************************************************************************/
-/* Control registers */
-
-#define LPC17_QEI_CON_OFFSET 0x0000 /* Control register */
-#define LPC17_QEI_STAT_OFFSET 0x0004 /* Encoder status register */
-#define LPC17_QEI_CONF_OFFSET 0x0008 /* Configuration register */
-
-/* Position, index, and timer registers */
-
-#define LPC17_QEI_POS_OFFSET 0x000c /* Position register */
-#define LPC17_QEI_MAXPOS_OFFSET 0x0010 /* Maximum position register */
-#define LPC17_QEI_CMPOS0_OFFSET 0x0014 /* Position compare register */
-#define LPC17_QEI_CMPOS1_OFFSET 0x0018 /* Position compare register */
-#define LPC17_QEI_CMPOS2_OFFSET 0x001c /* Position compare register */
-#define LPC17_QEI_INXCNT_OFFSET 0x0020 /* Index count register */
-#define LPC17_QEI_INXCMP_OFFSET 0x0024 /* Index compare register */
-#define LPC17_QEI_LOAD_OFFSET 0x0028 /* Velocity timer reload register */
-#define LPC17_QEI_TIME_OFFSET 0x002c /* Velocity timer register */
-#define LPC17_QEI_VEL_OFFSET 0x0030 /* Velocity counter register */
-#define LPC17_QEI_CAP_OFFSET 0x0034 /* Velocity capture register */
-#define LPC17_QEI_VELCOMP_OFFSET 0x0038 /* Velocity compare register */
-#define LPC17_QEI_FILTER_OFFSET 0x003c /* Digital filter register */
-
-#ifdef LPC178
-# define LPC17_QEI_INXCMP0_OFFSET 0x0024 /* Index compare0 register */
-# define LPC17_QEI_INXCMP1_OFFSET 0x004c /* Index compare1 register */
-# define LPC17_QEI_INXCMP2_OFFSET 0x0050 /* Index compare2 register */
-# define LPC17_QEI_FILTER_PHA_OFFSET 0x003c /* Digital filter register */
-# define LPC17_QEI_FILTER_PHB_OFFSET 0x0040 /* Digital filter register */
-# define LPC17_QEI_FILTER_INX_OFFSET 0x0044 /* Digital filter register */
-# define LPC17_QEI_WINDOW_OFFSET 0x0048 /* Index acceptance register */
-#endif
-
-/* Interrupt registers */
-
-#define LPC17_QEI_IEC_OFFSET 0x0fd8 /* Interrupt enable clear register */
-#define LPC17_QEI_IES_OFFSET 0x0fdc /* Interrupt enable set register */
-#define LPC17_QEI_INTSTAT_OFFSET 0x0fe0 /* Interrupt status register */
-#define LPC17_QEI_IE_OFFSET 0x0fe4 /* Interrupt enable register */
-#define LPC17_QEI_CLR_OFFSET 0x0fe8 /* Interrupt status clear register */
-#define LPC17_QEI_SET_OFFSET 0x0fec /* Interrupt status set register */
-
-/* Register addresses ***********************************************************************/
-/* Control registers */
-
-#define LPC17_QEI_CON (LPC17_QEI_BASE+LPC17_QEI_CON_OFFSET)
-#define LPC17_QEI_STAT (LPC17_QEI_BASE+LPC17_QEI_STAT_OFFSET)
-#define LPC17_QEI_CONF (LPC17_QEI_BASE+LPC17_QEI_CONF_OFFSET)
-
-/* Position, index, and timer registers */
-
-#define LPC17_QEI_POS (LPC17_QEI_BASE+LPC17_QEI_POS_OFFSET)
-#define LPC17_QEI_MAXPOS (LPC17_QEI_BASE+LPC17_QEI_MAXPOS_OFFSET)
-#define LPC17_QEI_CMPOS0 (LPC17_QEI_BASE+LPC17_QEI_CMPOS0_OFFSET)
-#define LPC17_QEI_CMPOS1 (LPC17_QEI_BASE+LPC17_QEI_CMPOS1_OFFSET)
-#define LPC17_QEI_CMPOS2 (LPC17_QEI_BASE+LPC17_QEI_CMPOS2_OFFSET)
-#define LPC17_QEI_INXCNT (LPC17_QEI_BASE+LPC17_QEI_INXCNT_OFFSET)
-#define LPC17_QEI_INXCMP (LPC17_QEI_BASE+LPC17_QEI_INXCMP_OFFSET)
-#define LPC17_QEI_LOAD (LPC17_QEI_BASE+LPC17_QEI_LOAD_OFFSET)
-#define LPC17_QEI_TIME (LPC17_QEI_BASE+LPC17_QEI_TIME_OFFSET)
-#define LPC17_QEI_VEL (LPC17_QEI_BASE+LPC17_QEI_VEL_OFFSET)
-#define LPC17_QEI_CAP (LPC17_QEI_BASE+LPC17_QEI_CAP_OFFSET)
-#define LPC17_QEI_VELCOMP (LPC17_QEI_BASE+LPC17_QEI_VELCOMP_OFFSET)
-#define LPC17_QEI_FILTER (LPC17_QEI_BASE+LPC17_QEI_FILTER_OFFSET)
-
-/* Interrupt registers */
-
-#define LPC17_QEI_IEC (LPC17_QEI_BASE+LPC17_QEI_IEC_OFFSET)
-#define LPC17_QEI_IES (LPC17_QEI_BASE+LPC17_QEI_IES_OFFSET)
-#define LPC17_QEI_INTSTAT (LPC17_QEI_BASE+LPC17_QEI_INTSTAT_OFFSET)
-#define LPC17_QEI_IE (LPC17_QEI_BASE+LPC17_QEI_IE_OFFSET)
-#define LPC17_QEI_CLR (LPC17_QEI_BASE+LPC17_QEI_CLR_OFFSET)
-#define LPC17_QEI_SET (LPC17_QEI_BASE+LPC17_QEI_SET_OFFSET)
-
-/* Register bit definitions *****************************************************************/
-/* The following registers hold 32-bit integer values and have no bit fields defined
- * in this section:
- *
- * Position register (POS)
- * Maximum position register (MAXPOS)
- * Position compare register 0 (CMPOS0)
- * Position compare register 1 (CMPOS)
- * Position compare register 2 (CMPOS2)
- * Index count register (INXCNT)
- * Index compare register (INXCMP)
- * Velocity timer reload register (LOAD)
- * Velocity timer register (TIME)
- * Velocity counter register (VEL)
- * Velocity capture register (CAP)
- * Velocity compare register (VELCOMP)
- * Digital filter register (FILTER)
- */
-
-/* Control registers */
-/* Control register */
-
-#define QEI_CON_RESP (1 << 0) /* Bit 0: Reset position counter */
-#define QEI_CON_RESPI (1 << 1) /* Bit 1: Reset position counter on index */
-#define QEI_CON_RESV (1 << 2) /* Bit 2: Reset velocity */
-#define QEI_CON_RESI (1 << 3) /* Bit 3: Reset index counter */
- /* Bits 4-31: reserved */
-/* Encoder status register */
-
-#define QEI_STAT_DIR (1 << 0) /* Bit 0: Direction bit */
- /* Bits 1-31: reserved */
-/* Configuration register */
-
-#define QEI_CONF_DIRINV (1 << 0) /* Bit 0: Direction invert */
-#define QEI_CONF_SIGMODE (1 << 1) /* Bit 1: Signal Mode */
-#define QEI_CONF_CAPMODE (1 << 2) /* Bit 2: Capture Mode */
-#define QEI_CONF_INVINX (1 << 3) /* Bit 3: Invert Index */
-
-#ifdef LPC178x
-# define QEI_CONF_CRESPI (1 << 4) /* Bit 4: Continuous Index reset */
- /* Bits 5-15: reserved */
-# define QEI_CONF_INXGATE_SHIFT (16) /* Bit 16:19 Index Gating */
-# define QEI_CONF_INXGATE_MASK (15 << QEI_CONF_INXGATE_SHIFT)
-#endif
- /* Bits 20-31: reserved */
-
-/* Position, index, and timer registers (all 32-bit integer values with not bit fields */
-
-/* Interrupt registers */
-/* Interrupt enable clear register (IEC), Interrupt enable set register (IES),
- * Interrupt status register (INTSTAT), Interrupt enable register (IE), Interrupt
- * status clear register (CLR), and Interrupt status set register (SET) common
- * bit definitions.
- */
-
-#define QEI_INT_INX (1 << 0) /* Bit 0: Index pulse detected */
-#define QEI_INT_TIM (1 << 1) /* Bit 1: Velocity timer overflow occurred */
-#define QEI_INT_VELC (1 << 2) /* Bit 2: Captured velocity less than compare velocity */
-#define QEI_INT_DIR (1 << 3) /* Bit 3: Change of direction detected */
-#define QEI_INT_ERR (1 << 4) /* Bit 4: Encoder phase error detected */
-#define QEI_INT_ENCLK (1 << 5) /* Bit 5: Eencoder clock pulse detected */
-#define QEI_INT_POS0 (1 << 6) /* Bit 6: Position 0 compare equal to current position */
-#define QEI_INT_POS1 (1 << 7) /* Bit 7: Position 1 compare equal to current position */
-#define QEI_INT_POS2 (1 << 8) /* Bit 8: Position 2 compare equal to current position */
-#define QEI_INT_REV (1 << 9) /* Bit 9: Index compare value equal to current index count */
-#define QEI_INT_POS0REV (1 << 10) /* Bit 10: Combined position 0 and revolution count interrupt */
-#define QEI_INT_POS1REV (1 << 11) /* Bit 11: Position 1 and revolution count interrupt */
-#define QEI_INT_POS2REV (1 << 12) /* Bit 12: Position 2 and revolution count interrupt */
-
-#ifdef LPC178x
-# define QEI_INT_REV1 (1 << 13) /* Bit 13: Index compare1 value to current index interrupt */
-# define QEI_INT_REV2 (1 << 14) /* Bit 14: Index compare2 value to current index interrupt */
-# define QEI_INT_MAXPOS (1 << 15) /* Bit 15: Current position count interrupt */
-#endif
- /* Bits 16-31: reserved */
-
-/********************************************************************************************
- * Public Types
- ********************************************************************************************/
-
-/********************************************************************************************
- * Public Data
- ********************************************************************************************/
-
-/********************************************************************************************
- * Public Functions
- ********************************************************************************************/
-
-#endif /* __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC17_QEI_H */
diff --git a/arch/arm/src/lpc17xx/hardware/lpc17_rtc.h b/arch/arm/src/lpc17xx/hardware/lpc17_rtc.h
deleted file mode 100644
index 08975f2e99c..00000000000
--- a/arch/arm/src/lpc17xx/hardware/lpc17_rtc.h
+++ /dev/null
@@ -1,277 +0,0 @@
-/************************************************************************************
- * arch/arm/src/lpc17xx/hardware/lpc17_rtc.h
- *
- * Copyright (C) 2010, 2012-2013 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. 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.
- * 3. Neither the name NuttX 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 THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- ************************************************************************************/
-
-#ifndef __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC17_RTC_H
-#define __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC17_RTC_H
-
-/************************************************************************************
- * Included Files
- ************************************************************************************/
-
-#include
-
-#include "chip.h"
-#include "hardware/lpc17_memorymap.h"
-
-/************************************************************************************
- * Pre-processor Definitions
- ************************************************************************************/
-
-/* Register offsets *****************************************************************/
-/* Miscellaneous registers */
-
-#define LPC17_RTC_ILR_OFFSET 0x0000 /* Interrupt Location Register */
-#define LPC17_RTC_CCR_OFFSET 0x0008 /* Clock Control Register */
-#define LPC17_RTC_CIIR_OFFSET 0x000c /* Counter Increment Interrupt Register */
-#define LPC17_RTC_AMR_OFFSET 0x0010 /* Alarm Mask Register */
-#define LPC17_RTC_AUXEN_OFFSET 0x0058 /* RTC Auxiliary Enable register */
-#define LPC17_RTC_AUX_OFFSET 0x005c /* RTC Auxiliary control register */
-
-/* Consolidated time registers */
-
-#define LPC17_RTC_CTIME0_OFFSET 0x0014 /* Consolidated Time Register 0 */
-#define LPC17_RTC_CTIME1_OFFSET 0x0018 /* Consolidated Time Register 1 */
-#define LPC17_RTC_CTIME2_OFFSET 0x001c /* Consolidated Time Register 2 */
-
-/* Time counter registers */
-
-#define LPC17_RTC_SEC_OFFSET 0x0020 /* Seconds Counter */
-#define LPC17_RTC_MIN_OFFSET 0x0024 /* Minutes Register */
-#define LPC17_RTC_HOUR_OFFSET 0x0028 /* Hours Register */
-#define LPC17_RTC_DOM_OFFSET 0x002c /* Day of Month Register */
-#define LPC17_RTC_DOW_OFFSET 0x0030 /* Day of Week Register */
-#define LPC17_RTC_DOY_OFFSET 0x0034 /* Day of Year Register */
-#define LPC17_RTC_MONTH_OFFSET 0x0038 /* Months Register */
-#define LPC17_RTC_YEAR_OFFSET 0x003c /* Years Register */
-#define LPC17_RTC_CALIB_OFFSET 0x0040 /* Calibration Value Register */
-
-/* General purpose registers */
-
-#define LPC17_RTC_GPREG0_OFFSET 0x0044 /* General Purpose Register 0 */
-#define LPC17_RTC_GPREG1_OFFSET 0x0048 /* General Purpose Register 1 */
-#define LPC17_RTC_GPREG2_OFFSET 0x004c /* General Purpose Register 2 */
-#define LPC17_RTC_GPREG3_OFFSET 0x0050 /* General Purpose Register 3 */
-#define LPC17_RTC_GPREG4_OFFSET 0x0054 /* General Purpose Register 4 */
-
-/* Alarm register group */
-
-#define LPC17_RTC_ALSEC_OFFSET 0x0060 /* Alarm value for Seconds */
-#define LPC17_RTC_ALMIN_OFFSET 0x0064 /* Alarm value for Minutes */
-#define LPC17_RTC_ALHOUR_OFFSET 0x0068 /* Alarm value for Hours */
-#define LPC17_RTC_ALDOM_OFFSET 0x006c /* Alarm value for Day of Month */
-#define LPC17_RTC_ALDOW_OFFSET 0x0070 /* Alarm value for Day of Week */
-#define LPC17_RTC_ALDOY_OFFSET 0x0074 /* Alarm value for Day of Year */
-#define LPC17_RTC_ALMON_OFFSET 0x0078 /* Alarm value for Months */
-#define LPC17_RTC_ALYEAR_OFFSET 0x007c /* Alarm value for Year */
-
-/* Register addresses ***************************************************************/
-/* Miscellaneous registers */
-
-#define LPC17_RTC_ILR (LPC17_RTC_BASE+LPC17_RTC_ILR_OFFSET)
-#define LPC17_RTC_CCR (LPC17_RTC_BASE+LPC17_RTC_CCR_OFFSET)
-#define LPC17_RTC_CIIR (LPC17_RTC_BASE+LPC17_RTC_CIIR_OFFSET)
-#define LPC17_RTC_AMR (LPC17_RTC_BASE+LPC17_RTC_AMR_OFFSET)
-#define LPC17_RTC_AUXEN (LPC17_RTC_BASE+LPC17_RTC_AUXEN_OFFSET)
-#define LPC17_RTC_AUX (LPC17_RTC_BASE+LPC17_RTC_AUX_OFFSET)
-
-/* Consolidated time registers */
-
-#define LPC17_RTC_CTIME0 (LPC17_RTC_BASE+LPC17_RTC_CTIME0_OFFSET)
-#define LPC17_RTC_CTIME1 (LPC17_RTC_BASE+LPC17_RTC_CTIME1_OFFSET)
-#define LPC17_RTC_CTIME2 (LPC17_RTC_BASE+LPC17_RTC_CTIME2_OFFSET)
-
-/* Time counter registers */
-
-#define LPC17_RTC_SEC (LPC17_RTC_BASE+LPC17_RTC_SEC_OFFSET)
-#define LPC17_RTC_MIN (LPC17_RTC_BASE+LPC17_RTC_MIN_OFFSET)
-#define LPC17_RTC_HOUR (LPC17_RTC_BASE+LPC17_RTC_HOUR_OFFSET)
-#define LPC17_RTC_DOM (LPC17_RTC_BASE+LPC17_RTC_DOM_OFFSET)
-#define LPC17_RTC_DOW (LPC17_RTC_BASE+LPC17_RTC_DOW_OFFSET)
-#define LPC17_RTC_DOY (LPC17_RTC_BASE+LPC17_RTC_DOY_OFFSET)
-#define LPC17_RTC_MONTH (LPC17_RTC_BASE+LPC17_RTC_MONTH_OFFSET)
-#define LPC17_RTC_YEAR (LPC17_RTC_BASE+LPC17_RTC_YEAR_OFFSET)
-#define LPC17_RTC_CALIB (LPC17_RTC_BASE+LPC17_RTC_CALIB_OFFSET)
-
-/* General purpose registers */
-
-#define LPC17_RTC_GPREG0 (LPC17_RTC_BASE+LPC17_RTC_GPREG0_OFFSET)
-#define LPC17_RTC_GPREG1 (LPC17_RTC_BASE+LPC17_RTC_GPREG1_OFFSET)
-#define LPC17_RTC_GPREG2 (LPC17_RTC_BASE+LPC17_RTC_GPREG2_OFFSET)
-#define LPC17_RTC_GPREG3 (LPC17_RTC_BASE+LPC17_RTC_GPREG3_OFFSET)
-#define LPC17_RTC_GPREG4 (LPC17_RTC_BASE+LPC17_RTC_GPREG4_OFFSET)
-
-/* Alarm register group */
-
-#define LPC17_RTC_ALSEC (LPC17_RTC_BASE+LPC17_RTC_ALSEC_OFFSET)
-#define LPC17_RTC_ALMIN (LPC17_RTC_BASE+LPC17_RTC_ALMIN_OFFSET)
-#define LPC17_RTC_ALHOUR (LPC17_RTC_BASE+LPC17_RTC_ALHOUR_OFFSET)
-#define LPC17_RTC_ALDOM (LPC17_RTC_BASE+LPC17_RTC_ALDOM_OFFSET)
-#define LPC17_RTC_ALDOW (LPC17_RTC_BASE+LPC17_RTC_ALDOW_OFFSET)
-#define LPC17_RTC_ALDOY (LPC17_RTC_BASE+LPC17_RTC_ALDOY_OFFSET)
-#define LPC17_RTC_ALMON (LPC17_RTC_BASE+LPC17_RTC_ALMON_OFFSET)
-#define LPC17_RTC_ALYEAR (LPC17_RTC_BASE+LPC17_RTC_ALYEAR_OFFSET)
-
-/* Register bit definitions *********************************************************/
-/* The following registers hold 32-bit values and have no bit fields to be defined:
- *
- * General Purpose Register 0
- * General Purpose Register 1
- * General Purpose Register 2
- * General Purpose Register 3
- * General Purpose Register 4
- */
-
-/* Miscellaneous registers */
-/* Interrupt Location Register */
-
-#define RTC_ILR_RTCCIF (1 << 0) /* Bit 0: Counter Increment Interrupt */
-#define RTC_ILR_RTCALF (1 << 1) /* Bit 1: Alarm interrupt */
- /* Bits 2-31: Reserved */
-/* Clock Control Register */
-
-#define RTC_CCR_CLKEN (1 << 0) /* Bit 0: Clock Enable */
-#define RTC_CCR_CTCRST (1 << 1) /* Bit 1: CTC Reset */
- /* Bits 2-3: Internal test mode controls */
-#define RTC_CCR_CCALEN (1 << 4) /* Bit 4: Calibration counter enable */
- /* Bits 5-31: Reserved */
-/* Counter Increment Interrupt Register */
-
-#define RTC_CIIR_IMSEC (1 << 0) /* Bit 0: Second interrupt */
-#define RTC_CIIR_IMMIN (1 << 1) /* Bit 1: Minute interrupt */
-#define RTC_CIIR_IMHOUR (1 << 2) /* Bit 2: Hour interrupt */
-#define RTC_CIIR_IMDOM (1 << 3) /* Bit 3: Day of Month value interrupt */
-#define RTC_CIIR_IMDOW (1 << 4) /* Bit 4: Day of Week value interrupt */
-#define RTC_CIIR_IMDOY (1 << 5) /* Bit 5: Day of Year interrupt */
-#define RTC_CIIR_IMMON (1 << 6) /* Bit 6: Month interrupt */
-#define RTC_CIIR_IMYEAR (1 << 7) /* Bit 7: Yearinterrupt */
- /* Bits 8-31: Reserved */
-/* Alarm Mask Register */
-
-#define RTC_AMR_SEC (1 << 0) /* Bit 0: Second not compared for alarm */
-#define RTC_AMR_MIN (1 << 1) /* Bit 1: Minutes not compared for alarm */
-#define RTC_AMR_HOUR (1 << 2) /* Bit 2: Hour not compared for alarm */
-#define RTC_AMR_DOM (1 << 3) /* Bit 3: Day of Monthnot compared for alarm */
-#define RTC_AMR_DOW (1 << 4) /* Bit 4: Day of Week not compared for alarm */
-#define RTC_AMR_DOY (1 << 5) /* Bit 5: Day of Year not compared for alarm */
-#define RTC_AMR_MON (1 << 6) /* Bit 6: Month not compared for alarm */
-#define RTC_AMR_YEAR (1 << 7) /* Bit 7: Year not compared for alarm */
- /* Bits 8-31: Reserved */
-
-/* RTC Auxiliary Control Register */
- /* Bits 0-3: Reserved */
-#define RTC_AUXEN_RTCOSCF (1 << 4) /* Bit 4: RTC Oscillator Fail detect flag */
-#ifdef LPC178x
- /* Bit 5: Reserved */
-# define RTC_AUXEN_RTCPDOUT (1 << 6) /* Bit 6: RTC power down mode flag */
- /* Bits 7-31: Reserved */
-#endif
-
-/* RTC Auxiliary Enable Register */
- /* Bits 0-3: Reserved */
-#define RTC_AUX_OSCFEN (1 << 4) /* Bit 4: Oscillator Fail Detect interrupt enable */
- /* Bits 5-31: Reserved */
-
-/* Consolidated Time Registers */
-/* Consolidated Time Register 0 */
-
-#define RTC_CTIME0_SEC_SHIFT (0) /* Bits 0-5: Seconds */
-#define RTC_CTIME0_SEC_MASK (63 << RTC_CTIME0_SEC_SHIFT)
- /* Bits 6-7: Reserved */
-#define RTC_CTIME0_MIN_SHIFT (8) /* Bits 8-13: Minutes */
-#define RTC_CTIME0_MIN_MASK (63 << RTC_CTIME0_MIN_SHIFT)
- /* Bits 14-15: Reserved */
-#define RTC_CTIME0_HOURS_SHIFT (16) /* Bits 16-20: Hours */
-#define RTC_CTIME0_HOURS_MASK (31 << RTC_CTIME0_HOURS_SHIFT)
- /* Bits 21-23: Reserved */
-#define RTC_CTIME0_DOW_SHIFT (24) /* Bits 24-26: Day of Week */
-#define RTC_CTIME0_DOW_MASK (7 << RTC_CTIME0_DOW_SHIFT)
- /* Bits 27-31: Reserved */
-/* Consolidated Time Register 1 */
-
-#define RTC_CTIME1_DOM_SHIFT (0) /* Bits 0-4: Day of Month */
-#define RTC_CTIME1_DOM_MASK (31 << RTC_CTIME1_DOM_SHIFT)
- /* Bits 5-7: Reserved */
-#define RTC_CTIME1_MON_SHIFT (8) /* Bits 8-11: Month */
-#define RTC_CTIME1_MON_MASK (15 << RTC_CTIME1_MON_SHIFT)
- /* Bits 12-15: Reserved */
-#define RTC_CTIME1_YEAR_SHIFT (16) /* Bits 16-27: Year */
-#define RTC_CTIME1_YEAR_MASK (0x0fff << RTC_CTIME1_YEAR_SHIFT)
- /* Bits 28-31: Reserved */
-/* Consolidated Time Register 2 */
-
-#define RTC_CTIME2_DOY_SHIFT (0) /* Bits 0-11: Day of Year */
-#define RTC_CTIME2_DOY_MASK (0x0fff << RTC_CTIME2_DOY_SHIFT)
- /* Bits 12-31: Reserved */
-/* Time counter registers */
-
-#define RTC_SEC_MASK (0x003f)
-#define RTC_MIN_MASK (0x003f)
-#define RTC_HOUR_MASK (0x001f)
-#define RTC_DOM_MASK (0x001f)
-#define RTC_DOW_MASK (0x0007)
-#define RTC_DOY_MASK (0x01ff)
-#define RTC_MONTH_MASK (0x000f)
-#define RTC_YEAR_MASK (0x0fff)
-
-/* Calibration Value Register */
-
-#define RTC_CALIB_CALVAL_SHIFT (0) /* Bits 0-16: calibration counter counts to this value */
-#define RTC_CALIB_CALVAL_MASK (0xffff << RTC_CALIB_CALVAL_SHIFT)
-#define RTC_CALIB_CALDIR (1 << 17) /* Bit 17: Calibration direction */
- /* Bits 18-31: Reserved */
-/* Alarm register group */
-
-#define RTC_ALSEC_MASK (0x003f)
-#define RTC_ALMIN_MASK (0x003f)
-#define RTC_ALHOUR_MASK (0x001f)
-#define RTC_ALDOM_MASK (0x001f)
-#define RTC_ALDOW_MASK (0x0007)
-#define RTC_ALDOY_MASK (0x01ff)
-#define RTC_ALMON_MASK (0x000f)
-#define RTC_ALYEAR_MASK (0x0fff)
-
-/************************************************************************************
- * Public Types
- ************************************************************************************/
-
-/************************************************************************************
- * Public Data
- ************************************************************************************/
-
-/************************************************************************************
- * Public Functions
- ************************************************************************************/
-
-#endif /* __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC17_RTC_H */
diff --git a/arch/arm/src/lpc17xx/hardware/lpc17_rtcevmr.h b/arch/arm/src/lpc17xx/hardware/lpc17_rtcevmr.h
deleted file mode 100644
index 5448a3b7cf5..00000000000
--- a/arch/arm/src/lpc17xx/hardware/lpc17_rtcevmr.h
+++ /dev/null
@@ -1,143 +0,0 @@
-/************************************************************************************
- * arch/arm/src/lpc17xx/hardware/lpc17_rtcevmr.h
- *
- * Copyright (C) 2013 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. 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.
- * 3. Neither the name NuttX 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 THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- ************************************************************************************/
-
-#ifndef __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC17_RTCEVMR_H
-#define __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC17_RTCEVMR_H
-
-/************************************************************************************
- * Included Files
- ************************************************************************************/
-
-#include
-
-#include "chip.h"
-#include "hardware/lpc17_memorymap.h"
-
-/************************************************************************************
- * Pre-processor Definitions
- ************************************************************************************/
-
-/* Register offsets *****************************************************************/
-
-#define LPC17_RTCEV_ERCONTROL_OFFSET 0x0084 /* Monitor/Recorder Control register */
-#define LPC17_RTCEV_ERSTATUS_OFFSET 0x0080 /* Status register */
-#define LPC17_RTCEV_ERCOUNTERS_OFFSET 0x0088 /* Counters register */
-#define LPC17_RTCEV_ERFIRSTSTAMP0_OFFSET 0x0090 /* Channel 0 first Stamp register */
-#define LPC17_RTCEV_ERFIRSTSTAMP1_OFFSET 0x0090 /* Channel 1 first Stamp register */
-#define LPC17_RTCEV_ERFIRSTSTAMP2_OFFSET 0x0090 /* Channel 2 first Stamp register */
-#define LPC17_RTCEV_ERLASTSTAMP0_OFFSET 0x0098 /* Channel 0 last stamp register */
-#define LPC17_RTCEV_ERLASTSTAMP1_OFFSET 0x00a0 /* Channel 1 last stamp register */
-#define LPC17_RTCEV_ERLASTSTAMP2_OFFSET 0x00a8 /* Channel 2 last stamp register */
-
-#define LPC17_RTCEV_ERCONTROL (LPC17_RTC_BASE+LPC17_RTCEV_ERCONTROL_OFFSET)
-#define LPC17_RTCEV_ERSTATUS (LPC17_RTC_BASE+LPC17_RTCEV_ERSTATUS_OFFSET)
-#define LPC17_RTCEV_ERCOUNTERS (LPC17_RTC_BASE+LPC17_RTCEV_ERCOUNTERS_OFFSET)
-#define LPC17_RTCEV_ERFIRSTSTAMP0 (LPC17_RTC_BASE+LPC17_RTCEV_ERFIRSTSTAMP0_OFFSET)
-#define LPC17_RTCEV_ERFIRSTSTAMP1 (LPC17_RTC_BASE+LPC17_RTCEV_ERFIRSTSTAMP1_OFFSET)
-#define LPC17_RTCEV_ERFIRSTSTAMP2 (LPC17_RTC_BASE+LPC17_RTCEV_ERFIRSTSTAMP2_OFFSET)
-#define LPC17_RTCEV_ERLASTSTAMP0 (LPC17_RTC_BASE+LPC17_RTCEV_ERLASTSTAMP0_OFFSET)
-#define LPC17_RTCEV_ERLASTSTAMP1 (LPC17_RTC_BASE+LPC17_RTCEV_ERLASTSTAMP1_OFFSET)
-#define LPC17_RTCEV_ERLASTSTAMP2 (LPC17_RTC_BASE+LPC17_RTCEV_ERLASTSTAMP2_OFFSET)
-
-/* RTCEV ERCONTROL Event Monitor/Recorder Control Register */
-
-#define RTCEV_ERCONTROL_INTWAKE_EN0 (1) /* Bit 0: Interrupt/wakeup enable channel 0 */
-#define RTCEV_ERCONTROL_GPCLEAR_EN0 (1 << 1) /* Bit 1: Automatic clearing of RTC - channel 0 */
-#define RTCEV_ERCONTROL_POL0 (1 << 2) /* Bit 2: Edge polarity on RTC_EV0 pins */
-#define RTCEV_ERCONTROL_EV0_INPUT_EN (1 << 3) /* Bit 3: Event enable for channel 0 */
- /* Bits 4-9: Reserved */
-#define RTCEV_ERCONTROL_INTWAKE_EN1 (1 << 10) /* Bit 10: Interrupt/wakeup enable - channel 1 */
-#define RTCEV_ERCONTROL_GPCLEAR_EN1 (1 << 11) /* Bit 11: Automatic clearing of RTC - channel 1 */
-#define RTCEV_ERCONTROL_POL1 (1 << 12) /* Bit 12: Edge polarity on RTC_EV1 pins */
-#define RTCEV_ERCONTROL_EV1_INPUT_EN (1 << 13) /* Bit 13: Event enable for channel 1 */
- /* Bits 14-19: Reserved */
-#define RTCEV_ERCONTROL_INTWAKE_EN2 (1 << 20) /* Bit 20: Interrupt/wakeup enable - channel 2 */
-#define RTCEV_ERCONTROL_GPCLEAR_EN2 (1 << 21) /* Bit 21: Automatic clearing of RTC - channel 2 */
-#define RTCEV_ERCONTROL_POL2 (1 << 22) /* Bit 22: Edge polarity on RTC_EV2 pins */
-#define RTCEV_ERCONTROL_EV2_INPUT_EN (1 << 23) /* Bit 23: Event enable for channel 1 */
- /* Bits 24-29: Reserved */
-#define RTCEV_ERCONTROL_ERMODE_SHIFT (30) /* Bits 30-31: Event monitoring mode */
-#define RTCEV_ERCONTROL_ERMODE_MASK (3 << RTCEV_ERCONTROL_ERMODE_SHIFT)
-# define ERMODE0 (0) /* monitor/clocks disabled */
-# define ERMODE1 (1) /* 16Hz sample clock */
-# define ERMODE2 (2) /* 64Hz sample clock */
-# define ERMODE3 (3) /* 1000Hz sample clock */
-
-/* RTCEV ERSTATUS - Monitor/Recorder Status Register */
-
-#define RTCEV_ERSTATUS_EV0 (1) /* Bit 0: Event flag - channel 0 */
-#define RTCEV_ERSTATUS_EV1 (1 << 1) /* Bit 1: Event flag - channel 1 */
-#define RTCEV_ERSTATUS_EV2 (1 << 2) /* Bit 2: Event flag - channel 2 */
-#define RTCEV_ERSTATUS_EV2 (1 << 3) /* Bit 3: GPReg async clear flag */
- /* Bits 4-30: Reserved */
-#define RTCEV_ERSTATUS_WAKEUP (1 << 31) /* Bit 31: Interrupt/Wakeup request flag */
-
-/* RTCEV ERCOUNTERS - Monitor/Recorder Counters Register */
-
-#define RTCEV_ERCOUNTER_COUNTER0_SHIFT (0) /* Bits 0-2: Value for event 0 */
-#define RTCEV_ERCOUNTER_COUNTER0_MASK (7 << RTCEV_ERCOUNTER_COUNTER0_SHIFT)
- /* Bits 3-7: Reserved */
-#define RTCEV_ERCOUNTER_COUNTER1_SHIFT (8) i /* Bits 8-10: Value for event 1 */
-#define RTCEV_ERCOUNTER_COUNTER1_MASK (7 << RTCEV_ERCOUNTER_COUNTER1_SHIFT)
- /* Bits 11-15: Reserved */
-#define RTCEV_ERCOUNTER_COUNTER2_SHIFT (16) /* Bits 16-18: Value for event 2 */
-#define RTCEV_ERCOUNTER_COUNTER2_MASK (7 << RTCEV_ERCOUNTER_COUNTER2_SHIFT)
- /* Bits 19-31: Reserved */
-
-/* RTCEV ERFIRSTSTAMP[0-2] - Monitor/Recorder First Stamp Registers */
-/* RTCEV ERLASTSTAMP[0-2] - Monitor/Recorder Last Stamp Registers */
-
-#define RTCEV_TIMESTAMP_SEC_SHIFT (0) /* Bits 0-5: Seconds value 0-59 */
-#define RTCEV_TIMESTAMP_SEC_MASK (0x3f << RTCEV_TIMESTAMP_SEC_SHIFT)
-#define RTCEV_TIMESTAMP_MIN_SHIFT (6) /* Bits 6-11: Minutes value 0-59 */
-#define RTCEV_TIMESTAMP_MIN_MASK (0x3f << RTCEV_TIMESTAMP_MIN_SHIFT)
-#define RTCEV_TIMESTAMP_HOUR_SHIFT (12) /* Bits 12-16: Hours value 0-23 */
-#define RTCEV_TIMESTAMP_HOUR_MASK (0x1f << RTCEV_TIMESTAMP_HOUR_SHIFT)
-#define RTCEV_TIMESTAMP_DOY_SHIFT (17) /* Bits 17-25: Day of the year value 1-366 */
-#define RTCEV_TIMESTAMP_DOY_MASK (0x1ff << RTCEV_TIMESTAMP_DOY_SHIFT)
-
-/************************************************************************************
- * Public Types
- ************************************************************************************/
-
-/************************************************************************************
- * Public Data
- ************************************************************************************/
-
-/************************************************************************************
- * Public Functions
- ************************************************************************************/
-
-#endif /* __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC17_RTCEVMR_H */
diff --git a/arch/arm/src/lpc17xx/hardware/lpc17_sdcard.h b/arch/arm/src/lpc17xx/hardware/lpc17_sdcard.h
deleted file mode 100644
index 7140d186cf3..00000000000
--- a/arch/arm/src/lpc17xx/hardware/lpc17_sdcard.h
+++ /dev/null
@@ -1,272 +0,0 @@
-/************************************************************************************
- * arch/arm/src/lpc17xx/hardware/lpc17_sdcard.h
- *
- * Copyright (C) 2013 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. 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.
- * 3. Neither the name NuttX 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 THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- ************************************************************************************/
-
-#ifndef __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC17_SDCARD_H
-#define __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC17_SDCARD_H
-
-/************************************************************************************
- * Pre-processor Definitions
- ************************************************************************************/
-
-/* Register Offsets *****************************************************************/
-
-#define LPC17_SDCARD_PWR_OFFSET 0x0000 /* SD card power control register */
-#define LPC17_SDCARD_CLOCK_OFFSET 0x0004 /* SD card clock control register */
-#define LPC17_SDCARD_ARG_OFFSET 0x0008 /* SD card argument register */
-#define LPC17_SDCARD_CMD_OFFSET 0x000c /* SD card command register */
-#define LPC17_SDCARD_RESPCMD_OFFSET 0x0010 /* SD card command response register */
-#define LPC17_SDCARD_RESP_OFFSET(n) (0x0010+4*(n))
-# define LPC17_SDCARD_RESP0_OFFSET 0x0014 /* SD card response 1 register */
-# define LPC17_SDCARD_RESP1_OFFSET 0x0018 /* SD card response 2 register */
-# define LPC17_SDCARD_RESP2_OFFSET 0x001c /* SD card response 3 register */
-# define LPC17_SDCARD_RESP3_OFFSET 0x0020 /* SD card response 4 register */
-#define LPC17_SDCARD_DTIMER_OFFSET 0x0024 /* SD card data timer register */
-#define LPC17_SDCARD_DLEN_OFFSET 0x0028 /* SD card data length register */
-#define LPC17_SDCARD_DCTRL_OFFSET 0x002c /* SD card data control register */
-#define LPC17_SDCARD_DCOUNT_OFFSET 0x0030 /* SD card data counter register */
-#define LPC17_SDCARD_STATUS_OFFSET 0x0034 /* SD card status register */
-#define LPC17_SDCARD_CLEAR_OFFSET 0x0038 /* SD card interrupt clear register */
-#define LPC17_SDCARD_MASK0_OFFSET 0x003c /* SD card mask register */
-#define LPC17_SDCARD_FIFOCNT_OFFSET 0x0048 /* SD card FIFO counter register */
-#define LPC17_SDCARD_FIFO_OFFSET 0x0080 /* SD card data FIFO register */
-
-/* Register Addresses ***************************************************************/
-
-#define LPC17_SDCARD_PWR (LPC17_MCI_BASE+LPC17_SDCARD_PWR_OFFSET)
-#define LPC17_SDCARD_CLOCK (LPC17_MCI_BASE+LPC17_SDCARD_CLOCK_OFFSET)
-#define LPC17_SDCARD_ARG (LPC17_MCI_BASE+LPC17_SDCARD_ARG_OFFSET)
-#define LPC17_SDCARD_CMD (LPC17_MCI_BASE+LPC17_SDCARD_CMD_OFFSET)
-#define LPC17_SDCARD_RESPCMD (LPC17_MCI_BASE+LPC17_SDCARD_RESPCMD_OFFSET)
-#define LPC17_SDCARD_RESP(n) (LPC17_MCI_BASE+LPC17_SDCARD_RESP_OFFSET(n))
-#define LPC17_SDCARD_RESP0 (LPC17_MCI_BASE+LPC17_SDCARD_RESP0_OFFSET)
-#define LPC17_SDCARD_RESP1 (LPC17_MCI_BASE+LPC17_SDCARD_RESP1_OFFSET)
-#define LPC17_SDCARD_RESP2 (LPC17_MCI_BASE+LPC17_SDCARD_RESP2_OFFSET)
-#define LPC17_SDCARD_RESP3 (LPC17_MCI_BASE+LPC17_SDCARD_RESP3_OFFSET)
-#define LPC17_SDCARD_DTIMER (LPC17_MCI_BASE+LPC17_SDCARD_DTIMER_OFFSET)
-#define LPC17_SDCARD_DLEN (LPC17_MCI_BASE+LPC17_SDCARD_DLEN_OFFSET)
-#define LPC17_SDCARD_DCTRL (LPC17_MCI_BASE+LPC17_SDCARD_DCTRL_OFFSET)
-#define LPC17_SDCARD_DCOUNT (LPC17_MCI_BASE+LPC17_SDCARD_DCOUNT_OFFSET)
-#define LPC17_SDCARD_STATUS (LPC17_MCI_BASE+LPC17_SDCARD_STATUS_OFFSET)
-#define LPC17_SDCARD_CLEAR (LPC17_MCI_BASE+LPC17_SDCARD_CLEAR_OFFSET)
-#define LPC17_SDCARD_MASK0 (LPC17_MCI_BASE+LPC17_SDCARD_MASK0_OFFSET)
-#define LPC17_SDCARD_FIFOCNT (LPC17_MCI_BASE+LPC17_SDCARD_FIFOCNT_OFFSET)
-#define LPC17_SDCARD_FIFO (LPC17_MCI_BASE+LPC17_SDCARD_FIFO_OFFSET)
-
-/* Register Bitfield Definitions ****************************************************/
-
-/* MCI Power Control Registers - PWR - 0x400c 0000*/
-
-#define SDCARD_PWR_CTRL_SHIFT (0) /* Bits 0-1: Power supply control bits */
-#define SDCARD_PWR_CTRL_MASK (3 << SDCARD_PWR_CTRL_SHIFT)
-# define SDCARD_PWR_CTRL_OFF (0 << SDCARD_PWR_CTRL_SHIFT) /* 00: Power-off: card clock stopped */
-# define SDCARD_PWR_CTRL_PWRUP (2 << SDCARD_PWR_CTRL_SHIFT) /* 10: Reserved power-up */
-# define SDCARD_PWR_CTRL_ON (3 << SDCARD_PWR_CTRL_SHIFT) /* 11: Power-on: card is clocked */
- /* Bits 2-5 Reserved */
-#define SDCARD_PWR_OPENDRAIN (1 << 6) /* SD_CMD Output Control */
-#define SDCARD_PWR_ROD (1 << 7) /* Rod Control */
- /* Bits 8-31: Reserved */
-#define SDCARD_PWR_RESET (0) /* Reset value */
-
-/* MCI Clock Control Register - CLOCK - 0x400c 0004 */
-
-#define SDCARD_CLOCK_CLKDIV_SHIFT (0) /* Bits 7-0: Clock divide factor */
-#define SDCARD_CLOCK_CLKDIV_MASK (0xff << SDCARD_CLOCK_CLKDIV_SHIFT)
-#define SDCARD_CLOCK_CLKEN (1 << 8) /* Bit 8: Clock enable bit */
-#define SDCARD_CLOCK_PWRSAV (1 << 9) /* Bit 9: Power saving configuration bit */
-#define SDCARD_CLOCK_BYPASS (1 << 10) /* Bit 10: Clock divider bypass enable bit */
-#define SDCARD_CLOCK_WIDBUS (1 << 11) /* Bit 11: Wide bus mode enable bit */
-# define SDCARD_CLOCK_WIDBUS_D1 (0) /* 0: Default (SDIO_D0) */
-# define SDCARD_CLOCK_WIDBUS_D4 (SDCARD_CLOCK_WIDBUS) /* 1: 4-wide (SDIO_D[3:0]) */
- /* Bits 12-31: Reserved */
-
-#define SDCARD_CLOCK_RESET (0) /* Reset value */
-
-/* MCI Argument Register - ARGUMENT - 0x400c 0008 has no bitfields */
-
-#define SDCARD_ARG_RESET (0) /* Reset value */
-
-/* MCI Command Register - COMMAND - 0x400c 000c */
-
-#define SDCARD_CMD_INDEX_SHIFT (0) /* Bits 0-5: Command Index */
-#define SDCARD_CMD_INDEX_MASK (0x3f << SDCARD_CMD_INDEX_SHIFT)
-#define SDCARD_CMD_WAITRESP_SHIFT (6) /* Bits 7-6: Wait for response bits */
-#define SDCARD_CMD_WAITRESP_MASK (3 << SDCARD_CMD_WAITRESP_SHIFT)
-# define SDCARD_CMD_NORESPONSE (0 << SDCARD_CMD_WAITRESP_SHIFT) /* 00/01: No response */
-# define SDCARD_CMD_SHORTRESPONSE (1 << SDCARD_CMD_WAITRESP_SHIFT) /* 10: Short response */
-# define SDCARD_CMD_LONGRESPONSE (3 << SDCARD_CMD_WAITRESP_SHIFT) /* 11: Long response */
-#define SDCARD_CMD_WAITINT (1 << 8) /* Bit 8: CPSM waits for interrupt request */
-#define SDCARD_CMD_WAITPEND (1 << 9) /* Bit 9: CPSM Waits for ends of data transfer */
-#define SDCARD_CMD_CPSMEN (1 << 10) /* Bit 10: Command path state machine enable */
- /* Bits 11-31: Reserved */
-
-#define SDCARD_CMD_RESET (0) /* Reset value */
-
-/* MCI Command Response Register - RESPCOMMAND - 0x400c 0010 */
-
-#define SDCARD_RESPCMD_SHIFT (0) /* Bits 0-5: Resopnse Command index */
-#define SDCARD_RESPCMD_MASK (0x3f << SDCARD_RESPCMD_SHIFT)
- /* Bits 6-31: Reserved */
-
-/* MCI Response Registers RESPONSE0-3 - 0x400c 0014, 0x400c 0018,
- No bitfields 0x400c 001c, 0x400c 0020 */
-
-
-/* MCI - Data Timer Register DATATIMER - 0x400c 0024 */
-/* No bitfields */
-
-#define SDCARD_DTIMER_RESET (0) /* Reset value */
-
-/* MCI - Data Length Register DATALENGTH - 0x400C 0028 */
-
-#define SDCARD_DATALENGTH_SHIFT (0) /* Bits 0-15: Data length value */
-#define SDCARD_DATALENGTH_MASK (0xffff << SDCARD_DATALENGTH_SHIFT)
- /* Bits 16-31: Reserved */
-
-#define SDCARD_DLEN_RESET (0) /* Reset value */
-
-/* MCI - Data Control Register - DATACTRL - 0x400c 002c */
-
-#define SDCARD_DCTRL_DTEN (1 << 0) /* Bit 0: Data transfer enabled bit */
-#define SDCARD_DCTRL_DTDIR (1 << 1) /* Bit 1: Data transfer direction */
-#define SDCARD_DCTRL_DTMODE (1 << 2) /* Bit 2: Data transfer mode */
-#define SDCARD_DCTRL_DMAEN (1 << 3) /* Bit 3: DMA enable bit */
-#define SDCARD_DCTRL_DBLOCKSIZE_SHIFT (4) /* Bits 4-7: Data block size */
-#define SDCARD_DCTRL_DBLOCKSIZE_MASK (15 << SDCARD_DCTRL_DBLOCKSIZE_SHIFT)
-# define SDCARD_DCTRL_1BYTE (0 << SDCARD_DCTRL_DBLOCKSIZE_SHIFT)
-# define SDCARD_DCTRL_2BYTES (1 << SDCARD_DCTRL_DBLOCKSIZE_SHIFT)
-# define SDCARD_DCTRL_4BYTES (2 << SDCARD_DCTRL_DBLOCKSIZE_SHIFT)
-# define SDCARD_DCTRL_8BYTES (3 << SDCARD_DCTRL_DBLOCKSIZE_SHIFT)
-# define SDCARD_DCTRL_16BYTES (4 << SDCARD_DCTRL_DBLOCKSIZE_SHIFT)
-# define SDCARD_DCTRL_32BYTES (5 << SDCARD_DCTRL_DBLOCKSIZE_SHIFT)
-# define SDCARD_DCTRL_64BYTES (6 << SDCARD_DCTRL_DBLOCKSIZE_SHIFT)
-# define SDCARD_DCTRL_128BYTES (7 << SDCARD_DCTRL_DBLOCKSIZE_SHIFT)
-# define SDCARD_DCTRL_256BYTES (8 << SDCARD_DCTRL_DBLOCKSIZE_SHIFT)
-# define SDCARD_DCTRL_512BYTES (9 << SDCARD_DCTRL_DBLOCKSIZE_SHIFT)
-# define SDCARD_DCTRL_1KBYTE (10 << SDCARD_DCTRL_DBLOCKSIZE_SHIFT)
-# define SDCARD_DCTRL_2KBYTES (11 << SDCARD_DCTRL_DBLOCKSIZE_SHIFT)
- /* Bits 8-31: Reserved */
-
-#define SDCARD_DCTRL_RESET (0) /* Reset value */
-
-/* MCI - Data Length Register DATALENGTH - 0x400c 0028 */
-
-#define SDCARD_DATACOUNT_SHIFT (0) /* Bits 0-15: Remaining data */
-#define SDCARD_DATACOUNT_MASK (0xffff << SDCARD_DATACOUNT_SHIFT)
- /* Bits 16-31: Reserved */
-
-/* MCI - Status Register -Status - 0x400c 0034 */
-
-#define SDCARD_STATUS_CCRCFAIL (1 << 0) /* Bit 0: Command response CRC fail */
-#define SDCARD_STATUS_DCRCFAIL (1 << 1) /* Bit 1: Data block CRC fail */
-#define SDCARD_STATUS_CTIMEOUT (1 << 2) /* Bit 2: Command response timeout */
-#define SDCARD_STATUS_DTIMEOUT (1 << 3) /* Bit 3: Data timeout */
-#define SDCARD_STATUS_TXUNDERR (1 << 4) /* Bit 4: Transmit FIFO underrun error */
-#define SDCARD_STATUS_RXOVERR (1 << 5) /* Bit 5: Received FIFO overrun error */
-#define SDCARD_STATUS_CMDREND (1 << 6) /* Bit 6: Command response received */
-#define SDCARD_STATUS_CMDSENT (1 << 7) /* Bit 7: Command sent */
-#define SDCARD_STATUS_DATAEND (1 << 8) /* Bit 8: Data end */
-#define SDCARD_STATUS_STBITERR (1 << 9) /* Bit 9: Start bit not detected */
-#define SDCARD_STATUS_DBCKEND (1 << 10) /* Bit 10: Data block sent/received */
-#define SDCARD_STATUS_CMDACT (1 << 11) /* Bit 11: Command transfer in progress */
-#define SDCARD_STATUS_TXACT (1 << 12) /* Bit 12: Data transmit in progress */
-#define SDCARD_STATUS_RXACT (1 << 13) /* Bit 13: Data receive in progress */
-#define SDCARD_STATUS_TXFIFOHE (1 << 14) /* Bit 14: Transmit FIFO half empty */
-#define SDCARD_STATUS_RXFIFOHF (1 << 15) /* Bit 15: Receive FIFO half full */
-#define SDCARD_STATUS_TXFIFOF (1 << 16) /* Bit 16: Transmit FIFO full */
-#define SDCARD_STATUS_RXFIFOF (1 << 17) /* Bit 17: Receive FIFO full */
-#define SDCARD_STATUS_TXFIFOE (1 << 18) /* Bit 18: Transmit FIFO empty */
-#define SDCARD_STATUS_RXFIFOE (1 << 19) /* Bit 19: Receive FIFO empty */
-#define SDCARD_STATUS_TXDAVL (1 << 20) /* Bit 20: Data available in transmit FIFO */
-#define SDCARD_STATUS_RXDAVL (1 << 21) /* Bit 21: Data available in receive FIFO */
- /* Bits 22-31: Reserved */
-
-/* MCI - Clear Register CLEAR - 0x400c 0038 */
-
-#define SDCARD_CLEAR_CCRCFAILC (1 << 0) /* Bit 0: CCRCFAIL flag clear bit */
-#define SDCARD_CLEAR_DCRCFAILC (1 << 1) /* Bit 1: DCRCFAIL flag clear bit */
-#define SDCARD_CLEAR_CTIMEOUTC (1 << 2) /* Bit 2: CTIMEOUT flag clear bit */
-#define SDCARD_CLEAR_DTIMEOUTC (1 << 3) /* Bit 3: DTIMEOUT flag clear bit */
-#define SDCARD_CLEAR_TXUNDERRC (1 << 4) /* Bit 4: TXUNDERR flag clear bit */
-#define SDCARD_CLEAR_RXOVERRC (1 << 5) /* Bit 5: RXOVERR flag clear bit */
-#define SDCARD_CLEAR_CMDRENDC (1 << 6) /* Bit 6: CMDREND flag clear bit */
-#define SDCARD_CLEAR_CMDSENTC (1 << 7) /* Bit 7: CMDSENT flag clear bit */
-#define SDCARD_CLEAR_DATAENDC (1 << 8) /* Bit 8: DATAEND flag clear bit */
-#define SDCARD_CLEAR_STBITERRC (1 << 9) /* Bit 9: STBITERR flag clear bit */
-#define SDCARD_CLEAR_DBCKENDC (1 << 10) /* Bit 10: DBCKEND flag clear bit */
- /* Bits 11-31: Reserved */
-
-#define SDCARD_CLEAR_RESET 0x000007ff
-#define SDCARD_CLEAR_STATICFLAGS 0x000005ff
-
-/* MCI - Interrupt Mask Registers - MASK0 - 0x400c 003c */
-
-#define SDCARD_MASK0_CCRCFAILIE (1 << 0) /* Bit 0: Command CRC fail interrupt enable */
-#define SDCARD_MASK0_DCRCFAILIE (1 << 1) /* Bit 1: Data CRC fail interrupt enable */
-#define SDCARD_MASK0_CTIMEOUTIE (1 << 2) /* Bit 2: Command timeout interrupt enable */
-#define SDCARD_MASK0_DTIMEOUTIE (1 << 3) /* Bit 3: Data timeout interrupt enable */
-#define SDCARD_MASK0_TXUNDERRIE (1 << 4) /* Bit 4: Tx FIFO underrun error interrupt enable */
-#define SDCARD_MASK0_RXOVERRIE (1 << 5) /* Bit 5: Rx FIFO overrun error interrupt enable */
-#define SDCARD_MASK0_CMDRENDIE (1 << 6) /* Bit 6: Command response received interrupt enable */
-#define SDCARD_MASK0_CMDSENTIE (1 << 7) /* Bit 7: Command sent interrupt enable */
-#define SDCARD_MASK0_DATAENDIE (1 << 8) /* Bit 8: Data end interrupt enable */
-#define SDCARD_MASK0_STBITERRIE (1 << 9) /* Bit 9: Start bit error interrupt enable */
-#define SDCARD_MASK0_DBCKENDIE (1 << 10) /* Bit 10: Data block end interrupt enable */
-#define SDCARD_MASK0_CMDACTIE (1 << 11) /* Bit 11: Command acting interrupt enable */
-#define SDCARD_MASK0_TXACTIE (1 << 12) /* Bit 12: Data transmit acting interrupt enable */
-#define SDCARD_MASK0_RXACTIE (1 << 13) /* Bit 13: Data receive acting interrupt enable */
-#define SDCARD_MASK0_TXFIFOHEIE (1 << 14) /* Bit 14: Tx FIFO half empty interrupt enable */
-#define SDCARD_MASK0_RXFIFOHFIE (1 << 15) /* Bit 15: Rx FIFO half full interrupt enable */
-#define SDCARD_MASK0_TXFIFOFIE (1 << 16) /* Bit 16: Tx FIFO full interrupt enable */
-#define SDCARD_MASK0_RXFIFOFIE (1 << 17) /* Bit 17: Rx FIFO full interrupt enable */
-#define SDCARD_MASK0_TXFIFOEIE (1 << 18) /* Bit 18: Tx FIFO empty interrupt enable */
-#define SDCARD_MASK0_RXFIFOEIE (1 << 19) /* Bit 19: Rx FIFO empty interrupt enable */
-#define SDCARD_MASK0_TXDAVLIE (1 << 20) /* Bit 20: Data available in Tx FIFO interrupt enable */
-#define SDCARD_MASK0_RXDAVLIE (1 << 21) /* Bit 21: Data available in Rx FIFO interrupt enable */
- /* Bits 22-31: Reserved */
-#define SDCARD_MASK0_RESET (0)
-
-/* MCI - FIFO Counter Register (FIFOCNT - 0x400c 0048 */
-
-#define SDCARD_FIFOCNT_SHIFT (0) /* Bits 0-14: Remaining data */
-#define SDCARD_FIFOCNT_MASK (0x7fff << SDCARD_FIFOCNT_SHIFT)
- /* Bits 15-31: Reserved */
-
-/* MCI - Data FIFO Register - FIFO - 0x400c 0080 to 0x400c 00bc */
-/* The receive and transmit FIFOs can be read or written as 32 bit wide registers.
- * The FIFOs contain 16 entries on 16 sequential addresses.
- */
-
-#endif /* __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC17_SDCARD_H */
-
diff --git a/arch/arm/src/lpc17xx/hardware/lpc17_spi.h b/arch/arm/src/lpc17xx/hardware/lpc17_spi.h
deleted file mode 100644
index dc9dce94385..00000000000
--- a/arch/arm/src/lpc17xx/hardware/lpc17_spi.h
+++ /dev/null
@@ -1,141 +0,0 @@
-/************************************************************************************
- * arch/arm/src/lpc17xx/hardware/lpc17_spi.h
- *
- * Copyright (C) 2010, 2013 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. 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.
- * 3. Neither the name NuttX 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 THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- ************************************************************************************/
-
-#ifndef __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC17_SPI_H
-#define __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC17_SPI_H
-
-/************************************************************************************
- * Included Files
- ************************************************************************************/
-
-#include
-
-#include "chip.h"
-#include "hardware/lpc17_memorymap.h"
-
-/************************************************************************************
- * Pre-processor Definitions
- ************************************************************************************/
-
-/* Register offsets *****************************************************************/
-
-#define LPC17_SPI_CR_OFFSET 0x0000 /* Control Register */
-#define LPC17_SPI_SR_OFFSET 0x0004 /* SPI Status Register */
-#define LPC17_SPI_DR_OFFSET 0x0008 /* SPI Data Register */
-#define LPC17_SPI_CCR_OFFSET 0x000c /* SPI Clock Counter Register */
-#define LPC17_SPI_TCR_OFFSET 0x0010 /* SPI Test Control Register */
-#define LPC17_SPI_TSR_OFFSET 0x0014 /* SPI Test Status Register */
-#define LPC17_SPI_INT_OFFSET 0x001c /* SPI Interrupt Register */
-
-/* Register addresses ***************************************************************/
-
-#define LPC17_SPI_CR (LPC17_SPI_BASE+LPC17_SPI_CR_OFFSET)
-#define LPC17_SPI_SR (LPC17_SPI_BASE+LPC17_SPI_SR_OFFSET)
-#define LPC17_SPI_DR (LPC17_SPI_BASE+LPC17_SPI_DR_OFFSET)
-#define LPC17_SPI_CCR (LPC17_SPI_BASE+LPC17_SPI_CCR_OFFSET)
-#define LPC17_TCR_CCR (LPC17_SPI_BASE+LPC17_SPI_TCR_OFFSET)
-#define LPC17_TSR_CCR (LPC17_SPI_BASE+LPC17_SPI_TSR_OFFSET)
-#define LPC17_SPI_INT (LPC17_SPI_BASE+LPC17_SPI_INT_OFFSET)
-
-/* Register bit definitions *********************************************************/
-
-/* Control Register */
- /* Bits 0-1: Reserved */
-#define SPI_CR_BITENABLE (1 << 2) /* Bit 2: Enable word size selected by BITS */
-#define SPI_CR_CPHA (1 << 3) /* Bit 3: Clock phase control */
-#define SPI_CR_CPOL (1 << 4) /* Bit 4: Clock polarity control */
-#define SPI_CR_MSTR (1 << 5) /* Bit 5: Master mode select */
-#define SPI_CR_LSBF (1 << 6) /* Bit 6: SPI data is transferred LSB first */
-#define SPI_CR_SPIE (1 << 7) /* Bit 7: Serial peripheral interrupt enable */
-#define SPI_CR_BITS_SHIFT (8) /* Bits 8-11: Number of bits per word (BITENABLE==1) */
-#define SPI_CR_BITS_MASK (15 << SPI_CR_BITS_SHIFT)
-# define SPI_CR_BITS_8BITS (8 << SPI_CR_BITS_SHIFT) /* 8 bits per transfer */
-# define SPI_CR_BITS_9BITS (9 << SPI_CR_BITS_SHIFT) /* 9 bits per transfer */
-# define SPI_CR_BITS_10BITS (10 << SPI_CR_BITS_SHIFT) /* 10 bits per transfer */
-# define SPI_CR_BITS_11BITS (11 << SPI_CR_BITS_SHIFT) /* 11 bits per transfer */
-# define SPI_CR_BITS_12BITS (12 << SPI_CR_BITS_SHIFT) /* 12 bits per transfer */
-# define SPI_CR_BITS_13BITS (13 << SPI_CR_BITS_SHIFT) /* 13 bits per transfer */
-# define SPI_CR_BITS_14BITS (14 << SPI_CR_BITS_SHIFT) /* 14 bits per transfer */
-# define SPI_CR_BITS_15BITS (15 << SPI_CR_BITS_SHIFT) /* 15 bits per transfer */
-# define SPI_CR_BITS_16BITS (0 << SPI_CR_BITS_SHIFT) /* 16 bits per transfer */
- /* Bits 12-31: Reserved */
-/* SPI Status Register */
- /* Bits 0-2: Reserved */
-#define SPI_SR_ABRT (1 << 3) /* Bit 3: Slave abort */
-#define SPI_SR_MODF (1 << 4) /* Bit 4: Mode fault */
-#define SPI_SR_ROVR (1 << 5) /* Bit 5: Read overrun */
-#define SPI_SR_WCOL (1 << 6) /* Bit 6: Write collision */
-#define SPI_SR_SPIF (1 << 7) /* Bit 7: SPI transfer complete */
- /* Bits 8-31: Reserved */
-/* SPI Data Register */
-
-#define SPI_DR_MASK (0xff) /* Bits 0-15: SPI Bi-directional data port */
-#define SPI_DR_MASKWIDE (0xffff) /* Bits 0-15: If SPI_CR_BITENABLE != 0 */
- /* Bits 8-31: Reserved */
-/* SPI Clock Counter Register */
-
-#define SPI_CCR_MASK (0xff) /* Bits 0-7: SPI Clock counter setting */
- /* Bits 8-31: Reserved */
-/* SPI Test Control Register */
- /* Bit 0: Reserved */
-#define SPI_TCR_TEST_SHIFT (1) /* Bits 1-7: SPI test mode */
-#define SPI_TCR_TEST_MASK (0x7f << SPI_TCR_TEST_SHIFT)
- /* Bits 8-31: Reserved */
-/* SPI Test Status Register */
- /* Bits 0-2: Reserved */
-#define SPI_TSR_ABRT (1 << 3) /* Bit 3: Slave abort */
-#define SPI_TSR_MODF (1 << 4) /* Bit 4: Mode fault */
-#define SPI_TSR_ROVR (1 << 5) /* Bit 5: Read overrun */
-#define SPI_TSR_WCOL (1 << 6) /* Bit 6: Write collision */
-#define SPI_TSR_SPIF (1 << 7) /* Bit 7: SPI transfer complete */
- /* Bits 8-31: Reserved */
-/* SPI Interrupt Register */
-
-#define SPI_INT_SPIF (1 << 0) /* SPI interrupt */
- /* Bits 1-31: Reserved */
-
-/************************************************************************************
- * Public Types
- ************************************************************************************/
-
-/************************************************************************************
- * Public Data
- ************************************************************************************/
-
-/************************************************************************************
- * Public Functions
- ************************************************************************************/
-
-#endif /* __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC17_SPI_H */
diff --git a/arch/arm/src/lpc17xx/hardware/lpc17_ssp.h b/arch/arm/src/lpc17xx/hardware/lpc17_ssp.h
deleted file mode 100644
index c1d40a211f5..00000000000
--- a/arch/arm/src/lpc17xx/hardware/lpc17_ssp.h
+++ /dev/null
@@ -1,185 +0,0 @@
-/************************************************************************************
- * arch/arm/src/lpc17xx/hardware/lpc17_ssp.h
- *
- * Copyright (C) 2010, 2012-2013 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. 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.
- * 3. Neither the name NuttX 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 THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- ************************************************************************************/
-
-#ifndef __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC17_SSP_H
-#define __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC17_SSP_H
-
-/************************************************************************************
- * Included Files
- ************************************************************************************/
-
-#include
-
-#include "chip.h"
-#include "hardware/lpc17_memorymap.h"
-
-/************************************************************************************
- * Pre-processor Definitions
- ************************************************************************************/
-/* 8 frame FIFOs for both transmit and receive */
-
-#define LPC17_SSP_FIFOSZ 8
-
-/* Register offsets *****************************************************************/
-
-#define LPC17_SSP_CR0_OFFSET 0x0000 /* Control Register 0 */
-#define LPC17_SSP_CR1_OFFSET 0x0004 /* Control Register 1 */
-#define LPC17_SSP_DR_OFFSET 0x0008 /* Data Register */
-#define LPC17_SSP_SR_OFFSET 0x000c /* Status Register */
-#define LPC17_SSP_CPSR_OFFSET 0x0010 /* Clock Prescale Register */
-#define LPC17_SSP_IMSC_OFFSET 0x0014 /* Interrupt Mask Set and Clear Register */
-#define LPC17_SSP_RIS_OFFSET 0x0018 /* Raw Interrupt Status Register */
-#define LPC17_SSP_MIS_OFFSET 0x001c /* Masked Interrupt Status Register */
-#define LPC17_SSP_ICR_OFFSET 0x0020 /* Interrupt Clear Register */
-#define LPC17_SSP_DMACR_OFFSET 0x0024 /* DMA Control Register */
-
-/* Register addresses ***************************************************************/
-
-#define LPC17_SSP0_CR0 (LPC17_SSP0_BASE+LPC17_SSP_CR0_OFFSET)
-#define LPC17_SSP0_CR1 (LPC17_SSP0_BASE+LPC17_SSP_CR1_OFFSET)
-#define LPC17_SSP0_DR (LPC17_SSP0_BASE+LPC17_SSP_DR_OFFSET)
-#define LPC17_SSP0_SR (LPC17_SSP0_BASE+LPC17_SSP_SR_OFFSET)
-#define LPC17_SSP0_CPSR (LPC17_SSP0_BASE+LPC17_SSP_CPSR_OFFSET)
-#define LPC17_SSP0_IMSC (LPC17_SSP0_BASE+LPC17_SSP_IMSC_OFFSET)
-#define LPC17_SSP0_RIS (LPC17_SSP0_BASE+LPC17_SSP_RIS_OFFSET)
-#define LPC17_SSP0_MIS (LPC17_SSP0_BASE+LPC17_SSP_MIS_OFFSET)
-#define LPC17_SSP0_ICR (LPC17_SSP0_BASE+LPC17_SSP_ICR_OFFSET)
-#define LPC17_SSP0_DMACR (LPC17_SSP0_BASE+LPC17_SSP_DMACR_OFFSET)
-
-#define LPC17_SSP1_CR0 (LPC17_SSP1_BASE+LPC17_SSP_CR0_OFFSET)
-#define LPC17_SSP1_CR1 (LPC17_SSP1_BASE+LPC17_SSP_CR1_OFFSET)
-#define LPC17_SSP1_DR (LPC17_SSP1_BASE+LPC17_SSP_DR_OFFSET)
-#define LPC17_SSP1_SR (LPC17_SSP1_BASE+LPC17_SSP_SR_OFFSET)
-#define LPC17_SSP1_CPSR (LPC17_SSP1_BASE+LPC17_SSP_CPSR_OFFSET)
-#define LPC17_SSP1_IMSC (LPC17_SSP1_BASE+LPC17_SSP_IMSC_OFFSET)
-#define LPC17_SSP1_RIS (LPC17_SSP1_BASE+LPC17_SSP_RIS_OFFSET)
-#define LPC17_SSP1_MIS (LPC17_SSP1_BASE+LPC17_SSP_MIS_OFFSET)
-#define LPC17_SSP1_ICR (LPC17_SSP1_BASE+LPC17_SSP_ICR_OFFSET)
-#define LPC17_SSP1_DMACR (LPC17_SSP1_BASE+LPC17_SSP_DMACR_OFFSET)
-
-#define LPC17_SSP2_CR0 (LPC17_SSP2_BASE+LPC17_SSP_CR0_OFFSET)
-#define LPC17_SSP2_CR1 (LPC17_SSP2_BASE+LPC17_SSP_CR1_OFFSET)
-#define LPC17_SSP2_DR (LPC17_SSP2_BASE+LPC17_SSP_DR_OFFSET)
-#define LPC17_SSP2_SR (LPC17_SSP2_BASE+LPC17_SSP_SR_OFFSET)
-#define LPC17_SSP2_CPSR (LPC17_SSP2_BASE+LPC17_SSP_CPSR_OFFSET)
-#define LPC17_SSP2_IMSC (LPC17_SSP2_BASE+LPC17_SSP_IMSC_OFFSET)
-#define LPC17_SSP2_RIS (LPC17_SSP2_BASE+LPC17_SSP_RIS_OFFSET)
-#define LPC17_SSP2_MIS (LPC17_SSP2_BASE+LPC17_SSP_MIS_OFFSET)
-#define LPC17_SSP2_ICR (LPC17_SSP2_BASE+LPC17_SSP_ICR_OFFSET)
-#define LPC17_SSP2_DMACR (LPC17_SSP2_BASE+LPC17_SSP_DMACR_OFFSET)
-
-/* Register bit definitions *********************************************************/
-/* Control Register 0 */
-
-#define SSP_CR0_DSS_SHIFT (0) /* Bits 0-3: DSS Data Size Select */
-#define SSP_CR0_DSS_MASK (15 << SSP_CR0_DSS_SHIFT)
-# define SSP_CR0_DSS_4BIT (3 << SSP_CR0_DSS_SHIFT)
-# define SSP_CR0_DSS_5BIT (4 << SSP_CR0_DSS_SHIFT)
-# define SSP_CR0_DSS_6BIT (5 << SSP_CR0_DSS_SHIFT)
-# define SSP_CR0_DSS_7BIT (6 << SSP_CR0_DSS_SHIFT)
-# define SSP_CR0_DSS_8BIT (7 << SSP_CR0_DSS_SHIFT)
-# define SSP_CR0_DSS_9BIT (8 << SSP_CR0_DSS_SHIFT)
-# define SSP_CR0_DSS_10BIT (9 << SSP_CR0_DSS_SHIFT)
-# define SSP_CR0_DSS_11BIT (10 << SSP_CR0_DSS_SHIFT)
-# define SSP_CR0_DSS_12BIT (11 << SSP_CR0_DSS_SHIFT)
-# define SSP_CR0_DSS_13BIT (12 << SSP_CR0_DSS_SHIFT)
-# define SSP_CR0_DSS_14BIT (13 << SSP_CR0_DSS_SHIFT)
-# define SSP_CR0_DSS_15BIT (14 << SSP_CR0_DSS_SHIFT)
-# define SSP_CR0_DSS_16BIT (15 << SSP_CR0_DSS_SHIFT)
-#define SSP_CR0_FRF_SHIFT (4) /* Bits 4-5: FRF Frame Format */
-#define SSP_CR0_FRF_MASK (3 << SSP_CR0_FRF_SHIFT)
-# define SSP_CR0_FRF_SPI (0 << SSP_CR0_FRF_SHIFT)
-# define SSP_CR0_FRF_TI (1 << SSP_CR0_FRF_SHIFT)
-# define SSP_CR0_FRF_UWIRE (2 << SSP_CR0_FRF_SHIFT)
-#define SSP_CR0_CPOL (1 << 6) /* Bit 6: Clock Out Polarity */
-#define SSP_CR0_CPHA (1 << 7) /* Bit 7: Clock Out Phase */
-#define SSP_CR0_SCR_SHIFT (8) /* Bits 8-15: Serial Clock Rate */
-#define SSP_CR0_SCR_MASK (0xff << SSP_CR0_SCR_SHIFT)
- /* Bits 8-31: Reserved */
-/* Control Register 1 */
-
-#define SSP_CR1_LBM (1 << 0) /* Bit 0: Loop Back Mode */
-#define SSP_CR1_SSE (1 << 1) /* Bit 1: SSP Enable */
-#define SSP_CR1_MS (1 << 2) /* Bit 2: Master/Slave Mode */
-#define SSP_CR1_SOD (1 << 3) /* Bit 3: Slave Output Disable */
- /* Bits 4-31: Reserved */
-/* Data Register */
-
-#define SSP_DR_MASK (0xffff) /* Bits 0-15: Data */
- /* Bits 16-31: Reserved */
-/* Status Register */
-
-#define SSP_SR_TFE (1 << 0) /* Bit 0: Transmit FIFO Empty */
-#define SSP_SR_TNF (1 << 1) /* Bit 1: Transmit FIFO Not Full */
-#define SSP_SR_RNE (1 << 2) /* Bit 2: Receive FIFO Not Empty */
-#define SSP_SR_RFF (1 << 3) /* Bit 3: Receive FIFO Full */
-#define SSP_SR_BSY (1 << 4) /* Bit 4: Busy */
- /* Bits 5-31: Reserved */
-/* Clock Prescale Register */
-
-#define SSP_CPSR_DVSR_MASK (0xff) /* Bits 0-7: clock = SSP_PCLK/DVSR */
- /* Bits 8-31: Reserved */
-/* Common format for interrupt control registers:
- *
- * Interrupt Mask Set and Clear Register (IMSC)
- * Raw Interrupt Status Register (RIS)
- * Masked Interrupt Status Register (MIS)
- * Interrupt Clear Register (ICR)
- */
-
-#define SSP_INT_ROR (1 << 0) /* Bit 0: RX FIFO overrun */
-#define SSP_INT_RT (1 << 1) /* Bit 1: RX FIFO timeout */
-#define SSP_INT_RX (1 << 2) /* Bit 2: RX FIFO at least half full (not ICR) */
-#define SSP_INT_TX (1 << 3 ) /* Bit 3: TX FIFO at least half empy (not ICR) */
- /* Bits 4-31: Reserved */
-/* DMA Control Register */
-
-#define SSP_DMACR_RXDMAE (1 << 0) /* Bit 0: Receive DMA Enable */
-#define SSP_DMACR_TXDMAE (1 << 1) /* Bit 1: Transmit DMA Enable */
- /* Bits 2-31: Reserved */
-
-/************************************************************************************
- * Public Types
- ************************************************************************************/
-
-/************************************************************************************
- * Public Data
- ************************************************************************************/
-
-/************************************************************************************
- * Public Functions
- ************************************************************************************/
-
-#endif /* __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC17_SSP_H */
diff --git a/arch/arm/src/lpc17xx/hardware/lpc17_timer.h b/arch/arm/src/lpc17xx/hardware/lpc17_timer.h
deleted file mode 100644
index b66b3921ada..00000000000
--- a/arch/arm/src/lpc17xx/hardware/lpc17_timer.h
+++ /dev/null
@@ -1,250 +0,0 @@
-/************************************************************************************
- * arch/arm/src/lpc17xx/hardware/lpc17_timer.h
- *
- * Copyright (C) 2010, 2012-2013 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. 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.
- * 3. Neither the name NuttX 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 THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- ************************************************************************************/
-
-#ifndef __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC17_TIMER_H
-#define __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC17_TIMER_H
-
-/************************************************************************************
- * Included Files
- ************************************************************************************/
-
-#include
-
-#include "chip.h"
-#include "hardware/lpc17_memorymap.h"
-
-/************************************************************************************
- * Pre-processor Definitions
- ************************************************************************************/
-
-/* Register offsets *****************************************************************/
-
-#define LPC17_TMR_IR_OFFSET 0x0000 /* Interrupt Register */
-#define LPC17_TMR_TCR_OFFSET 0x0004 /* Timer Control Register */
-#define LPC17_TMR_TC_OFFSET 0x0008 /* Timer Counter */
-#define LPC17_TMR_PR_OFFSET 0x000c /* Prescale Register */
-#define LPC17_TMR_PC_OFFSET 0x0010 /* Prescale Counter */
-#define LPC17_TMR_MCR_OFFSET 0x0014 /* Match Control Register */
-#define LPC17_TMR_MR0_OFFSET 0x0018 /* Match Register 0 */
-#define LPC17_TMR_MR1_OFFSET 0x001c /* Match Register 1 */
-#define LPC17_TMR_MR2_OFFSET 0x0020 /* Match Register 2 */
-#define LPC17_TMR_MR3_OFFSET 0x0024 /* Match Register 3 */
-#define LPC17_TMR_CCR_OFFSET 0x0028 /* Capture Control Register */
-#define LPC17_TMR_CR0_OFFSET 0x002c /* Capture Register 0 */
-#define LPC17_TMR_CR1_OFFSET 0x0030 /* Capture Register 1 */
-#define LPC17_TMR_EMR_OFFSET 0x003c /* External Match Register */
-#define LPC17_TMR_CTCR_OFFSET 0x0070 /* Count Control Register */
-
-/* Register addresses ***************************************************************/
-
-#define LPC17_TMR0_IR (LPC17_TMR0_BASE+LPC17_TMR_IR_OFFSET)
-#define LPC17_TMR0_TCR (LPC17_TMR0_BASE+LPC17_TMR_TCR_OFFSET)
-#define LPC17_TMR0_TC (LPC17_TMR0_BASE+LPC17_TMR_TC_OFFSET)
-#define LPC17_TMR0_PR (LPC17_TMR0_BASE+LPC17_TMR_PR_OFFSET)
-#define LPC17_TMR0_PC (LPC17_TMR0_BASE+LPC17_TMR_PC_OFFSET)
-#define LPC17_TMR0_MCR (LPC17_TMR0_BASE+LPC17_TMR_MCR_OFFSET)
-#define LPC17_TMR0_MR0 (LPC17_TMR0_BASE+LPC17_TMR_MR0_OFFSET)
-#define LPC17_TMR0_MR1 (LPC17_TMR0_BASE+LPC17_TMR_MR1_OFFSET)
-#define LPC17_TMR0_MR2 (LPC17_TMR0_BASE+LPC17_TMR_MR2_OFFSET)
-#define LPC17_TMR0_MR3 (LPC17_TMR0_BASE+LPC17_TMR_MR3_OFFSET)
-#define LPC17_TMR0_CCR (LPC17_TMR0_BASE+LPC17_TMR_CCR_OFFSET)
-#define LPC17_TMR0_CR0 (LPC17_TMR0_BASE+LPC17_TMR_CR0_OFFSET)
-#define LPC17_TMR0_CR1 (LPC17_TMR0_BASE+LPC17_TMR_CR1_OFFSET)
-#define LPC17_TMR0_EMR (LPC17_TMR0_BASE+LPC17_TMR_EMR_OFFSET)
-#define LPC17_TMR0_CTCR (LPC17_TMR0_BASE+LPC17_TMR_CTCR_OFFSET)
-
-#define LPC17_TMR1_IR (LPC17_TMR1_BASE+LPC17_TMR_IR_OFFSET)
-#define LPC17_TMR1_TCR (LPC17_TMR1_BASE+LPC17_TMR_TCR_OFFSET)
-#define LPC17_TMR1_TC (LPC17_TMR1_BASE+LPC17_TMR_TC_OFFSET)
-#define LPC17_TMR1_PR (LPC17_TMR1_BASE+LPC17_TMR_PR_OFFSET)
-#define LPC17_TMR1_PC (LPC17_TMR1_BASE+LPC17_TMR_PC_OFFSET)
-#define LPC17_TMR1_MCR (LPC17_TMR1_BASE+LPC17_TMR_MCR_OFFSET)
-#define LPC17_TMR1_MR0 (LPC17_TMR1_BASE+LPC17_TMR_MR0_OFFSET)
-#define LPC17_TMR1_MR1 (LPC17_TMR1_BASE+LPC17_TMR_MR1_OFFSET)
-#define LPC17_TMR1_MR2 (LPC17_TMR1_BASE+LPC17_TMR_MR2_OFFSET)
-#define LPC17_TMR1_MR3 (LPC17_TMR1_BASE+LPC17_TMR_MR3_OFFSET)
-#define LPC17_TMR1_CCR (LPC17_TMR1_BASE+LPC17_TMR_CCR_OFFSET)
-#define LPC17_TMR1_CR0 (LPC17_TMR1_BASE+LPC17_TMR_CR0_OFFSET)
-#define LPC17_TMR1_CR1 (LPC17_TMR1_BASE+LPC17_TMR_CR1_OFFSET)
-#define LPC17_TMR1_EMR (LPC17_TMR1_BASE+LPC17_TMR_EMR_OFFSET)
-#define LPC17_TMR1_CTCR (LPC17_TMR1_BASE+LPC17_TMR_CTCR_OFFSET)
-
-#define LPC17_TMR2_IR (LPC17_TMR2_BASE+LPC17_TMR_IR_OFFSET)
-#define LPC17_TMR2_TCR (LPC17_TMR2_BASE+LPC17_TMR_TCR_OFFSET)
-#define LPC17_TMR2_TC (LPC17_TMR2_BASE+LPC17_TMR_TC_OFFSET)
-#define LPC17_TMR2_PR (LPC17_TMR2_BASE+LPC17_TMR_PR_OFFSET)
-#define LPC17_TMR2_PC (LPC17_TMR2_BASE+LPC17_TMR_PC_OFFSET)
-#define LPC17_TMR2_MCR (LPC17_TMR2_BASE+LPC17_TMR_MCR_OFFSET)
-#define LPC17_TMR2_MR0 (LPC17_TMR2_BASE+LPC17_TMR_MR0_OFFSET)
-#define LPC17_TMR2_MR1 (LPC17_TMR2_BASE+LPC17_TMR_MR1_OFFSET)
-#define LPC17_TMR2_MR2 (LPC17_TMR2_BASE+LPC17_TMR_MR2_OFFSET)
-#define LPC17_TMR2_MR3 (LPC17_TMR2_BASE+LPC17_TMR_MR3_OFFSET)
-#define LPC17_TMR2_CCR (LPC17_TMR2_BASE+LPC17_TMR_CCR_OFFSET)
-#define LPC17_TMR2_CR0 (LPC17_TMR2_BASE+LPC17_TMR_CR0_OFFSET)
-#define LPC17_TMR2_CR1 (LPC17_TMR2_BASE+LPC17_TMR_CR1_OFFSET)
-#define LPC17_TMR2_EMR (LPC17_TMR2_BASE+LPC17_TMR_EMR_OFFSET)
-#define LPC17_TMR2_CTCR (LPC17_TMR2_BASE+LPC17_TMR_CTCR_OFFSET)
-
-#define LPC17_TMR3_IR (LPC17_TMR3_BASE+LPC17_TMR_IR_OFFSET)
-#define LPC17_TMR3_TCR (LPC17_TMR3_BASE+LPC17_TMR_TCR_OFFSET)
-#define LPC17_TMR3_TC (LPC17_TMR3_BASE+LPC17_TMR_TC_OFFSET)
-#define LPC17_TMR3_PR (LPC17_TMR3_BASE+LPC17_TMR_PR_OFFSET)
-#define LPC17_TMR3_PC (LPC17_TMR3_BASE+LPC17_TMR_PC_OFFSET)
-#define LPC17_TMR3_MCR (LPC17_TMR3_BASE+LPC17_TMR_MCR_OFFSET)
-#define LPC17_TMR3_MR0 (LPC17_TMR3_BASE+LPC17_TMR_MR0_OFFSET)
-#define LPC17_TMR3_MR1 (LPC17_TMR3_BASE+LPC17_TMR_MR1_OFFSET)
-#define LPC17_TMR3_MR2 (LPC17_TMR3_BASE+LPC17_TMR_MR2_OFFSET)
-#define LPC17_TMR3_MR3 (LPC17_TMR3_BASE+LPC17_TMR_MR3_OFFSET)
-#define LPC17_TMR3_CCR (LPC17_TMR3_BASE+LPC17_TMR_CCR_OFFSET)
-#define LPC17_TMR3_CR0 (LPC17_TMR3_BASE+LPC17_TMR_CR0_OFFSET)
-#define LPC17_TMR3_CR1 (LPC17_TMR3_BASE+LPC17_TMR_CR1_OFFSET)
-#define LPC17_TMR3_EMR (LPC17_TMR3_BASE+LPC17_TMR_EMR_OFFSET)
-#define LPC17_TMR3_CTCR (LPC17_TMR3_BASE+LPC17_TMR_CTCR_OFFSET)
-
-/* Register bit definitions *********************************************************/
-/* Registers holding 32-bit numeric values (no bit field definitions):
- *
- * Timer Counter (TC)
- * Prescale Register (PR)
- * Prescale Counter (PC)
- * Match Register 0 (MR0)
- * Match Register 1 (MR1)
- * Match Register 2 (MR2)
- * Match Register 3 (MR3)
- * Capture Register 0 (CR0)
- * Capture Register 1 (CR1)
- */
-
-/* Interrupt Register */
-
-#define TMR_IR_MR0 (1 << 0) /* Bit 0: Match channel 0 interrupt */
-#define TMR_IR_MR1 (1 << 1) /* Bit 1: Match channel 1 interrupt */
-#define TMR_IR_MR2 (1 << 2) /* Bit 2: Match channel 2 interrupt */
-#define TMR_IR_MR3 (1 << 3) /* Bit 3: Match channel 3 interrupt */
-#define TMR_IR_CR0 (1 << 4) /* Bit 4: Capture channel 0 interrupt */
-#define TMR_IR_CR1 (1 << 5) /* Bit 5: Capture channel 1 interrupt */
- /* Bits 6-31: Reserved */
-/* Timer Control Register */
-
-#define TMR_TCR_EN (1 << 0) /* Bit 0: Counter Enable */
-#define TMR_TCR_RESET (1 << 1) /* Bit 1: Counter Reset */
- /* Bits 2-31: Reserved */
-/* Match Control Register */
-
-#define TMR_MCR_MR0I (1 << 0) /* Bit 0: Interrupt on MR0 */
-#define TMR_MCR_MR0R (1 << 1) /* Bit 1: Reset on MR0 */
-#define TMR_MCR_MR0S (1 << 2) /* Bit 2: Stop on MR0 */
-#define TMR_MCR_MR1I (1 << 3) /* Bit 3: Interrupt on MR1 */
-#define TMR_MCR_MR1R (1 << 4) /* Bit 4: Reset on MR1 */
-#define TMR_MCR_MR1S (1 << 5) /* Bit 5: Stop on MR1 */
-#define TMR_MCR_MR2I (1 << 6) /* Bit 6: Interrupt on MR2 */
-#define TMR_MCR_MR2R (1 << 7) /* Bit 7: Reset on MR2 */
-#define TMR_MCR_MR2S (1 << 8) /* Bit 8: Stop on MR2 */
-#define TMR_MCR_MR3I (1 << 9) /* Bit 9: Interrupt on MR3 */
-#define TMR_MCR_MR3R (1 << 10) /* Bit 10: Reset on MR3 */
-#define TMR_MCR_MR3S (1 << 11) /* Bit 11: Stop on MR3 */
- /* Bits 12-31: Reserved */
-/* Capture Control Register */
-
-#define TMR_CCR_CAP0RE (1 << 0) /* Bit 0: Capture on CAPn.0 rising edge */
-#define TMR_CCR_CAP0FE (1 << 1) /* Bit 1: Capture on CAPn.0 falling edge */
-#define TMR_CCR_CAP0I (1 << 2) /* Bit 2: Interrupt on CAPn.0 */
-#define TMR_CCR_CAP1RE (1 << 3) /* Bit 3: Capture on CAPn.1 rising edge */
-#define TMR_CCR_CAP1FE (1 << 4) /* Bit 4: Capture on CAPn.1 falling edge */
-#define TMR_CCR_CAP1I (1 << 5) /* Bit 5: Interrupt on CAPn.1 */
- /* Bits 6-31: Reserved */
-/* External Match Register */
-
-#define TMR_EMR_NOTHING (0) /* Do Nothing */
-#define TMR_EMR_CLEAR (1) /* Clear external match bit MATn.m */
-#define TMR_EMR_SET (2) /* Set external match bit MATn.m */
-#define TMR_EMR_TOGGLE (3) /* Toggle external match bit MATn.m */
-
-#define TMR_EMR_EM0 (1 << 0) /* Bit 0: External Match 0 */
-#define TMR_EMR_EM1 (1 << 1) /* Bit 1: External Match 1 */
-#define TMR_EMR_EM2 (1 << 2) /* Bit 2: External Match 2 */
-#define TMR_EMR_EM3 (1 << 3) /* Bit 3: External Match 3 */
-#define TMR_EMR_EMC0_SHIFT (4) /* Bits 4-5: External Match Control 0 */
-#define TMR_EMR_EMC0_MASK (3 << TMR_EMR_EMC0_SHIFTy)
-# define TMR_EMR_EMC0_NOTHING (TMR_EMR_NOTHING << TMR_EMR_EMC0_SHIFT)
-# define TMR_EMR_EMC0_CLEAR (TMR_EMR_CLEAR << TMR_EMR_EMC0_SHIFT)
-# define TMR_EMR_EMC0_SET (TMR_EMR_SET << TMR_EMR_EMC0_SHIFT)
-# define TMR_EMR_EMC0_TOGGLE (TMR_EMR_TOGGLE << TMR_EMR_EMC0_SHIFT)
-#define TMR_EMR_EMC1_SHIFT (6) /* Bits 6-7: External Match Control 1 */
-#define TMR_EMR_EMC1_MASK (3 << TMR_EMR_EMC1_SHIFT)
-# define TMR_EMR_EMC1_NOTHING (TMR_EMR_NOTHING << TMR_EMR_EMC1_SHIFT)
-# define TMR_EMR_EMC1_CLEAR (TMR_EMR_CLEAR << TMR_EMR_EMC1_SHIFT)
-# define TMR_EMR_EMC1_SET (TMR_EMR_SET << TMR_EMR_EMC1_SHIFT)
-# define TMR_EMR_EMC1_TOGGLE (TMR_EMR_TOGGLE << TMR_EMR_EMC1_SHIFT)
-#define TMR_EMR_EMC2_SHIFT (8) /* Bits 8-9: External Match Control 2 */
-#define TMR_EMR_EMC2_MASK (3 << TMR_EMR_EMC2_SHIFT)
-# define TMR_EMR_EMC2_NOTHING (TMR_EMR_NOTHING << TMR_EMR_EMC2_SHIFT)
-# define TMR_EMR_EMC2_CLEAR (TMR_EMR_CLEAR << TMR_EMR_EMC2_SHIFT)
-# define TMR_EMR_EMC2_SET (TMR_EMR_SET << TMR_EMR_EMC2_SHIFT)
-# define TMR_EMR_EMC2_TOGGLE (TMR_EMR_TOGGLE << TMR_EMR_EMC2_SHIFT)
-#define TMR_EMR_EMC3_SHIFT (10) /* Bits 10-11: External Match Control 3 */
-#define TMR_EMR_EMC3_MASK (3 << TMR_EMR_EMC3_SHIFT)
-# define TMR_EMR_EMC3_NOTHING (TMR_EMR_NOTHING << TMR_EMR_EMC3_SHIFT)
-# define TMR_EMR_EMC3_CLEAR (TMR_EMR_CLEAR << TMR_EMR_EMC3_SHIFT)
-# define TMR_EMR_EMC3_SET (TMR_EMR_SET << TMR_EMR_EMC3_SHIFT)
-# define TMR_EMR_EMC3_TOGGLE (TMR_EMR_TOGGLE << TMR_EMR_EMC3_SHIFT)
- /* Bits 12-31: Reserved */
-/* Count Control Register */
-
-#define TMR_CTCR_MODE_SHIFT (0) /* Bits 0-1: Counter/Timer Mode */
-#define TMR_CTCR_MODE_MASK (3 << TMR_CTCR_MODE_SHIFT)
-# define TMR_CTCR_MODE_TIMER (0 << TMR_CTCR_MODE_SHIFT) /* Timer Mode, prescale match */
-# define TMR_CTCR_MODE_CNTRRE (1 << TMR_CTCR_MODE_SHIFT) /* Counter Mode, CAP rising edge */
-# define TMR_CTCR_MODE_CNTRFE (2 << TMR_CTCR_MODE_SHIFT) /* Counter Mode, CAP falling edge */
-# define TMR_CTCR_MODE_CNTRBE (3 << TMR_CTCR_MODE_SHIFT) /* Counter Mode, CAP both edges */
-#define TMR_CTCR_INPSEL_SHIFT (2) /* Bits 2-3: Count Input Select */
-#define TMR_CTCR_INPSEL_MASK (3 << TMR_CTCR_INPSEL_SHIFT)
-# define TMR_CTCR_INPSEL_CAPNp0 (0 << TMR_CTCR_INPSEL_SHIFT) /* CAPn.0 for TIMERn */
-# define TMR_CTCR_INPSEL_CAPNp1 (1 << TMR_CTCR_INPSEL_SHIFT) /* CAPn.1 for TIMERn */
- /* Bits 4-31: Reserved */
-
-/************************************************************************************
- * Public Types
- ************************************************************************************/
-
-/************************************************************************************
- * Public Data
- ************************************************************************************/
-
-/************************************************************************************
- * Public Functions
- ************************************************************************************/
-
-#endif /* __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC17_TIMER_H */
diff --git a/arch/arm/src/lpc17xx/hardware/lpc17_uart.h b/arch/arm/src/lpc17xx/hardware/lpc17_uart.h
deleted file mode 100644
index 175fedacfa6..00000000000
--- a/arch/arm/src/lpc17xx/hardware/lpc17_uart.h
+++ /dev/null
@@ -1,414 +0,0 @@
-/************************************************************************************
- * arch/arm/src/lpc17xx/hardware/lpc17_uart.h
- *
- * Copyright (C) 2010, 2012-2013 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. 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.
- * 3. Neither the name NuttX 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 THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- ************************************************************************************/
-
-#ifndef __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC17_UART_H
-#define __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC17_UART_H
-
-/************************************************************************************
- * Included Files
- ************************************************************************************/
-
-#include
-
-#include "chip.h"
-#include "hardware/lpc17_memorymap.h"
-
-/************************************************************************************
- * Pre-processor Definitions
- ************************************************************************************/
-
-/* Register offsets *****************************************************************/
-
-#define LPC17_UART_RBR_OFFSET 0x0000 /* (DLAB =0) Receiver Buffer Register (all) */
-#define LPC17_UART_THR_OFFSET 0x0000 /* (DLAB =0) Transmit Holding Register (all) */
-#define LPC17_UART_DLL_OFFSET 0x0000 /* (DLAB =1) Divisor Latch LSB (all) */
-#define LPC17_UART_DLM_OFFSET 0x0004 /* (DLAB =1) Divisor Latch MSB (all) */
-#define LPC17_UART_IER_OFFSET 0x0004 /* (DLAB =0) Interrupt Enable Register (all) */
-#define LPC17_UART_IIR_OFFSET 0x0008 /* Interrupt ID Register (all) */
-#define LPC17_UART_FCR_OFFSET 0x0008 /* FIFO Control Register (all) */
-#define LPC17_UART_LCR_OFFSET 0x000c /* Line Control Register (all) */
-#define LPC17_UART_MCR_OFFSET 0x0010 /* Modem Control Register (UART1 only) */
-#define LPC17_UART_LSR_OFFSET 0x0014 /* Line Status Register (all) */
-#define LPC17_UART_MSR_OFFSET 0x0018 /* Modem Status Register (UART1 only) */
-#define LPC17_UART_SCR_OFFSET 0x001c /* Scratch Pad Register (all) */
-#define LPC17_UART_ACR_OFFSET 0x0020 /* Auto-baud Control Register (all) */
-#define LPC17_UART_ICR_OFFSET 0x0024 /* IrDA Control Register (UART0,2,3 only) */
-#define LPC17_UART_FDR_OFFSET 0x0028 /* Fractional Divider Register (all) */
-#define LPC17_UART_TER_OFFSET 0x0030 /* Transmit Enable Register (all) */
-#define LPC17_UART_RS485CTRL_OFFSET 0x004c /* RS-485/EIA-485 Control (UART1 only) */
-#define LPC17_UART_ADRMATCH_OFFSET 0x0050 /* RS-485/EIA-485 address match (UART1 only) */
-#define LPC17_UART_RS485DLY_OFFSET 0x0054 /* RS-485/EIA-485 direction control delay (UART1 only) */
-#define LPC17_UART_FIFOLVL_OFFSET 0x0058 /* FIFO Level register (all) */
-
-#ifdef LPC178x
-# define LPC17_UART_OSR_OFFSET 0x002c /* Oversampling Register (UART4 only) */
-# define LPC17_UART_SCICTRL_OFFSET 0x0048 /* Smart Card Interface Register (UART4 only) */
-# define LPC17_UART_SYNCCTRL_OFFSET 0x0058 /* Synchronous Mode Register (UART4 only) */
-#endif
-
-/* Register addresses ***************************************************************/
-
-#define LPC17_UART0_RBR (LPC17_UART0_BASE+LPC17_UART_RBR_OFFSET)
-#define LPC17_UART0_THR (LPC17_UART0_BASE+LPC17_UART_THR_OFFSET)
-#define LPC17_UART0_DLL (LPC17_UART0_BASE+LPC17_UART_DLL_OFFSET)
-#define LPC17_UART0_DLM (LPC17_UART0_BASE+LPC17_UART_DLM_OFFSET)
-#define LPC17_UART0_IER (LPC17_UART0_BASE+LPC17_UART_IER_OFFSET)
-#define LPC17_UART0_IIR (LPC17_UART0_BASE+LPC17_UART_IIR_OFFSET)
-#define LPC17_UART0_FCR (LPC17_UART0_BASE+LPC17_UART_FCR_OFFSET)
-#define LPC17_UART0_LCR (LPC17_UART0_BASE+LPC17_UART_LCR_OFFSET)
-#define LPC17_UART0_LSR (LPC17_UART0_BASE+LPC17_UART_LSR_OFFSET)
-#define LPC17_UART0_SCR (LPC17_UART0_BASE+LPC17_UART_SCR_OFFSET)
-#define LPC17_UART0_ACR (LPC17_UART0_BASE+LPC17_UART_ACR_OFFSET)
-#define LPC17_UART0_ICR (LPC17_UART0_BASE+LPC17_UART_ICR_OFFSET)
-#define LPC17_UART0_FDR (LPC17_UART0_BASE+LPC17_UART_FDR_OFFSET)
-#define LPC17_UART0_TER (LPC17_UART0_BASE+LPC17_UART_TER_OFFSET)
-
-#ifdef LPC178x
-# define LPC17_UART0_RS485CTRL (LPC17_UART0_BASE+LPC17_UART_RS485CTRL_OFFSET)
-# define LPC17_UART0_ADRMATCH (LPC17_UART0_BASE+LPC17_UART_ADRMATCH_OFFSET)
-# define LPC17_UART0_RS485DLY (LPC17_UART0_BASE+LPC17_UART_RS485DLY_OFFSET)
-#endif
-
-#define LPC17_UART0_FIFOLVL (LPC17_UART0_BASE+LPC17_UART_FIFOLVL_OFFSET)
-
-#define LPC17_UART1_RBR (LPC17_UART1_BASE+LPC17_UART_RBR_OFFSET)
-#define LPC17_UART1_THR (LPC17_UART1_BASE+LPC17_UART_THR_OFFSET)
-#define LPC17_UART1_DLL (LPC17_UART1_BASE+LPC17_UART_DLL_OFFSET)
-#define LPC17_UART1_DLM (LPC17_UART1_BASE+LPC17_UART_DLM_OFFSET)
-#define LPC17_UART1_IER (LPC17_UART1_BASE+LPC17_UART_IER_OFFSET)
-#define LPC17_UART1_IIR (LPC17_UART1_BASE+LPC17_UART_IIR_OFFSET)
-#define LPC17_UART1_FCR (LPC17_UART1_BASE+LPC17_UART_FCR_OFFSET)
-#define LPC17_UART1_LCR (LPC17_UART1_BASE+LPC17_UART_LCR_OFFSET)
-#define LPC17_UART1_MCR (LPC17_UART1_BASE+LPC17_UART_MCR_OFFSET)
-#define LPC17_UART1_LSR (LPC17_UART1_BASE+LPC17_UART_LSR_OFFSET)
-#define LPC17_UART1_MSR (LPC17_UART1_BASE+LPC17_UART_MSR_OFFSET)
-#define LPC17_UART1_SCR (LPC17_UART1_BASE+LPC17_UART_SCR_OFFSET)
-#define LPC17_UART1_ACR (LPC17_UART1_BASE+LPC17_UART_ACR_OFFSET)
-#define LPC17_UART1_FDR (LPC17_UART1_BASE+LPC17_UART_FDR_OFFSET)
-#define LPC17_UART1_TER (LPC17_UART1_BASE+LPC17_UART_TER_OFFSET)
-#define LPC17_UART1_RS485CTRL (LPC17_UART1_BASE+LPC17_UART_RS485CTRL_OFFSET)
-#define LPC17_UART1_ADRMATCH (LPC17_UART1_BASE+LPC17_UART_ADRMATCH_OFFSET)
-#define LPC17_UART1_RS485DLY (LPC17_UART1_BASE+LPC17_UART_RS485DLY_OFFSET)
-#define LPC17_UART1_FIFOLVL (LPC17_UART1_BASE+LPC17_UART_FIFOLVL_OFFSET)
-
-#define LPC17_UART2_RBR (LPC17_UART2_BASE+LPC17_UART_RBR_OFFSET)
-#define LPC17_UART2_THR (LPC17_UART2_BASE+LPC17_UART_THR_OFFSET)
-#define LPC17_UART2_DLL (LPC17_UART2_BASE+LPC17_UART_DLL_OFFSET)
-#define LPC17_UART2_DLM (LPC17_UART2_BASE+LPC17_UART_DLM_OFFSET)
-#define LPC17_UART2_IER (LPC17_UART2_BASE+LPC17_UART_IER_OFFSET)
-#define LPC17_UART2_IIR (LPC17_UART2_BASE+LPC17_UART_IIR_OFFSET)
-#define LPC17_UART2_FCR (LPC17_UART2_BASE+LPC17_UART_FCR_OFFSET)
-#define LPC17_UART2_LCR (LPC17_UART2_BASE+LPC17_UART_LCR_OFFSET)
-#define LPC17_UART2_LSR (LPC17_UART2_BASE+LPC17_UART_LSR_OFFSET)
-#define LPC17_UART2_SCR (LPC17_UART2_BASE+LPC17_UART_SCR_OFFSET)
-#define LPC17_UART2_ACR (LPC17_UART2_BASE+LPC17_UART_ACR_OFFSET)
-#define LPC17_UART2_ICR (LPC17_UART2_BASE+LPC17_UART_ICR_OFFSET)
-#define LPC17_UART2_FDR (LPC17_UART2_BASE+LPC17_UART_FDR_OFFSET)
-#define LPC17_UART2_TER (LPC17_UART2_BASE+LPC17_UART_TER_OFFSET)
-
-#ifdef LPC178x
-# define LPC17_UART2_RS485CTRL (LPC17_UART2_BASE+LPC17_UART_RS485CTRL_OFFSET)
-# define LPC17_UART2_ADRMATCH (LPC17_UART2_BASE+LPC17_UART_ADRMATCH_OFFSET)
-# define LPC17_UART2_RS485DLY (LPC17_UART2_BASE+LPC17_UART_RS485DLY_OFFSET)
-#endif
-
-#define LPC17_UART2_FIFOLVL (LPC17_UART2_BASE+LPC17_UART_FIFOLVL_OFFSET)
-
-#define LPC17_UART3_RBR (LPC17_UART3_BASE+LPC17_UART_RBR_OFFSET)
-#define LPC17_UART3_THR (LPC17_UART3_BASE+LPC17_UART_THR_OFFSET)
-#define LPC17_UART3_DLL (LPC17_UART3_BASE+LPC17_UART_DLL_OFFSET)
-#define LPC17_UART3_DLM (LPC17_UART3_BASE+LPC17_UART_DLM_OFFSET)
-#define LPC17_UART3_IER (LPC17_UART3_BASE+LPC17_UART_IER_OFFSET)
-#define LPC17_UART3_IIR (LPC17_UART3_BASE+LPC17_UART_IIR_OFFSET)
-#define LPC17_UART3_FCR (LPC17_UART3_BASE+LPC17_UART_FCR_OFFSET)
-#define LPC17_UART3_LCR (LPC17_UART3_BASE+LPC17_UART_LCR_OFFSET)
-#define LPC17_UART3_LSR (LPC17_UART3_BASE+LPC17_UART_LSR_OFFSET)
-#define LPC17_UART3_SCR (LPC17_UART3_BASE+LPC17_UART_SCR_OFFSET)
-#define LPC17_UART3_ACR (LPC17_UART3_BASE+LPC17_UART_ACR_OFFSET)
-#define LPC17_UART3_ICR (LPC17_UART3_BASE+LPC17_UART_ICR_OFFSET)
-#define LPC17_UART3_FDR (LPC17_UART3_BASE+LPC17_UART_FDR_OFFSET)
-#define LPC17_UART3_TER (LPC17_UART3_BASE+LPC17_UART_TER_OFFSET)
-
-#ifdef LPC178x
-# define LPC17_UART3_RS485CTRL (LPC17_UART3_BASE+LPC17_UART_RS485CTRL_OFFSET)
-# define LPC17_UART3_ADRMATCH (LPC17_UART3_BASE+LPC17_UART_ADRMATCH_OFFSET)
-# define LPC17_UART3_RS485DLY (LPC17_UART3_BASE+LPC17_UART_RS485DLY_OFFSET)
-#endif
-
-#define LPC17_UART3_FIFOLVL (LPC17_UART3_BASE+LPC17_UART_FIFOLVL_OFFSET)
-
-#ifdef LPC178x
-# define LPC17_UART4_RBR (LPC17_UART4_BASE+LPC17_UART_RBR_OFFSET)
-# define LPC17_UART4_THR (LPC17_UART4_BASE+LPC17_UART_THR_OFFSET)
-# define LPC17_UART4_DLL (LPC17_UART4_BASE+LPC17_UART_DLL_OFFSET)
-# define LPC17_UART4_DLM (LPC17_UART4_BASE+LPC17_UART_DLM_OFFSET)
-# define LPC17_UART4_IER (LPC17_UART4_BASE+LPC17_UART_IER_OFFSET)
-# define LPC17_UART4_IIR (LPC17_UART4_BASE+LPC17_UART_IIR_OFFSET)
-# define LPC17_UART4_FCR (LPC17_UART4_BASE+LPC17_UART_FCR_OFFSET)
-# define LPC17_UART4_LCR (LPC17_UART4_BASE+LPC17_UART_LCR_OFFSET)
-# define LPC17_UART4_LSR (LPC17_UART4_BASE+LPC17_UART_LSR_OFFSET)
-# define LPC17_UART4_SCR (LPC17_UART4_BASE+LPC17_UART_SCR_OFFSET)
-# define LPC17_UART4_ACR (LPC17_UART4_BASE+LPC17_UART_ACR_OFFSET)
-# define LPC17_UART4_ICR (LPC17_UART4_BASE+LPC17_UART_ICR_OFFSET)
-# define LPC17_UART4_FDR (LPC17_UART4_BASE+LPC17_UART_FDR_OFFSET)
-# define LPC17_UART4_TER (LPC17_UART4_BASE+LPC17_UART_TER_OFFSET)
-# define LPC17_UART4_RS485CTRL (LPC17_UART4_BASE+LPC17_UART_RS485CTRL_OFFSET)
-# define LPC17_UART4_ADRMATCH (LPC17_UART4_BASE+LPC17_UART_ADRMATCH_OFFSET)
-# define LPC17_UART4_RS485DLY (LPC17_UART4_BASE+LPC17_UART_RS485DLY_OFFSET)
-# define LPC17_UART4_FIFOLVL (LPC17_UART4_BASE+LPC17_UART_FIFOLVL_OFFSET)
-# define LPC17_UART4_OSR (LPC17_UART4_BASE+LPC17_UART4_OSR_OFFSET)
-# define LPC17_UART4_SCICTRL (LPC17_UART4_BASE+LPC17_UART4_SCICTRL_OFFSET)
-# define LPC17_UART4_SYNCCTRL (LPC17_UART4_BASE+LPC17_UART4_SYNCCTRL_OFFSET)
-#endif
-
-/* Register bit definitions *********************************************************/
-
-/* RBR (DLAB =0) Receiver Buffer Register (all) */
-
-#define UART_RBR_MASK (0xff) /* Bits 0-7: Oldest received byte in RX FIFO */
- /* Bits 8-31: Reserved */
-
-/* THR (DLAB =0) Transmit Holding Register (all) */
-
-#define UART_THR_MASK (0xff) /* Bits 0-7: Adds byte to TX FIFO */
- /* Bits 8-31: Reserved */
-
-/* DLL (DLAB =1) Divisor Latch LSB (all) */
-
-#define UART_DLL_MASK (0xff) /* Bits 0-7: DLL */
- /* Bits 8-31: Reserved */
-
-/* DLM (DLAB =1) Divisor Latch MSB (all) */
-
-#define UART_DLM_MASK (0xff) /* Bits 0-7: DLM */
- /* Bits 8-31: Reserved */
-
-/* IER (DLAB =0) Interrupt Enable Register (all) */
-
-#define UART_IER_RBRIE (1 << 0) /* Bit 0: RBR Interrupt Enable */
-#define UART_IER_THREIE (1 << 1) /* Bit 1: THRE Interrupt Enable */
-#define UART_IER_RLSIE (1 << 2) /* Bit 2: RX Line Status Interrupt Enable */
-#define UART_IER_MSIE (1 << 3) /* Bit 3: Modem Status Interrupt Enable (UART1 only) */
- /* Bits 4-6: Reserved */
-#define UART_IER_CTSIE (1 << 7) /* Bit 7: CTS transition interrupt (UART1 only) */
-#define UART_IER_ABEOIE (1 << 8) /* Bit 8: Enables the end of auto-baud interrupt */
-#define UART_IER_ABTOIE (1 << 9) /* Bit 9: Enables the auto-baud time-out interrupt */
- /* Bits 10-31: Reserved */
-#define UART_IER_ALLIE (0x038f)
-
-/* IIR Interrupt ID Register (all) */
-
-#define UART_IIR_INTSTATUS (1 << 0) /* Bit 0: Interrupt status (active low) */
-#define UART_IIR_INTID_SHIFT (1) /* Bits 1-3: Interrupt identification */
-#define UART_IIR_INTID_MASK (7 << UART_IIR_INTID_SHIFT)
-# define UART_IIR_INTID_MSI (0 << UART_IIR_INTID_SHIFT) /* Modem Status (UART1 only) */
-# define UART_IIR_INTID_THRE (1 << UART_IIR_INTID_SHIFT) /* THRE Interrupt */
-# define UART_IIR_INTID_RDA (2 << UART_IIR_INTID_SHIFT) /* 2a - Receive Data Available (RDA) */
-# define UART_IIR_INTID_RLS (3 << UART_IIR_INTID_SHIFT) /* 1 - Receive Line Status (RLS) */
-# define UART_IIR_INTID_CTI (6 << UART_IIR_INTID_SHIFT) /* 2b - Character Time-out Indicator (CTI) */
- /* Bits 4-5: Reserved */
-#define UART_IIR_FIFOEN_SHIFT (6) /* Bits 6-7: Copies of FCR bit 0 */
-#define UART_IIR_FIFOEN_MASK (3 << UART_IIR_FIFOEN_SHIFT)
-#define UART_IIR_ABEOINT (1 << 8) /* Bit 8: End of auto-baud interrupt */
-#define UART_IIR_ABTOINT (1 << 9) /* Bit 9: Auto-baud time-out interrupt */
- /* Bits 10-31: Reserved */
-/* FCR FIFO Control Register (all) */
-
-#define UART_FCR_FIFOEN (1 << 0) /* Bit 0: Enable FIFOs */
-#define UART_FCR_RXRST (1 << 1) /* Bit 1: RX FIFO Reset */
-#define UART_FCR_TXRST (1 << 2) /* Bit 2: TX FIFO Reset */
-#define UART_FCR_DMAMODE (1 << 3) /* Bit 3: DMA Mode Select */
- /* Bits 4-5: Reserved */
-#define UART_FCR_RXTRIGGER_SHIFT (6) /* Bits 6-7: RX Trigger Level */
-#define UART_FCR_RXTRIGGER_MASK (3 << UART_FCR_RXTRIGGER_SHIFT)
-# define UART_FCR_RXTRIGGER_0 (0 << UART_FCR_RXTRIGGER_SHIFT) /* Trigger level 0 (1 character) */
-# define UART_FCR_RXTRIGGER_4 (1 << UART_FCR_RXTRIGGER_SHIFT) /* Trigger level 1 (4 characters) */
-# define UART_FCR_RXTRIGGER_8 (2 << UART_FCR_RXTRIGGER_SHIFT) /* Trigger level 2 (8 characters) */
-# define UART_FCR_RXTRIGGER_14 (3 << UART_FCR_RXTRIGGER_SHIFT) /* Trigger level 3 (14 characters) */
- /* Bits 8-31: Reserved */
-/* LCR Line Control Register (all) */
-
-#define UART_LCR_WLS_SHIFT (0) /* Bit 0-1: Word Length Select */
-#define UART_LCR_WLS_MASK (3 << UART_LCR_WLS_SHIFT)
-# define UART_LCR_WLS_5BIT (0 << UART_LCR_WLS_SHIFT)
-# define UART_LCR_WLS_6BIT (1 << UART_LCR_WLS_SHIFT)
-# define UART_LCR_WLS_7BIT (2 << UART_LCR_WLS_SHIFT)
-# define UART_LCR_WLS_8BIT (3 << UART_LCR_WLS_SHIFT)
-#define UART_LCR_STOP (1 << 2) /* Bit 2: Stop Bit Select */
-#define UART_LCR_PE (1 << 3) /* Bit 3: Parity Enable */
-#define UART_LCR_PS_SHIFT (4) /* Bits 4-5: Parity Select */
-#define UART_LCR_PS_MASK (3 << UART_LCR_PS_SHIFT)
-# define UART_LCR_PS_ODD (0 << UART_LCR_PS_SHIFT) /* Odd parity */
-# define UART_LCR_PS_EVEN (1 << UART_LCR_PS_SHIFT) /* Even Parity */
-# define UART_LCR_PS_STICK1 (2 << UART_LCR_PS_SHIFT) /* Forced "1" stick parity */
-# define UART_LCR_PS_STICK0 (3 << UART_LCR_PS_SHIFT) /* Forced "0" stick parity */
-#define UART_LCR_BRK (1 << 6) /* Bit 6: Break Control */
-#define UART_LCR_DLAB (1 << 7) /* Bit 7: Divisor Latch Access Bit (DLAB) */
- /* Bits 8-31: Reserved */
-/* MCR Modem Control Register (UART1 only) */
-
-#define UART_MCR_DTR (1 << 0) /* Bit 0: DTR Control Source for DTR output */
-#define UART_MCR_RTS (1 << 1) /* Bit 1: Control Source for RTS output */
- /* Bits 2-3: Reserved */
-#define UART_MCR_LPBK (1 << 4) /* Bit 4: Loopback Mode Select */
- /* Bit 5: Reserved */
-#define UART_MCR_RTSEN (1 << 6) /* Bit 6: Enable auto-rts flow control */
-#define UART_MCR_CTSEN (1 << 7) /* Bit 7: Enable auto-cts flow control */
- /* Bits 8-31: Reserved */
-/* LSR Line Status Register (all) */
-
-#define UART_LSR_RDR (1 << 0) /* Bit 0: Receiver Data Ready */
-#define UART_LSR_OE (1 << 1) /* Bit 1: Overrun Error */
-#define UART_LSR_PE (1 << 2) /* Bit 2: Parity Error */
-#define UART_LSR_FE (1 << 3) /* Bit 3: Framing Error */
-#define UART_LSR_BI (1 << 4) /* Bit 4: Break Interrupt */
-#define UART_LSR_THRE (1 << 5) /* Bit 5: Transmitter Holding Register Empty */
-#define UART_LSR_TEMT (1 << 6) /* Bit 6: Transmitter Empty */
-#define UART_LSR_RXFE (1 << 7) /* Bit 7: Error in RX FIFO (RXFE) */
- /* Bits 8-31: Reserved */
-/* MSR Modem Status Register (UART1 only) */
-
-#define UART_MSR_DELTACTS (1 << 0) /* Bit 0: CTS state change */
-#define UART_MSR_DELTADSR (1 << 1) /* Bit 1: DSR state change */
-#define UART_MSR_RIEDGE (1 << 2) /* Bit 2: RI ow to high transition */
-#define UART_MSR_DELTADCD (1 << 3) /* Bit 3: DCD state change */
-#define UART_MSR_CTS (1 << 4) /* Bit 4: CTS State */
-#define UART_MSR_DSR (1 << 5) /* Bit 5: DSR State */
-#define UART_MSR_RI (1 << 6) /* Bit 6: Ring Indicator State */
-#define UART_MSR_DCD (1 << 7) /* Bit 7: Data Carrier Detect State */
- /* Bits 8-31: Reserved */
-/* SCR Scratch Pad Register (all) */
-
-#define UART_SCR_MASK (0xff) /* Bits 0-7: SCR data */
- /* Bits 8-31: Reserved */
-/* ACR Auto-baud Control Register (all) */
-
-#define UART_ACR_START (1 << 0) /* Bit 0: Auto-baud start/running*/
-#define UART_ACR_MODE (1 << 1) /* Bit 1: Auto-baud mode select*/
-#define UART_ACR_AUTORESTART (1 << 2) /* Bit 2: Restart in case of time-out*/
- /* Bits 3-7: Reserved */
-#define UART_ACR_ABEOINTCLR (1 << 8) /* Bit 8: End of auto-baud interrupt clear */
-#define UART_ACR_ABTOINTCLRT (1 << 9) /* Bit 9: Auto-baud time-out interrupt clear */
- /* Bits 10-31: Reserved */
-/* ICA IrDA Control Register (UART0,2,3 only) */
-
-#define UART_ICR_IRDAEN (1 << 0) /* Bit 0: Enable IrDA mode */
-#define UART_ICR_IRDAINV (1 << 1) /* Bit 1: Invert serial input */
-#define UART_ICR_FIXPULSEEN (1 << 2) /* Bit 2: Enable IrDA fixed pulse width mode */
-#define UART_ICR_PULSEDIV_SHIFT (3) /* Bits 3-5: Configures the pulse when FixPulseEn = 1 */
-#define UART_ICR_PULSEDIV_MASK (7 << UART_ICR_PULSEDIV_SHIFT)
-# define UART_ICR_PULSEDIV_2TPCLK (0 << UART_ICR_PULSEDIV_SHIFT) /* 2 x TPCLK */
-# define UART_ICR_PULSEDIV_4TPCLK (1 << UART_ICR_PULSEDIV_SHIFT) /* 4 x TPCLK */
-# define UART_ICR_PULSEDIV_8TPCLK (2 << UART_ICR_PULSEDIV_SHIFT) /* 8 x TPCLK */
-# define UART_ICR_PULSEDIV_16TPCLK (3 << UART_ICR_PULSEDIV_SHIFT) /* 16 x TPCLK */
-# define UART_ICR_PULSEDIV_32TPCLK (4 << UART_ICR_PULSEDIV_SHIFT) /* 32 x TPCLK */
-# define UART_ICR_PULSEDIV_64TPCLK (5 << UART_ICR_PULSEDIV_SHIFT) /* 64 x TPCLK */
-# define UART_ICR_PULSEDIV_128TPCLK (6 << UART_ICR_PULSEDIV_SHIFT) /* 128 x TPCLK */
-# define UART_ICR_PULSEDIV_256TPCLK (7 << UART_ICR_PULSEDIV_SHIFT) /* 246 x TPCLK */
- /* Bits 6-31: Reserved */
-/* FDR Fractional Divider Register (all) */
-
-#define UART_FDR_DIVADDVAL_SHIFT (0) /* Bits 0-3: Baud-rate generation pre-scaler divisor value */
-#define UART_FDR_DIVADDVAL_MASK (15 << UART_FDR_DIVADDVAL_SHIFT)
-#define UART_FDR_MULVAL_SHIFT (4) /* Bits 4-7 Baud-rate pre-scaler multiplier value */
-#define UART_FDR_MULVAL_MASK (15 << UART_FDR_MULVAL_SHIFT)
- /* Bits 8-31: Reserved */
-/* TER Transmit Enable Register (all) */
- /* Bits 0-6: Reserved */
-#define UART_TER_TXEN (1 << 7) /* Bit 7: TX Enable */
- /* Bits 8-31: Reserved */
-/* RS-485/EIA-485 Control (UART1 only) */
-
-#define UART_RS485CTRL_NMMEN (1 << 0) /* Bit 0: RS-485/EIA-485 Normal Multidrop Mode (NMM) enabled */
-#define UART_RS485CTRL_RXDIS (1 << 1) /* Bit 1: Receiver is disabled */
-#define UART_RS485CTRL_AADEN (1 << 2) /* Bit 2: Auto Address Detect (AAD) is enabled */
-#define UART_RS485CTRL_SEL (1 << 3) /* Bit 3: RTS/DTR used for direction control (DCTRL=1) */
-#define UART_RS485CTRL_DCTRL (1 << 4) /* Bit 4: Enable Auto Direction Control */
-#define UART_RS485CTRL_OINV (1 << 5) /* Bit 5: Polarity of the direction control signal on RTS/DTR */
- /* Bits 6-31: Reserved */
-/* RS-485/EIA-485 address match (UART1 only) */
-
-#define UART_ADRMATCH_MASK (0xff) /* Bits 0-7: Address match value */
- /* Bits 8-31: Reserved */
-/* RS-485/EIA-485 direction control delay (UART1 only) */
-
-#define UART_RS485DLY_MASK (0xff) /* Bits 0-7: Direction control (RTS/DTR) delay */
- /* Bits 8-31: Reserved */
-/* FIFOLVL FIFO Level register (all) */
-
-#define UART_FIFOLVL_RX_SHIFT (0) /* Bits 0-3: Current level of the UART RX FIFO */
-#define UART_FIFOLVL_RX_MASK (15 << UART_FIFOLVL_RX_SHIFT)
- /* Bits 4-7: Reserved */
-#define UART_FIFOLVL_TX_SHIFT (8) /* Bits 8-11: Current level of the UART TX FIFO */
-#define UART_FIFOLVL_TX_MASK (15 << UART_FIFOLVL_TX_SHIFT)
- /* Bits 12-31: Reserved */
-
-/* SCICTL Smart Card Interface (UART4 only) */
-
-#ifdef LPC178x
-# define UART_SCIEN (1 << 0) /* Bit 0: Smart Card Interface enable */
-# define UART_NACKDIS (1 << 1) /* Bit 1: NACK response disable.Applicable if PROTSEL=0 */
-# define UART_PROTSEL (1 << 2) /* Bit 2: Protocol Selection ISO7816-3 */
-# define UART_TXRETRY (7 << 5) /* Bits 5-7: Maximum number of Re-Transmission */
-# define UART_GUARDTIME_SHIFT (8) /* Bits 8-15: Extra guard time */
-# define UART_GUARDTIME_MASK (0xff << UART_GUARDTIME_SHIFT)
- /* Bits 16-31: Reserved */
-#endif
-
-/* OSR Oversampling Register (UART4 only) */
-
-#ifdef LPC178x
- /* Bit 0: Reserved */
-# define UART_OSFRAC (7 << 1) /* Bits 1-3: Fractional part of Oversampling Ratio */
-# define UART_OSINT_SHIFT (4) /* Bits 4-7: Integer part of (Oversampling Ratio -1) */
-# define UART_OSINT_MASK (0x0f << UART_OSINT_SHIFT)
-# define UART_FDINT_SHIFT (8) /* Bits 8-14: OSINT extension in Smart Card mode */
-# define UART_FDINT_MASK (0x7f << UART_FDINT_SHIFT)
- /* Bits 15-31: Reserved */
-#endif
-
-/************************************************************************************
- * Public Types
- ************************************************************************************/
-
-/************************************************************************************
- * Public Data
- ************************************************************************************/
-
-/************************************************************************************
- * Public Functions
- ************************************************************************************/
-
-#endif /* __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC17_UART_H */
diff --git a/arch/arm/src/lpc17xx/hardware/lpc17_usb.h b/arch/arm/src/lpc17xx/hardware/lpc17_usb.h
deleted file mode 100644
index 56b38e55a09..00000000000
--- a/arch/arm/src/lpc17xx/hardware/lpc17_usb.h
+++ /dev/null
@@ -1,778 +0,0 @@
-/************************************************************************************
- * arch/arm/src/lpc17xx/hardware/lpc17_usb.h
- *
- * Copyright (C) 2010, 2013 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. 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.
- * 3. Neither the name NuttX 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 THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- ************************************************************************************/
-
-#ifndef __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC17_USB_H
-#define __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC17_USB_H
-
-/************************************************************************************
- * Included Files
- ************************************************************************************/
-
-#include
-#include
-
-#include "chip.h"
-#include "hardware/lpc17_memorymap.h"
-
-/************************************************************************************
- * Pre-processor Definitions
- ************************************************************************************/
-
-/* Register offsets *****************************************************************/
-/* USB Host Controller (OHCI) *******************************************************/
-/* See include/nuttx/usb/ohci.h */
-
-#define LPC17_USBHOST_MODID_OFFSET 0x00fc /* Module ID/Revision ID */
-
-/* USB OTG Controller ***************************************************************/
-/* OTG registers */
-
-#define LPC17_USBOTG_INTST_OFFSET 0x0100 /* OTG Interrupt Status */
-#define LPC17_USBOTG_INTEN_OFFSET 0x0104 /* OTG Interrupt Enable */
-#define LPC17_USBOTG_INTSET_OFFSET 0x0108 /* OTG Interrupt Set */
-#define LPC17_USBOTG_INTCLR_OFFSET 0x010c /* OTG Interrupt Clear */
-#define LPC17_USBOTG_STCTRL_OFFSET 0x0110 /* OTG Status and Control */
-#define LPC17_USBOTG_TMR_OFFSET 0x0114 /* OTG Timer */
-
-/* USB Device Controller ************************************************************/
-/* Device interrupt registers. See also SYSCON_USBINTST in lpc17_syscon.h */
-
-#define LPC17_USBDEV_INTST_OFFSET 0x0200 /* USB Device Interrupt Status */
-#define LPC17_USBDEV_INTEN_OFFSET 0x0204 /* USB Device Interrupt Enable */
-#define LPC17_USBDEV_INTCLR_OFFSET 0x0208 /* USB Device Interrupt Clear */
-#define LPC17_USBDEV_INTSET_OFFSET 0x020c /* USB Device Interrupt Set */
-
-/* SIE Command registers */
-
-#define LPC17_USBDEV_CMDCODE_OFFSET 0x0210 /* USB Command Code */
-#define LPC17_USBDEV_CMDDATA_OFFSET 0x0214 /* USB Command Data */
-
-/* USB transfer registers */
-
-#define LPC17_USBDEV_RXDATA_OFFSET 0x0218 /* USB Receive Data */
-#define LPC17_USBDEV_RXPLEN_OFFSET 0x0220 /* USB Receive Packet Length */
-#define LPC17_USBDEV_TXDATA_OFFSET 0x021c /* USB Transmit Data */
-#define LPC17_USBDEV_TXPLEN_OFFSET 0x0224 /* USB Transmit Packet Length */
-#define LPC17_USBDEV_CTRL_OFFSET 0x0228 /* USB Control */
-
-/* More Device interrupt registers */
-
-#define LPC17_USBDEV_INTPRI_OFFSET 0x022c /* USB Device Interrupt Priority */
-
-/* Endpoint interrupt registers */
-
-#define LPC17_USBDEV_EPINTST_OFFSET 0x0230 /* USB Endpoint Interrupt Status */
-#define LPC17_USBDEV_EPINTEN_OFFSET 0x0234 /* USB Endpoint Interrupt Enable */
-#define LPC17_USBDEV_EPINTCLR_OFFSET 0x0238 /* USB Endpoint Interrupt Clear */
-#define LPC17_USBDEV_EPINTSET_OFFSET 0x023c /* USB Endpoint Interrupt Set */
-#define LPC17_USBDEV_EPINTPRI_OFFSET 0x0240 /* USB Endpoint Priority */
-
-/* Endpoint realization registers */
-
-#define LPC17_USBDEV_REEP_OFFSET 0x0244 /* USB Realize Endpoint */
-#define LPC17_USBDEV_EPIND_OFFSET 0x0248 /* USB Endpoint Index */
-#define LPC17_USBDEV_MAXPSIZE_OFFSET 0x024c /* USB MaxPacketSize */
-
-/* DMA registers */
-
-#define LPC17_USBDEV_DMARST_OFFSET 0x0250 /* USB DMA Request Status */
-#define LPC17_USBDEV_DMARCLR_OFFSET 0x0254 /* USB DMA Request Clear */
-#define LPC17_USBDEV_DMARSET_OFFSET 0x0258 /* USB DMA Request Set */
-#define LPC17_USBDEV_UDCAH_OFFSET 0x0280 /* USB UDCA Head */
-#define LPC17_USBDEV_EPDMAST_OFFSET 0x0284 /* USB Endpoint DMA Status */
-#define LPC17_USBDEV_EPDMAEN_OFFSET 0x0288 /* USB Endpoint DMA Enable */
-#define LPC17_USBDEV_EPDMADIS_OFFSET 0x028c /* USB Endpoint DMA Disable */
-#define LPC17_USBDEV_DMAINTST_OFFSET 0x0290 /* USB DMA Interrupt Status */
-#define LPC17_USBDEV_DMAINTEN_OFFSET 0x0294 /* USB DMA Interrupt Enable */
-#define LPC17_USBDEV_EOTINTST_OFFSET 0x02a0 /* USB End of Transfer Interrupt Status */
-#define LPC17_USBDEV_EOTINTCLR_OFFSET 0x02a4 /* USB End of Transfer Interrupt Clear */
-#define LPC17_USBDEV_EOTINTSET_OFFSET 0x02a8 /* USB End of Transfer Interrupt Set */
-#define LPC17_USBDEV_NDDRINTST_OFFSET 0x02ac /* USB New DD Request Interrupt Status */
-#define LPC17_USBDEV_NDDRINTCLR_OFFSET 0x02b0 /* USB New DD Request Interrupt Clear */
-#define LPC17_USBDEV_NDDRINTSET_OFFSET 0x02b4 /* USB New DD Request Interrupt Set */
-#define LPC17_USBDEV_SYSERRINTST_OFFSET 0x02b8 /* USB System Error Interrupt Status */
-#define LPC17_USBDEV_SYSERRINTCLR_OFFSET 0x02bc /* USB System Error Interrupt Clear */
-#define LPC17_USBDEV_SYSERRINTSET_OFFSET 0x02c0 /* USB System Error Interrupt Set */
-
-/* OTG I2C registers ****************************************************************/
-
-#define LPC17_OTGI2C_RX_OFFSET 0x0300 /* I2C Receive */
-#define LPC17_OTGI2C_TX_OFFSET 0x0300 /* I2C Transmit */
-#define LPC17_OTGI2C_STS_OFFSET 0x0304 /* I2C Status */
-#define LPC17_OTGI2C_CTL_OFFSET 0x0308 /* I2C Control */
-#define LPC17_OTGI2C_CLKHI_OFFSET 0x030c /* I2C Clock High */
-#define LPC17_OTGI2C_CLKLO_OFFSET 0x0310 /* I2C Clock Low */
-
-/* Clock control registers ***********************************************************/
-
-#define LPC17_USBOTG_CLKCTRL_OFFSET 0x0ff4 /* OTG clock controller */
-#define LPC17_USBOTG_CLKST_OFFSET 0x0ff8 /* OTG clock status */
-
-#define LPC17_USBDEV_CLKCTRL_OFFSET 0x0ff4 /* USB Clock Control */
-#define LPC17_USBDEV_CLKST_OFFSET 0x0ff8 /* USB Clock Status */
-
-/* Register addresses ***************************************************************/
-/* USB Host Controller (OHCI) *******************************************************/
-/* Control and status registers (section 7.1) */
-
-#define LPC17_USBHOST_HCIREV (LPC17_USB_BASE+OHCI_HCIREV_OFFSET)
-#define LPC17_USBHOST_CTRL (LPC17_USB_BASE+OHCI_CTRL_OFFSET)
-#define LPC17_USBHOST_CMDST (LPC17_USB_BASE+OHCI_CMDST_OFFSET)
-#define LPC17_USBHOST_INTST (LPC17_USB_BASE+OHCI_INTST_OFFSET)
-#define LPC17_USBHOST_INTEN (LPC17_USB_BASE+OHCI_INTEN_OFFSET)
-#define LPC17_USBHOST_INTDIS (LPC17_USB_BASE+OHCI_INTDIS_OFFSET)
-
-/* Memory pointers (section 7.2) */
-
-#define LPC17_USBHOST_HCCA (LPC17_USB_BASE+OHCI_HCCA_OFFSET)
-#define LPC17_USBHOST_PERED (LPC17_USB_BASE+OHCI_PERED_OFFSET)
-#define LPC17_USBHOST_CTRLHEADED (LPC17_USB_BASE+OHCI_CTRLHEADED_OFFSET)
-#define LPC17_USBHOST_CTRLED (LPC17_USB_BASE+OHCI_CTRLED_OFFSET)
-#define LPC17_USBHOST_BULKHEADED (LPC17_USB_BASE+OHCI_BULKHEADED_OFFSET)
-#define LPC17_USBHOST_BULKED (LPC17_USB_BASE+OHCI_BULKED_OFFSET)
-#define LPC17_USBHOST_DONEHEAD (LPC17_USB_BASE+OHCI_DONEHEAD_OFFSET)
-
-/* Frame counters (section 7.3) */
-
-#define LPC17_USBHOST_FMINT (LPC17_USB_BASE+OHCI_FMINT_OFFSET)
-#define LPC17_USBHOST_FMREM (LPC17_USB_BASE+OHCI_FMREM_OFFSET)
-#define LPC17_USBHOST_FMNO (LPC17_USB_BASE+OHCI_FMNO_OFFSET)
-#define LPC17_USBHOST_PERSTART (LPC17_USB_BASE+OHCI_PERSTART_OFFSET)
-
-/* Root hub ports (section 7.4) */
-
-#define LPC17_USBHOST_LSTHRES (LPC17_USB_BASE+OHCI_LSTHRES_OFFSET)
-#define LPC17_USBHOST_RHDESCA (LPC17_USB_BASE+OHCI_RHDESCA_OFFSET)
-#define LPC17_USBHOST_RHDESCB (LPC17_USB_BASE+OHCI_RHDESCB_OFFSET)
-#define LPC17_USBHOST_RHSTATUS (LPC17_USB_BASE+OHCI_RHSTATUS_OFFSET)
-#define LPC17_USBHOST_RHPORTST1 (LPC17_USB_BASE+OHCI_RHPORTST1_OFFSET)
-#define LPC17_USBHOST_RHPORTST2 (LPC17_USB_BASE+OHCI_RHPORTST2_OFFSET)
-#define LPC17_USBHOST_MODID (LPC17_USB_BASE+LPC17_USBHOST_MODID_OFFSET)
-
-/* USB OTG Controller ***************************************************************/
-/* OTG registers */
-
-#define LPC17_USBOTG_INTST (LPC17_USB_BASE+LPC17_USBOTG_INTST_OFFSET)
-#define LPC17_USBOTG_INTEN (LPC17_USB_BASE+LPC17_USBOTG_INTEN_OFFSET)
-#define LPC17_USBOTG_INTSET (LPC17_USB_BASE+LPC17_USBOTG_INTSET_OFFSET)
-#define LPC17_USBOTG_INTCLR (LPC17_USB_BASE+LPC17_USBOTG_INTCLR_OFFSET)
-#define LPC17_USBOTG_STCTRL (LPC17_USB_BASE+LPC17_USBOTG_STCTRL_OFFSET)
-#define LPC17_USBOTG_TMR (LPC17_USB_BASE+LPC17_USBOTG_TMR_OFFSET)
-
-/* USB Device Controller ************************************************************/
-/* Device interrupt registers. See also SYSCON_USBINTST in lpc17_syscon.h */
-
-#define LPC17_USBDEV_INTST (LPC17_USB_BASE+LPC17_USBDEV_INTST_OFFSET)
-#define LPC17_USBDEV_INTEN (LPC17_USB_BASE+LPC17_USBDEV_INTEN_OFFSET)
-#define LPC17_USBDEV_INTCLR (LPC17_USB_BASE+LPC17_USBDEV_INTCLR_OFFSET)
-#define LPC17_USBDEV_INTSET (LPC17_USB_BASE+LPC17_USBDEV_INTSET_OFFSET)
-
-/* SIE Command registers */
-
-#define LPC17_USBDEV_CMDCODE (LPC17_USB_BASE+LPC17_USBDEV_CMDCODE_OFFSET)
-#define LPC17_USBDEV_CMDDATA (LPC17_USB_BASE+LPC17_USBDEV_CMDDATA_OFFSET)
-
-/* USB transfer registers */
-
-#define LPC17_USBDEV_RXDATA (LPC17_USB_BASE+LPC17_USBDEV_RXDATA_OFFSET)
-#define LPC17_USBDEV_RXPLEN (LPC17_USB_BASE+LPC17_USBDEV_RXPLEN_OFFSET)
-#define LPC17_USBDEV_TXDATA (LPC17_USB_BASE+LPC17_USBDEV_TXDATA_OFFSET)
-#define LPC17_USBDEV_TXPLEN (LPC17_USB_BASE+LPC17_USBDEV_TXPLEN_OFFSET)
-#define LPC17_USBDEV_CTRL (LPC17_USB_BASE+LPC17_USBDEV_CTRL_OFFSET)
-
-/* More Device interrupt registers */
-
-#define LPC17_USBDEV_INTPRI (LPC17_USB_BASE+LPC17_USBDEV_INTPRI_OFFSET)
-
-/* Endpoint interrupt registers */
-
-#define LPC17_USBDEV_EPINTST (LPC17_USB_BASE+LPC17_USBDEV_EPINTST_OFFSET)
-#define LPC17_USBDEV_EPINTEN (LPC17_USB_BASE+LPC17_USBDEV_EPINTEN_OFFSET)
-#define LPC17_USBDEV_EPINTCLR (LPC17_USB_BASE+LPC17_USBDEV_EPINTCLR_OFFSET)
-#define LPC17_USBDEV_EPINTSET (LPC17_USB_BASE+LPC17_USBDEV_EPINTSET_OFFSET)
-#define LPC17_USBDEV_EPINTPRI (LPC17_USB_BASE+LPC17_USBDEV_EPINTPRI_OFFSET)
-
-/* Endpoint realization registers */
-
-#define LPC17_USBDEV_REEP (LPC17_USB_BASE+LPC17_USBDEV_REEP_OFFSET)
-#define LPC17_USBDEV_EPIND (LPC17_USB_BASE+LPC17_USBDEV_EPIND_OFFSET)
-#define LPC17_USBDEV_MAXPSIZE (LPC17_USB_BASE+LPC17_USBDEV_MAXPSIZE_OFFSET)
-
-/* DMA registers */
-
-#define LPC17_USBDEV_DMARST (LPC17_USB_BASE+LPC17_USBDEV_DMARST_OFFSET)
-#define LPC17_USBDEV_DMARCLR (LPC17_USB_BASE+LPC17_USBDEV_DMARCLR_OFFSET)
-#define LPC17_USBDEV_DMARSET (LPC17_USB_BASE+LPC17_USBDEV_DMARSET_OFFSET)
-#define LPC17_USBDEV_UDCAH (LPC17_USB_BASE+LPC17_USBDEV_UDCAH_OFFSET)
-#define LPC17_USBDEV_EPDMAST (LPC17_USB_BASE+LPC17_USBDEV_EPDMAST_OFFSET)
-#define LPC17_USBDEV_EPDMAEN (LPC17_USB_BASE+LPC17_USBDEV_EPDMAEN_OFFSET)
-#define LPC17_USBDEV_EPDMADIS (LPC17_USB_BASE+LPC17_USBDEV_EPDMADIS_OFFSET)
-#define LPC17_USBDEV_DMAINTST (LPC17_USB_BASE+LPC17_USBDEV_DMAINTST_OFFSET)
-#define LPC17_USBDEV_DMAINTEN (LPC17_USB_BASE+LPC17_USBDEV_DMAINTEN_OFFSET)
-#define LPC17_USBDEV_EOTINTST (LPC17_USB_BASE+LPC17_USBDEV_EOTINTST_OFFSET)
-#define LPC17_USBDEV_EOTINTCLR (LPC17_USB_BASE+LPC17_USBDEV_EOTINTCLR_OFFSET)
-#define LPC17_USBDEV_EOTINTSET (LPC17_USB_BASE+LPC17_USBDEV_EOTINTSET_OFFSET)
-#define LPC17_USBDEV_NDDRINTST (LPC17_USB_BASE+LPC17_USBDEV_NDDRINTST_OFFSET)
-#define LPC17_USBDEV_NDDRINTCLR (LPC17_USB_BASE+LPC17_USBDEV_NDDRINTCLR_OFFSET)
-#define LPC17_USBDEV_NDDRINTSET (LPC17_USB_BASE+LPC17_USBDEV_NDDRINTSET_OFFSET)
-#define LPC17_USBDEV_SYSERRINTST (LPC17_USB_BASE+LPC17_USBDEV_SYSERRINTST_OFFSET)
-#define LPC17_USBDEV_SYSERRINTCLR (LPC17_USB_BASE+LPC17_USBDEV_SYSERRINTCLR_OFFSET)
-#define LPC17_USBDEV_SYSERRINTSET (LPC17_USB_BASE+LPC17_USBDEV_SYSERRINTSET_OFFSET)
-
-/* OTG I2C registers ****************************************************************/
-
-#define LPC17_OTGI2C_RX (LPC17_USB_BASE+LPC17_OTGI2C_RX_OFFSET)
-#define LPC17_OTGI2C_TX (LPC17_USB_BASE+LPC17_OTGI2C_TX_OFFSET)
-#define LPC17_OTGI2C_STS (LPC17_USB_BASE+LPC17_OTGI2C_STS_OFFSET)
-#define LPC17_OTGI2C_CTL (LPC17_USB_BASE+LPC17_OTGI2C_CTL_OFFSET)
-#define LPC17_OTGI2C_CLKHI (LPC17_USB_BASE+LPC17_OTGI2C_CLKHI_OFFSET)
-#define LPC17_OTGI2C_CLKLO (LPC17_USB_BASE+LPC17_OTGI2C_CLKLO_OFFSET)
-
-/* Clock control registers ***********************************************************/
-
-#define LPC17_USBOTG_CLKCTRL (LPC17_USB_BASE+LPC17_USBOTG_CLKCTRL_OFFSET)
-#define LPC17_USBOTG_CLKST (LPC17_USB_BASE+LPC17_USBOTG_CLKST_OFFSET)
-
-#define LPC17_USBDEV_CLKCTRL (LPC17_USB_BASE+LPC17_USBDEV_CLKCTRL_OFFSET)
-#define LPC17_USBDEV_CLKST (LPC17_USB_BASE+LPC17_USBDEV_CLKST_OFFSET)
-
-/* Register bit definitions *********************************************************/
-/* USB Host Controller (OHCI) *******************************************************/
-/* See include/nuttx/usb/ohci.h */
-
-/* Module ID/Revision ID */
-
-#define USBHOST_MODID_VER_SHIFT (0) /* Bits 0-7: Unique version number */
-#define USBHOST_MODID_VER_MASK (0xff << USBHOST_MODID_VER_SHIFT)
-#define USBHOST_MODID_REV_SHIFT (8) /* Bits 9-15: Unique revision number */
-#define USBHOST_MODID_REV_MASK (0xff << USBHOST_MODID_REV_SHIFT)
-#define USBHOST_MODID_3505_SHIFT (16) /* Bits 16-31: 0x3505 */
-#define USBHOST_MODID_3505_MASK (0xffff << USBHOST_MODID_3505_SHIFT)
-# define USBHOST_MODID_3505 (0x3505 << USBHOST_MODID_3505_SHIFT)
-
-/* USB OTG Controller ***************************************************************/
-/* OTG registers:
- *
- * OTG Interrupt Status, OTG Interrupt Enable, OTG Interrupt Set, AND OTG Interrupt
- * Clear
- */
-
-#define USBOTG_INT_TMR (1 << 0) /* Bit 0: Timer time-out */
-#define USBOTG_INT_REMOVE_PU (1 << 1) /* Bit 1: Remove pull-up */
-#define USBOTG_INT_HNP_FAILURE (1 << 2) /* Bit 2: HNP failed */
-#define USBOTG_INT_HNP_SUCCESS (1 << 3) /* Bit 3: HNP succeeded */
- /* Bits 4-31: Reserved */
-/* OTG Status and Control */
-
-#define USBOTG_STCTRL_PORTFUNC_SHIFT (0) /* Bits 0-1: Controls port function */
-#define USBOTG_STCTRL_PORTFUNC_MASK (3 << USBOTG_STCTRL_PORTFUNC_SHIFT)
-# define USBOTG_STCTRL_PORTFUNC_HNPOK (1 << USBOTG_STCTRL_PORTFUNC_SHIFT) /* HNP suceeded */
-#define USBOTG_STCTRL_TMRSCALE_SHIFT (2) /* Bits 2-3: Timer scale selection */
-#define USBOTG_STCTRL_TMRSCALE_MASK (3 << USBOTG_STCTRL_TMR_SCALE_SHIFT)
-# define USBOTG_STCTRL_TMRSCALE_10US (0 << USBOTG_STCTRL_TMR_SCALE_SHIFT) /* 10uS (100 KHz) */
-# define USBOTG_STCTRL_TMRSCALE_100US (1 << USBOTG_STCTRL_TMR_SCALE_SHIFT) /* 100uS (10 KHz) */
-# define USBOTG_STCTRL_TMRSCALE_1000US (2 << USBOTG_STCTRL_TMR_SCALE_SHIFT) /* 1000uS (1 KHz) */
-#define USBOTG_STCTRL_TMRMODE (1 << 4) /* Bit 4: Timer mode selection */
-#define USBOTG_STCTRL_TMREN (1 << 5) /* Bit 5: Timer enable */
-#define USBOTG_STCTRL_TMRRST (1 << 6) /* Bit 6: TTimer reset */
- /* Bit 7: Reserved */
-#define USBOTG_STCTRL_BHNPTRACK (1 << 8) /* Bit 8: Enable HNP tracking for B-device (peripheral) */
-#define USBOTG_STCTRL_AHNPTRACK (1 << 9) /* Bit 9: Enable HNP tracking for A-device (host) */
-#define USBOTG_STCTRL_PUREMOVED (1 << 10) /* Bit 10: Set when D+ pull-up removed */
- /* Bits 11-15: Reserved */
-#define USBOTG_STCTRL_TMRCNT_SHIFT (0) /* Bits 16-313: Timer scale selection */
-#define USBOTG_STCTRL_TMRCNT_MASK (0ffff << USBOTG_STCTRL_TMR_CNT_SHIFT)
-
-/* OTG Timer */
-
-#define USBOTG_TMR_TIMEOUTCNT_SHIFT (0) /* Bits 0-15: Interrupt when CNT matches this */
-#define USBOTG_TMR_TIMEOUTCNT_MASK (0xffff << USBOTG_TMR_TIMEOUTCNT_SHIFT)
- /* Bits 16-31: Reserved */
-
-/* USB Device Controller ************************************************************/
-/* Device interrupt registers. See also SYSCON_USBINTST in lpc17_syscon.h */
-/* USB Device Interrupt Status, USB Device Interrupt Enable, USB Device Interrupt
- * Clear, USB Device Interrupt Set, and USB Device Interrupt Priority
- */
-
-#define USBDEV_INT_FRAME (1 << 0) /* Bit 0: frame interrupt (every 1 ms) */
-#define USBDEV_INT_EPFAST (1 << 1) /* Bit 1: Fast endpoint interrupt */
-#define USBDEV_INT_EPSLOW (1 << 2) /* Bit 2: Slow endpoints interrupt */
-#define USBDEV_INT_DEVSTAT (1 << 3) /* Bit 3: Bus reset, suspend change or connect change */
-#define USBDEV_INT_CCEMPTY (1 << 4) /* Bit 4: Command code register empty */
-#define USBDEV_INT_CDFULL (1 << 5) /* Bit 5: Command data register full */
-#define USBDEV_INT_RXENDPKT (1 << 6) /* Bit 6: RX endpoint data transferred */
-#define USBDEV_INT_TXENDPKT (1 << 7) /* Bit 7: TX endpoint data tansferred */
-#define USBDEV_INT_EPRLZED (1 << 8) /* Bit 8: Endpoints realized */
-#define USBDEV_INT_ERRINT (1 << 9) /* Bit 9: Error Interrupt */
- /* Bits 10-31: Reserved */
-/* SIE Command registers:
- *
- * USB Command Code
- */
- /* Bits 0-7: Reserved */
-#define USBDEV_CMDCODE_PHASE_SHIFT (8) /* Bits 8-15: Command phase */
-#define USBDEV_CMDCODE_PHASE_MASK (0xff << USBDEV_CMDCODE_PHASE_SHIFT)
-# define USBDEV_CMDCODE_PHASE_READ (1 << USBDEV_CMDCODE_PHASE_SHIFT)
-# define USBDEV_CMDCODE_PHASE_WRITE (2 << USBDEV_CMDCODE_PHASE_SHIFT)
-# define USBDEV_CMDCODE_PHASE_COMMAND (5 << USBDEV_CMDCODE_PHASE_SHIFT)
-#define USBDEV_CMDCODE_CMD_SHIFT (16) /* Bits 15-23: Command (READ/COMMAND phases) */
-#define USBDEV_CMDCODE_CMD_MASK (0xff << USBDEV_CMDCODE_CMD_SHIFT)
-#define USBDEV_CMDCODE_WDATA_SHIFT (16) /* Bits 15-23: Write dagta (WRITE phase) */
-#define USBDEV_CMDCODE_WDATA_MASK (0xff << USBDEV_CMDCODE_CMD_SHIFT)
- /* Bits 24-31: Reserved */
-/* USB Command Data */
-
-#define USBDEV_CMDDATA_SHIFT (0) /* Bits 0-7: Command read data */
-#define USBDEV_CMDDATA_MASK (0xff << USBDEV_CMDDATA_SHIFT)
- /* Bits 8-31: Reserved */
-/* USB transfer registers:
- *
- * USB Receive Data (Bits 0-31: Received data)
- */
-
-/* USB Receive Packet Length */
-
-#define USBDEV_RXPLEN_SHIFT (0) /* Bits 0-9: Bytes remaining to be read */
-#define USBDEV_RXPLEN_MASK (0x3ff << USBDEV_RXPLEN_SHIFT)
-#define USBDEV_RXPLEN_DV (1 << 10) /* Bit 10: DV Data valid */
-#define USBDEV_RXPLEN_PKTRDY (1 << 11) /* Bit 11: Packet ready for reading */
- /* Bits 12-31: Reserved */
-/* USB Transmit Data (Bits 0-31: Transmit data) */
-
-/* USB Transmit Packet Length */
-
-#define USBDEV_TXPLEN_SHIFT (0) /* Bits 0-9: Bytes remaining to be written */
-#define USBDEV_TXPLEN_MASK (0x3ff << USBDEV_TXPLEN_SHIFT)
- /* Bits 10-31: Reserved */
-/* USB Control */
-
-#define USBDEV_CTRL_RDEN (1 << 0) /* Bit 0: Read mode control */
-#define USBDEV_CTRL_WREN (1 << 1) /* Bit 1: Write mode control */
-#define USBDEV_CTRL_LOGEP_SHIFT (2) /* Bits 2-5: Logical Endpoint number */
-#define USBDEV_CTRL_LOGEP_MASK (15 << USBDEV_CTRL_LOGEP_SHIFT)
- /* Bits 6-31: Reserved */
-/* Endpoint interrupt registers:
- *
- * USB Endpoint Interrupt Status, USB Endpoint Interrupt Enable, USB Endpoint Interrupt
- * Clear, USB Endpoint Interrupt Set, and USB Endpoint Priority. Bits correspond
- * to on RX or TX value for any of 15 logical endpoints).
- */
-
-#define USBDEV_LOGEPRX(n) (1 << ((n) << 1))
-#define USBDEV_LOGEPTX(n) ((1 << ((n) << 1)) + 1)
-#define USBDEV_LOGEPRX0 (1 << 0)
-#define USBDEV_LOGEPTX0 (1 << 1)
-#define USBDEV_LOGEPRX1 (1 << 2)
-#define USBDEV_LOGEPTX1 (1 << 3)
-#define USBDEV_LOGEPRX2 (1 << 4)
-#define USBDEV_LOGEPTX2 (1 << 5)
-#define USBDEV_LOGEPRX3 (1 << 6)
-#define USBDEV_LOGEPTX3 (1 << 7)
-#define USBDEV_LOGEPRX4 (1 << 8)
-#define USBDEV_LOGEPTX4 (1 << 9)
-#define USBDEV_LOGEPRX5 (1 << 10)
-#define USBDEV_LOGEPTX5 (1 << 11)
-#define USBDEV_LOGEPRX6 (1 << 12)
-#define USBDEV_LOGEPTX6 (1 << 13)
-#define USBDEV_LOGEPRX7 (1 << 14)
-#define USBDEV_LOGEPTX7 (1 << 15)
-#define USBDEV_LOGEPRX8 (1 << 16)
-#define USBDEV_LOGEPTX8 (1 << 17)
-#define USBDEV_LOGEPRX9 (1 << 18)
-#define USBDEV_LOGEPTX9 (1 << 19)
-#define USBDEV_LOGEPRX10 (1 << 20)
-#define USBDEV_LOGEPTX10 (1 << 21)
-#define USBDEV_LOGEPRX11 (1 << 22)
-#define USBDEV_LOGEPTX11 (1 << 23)
-#define USBDEV_LOGEPRX12 (1 << 24)
-#define USBDEV_LOGEPTX12 (1 << 25)
-#define USBDEV_LOGEPRX13 (1 << 26)
-#define USBDEV_LOGEPTX13 (1 << 27)
-#define USBDEV_LOGEPRX14 (1 << 28)
-#define USBDEV_LOGEPTX14 (1 << 29)
-#define USBDEV_LOGEPRX15 (1 << 30)
-#define USBDEV_LOGEPTX15 (1 << 31)
-
-/* Endpoint realization registers:
- *
- * USB Realize Endpoint (Bits correspond to 1 of 32 physical endpoints)
- */
-
-#define USBDEV_PHYEP(n) (1 << (n))
-#define USBDEV_PHYEP0 (1 << 0)
-#define USBDEV_PHYEP1 (1 << 1)
-#define USBDEV_PHYEP2 (1 << 2)
-#define USBDEV_PHYEP3 (1 << 3)
-#define USBDEV_PHYEP4 (1 << 4)
-#define USBDEV_PHYEP5 (1 << 5)
-#define USBDEV_PHYEP6 (1 << 6)
-#define USBDEV_PHYEP7 (1 << 7)
-#define USBDEV_PHYEP8 (1 << 8)
-#define USBDEV_PHYEP9 (1 << 9)
-#define USBDEV_PHYEP10 (1 << 10)
-#define USBDEV_PHYEP11 (1 << 11)
-#define USBDEV_PHYEP12 (1 << 12)
-#define USBDEV_PHYEP13 (1 << 13)
-#define USBDEV_PHYEP14 (1 << 14)
-#define USBDEV_PHYEP15 (1 << 15)
-#define USBDEV_PHYEP16 (1 << 16)
-#define USBDEV_PHYEP17 (1 << 17)
-#define USBDEV_PHYEP18 (1 << 18)
-#define USBDEV_PHYEP19 (1 << 19)
-#define USBDEV_PHYEP20 (1 << 20)
-#define USBDEV_PHYEP21 (1 << 21)
-#define USBDEV_PHYEP22 (1 << 22)
-#define USBDEV_PHYEP23 (1 << 23)
-#define USBDEV_PHYEP24 (1 << 24)
-#define USBDEV_PHYEP25 (1 << 25)
-#define USBDEV_PHYEP26 (1 << 26)
-#define USBDEV_PHYEP27 (1 << 27)
-#define USBDEV_PHYEP28 (1 << 28)
-#define USBDEV_PHYEP29 (1 << 29)
-#define USBDEV_PHYEP30 (1 << 30)
-#define USBDEV_PHYEP31 (1 << 31)
-
-/* USB Endpoint Index */
-
-#define USBDEV_EPIND_SHIFT (0) /* Bits 0-4: Physical endpoint number (0-31) */
-#define USBDEV_EPIND_MASK (31 << USBDEV_EPIND_SHIFT)
- /* Bits 5-31: Reserved */
-/* USB MaxPacketSize */
-
-#define USBDEV_MAXPSIZE_SHIFT (0) /* Bits 0-9: Maximum packet size value */
-#define USBDEV_MAXPSIZE_MASK (0x3ff << USBDEV_MAXPSIZE_SHIFT)
- /* Bits 10-31: Reserved */
-/* DMA registers:
- *
- * USB DMA Request Status, USB DMA Request Clear, and USB DMA Request Set. Registers
- * contain bits for each of 32 physical endpoints. Use the USBDEV_PHYEP* definitions
- * above. PHYEP0-1 (bits 0-1) must be zero.
- */
-
-/* USB UDCA Head */
- /* Bits 0-6: Reserved */
-#define USBDEV_UDCAH_SHIFT (7) /* Bits 7-31: UDCA start address */
-#define USBDEV_UDCAH_MASK (0x01ffffff << USBDEV_UDCAH_SHIFT)
-
-/* USB Endpoint DMA Status, USB Endpoint DMA Enable, and USB Endpoint DMA Disable.
- * Registers contain bits for physical endpoints 2-31. Use the USBDEV_PHYEP*
- * definitions above. PHYEP0-1 (bits 0-1) must be zero.
- */
-
-/* USB DMA Interrupt Status and USB DMA Interrupt Enable */
-
-#define USBDEV_DMAINT_EOT (1 << 0) /* Bit 0: End of Transfer Interrupt */
-#define USBDEV_DMAINT_NDDR (1 << 1) /* Bit 1: New DD Request Interrupt */
-#define USBDEV_DMAINT_ERR (1 << 2) /* Bit 2: System Error Interrupt */
- /* Bits 3-31: Reserved */
-/* USB End of Transfer Interrupt Status, USB End of Transfer Interrupt Clear, and USB
- * End of Transfer Interrupt Set. Registers contain bits for physical endpoints 2-31.
- * Use the USBDEV_PHYEP* definitions above. PHYEP0-1 (bits 0-1) must be zero.
- */
-
-/* USB New DD Request Interrupt Status, USB New DD Request Interrupt Clear, and USB
- * New DD Request Interrupt Set. Registers contain bits for physical endpoints 2-31.
- * Use the USBDEV_PHYEP* definitions above. PHYEP0-1 (bits 0-1) must be zero.
- */
-
-/* USB System Error Interrupt Status, USB System Error Interrupt Clear, USB System
- * Error Interrupt Set. Registers contain bits for physical endpoints 2-31. Use
- * the USBDEV_PHYEP* definitions above. PHYEP0-1 (bits 0-1) must be zero.
- */
-
-/* OTG I2C registers ****************************************************************/
-
-/* I2C Receive */
-
-#define OTGI2C_RX_DATA_SHIFT (0) /* Bits 0-7: RX data */
-#define OTGI2C_RX_DATA_MASK (0xff << OTGI2C_RX_SHIFT)
- /* Bits 8-31: Reserved */
-/* I2C Transmit */
-
-#define OTGI2C_TX_DATA_SHIFT (0) /* Bits 0-7: TX data */
-#define OTGI2C_TX_DATA_MASK (0xff << OTGI2C_TX_DATA_SHIFT)
-#define OTGI2C_TX_DATA_START (1 << 8) /* Bit 8: Issue START before transmit */
-#define OTGI2C_TX_DATA_STOP (1 << 9) /* Bit 9: Issue STOP before transmit */
- /* Bits 3-31: Reserved */
-/* I2C Status */
-
-#define OTGI2C_STS_TDI (1 << 0) /* Bit 0: Transaction Done Interrupt */
-#define OTGI2C_STS_AFI (1 << 1) /* Bit 1: Arbitration Failure Interrupt */
-#define OTGI2C_STS_NAI (1 << 2) /* Bit 2: No Acknowledge Interrupt */
-#define OTGI2C_STS_DRMI (1 << 3) /* Bit 3: Master Data Request Interrupt */
-#define OTGI2C_STS_DRSI (1 << 4) /* Bit 4: Slave Data Request Interrupt */
-#define OTGI2C_STS_ACTIVE (1 << 5) /* Bit 5: Indicates whether the bus is busy */
-#define OTGI2C_STS_SCL (1 << 6) /* Bit 6: The current value of the SCL signal */
-#define OTGI2C_STS_SDA (1 << 7) /* Bit 7: The current value of the SDA signal */
-#define OTGI2C_STS_RFF (1 << 8) /* Bit 8: Receive FIFO Full (RFF) */
-#define OTGI2C_STS_RFE (1 << 9) /* Bit 9: Receive FIFO Empty */
-#define OTGI2C_STS_TFF (1 << 10) /* Bit 10: Transmit FIFO Full */
-#define OTGI2C_STS_TFE (1 << 11) /* Bit 11: Transmit FIFO Empty */
- /* Bits 12-31: Reserved */
-/* I2C Control */
-
-#define OTGI2C_CTL_TDIE (1 << 0) /* Bit 0: Transmit Done Interrupt Enable */
-#define OTGI2C_CTL_AFIE (1 << 1) /* Bit 1: Transmitter Arbitration Failure Interrupt Enable */
-#define OTGI2C_CTL_NAIE (1 << 2) /* Bit 2: Transmitter No Acknowledge Interrupt Enable */
-#define OTGI2C_CTL_DRMIE (1 << 3) /* Bit 3: Master Transmitter Data Request Interrupt Enable */
-#define OTGI2C_CTL_DRSIE (1 << 4) /* Bit 4: Slave Transmitter Data Request Interrupt Enable */
-#define OTGI2C_CTL_REFIE (1 << 5) /* Bit 5: Receive FIFO Full Interrupt Enable */
-#define OTGI2C_CTL_RFDAIE (1 << 6) /* Bit 6: Receive Data Available Interrupt Enable */
-#define OTGI2C_CTL_TFFIE (1 << 7) /* Bit 7: Transmit FIFO Not Full Interrupt Enable */
-#define OTGI2C_CTL_SRST (1 << 8) /* Bit 8: Soft reset */
- /* Bits 9-31: Reserved */
-/* I2C Clock High */
-
-#define OTGI2C_CLKHI_SHIFT (0) /* Bits 0-7: Clock divisor high */
-#define OTGI2C_CLKHI_MASK (0xff << OTGI2C_CLKHI_SHIFT)
- /* Bits 8-31: Reserved */
-/* I2C Clock Low */
-
-#define OTGI2C_CLKLO_SHIFT (0) /* Bits 0-7: Clock divisor high */
-#define OTGI2C_CLLO_MASK (0xff << OTGI2C_CLKLO_SHIFT)
- /* Bits 8-31: Reserved */
-/* Clock control registers ***********************************************************/
-
-/* USB Clock Control (OTG clock controller) and USB Clock Status (OTG clock status) */
-
-#define USBDEV_CLK_HOSTCLK (1 << 0) /* Bit 1: Host clock (OTG only) */
-#define USBDEV_CLK_DEVCLK (1 << 1) /* Bit 1: Device clock */
-#define USBDEV_CLK_I2CCLK (1 << 2) /* Bit 2: I2C clock (OTG only) */
-#define USBDEV_CLK_PORTSELCLK (1 << 3) /* Bit 3: Port select register clock (device only) */
-#define USBDEV_CLK_OTGCLK (1 << 3) /* Bit 3: OTG clock (OTG only) */
-#define USBDEV_CLK_AHBCLK (1 << 4) /* Bit 4: AHB clock */
- /* Bits 5-31: Reserved */
-/* Alternate naming */
-
-#define USBOTG_CLK_HOSTCLK USBDEV_CLK_HOSTCLK
-#define USBOTG_CLK_DEVCLK USBDEV_CLK_DEVCLK
-#define USBOTG_CLK_I2CCLK USBDEV_CLK_I2CCLK
-#define USBOTG_CLK_PORTSELCLK USBDEV_CLK_PORTSELCLK
-#define USBOTG_CLK_OTGCLK USBDEV_CLK_OTGCLK
-#define USBOTG_CLK_AHBCLK USBDEV_CLK_AHBCLK
-
-/* Endpoints *************************************************************************/
-
-#define LPC17_EP0_OUT 0
-#define LPC17_EP0_IN 1
-#define LPC17_CTRLEP_OUT LPC17_EP0_OUT
-#define LPC17_CTRLEP_IN LPC17_EP0_IN
-#define LPC17_EP1_OUT 2
-#define LPC17_EP1_IN 3
-#define LPC17_EP2_OUT 4
-#define LPC17_EP2_IN 5
-#define LPC17_EP3_OUT 6
-#define LPC17_EP3_IN 7
-#define LPC17_EP4_OUT 8
-#define LPC17_EP4_IN 9
-#define LPC17_EP5_OUT 10
-#define LPC17_EP5_IN 11
-#define LPC17_EP6_OUT 12
-#define LPC17_EP6_IN 13
-#define LPC17_EP7_OUT 14
-#define LPC17_EP7_IN 15
-#define LPC17_EP8_OUT 16
-#define LPC17_EP8_IN 17
-#define LPC17_EP9_OUT 18
-#define LPC17_EP9_IN 19
-#define LPC17_EP10_OUT 20
-#define LPC17_EP10_IN 21
-#define LPC17_EP11_OUT 22
-#define LPC17_EP11_IN 23
-#define LPC17_EP12_OUT 24
-#define LPC17_EP12_IN 25
-#define LPC17_EP13_OUT 26
-#define LPC17_EP13_IN 27
-#define LPC17_EP14_OUT 28
-#define LPC17_EP14_IN 29
-#define LPC17_EP15_OUT 30
-#define LPC17_EP15_IN 31
-#define LPC17_NUMEPS 32
-
-/* Commands *************************************************************************/
-
-/* USB Command Code Register */
-
-#define CMD_USBDEV_PHASESHIFT (8) /* Bits 8-15: Command phase value */
-#define CMD_USBDEV_PHASEMASK (0xff << CMD_USBDEV_PHASESHIFT)
-# define CMD_USBDEV_DATAWR (1 << CMD_USBDEV_PHASESHIFT)
-# define CMD_USBDEV_DATARD (2 << CMD_USBDEV_PHASESHIFT)
-# define CMD_USBDEV_CMDWR (5 << CMD_USBDEV_PHASESHIFT)
-#define CMD_USBDEV_CMDSHIFT (16) /* Bits 16-23: Device command/WDATA */
-#define CMD_USBDEV_CMDMASK (0xff << CMD_USBDEV_CMDSHIFT)
-#define CMD_USBDEV_WDATASHIFT CMD_USBDEV_CMDSHIFT
-#define CMD_USBDEV_WDATAMASK CMD_USBDEV_CMDMASK
-
-/* Device Commands */
-
-#define CMD_USBDEV_SETADDRESS (0x00d0)
-#define CMD_USBDEV_CONFIG (0x00d8)
-#define CMD_USBDEV_SETMODE (0x00f3)
-#define CMD_USBDEV_READFRAMENO (0x00f5)
-#define CMD_USBDEV_READTESTREG (0x00fd)
-#define CMD_USBDEV_SETSTATUS (0x01fe) /* Bit 8 set to distingish get from set */
-#define CMD_USBDEV_GETSTATUS (0x00fe)
-#define CMD_USBDEV_GETERRORCODE (0x00ff)
-#define CMD_USBDEV_READERRORSTATUS (0x00fb)
-
-/* Endpoint Commands */
-
-#define CMD_USBDEV_EPSELECT (0x0000)
-#define CMD_USBDEV_EPSELECTCLEAR (0x0040)
-#define CMD_USBDEV_EPSETSTATUS (0x0140) /* Bit 8 set to distingish get from selectclear */
-#define CMD_USBDEV_EPCLRBUFFER (0x00f2)
-#define CMD_USBDEV_EPVALIDATEBUFFER (0x00fa)
-
-/* Command/response bit definitions ********************************************/
-/* SETADDRESS (0xd0) command definitions */
-
-#define CMD_USBDEV_SETADDRESS_MASK (0x7f) /* Bits 0-6: Device address */
-#define CMD_USBDEV_SETADDRESS_DEVEN (1 << 7) /* Bit 7: Device enable */
-
-/* SETSTATUS (0xfe) and GETSTATUS (0xfe) response: */
-
-#define CMD_STATUS_CONNECT (1 << 0) /* Bit 0: Connected */
-#define CMD_STATUS_CONNCHG (1 << 1) /* Bit 1: Connect change */
-#define CMD_STATUS_SUSPEND (1 << 2) /* Bit 2: Suspend */
-#define CMD_STATUS_SUSPCHG (1 << 3) /* Bit 3: Suspend change */
-#define CMD_STATUS_RESET (1 << 4) /* Bit 4: Bus reset bit */
-
-/* EPSELECT (0x00) endpoint status response */
-
-#define CMD_EPSELECT_FE (1 << 0) /* Bit 0: IN empty or OUT full */
-#define CMD_EPSELECT_ST (1 << 1) /* Bit 1: Endpoint is stalled */
-#define CMD_EPSELECT_STP (1 << 2) /* Bit 2: Last packet was setup */
-#define CMD_EPSELECT_PO (1 << 3) /* Bit 3: Previous packet was overwritten */
-#define CMD_EPSELECT_EPN (1 << 4) /* Bit 4: NAK sent */
-#define CMD_EPSELECT_B1FULL (1 << 5) /* Bit 5: Buffer 1 full */
-#define CMD_EPSELECT_B2FULL (1 << 6) /* Bit 6: Buffer 2 full */
- /* Bit 7: Reserved */
-/* EPSETSTATUS (0x40) command */
-
-#define CMD_SETSTAUS_ST (1 << 0) /* Bit 0: Stalled endpoint bit */
- /* Bits 1-4: Reserved */
-#define CMD_SETSTAUS_DA (1 << 5) /* Bit 5: Disabled endpoint bit */
-#define CMD_SETSTAUS_RFMO (1 << 6) /* Bit 6: Rate feedback mode */
-#define CMD_SETSTAUS_CNDST (1 << 7) /* Bit 7: Conditional stall bit */
-
-/* EPCLRBUFFER (0xf2) response */
-
-#define CMD_USBDEV_CLRBUFFER_PO (0x00000001)
-
-/* SETMODE(0xf3) command */
-
-#define CMD_SETMODE_APCLK (1 << 0) /* Bit 0: Always PLL Clock */
-#define CMD_SETMODE_INAKCI (1 << 1) /* Bit 1: Interrupt on NAK for Control IN endpoint */
-#define CMD_SETMODE_INAKCO (1 << 2) /* Bit 2: Interrupt on NAK for Control OUT endpoint */
-#define CMD_SETMODE_INAKII (1 << 3) /* Bit 3: Interrupt on NAK for Interrupt IN endpoint */
-#define CMD_SETMODE_INAKIO (1 << 4) /* Bit 4: Interrupt on NAK for Interrupt OUT endpoints */
-#define CMD_SETMODE_INAKBI (1 << 5) /* Bit 5: Interrupt on NAK for Bulk IN endpoints */
-#define CMD_SETMODE_INAKBO (1 << 6) /* Bit 6: Interrupt on NAK for Bulk OUT endpoints */
-
-/* READERRORSTATUS (0xFb) command */
-
-#define CMD_READERRORSTATUS_PIDERR (1 << 0) /* Bit 0: PID encoding/unknown or Token CRC */
-#define CMD_READERRORSTATUS_UEPKT (1 << 1) /* Bit 1: Unexpected Packet */
-#define CMD_READERRORSTATUS_DCRC (1 << 2) /* Bit 2: Data CRC error */
-#define CMD_READERRORSTATUS_TIMEOUT (1 << 3) /* Bit 3: Time out error */
-#define CMD_READERRORSTATUS_EOP (1 << 4) /* Bit 4: End of packet error */
-#define CMD_READERRORSTATUS_BOVRN (1 << 5) /* Bit 5: Buffer Overrun */
-#define CMD_READERRORSTATUS_BTSTF (1 << 6) /* Bit 6: Bit stuff error */
-#define CMD_READERRORSTATUS_TGLERR (1 << 7) /* Bit 7: Wrong toggle in data PID */
-#define CMD_READERRORSTATUS_ALLERRS (0xff)
-
-/* DMA ******************************************************************************/
-/* The DMA descriptor */
-
-#define USB_DMADESC_NEXTDDPTR 0 /* Offset 0: Next USB descriptor in RAM */
-#define USB_DMADESC_CONFIG 1 /* Offset 1: DMA configuration info. */
-#define USB_DMADESC_STARTADDR 2 /* Offset 2: DMA start address */
-#define USB_DMADESC_STATUS 3 /* Offset 3: DMA status info (read only) */
-#define USB_DMADESC_ISOCSIZEADDR 4 /* Offset 4: Isoc. packet size address */
-
-/* Bit settings for CONFIG (offset 1 )*/
-
-#define USB_DMADESC_MODE_SHIFT (0) /* Bits 0-1: DMA mode */
-#define USB_DMADESC_MODE_MASK (3 << USB_DMADESC_MODE_SHIFT)
-# define USB_DMADESC_MODENORMAL (0 << USB_DMADESC_MODE_SHIFT) /* Mode normal */
-# define USB_DMADESC_MODEATLE (1 << USB_DMADESC_MODE_SHIFT) /* ATLE normal */
-#define USB_DMADESC_NEXTDDVALID (1 << 2) /* Bit 2: Next descriptor valid */
- /* Bit 3: Reserved */
-#define USB_DMADESC_ISCOEP (1 << 4) /* Bit 4: ISOC endpoint */
-#define USB_DMADESC_PKTSIZE_SHIFT (5) /* Bits 5-15: Max packet size */
-#define USB_DMADESC_PKTSIZE_MASK (0x7ff << USB_DMADESC_PKTSIZE_SHIFT)
-#define USB_DMADESC_BUFLEN_SHIFT (16) /* Bits 16-31: DMA buffer length */
-#define USB_DMADESC_BUFLEN_MASK (0xffff << USB_DMADESC_BUFLEN_SHIFT
-
-/* Bit settings for STATUS (offset 3). All must be initialized to zero. */
-
-#define USB_DMADESC_STATUS_SHIFT (1) /* Bits 1-4: DMA status */
-#define USB_DMADESC_STATUS_MASK (15 << USB_DMADESC_STATUS_SHIFT)
-# define USB_DMADESC_NOTSERVICED (0 << USB_DMADESC_STATUS_SHIFT)
-# define USB_DMADESC_BEINGSERVICED (1 << USB_DMADESC_STATUS_SHIFT)
-# define USB_DMADESC_NORMALCOMPLETION (2 << USB_DMADESC_STATUS_SHIFT)
-# define USB_DMADESC_DATAUNDERRUN (3 << USB_DMADESC_STATUS_SHIFT)
-# define USB_DMADESC_DATAOVERRUN (8 << USB_DMADESC_STATUS_SHIFT)
-# define USB_DMADESC_SYSTEMERROR (9 << USB_DMADESC_STATUS_SHIFT)
-#define USB_DMADESC_PKTVALID (1 << 5) /* Bit 5: Packet valid */
-#define USB_DMADESC_LSBEXTRACTED (1 << 6) /* Bit 6: LS byte extracted */
-#define USB_DMADESC_MSBEXTRACTED (1 << 7) /* Bit 7: MS byte extracted */
-#define USB_DMADESC_MSGLENPOS_SHIFT (8) /* Bits 8-13: Message length position */
-#define USB_DMADESC_MSGLENPOS_MASK (0x3f << USB_DMADESC_MSGLENPOS_SHIFT)
-#define USB_DMADESC_DMACOUNT_SHIFT (16) /* Bits 16-31: DMA count */
-#define USB_DMADESC_DMACOUNT_MASK (0xffff << USB_DMADESC_DMACOUNT_SHIFT)
-
-/* DMA packet size format */
-
-#define USB_DMAPKTSIZE_PKTLEN_SHIFT (0) /* Bits 0-15: Packet length */
-#define USB_DMAPKTSIZE_PKTLEN_MASK (0xffff << USB_DMAPKTSIZE_PKTLEN_SHIFT)
-#define USB_DMAPKTSIZE_PKTVALID (1 << 16) /* Bit 16: Packet valid */
-#define USB_DMAPKTSIZE_FRAMENO_SHIFT (17) /* Bit 17-31: Frame number */
-#define USB_DMAPKTSIZE_FRAMENO_MASK (0x7fff << USB_DMAPKTSIZE_FRAMENO_SHIFT)
-
-/************************************************************************************
- * Public Types
- ************************************************************************************/
-
-/************************************************************************************
- * Public Data
- ************************************************************************************/
-
-/************************************************************************************
- * Public Functions
- ************************************************************************************/
-
-#endif /* __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC17_USB_H */
diff --git a/arch/arm/src/lpc17xx/hardware/lpc17_wdt.h b/arch/arm/src/lpc17xx/hardware/lpc17_wdt.h
deleted file mode 100644
index f740fe167c9..00000000000
--- a/arch/arm/src/lpc17xx/hardware/lpc17_wdt.h
+++ /dev/null
@@ -1,156 +0,0 @@
-/************************************************************************************
- * arch/arm/src/lpc17xx/hardware/lpc17_wdt.h
- *
- * Copyright (C) 2010, 2013 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. 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.
- * 3. Neither the name NuttX 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 THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- ************************************************************************************/
-
-#ifndef __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC17_WDT_H
-#define __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC17_WDT_H
-
-/************************************************************************************
- * Included Files
- ************************************************************************************/
-
-#include
-
-#include "chip.h"
-#include "hardware/lpc17_memorymap.h"
-
-/************************************************************************************
- * Pre-processor Definitions
- ************************************************************************************/
-
-/* Register offsets *****************************************************************/
-
-#define LPC17_WDT_MOD_OFFSET 0x0000 /* Watchdog mode register */
-#define LPC17_WDT_TC_OFFSET 0x0004 /* Watchdog timer constant register */
-#define LPC17_WDT_FEED_OFFSET 0x0008 /* Watchdog feed sequence register */
-#define LPC17_WDT_TV_OFFSET 0x000c /* Watchdog timer value register */
-
-#ifdef LPC176x
-# define LPC17_WDT_CLKSEL_OFFSET 0x0010 /* Watchdog clock source selection register */
-#endif
-
-#ifdef LPC178x
-# define LPC17_WDT_WARNINT_OFFSET 0x0014 /* Watchdog warning interrupt */
-# define LPC17_WDT_WINDOW_OFFSET 0x0018 /* Watchdog window compare value */
-#endif
-
-/* Register addresses ***************************************************************/
-
-#define LPC17_WDT_MOD (LPC17_WDT_BASE+LPC17_WDT_MOD_OFFSET)
-#define LPC17_WDT_TC (LPC17_WDT_BASE+LPC17_WDT_TC_OFFSET)
-#define LPC17_WDT_FEED (LPC17_WDT_BASE+LPC17_WDT_FEED_OFFSET)
-#define LPC17_WDT_TV (LPC17_WDT_BASE+LPC17_WDT_TV_OFFSET)
-#define LPC17_WDT_CLKSEL (LPC17_WDT_BASE+LPC17_WDT_CLKSEL_OFFSET)
-
-#ifdef LPC178x
-# define LPC17_WDT_WARNINT (LPC17_WDT_BASE+LPC17_WDT_WARNINT_OFFSET)
-# define LPC17_WDT_WINDOW (LPC17_WDT_BASE+LPC17_WDT_WINDOW_OFFSET)
-#endif
-
-/* Register bit definitions *********************************************************/
-
-/* Watchdog mode register */
-
-#define WDT_MOD_WDEN (1 << 0) /* Bit 0: Watchdog enable */
-#define WDT_MOD_WDRESET (1 << 1) /* Bit 1: Watchdog reset enable */
-#define WDT_MOD_WDTOF (1 << 2) /* Bit 2: Watchdog time-out */
-#define WDT_MOD_WDINT (1 << 3) /* Bit 3: Watchdog interrupt */
-#ifdef LPC178x
-# define WDT_MOD_WDPROTECT (1 << 4) /* Bit 4: Watchdog interrupt */
-#endif
- /* Bits 5-31: Reserved */
-/* Watchdog timer constant register */
-
-#ifdef LPC176x
-# define WDT_TC (0xffffffff) /* Bits 0-31: Watchdog time-out interval */
-#endif
-#ifdef LPC178x
-# define WDT_TC (0x00ffffff) /* Bits 0-23: Watchdog time-out interval */
- /* Bits 24-31: Reserved */
-#endif
-
-/* Watchdog feed sequence register */
-
-#define WDT_FEED_MASK (0xff) /* Bits 0-7: Feed value should be 0xaa
- * followed by 0x55 */
- /* Bits 14-31: Reserved */
-/* Watchdog timer value register */
-
-#ifdef LPC176x
-# define WDT_TVT (0xffffffff) /* Bits 0-31: Watchdog timer value */
-#endif
-#ifdef LPC178x
-# define WDT_TVT (0xffffff) /* Bits 0-23: Watchdog timer value */
- /* Bits 24-31: Reserved */
-#endif
-
-/* Watchdog clock source selection register */
-
-#ifdef LPC176x
-# define WDT_CLKSEL_WDSEL_SHIFT (0) /* Bits 0-1: Clock source for the Watchdog timer */
-# define WDT_CLKSEL_WDSEL_MASK (3 << WDT_CLKSEL_WDSEL_SHIFT)
-# define WDT_CLKSEL_WDSEL_INTRC (0 << WDT_CLKSEL_WDSEL_SHIFT) /* Internal RC osc */
-# define WDT_CLKSEL_WDSEL_APB (1 << WDT_CLKSEL_WDSEL_SHIFT) /* APB peripheral clock (watchdog pclk) */
-# define WDT_CLKSEL_WDSEL_RTC (2 << WDT_CLKSEL_WDSEL_SHIFT) /* RTC oscillator (rtc_clk) */
- /* Bits 2-30: Reserved */
-# define WDT_CLKSEL_WDLOCK (1 << 31) /* Bit 31: Lock WDT register bits if set */
-#endif
-
-/* Watchdog timer warning interrupt register */
-
-#ifdef LPC178x
-# define WDT_WARNINT (0x3ff) /* Bits 0-9: Warning Interrupt compare value */
- /* Bits 10-31: Reserved */
-#endif
-
-/* Watchdog timer value register */
-
-#ifdef LPC178x
-# define WDT_WINDOW (0xffffff) /* Bits 0-23: Watchdog window value */
- /* Bits 24-31: Reserved */
-#endif
-
-/************************************************************************************
- * Public Types
- ************************************************************************************/
-
-/************************************************************************************
- * Public Data
- ************************************************************************************/
-
-/************************************************************************************
- * Public Functions
- ************************************************************************************/
-
-#endif /* __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC17_WDT_H */
diff --git a/arch/arm/src/lpc17xx/Kconfig b/arch/arm/src/lpc17xx_40xx/Kconfig
similarity index 63%
rename from arch/arm/src/lpc17xx/Kconfig
rename to arch/arm/src/lpc17xx_40xx/Kconfig
index b75adb5d529..004fcf93696 100644
--- a/arch/arm/src/lpc17xx/Kconfig
+++ b/arch/arm/src/lpc17xx_40xx/Kconfig
@@ -3,97 +3,151 @@
# see the file kconfig-language.txt in the NuttX tools repository.
#
-comment "LPC17xx Configuration Options"
+comment "LPC17xx/40xx Configuration Options"
choice
- prompt "NXP LPC17XX Chip Selection"
+ prompt "NXP LPC17XX/LPC40XX Chip Selection"
default ARCH_CHIP_LPC1768
- depends on ARCH_CHIP_LPC17XX
+ depends on ARCH_CHIP_LPC17XX_40XX
config ARCH_CHIP_LPC1751
bool "LPC1751"
select ARCH_FAMILY_LPC175X
+ select ARCH_CORTEXM3
config ARCH_CHIP_LPC1752
bool "LPC1752"
select ARCH_FAMILY_LPC175X
+ select ARCH_CORTEXM3
config ARCH_CHIP_LPC1754
bool "LPC1754"
select ARCH_FAMILY_LPC175X
+ select ARCH_CORTEXM3
config ARCH_CHIP_LPC1756
bool "LPC1756"
select ARCH_FAMILY_LPC175X
+ select ARCH_CORTEXM3
config ARCH_CHIP_LPC1758
bool "LPC1758"
select ARCH_FAMILY_LPC175X
+ select ARCH_CORTEXM3
config ARCH_CHIP_LPC1759
bool "LPC1759"
select ARCH_FAMILY_LPC175X
+ select ARCH_CORTEXM3
config ARCH_CHIP_LPC1764
bool "LPC1764"
select ARCH_FAMILY_LPC176X
+ select ARCH_CORTEXM3
config ARCH_CHIP_LPC1765
bool "LPC1765"
select ARCH_FAMILY_LPC176X
+ select ARCH_CORTEXM3
config ARCH_CHIP_LPC1766
bool "LPC1766"
select ARCH_FAMILY_LPC176X
+ select ARCH_CORTEXM3
config ARCH_CHIP_LPC1767
bool "LPC1767"
select ARCH_FAMILY_LPC176X
+ select ARCH_CORTEXM3
config ARCH_CHIP_LPC1768
bool "LPC1768"
select ARCH_FAMILY_LPC176X
+ select ARCH_CORTEXM3
config ARCH_CHIP_LPC1769
bool "LPC1769"
select ARCH_FAMILY_LPC176X
+ select ARCH_CORTEXM3
config ARCH_CHIP_LPC1773
bool "LPC1773"
select ARCH_FAMILY_LPC177X
- select LPC17_HAVE_SPIFI
+ select LPC17_40_HAVE_SPIFI
+ select ARCH_CORTEXM3
config ARCH_CHIP_LPC1774
bool "LPC1774"
select ARCH_FAMILY_LPC177X
+ select ARCH_CORTEXM3
config ARCH_CHIP_LPC1776
bool "LPC1776"
select ARCH_FAMILY_LPC177X
+ select ARCH_CORTEXM3
config ARCH_CHIP_LPC1777
bool "LPC1777"
select ARCH_FAMILY_LPC177X
+ select ARCH_CORTEXM3
config ARCH_CHIP_LPC1778
bool "LPC1778"
select ARCH_FAMILY_LPC177X
+ select ARCH_CORTEXM3
config ARCH_CHIP_LPC1785
bool "LPC1785"
select ARCH_FAMILY_LPC178X
+ select ARCH_CORTEXM3
config ARCH_CHIP_LPC1786
bool "LPC1786"
select ARCH_FAMILY_LPC178X
+ select ARCH_CORTEXM3
config ARCH_CHIP_LPC1787
bool "LPC1787"
select ARCH_FAMILY_LPC178X
+ select ARCH_CORTEXM3
config ARCH_CHIP_LPC1788
bool "LPC1788"
select ARCH_FAMILY_LPC178X
+ select ARCH_CORTEXM3
+
+config ARCH_CHIP_LPC4072
+ bool "LPC4072"
+ select ARCH_FAMILY_LPC407X
+ select LPC17_40_HAVE_SPIFI
+ select ARCH_CORTEXM4
+
+config ARCH_CHIP_LPC4074
+ bool "LPC4074"
+ select ARCH_FAMILY_LPC407X
+ select LPC17_40_HAVE_SPIFI
+ select ARCH_CORTEXM4
+
+config ARCH_CHIP_LPC4076
+ bool "LPC4076"
+ select ARCH_FAMILY_LPC407X
+ select LPC17_40_HAVE_SPIFI
+ select ARCH_CORTEXM4
+ select ARCH_HAVE_FPU
+
+config ARCH_CHIP_LPC4078
+ bool "LPC4078"
+ select ARCH_FAMILY_LPC407X
+ select LPC17_40_HAVE_SPIFI
+ select ARCH_CORTEXM4
+ select ARCH_HAVE_FPU
+
+config ARCH_CHIP_LPC4088
+ bool "LPC4088"
+ select ARCH_FAMILY_LPC408X
+ select LPC17_40_HAVE_SPIFI
+ select ARCH_CORTEXM4
+ select ARCH_HAVE_FPU
endchoice
@@ -109,285 +163,292 @@ config ARCH_FAMILY_LPC177X
config ARCH_FAMILY_LPC178X
bool
-config LPC17_HAVE_SPIFI
+config ARCH_FAMILY_LPC407X
bool
-menu "LPC17xx Peripheral Support"
+config ARCH_FAMILY_LPC408X
+ bool
-config LPC17_MAINOSC
+config LPC17_40_HAVE_SPIFI
+ bool
+
+menu "LPC17xx/LPC40xx Peripheral Support"
+
+config LPC17_40_MAINOSC
bool "Main oscillator"
default y
-config LPC17_PLL0
+config LPC17_40_PLL0
bool "PLL0"
default y
-config LPC17_PLL1
+config LPC17_40_PLL1
bool "PLL1"
default y
-config LPC17_EMC
+config LPC17_40_EMC
bool "EMC"
default y
- depends on ARCH_FAMILY_LPC178X
- select LPC17_HAVE_EXTNAND
- select LPC17_HAVE_EXTSRAM0
- select LPC17_HAVE_EXTDRAM
- select LPC17_HAVE_EXTNOR
+ depends on ARCH_FAMILY_LPC177X || ARCH_FAMILY_LPC178X || ARCH_FAMILY_LPC407X || ARCH_FAMILY_LPC408X
+ select LPC17_40_HAVE_EXTNAND
+ select LPC17_40_HAVE_EXTSRAM0
+ select LPC17_40_HAVE_EXTDRAM
+ select LPC17_40_HAVE_EXTNOR
-config LPC17_ETHERNET
+config LPC17_40_ETHERNET
bool "Ethernet"
select NETDEVICES
select ARCH_HAVE_PHY
select ARCH_HAVE_NETDEV_STATISTICS
default n
-config LPC17_LCD
+config LPC17_40_LCD
bool "LCD controller"
default n
- depends on ARCH_FAMILY_LPC177X || ARCH_FAMILY_LPC178X
+ depends on ARCH_FAMILY_LPC178X || ARCH_FAMILY_LPC408X
-config LPC17_USBHOST
+config LPC17_40_USBHOST
bool "USB host"
select USBHOST
select USBHOST_HAVE_ASYNCH
default n
-config LPC17_USBDEV
+config LPC17_40_USBDEV
bool "USB Device"
select USBDEV
default n
-config LPC17_USBOTG
+config LPC17_40_USBOTG
bool "USB OTG"
default n
- depends on LPC17_USBHOST && LPC17_USBDEV
+ depends on LPC17_40_USBHOST && LPC17_40_USBDEV
-config LPC17_SDCARD
+config LPC17_40_SDCARD
bool "SD Card Interface"
- depends on ARCH_FAMILY_LPC177X || ARCH_FAMILY_LPC178X
+ depends on ARCH_FAMILY_LPC177X || ARCH_FAMILY_LPC178X || ARCH_FAMILY_LPC407X || ARCH_FAMILY_LPC408X
select ARCH_HAVE_SDIO
default n
-config LPC17_UART0
+config LPC17_40_UART0
bool "UART0"
default n
select UART0_SERIALDRIVER
select ARCH_HAVE_SERIAL_TERMIOS
-config LPC17_UART1
+config LPC17_40_UART1
bool "UART1"
default n
select UART1_SERIALDRIVER
select ARCH_HAVE_SERIAL_TERMIOS
-config LPC17_UART2
+config LPC17_40_UART2
bool "UART2"
default n
select UART2_SERIALDRIVER
select ARCH_HAVE_SERIAL_TERMIOS
-config LPC17_UART3
+config LPC17_40_UART3
bool "UART3"
default n
select UART3_SERIALDRIVER
select ARCH_HAVE_SERIAL_TERMIOS
-config LPC17_UART4
+config LPC17_40_UART4
bool "UART4"
+ depends on ARCH_FAMILY_LPC177X || ARCH_FAMILY_LPC178X || ARCH_FAMILY_LPC407X || ARCH_FAMILY_LPC408X
default n
select UART4_SERIALDRIVER
select ARCH_HAVE_SERIAL_TERMIOS
-config LPC17_CAN1
+config LPC17_40_CAN1
bool "CAN1"
default n
select CAN
-config LPC17_CAN2
+config LPC17_40_CAN2
bool "CAN2"
default n
select CAN
-config LPC17_SPI
+config LPC17_40_SPI
bool "SPI"
default n
depends on ARCH_FAMILY_LPC175X || ARCH_FAMILY_LPC176X
-config LPC17_SSP0
+config LPC17_40_SSP0
bool "SSP0"
default n
-config LPC17_SSP1
+config LPC17_40_SSP1
bool "SSP1"
default n
-config LPC17_SSP2
+config LPC17_40_SSP2
bool "SSP1"
default n
- depends on ARCH_FAMILY_LPC177X || ARCH_FAMILY_LPC178X
+ depends on ARCH_FAMILY_LPC177X || ARCH_FAMILY_LPC178X || ARCH_FAMILY_LPC407X || ARCH_FAMILY_LPC408X
-config LPC17_SPIFI
+config LPC17_40_SPIFI
bool "SPIFI Interface"
- depends on LPC17_HAVE_SPIFI
+ depends on LPC17_40_HAVE_SPIFI
default n
-config LPC17_I2C0
+config LPC17_40_I2C0
bool "I2C0"
default n
-config LPC17_I2C1
+config LPC17_40_I2C1
bool "I2C1"
default n
-config LPC17_I2C2
+config LPC17_40_I2C2
bool "I2C2"
default n
-config LPC17_I2S
+config LPC17_40_I2S
bool "I2S"
default n
-config LPC17_TMR0
+config LPC17_40_TMR0
bool "Timer 0"
default n
-config LPC17_MAT0_PIN
+config LPC17_40_MAT0_PIN
int "TIM1 MAT0 Output Pin"
default 1
range 1 4
- depends on LPC17_TMR0
+ depends on LPC17_40_TMR0
---help---
If TIM1 is enabled for PWM usage, you also need specifies the timer output
channel {1,..,4}
-config LPC17_TMR1
+config LPC17_40_TMR1
bool "Timer 1"
default n
-config LPC17_TMR2
+config LPC17_40_TMR2
bool "Timer 2"
default n
-config LPC17_TMR3
+config LPC17_40_TMR3
bool "Timer 3"
default n
-config LPC17_RIT
+config LPC17_40_RIT
bool "RIT"
default n
-config LPC17_PWM0
+config LPC17_40_PWM0
bool "PWM0"
+ depends on ARCH_FAMILY_LPC177X || ARCH_FAMILY_LPC178X || ARCH_FAMILY_LPC407X || ARCH_FAMILY_LPC408X
default n
-config LPC17_PWM1
+config LPC17_40_PWM1
bool "PWM1"
default n
- depends on ARCH_FAMILY_LPC177X || ARCH_FAMILY_LPC178X || ARCH_FAMILY_LPC176X
-config LPC17_PWM1_PIN
+config LPC17_40_PWM1_PIN
int "TIM1 PWM Output Pin"
default 1
range 1 4
- depends on LPC17_PWM1
+ depends on LPC17_40_PWM1
---help---
If TIM1 is enabled for PWM usage, you also need specifies the timer output
channel {1,..,4}
-config LPC17_MCPWM
+config LPC17_40_MCPWM
bool "MCPWM"
default n
depends on ARCH_FAMILY_LPC175X || ARCH_FAMILY_LPC176X
-config LPC17_MCPWM1_PIN
+config LPC17_40_MCPWM1_PIN
int "TIM1 MCPWM Output Pin"
default 1
range 1 4
- depends on LPC17_MCPWM
+ depends on LPC17_40_MCPWM
---help---
If TIM1 is enabled for PWM usage, you also need specifies the timer output
channel {1,..,4}
-config LPC17_QEI
+config LPC17_40_QEI
bool "QEI"
default n
-config LPC17_RTC
+config LPC17_40_RTC
bool "RTC"
default n
-config LPC17_RTCEV
+config LPC17_40_RTCEV
bool "RTC event monitor"
default n
- depends on LPC17_RTC
+ depends on LPC17_40_RTC
-config LPC17_WDT
+config LPC17_40_WDT
bool "WDT"
default n
-config LPC17_ADC
+config LPC17_40_ADC
bool "ADC"
default n
-config LPC17_DAC
+config LPC17_40_DAC
bool "DAC"
default n
-config LPC17_GPDMA
+config LPC17_40_GPDMA
bool "GPDMA"
default n
select ARCH_DMA
-config LPC17_CRC
+config LPC17_40_CRC
bool "CRC engine"
default n
- depends on ARCH_FAMILY_LPC177X || ARCH_FAMILY_LPC178X
+ depends on ARCH_FAMILY_LPC177X || ARCH_FAMILY_LPC178X || ARCH_FAMILY_LPC407X || ARCH_FAMILY_LPC408X
-config LPC17_FLASH
+config LPC17_40_FLASH
bool "FLASH"
default n
-config LPC17_EEPROM
+config LPC17_40_EEPROM
bool "EEPROM"
default n
- depends on ARCH_FAMILY_LPC177X || ARCH_FAMILY_LPC178X
+ depends on ARCH_FAMILY_LPC177X || ARCH_FAMILY_LPC178X || ARCH_FAMILY_LPC407X || ARCH_FAMILY_LPC408X
-config LPC17_PROGMEM
+config LPC17_40_PROGMEM
bool PROGMEM
default n
select ARCH_HAVE_PROGMEM
---help---
- Use a part of LPC17xx's internal flash memory as a
+ Use a part of LPC17xx/LPC40xx's internal flash memory as a
Memory-Technology-Device (MTD).
endmenu
menu "External Memory Configuration"
-config LPC17_HAVE_EXTNAND
+config LPC17_40_HAVE_EXTNAND
bool
-config LPC17_HAVE_EXTNOR
+config LPC17_40_HAVE_EXTNOR
bool
-config LPC17_HAVE_EXTDRAM
+config LPC17_40_HAVE_EXTDRAM
bool
-config LPC17_HAVE_EXTSRAM0
+config LPC17_40_HAVE_EXTSRAM0
bool
-config LPC17_EXTNAND
+config LPC17_40_EXTNAND
bool "Configure external NAND"
default n
- depends on LPC17_HAVE_EXTNAND
+ depends on LPC17_40_HAVE_EXTNAND
---help---
Configure external NAND memory and, if applicable, map then external
NAND into the memory map.
-if LPC17_EXTNAND
+if LPC17_40_EXTNAND
-config LPC17_EXTNANDSIZE
+config LPC17_40_EXTNANDSIZE
int "External NAND size"
default 0
---help---
@@ -395,17 +456,17 @@ config LPC17_EXTNANDSIZE
endif
-config LPC17_EXTNOR
+config LPC17_40_EXTNOR
bool "Configure external NOR memory"
default n
- depends on LPC17_HAVE_EXTNOR
+ depends on LPC17_40_HAVE_EXTNOR
---help---
Configure external NOR memory and, if applicable, map then external
NOR into the memory map.
-if LPC17_EXTNOR
+if LPC17_40_EXTNOR
-config LPC17_EXTNORSIZE
+config LPC17_40_EXTNORSIZE
int "External NOR size"
default 0
---help---
@@ -413,18 +474,18 @@ config LPC17_EXTNORSIZE
endif
-config LPC17_EXTDRAM
+config LPC17_40_EXTDRAM
bool "Configure external DRAM"
default n
- depends on LPC17_HAVE_EXTDRAM
+ depends on LPC17_40_HAVE_EXTDRAM
select ARCH_HAVE_SDRAM
---help---
Configure external DRAM memory and, if applicable, map then external
DRAM into the memory map.
-if LPC17_EXTDRAM
+if LPC17_40_EXTDRAM
-config LPC17_EXTDRAMSIZE
+config LPC17_40_EXTDRAMSIZE
int "External SDRAM size"
default 0
---help---
@@ -432,56 +493,56 @@ config LPC17_EXTDRAMSIZE
choice
prompt "SDRAM Width Selection"
- default LPC17_SDRAM_16BIT
+ default LPC17_40_SDRAM_16BIT
-config LPC17_SDRAM_8BIT
+config LPC17_40_SDRAM_8BIT
bool "8-bit"
-config LPC17_SDRAM_16BIT
+config LPC17_40_SDRAM_16BIT
bool "16-bit"
-config LPC17_SDRAM_32BIT
+config LPC17_40_SDRAM_32BIT
bool "32-bit"
endchoice
-config LPC17_EXTDRAMHEAP
+config LPC17_40_EXTDRAMHEAP
bool "Add external SDRAM to the heap"
default y
---help---
Add the external SDRAM into the heap.
-config LPC17_EXTDRAMHEAP_OFFSET
+config LPC17_40_EXTDRAMHEAP_OFFSET
int "DRAM heap offset"
default 0
- depends on LPC17_EXTDRAMHEAP
+ depends on LPC17_40_EXTDRAMHEAP
---help---
Memory may be reserved at the beginning of DRAM for other purposes
(for example for video framebuffers). Memory can similar be
- reserved at the end of DRAM using LPC17_EXTDRAMSIZE. The amount to
- be added to the heap will be from DRAM_BASE + LPC17_EXTDRAMHEAP_OFFSET
- through DRAM_BASE + LPC17_EXTDRAMSIZE where (DRAM_BASE is the base
+ reserved at the end of DRAM using LPC17_40_EXTDRAMSIZE. The amount to
+ be added to the heap will be from DRAM_BASE + LPC17_40_EXTDRAMHEAP_OFFSET
+ through DRAM_BASE + LPC17_40_EXTDRAMSIZE where (DRAM_BASE is the base
address of CS0).
endif
-config LPC17_EXTSRAM0
+config LPC17_40_EXTSRAM0
bool "Configure external SRAM (Bank 0)"
default n
- depends on LPC17_HAVE_EXTSRAM0
+ depends on LPC17_40_HAVE_EXTSRAM0
---help---
Configure external SRAM Bank 0 memory and, if applicable, map then
external SRAM Bank 0 into the memory map.
-if LPC17_EXTSRAM0
+if LPC17_40_EXTSRAM0
-config LPC17_EXTSRAM0SIZE
+config LPC17_40_EXTSRAM0SIZE
int "External SRAM size"
default 0
---help---
Size of the external SRAM Bank 0 in bytes.
-config LPC17_EXTSRAM0HEAP
+config LPC17_40_EXTSRAM0HEAP
bool "Add external SRAM (Bank 0) to the heap"
default y
---help---
@@ -491,11 +552,11 @@ endif
endmenu
menu "Serial driver options"
- depends on LPC17_UART0 || LPC17_UART1 || LPC17_UART2 || LPC17_UART3 || LPC17_UART4
+ depends on LPC17_40_UART0 || LPC17_40_UART1 || LPC17_40_UART2 || LPC17_40_UART3 || LPC17_40_UART4
-config LPC17_UART1_RINGINDICATOR
+config LPC17_40_UART1_RINGINDICATOR
bool "UART1 ring indicator"
- depends on LPC17_UART1
+ depends on LPC17_40_UART1
default n
---help---
Enable UART1 ring indicator
@@ -503,21 +564,21 @@ config LPC17_UART1_RINGINDICATOR
endmenu
menu "ADC driver options"
- depends on LPC17_ADC
+ depends on LPC17_40_ADC
-config LPC17_ADC0_AVERAGE
+config LPC17_40_ADC0_AVERAGE
int "ADC0 average"
default 200
-config LPC17_ADC0_MASK
+config LPC17_40_ADC0_MASK
hex "ADC0 mask"
default 0x01
-config LPC17_ADC0_SPS
+config LPC17_40_ADC0_SPS
int "ADC0 SPS"
default 1000
-config LPC17_ADC_CHANLIST
+config LPC17_40_ADC_CHANLIST
bool "Use ADC channel list"
default n
---help---
@@ -532,80 +593,80 @@ config LPC17_ADC_CHANLIST
triggering interrupt from the global DONE flag).
If this option is enabled, then the platform specific code must do
- two things: (1) define LPC17_ADC_NCHANNELS in the configuration file
+ two things: (1) define LPC17_40_ADC_NCHANNELS in the configuration file
and (2) provide an array g_adc_chanlist[] with the channel numbers
- matching the LPC17_ADC0_MASK within the board-specific library.
+ matching the LPC17_40_ADC0_MASK within the board-specific library.
-config LPC17_ADC_BURSTMODE
+config LPC17_40_ADC_BURSTMODE
bool "One interrupt at the end of all ADC conversions"
default n
---help---
Select this if you want to generate only one interrupt once all selected
channels has been converted by the ADC
-config LPC17_ADC_NCHANNELS
+config LPC17_40_ADC_NCHANNELS
int "ADC0 number of channels"
- depends on LPC17_ADC_CHANLIST
+ depends on LPC17_40_ADC_CHANLIST
default 0
---help---
- If LPC17_ADC_CHANLIST is enabled, then the platform specific code
- must do two things: (1) define LPC17_ADC_NCHANNELS in the configuration
+ If LPC17_40_ADC_CHANLIST is enabled, then the platform specific code
+ must do two things: (1) define LPC17_40_ADC_NCHANNELS in the configuration
file and (2) provide an array g_adc_chanlist[] with the channel
- numbers matching the LPC17_ADC0_MASK within the board-specific
+ numbers matching the LPC17_40_ADC0_MASK within the board-specific
library.
endmenu
menu "CAN driver options"
- depends on LPC17_CAN1 || LPC17_CAN2
+ depends on LPC17_40_CAN1 || LPC17_40_CAN2
-config LPC17_CAN1_BAUD
+config LPC17_40_CAN1_BAUD
int "CAN1 BAUD"
- depends on LPC17_CAN1
+ depends on LPC17_40_CAN1
---help---
- CAN1 BAUD rate. Required if LPC17_CAN1 is defined.
+ CAN1 BAUD rate. Required if LPC17_40_CAN1 is defined.
-config LPC17_CAN2_BAUD
+config LPC17_40_CAN2_BAUD
int "CAN2 BAUD"
- depends on LPC17_CAN2
+ depends on LPC17_40_CAN2
---help---
- CAN2 BAUD rate. Required if LPC17_CAN2 is defined.
+ CAN2 BAUD rate. Required if LPC17_40_CAN2 is defined.
-config LPC17_CAN1_DIVISOR
+config LPC17_40_CAN1_DIVISOR
int "CAN1 CCLK divisor"
- depends on LPC17_CAN1
+ depends on LPC17_40_CAN1
default 4
---help---
CAN1 is clocked at CCLK divided by this number. (the CCLK frequency is divided
by this number to get the CAN clock). Options = {1,2,4,6}. Default: 4.
-config LPC17_CAN2_DIVISOR
+config LPC17_40_CAN2_DIVISOR
int "CAN2 CCLK divisor"
- depends on LPC17_CAN2
+ depends on LPC17_40_CAN2
default 4
---help---
CAN2 is clocked at CCLK divided by this number. (the CCLK frequency is divided
by this number to get the CAN clock). Options = {1,2,4,6}. Default: 4.
-config LPC17_CAN_TSEG1
+config LPC17_40_CAN_TSEG1
int "TSEG1 quanta"
default 6
---help---
The number of CAN time quanta in segment 1. Default: 6
-config LPC17_CAN_TSEG2
+config LPC17_40_CAN_TSEG2
int "TSEG2 quanta"
default 4
---help---
The number of CAN time quanta in segment 2. Default: 7
-config LPC17_CAN_SAM
+config LPC17_40_CAN_SAM
bool "CAN sampling"
default n
---help---
The bus is sampled 3 times (recommended for low to medium speed buses to spikes on the bus-line).
-config LPC17_CAN_REGDEBUG
+config LPC17_40_CAN_REGDEBUG
bool "Register level debug"
depends on DEBUG_CAN_INFO
default n
@@ -615,47 +676,47 @@ config LPC17_CAN_REGDEBUG
endmenu
-config LPC17_GPIOIRQ
+config LPC17_40_GPIOIRQ
bool "GPIO interrupt support"
default n
---help---
Enable support for GPIO interrupts
menu "I2C driver options"
- depends on LPC17_I2C0 || LPC17_I2C1 || LPC17_I2C2
+ depends on LPC17_40_I2C0 || LPC17_40_I2C1 || LPC17_40_I2C2
-config LPC17_I2C0_FREQUENCY
+config LPC17_40_I2C0_FREQUENCY
int "I2C0 frequency"
- depends on LPC17_I2C0
+ depends on LPC17_40_I2C0
default 100000
-config LPC17_I2C1_FREQUENCY
+config LPC17_40_I2C1_FREQUENCY
int "I2C1 frequency"
- depends on LPC17_I2C1
+ depends on LPC17_40_I2C1
default 100000
-config LPC17_I2C2_FREQUENCY
+config LPC17_40_I2C2_FREQUENCY
int "I2C2 frequency"
- depends on LPC17_I2C2
+ depends on LPC17_40_I2C2
default 100000
endmenu
menu "SDCARD Configuration"
- depends on LPC17_SDCARD
+ depends on LPC17_40_SDCARD
-config LPC17_SDCARD_DMA
+config LPC17_40_SDCARD_DMA
bool "Support DMA data transfers"
- default y if LPC17_GPDMA
+ default y if LPC17_40_GPDMA
select SDIO_DMA
- depends on LPC17_GPDMA
+ depends on LPC17_40_GPDMA
---help---
Support DMA data transfers.
Enable SD card DMA data transfers. This is marginally optional.
For most usages, SD accesses will cause data overruns if used without
DMA.
-config LPC17_SDCARD_WIDTH_D1_ONLY
+config LPC17_40_SDCARD_WIDTH_D1_ONLY
bool "Use D1 only"
default n
---help---
@@ -666,63 +727,63 @@ config LPC17_SDCARD_WIDTH_D1_ONLY
endmenu
menu "Ethernet driver options"
- depends on LPC17_ETHERNET
+ depends on LPC17_40_ETHERNET
-config LPC17_PHY_AUTONEG
+config LPC17_40_PHY_AUTONEG
bool "Autonegotiation"
---help---
Enable auto-negotiation
-config LPC17_PHY_SPEED100
+config LPC17_40_PHY_SPEED100
bool "100Mbit/Sec"
- depends on !LPC17_PHY_AUTONEG
+ depends on !LPC17_40_PHY_AUTONEG
---help---
Select 100Mbit vs. 10Mbit speed.
-config LPC17_PHY_FDUPLEX
+config LPC17_40_PHY_FDUPLEX
bool "Full duplex"
- depends on !LPC17_PHY_AUTONEG
+ depends on !LPC17_40_PHY_AUTONEG
---help---
Select full (vs. half) duplex
-config LPC17_EMACRAM_SIZE
+config LPC17_40_EMACRAM_SIZE
int "EMAC RAM Size"
default 16384
---help---
Size of EMAC RAM. Default: 16384 bytes
-config LPC17_ETH_NTXDESC
+config LPC17_40_ETH_NTXDESC
int "Number of Tx descriptors"
default 13
---help---
Configured number of Tx descriptors. Default: 13
-config LPC17_ETH_NRXDESC
+config LPC17_40_ETH_NRXDESC
int "Number of Rx descriptors"
default 13
---help---
Configured number of Rx descriptors. Default: 13
-config LPC17_NET_WOL
+config LPC17_40_NET_WOL
bool "Wake-up on LAN"
default n
---help---
Enable Wake-up on Lan (not fully implemented).
-config LPC17_NET_REGDEBUG
+config LPC17_40_NET_REGDEBUG
bool "Ethernet register-level debug"
depends on DEBUG_NET_INFO
default n
---help---
Enable low level register debug. Also needs CONFIG_DEBUG_NET_INFO.
-config LPC17_ETH_HASH
+config LPC17_40_ETH_HASH
bool "Hashing"
default n
---help---
Enable receipt of near-perfect match frames.
-config LPC17_MULTICAST
+config LPC17_40_MULTICAST
bool "Multicast"
default y if NET_MCASTGROUP
default n if !NET_MCASTGROUP
@@ -733,35 +794,35 @@ config LPC17_MULTICAST
endmenu
menu "LCD device driver options"
- depends on LPC17_LCD
+ depends on LPC17_40_LCD
-config LPC17_LCD_VRAMBASE
+config LPC17_40_LCD_VRAMBASE
hex "Video RAM base address"
default 0xa0010000
---help---
Base address of the video RAM frame buffer. The default is
- (LPC17_EXTDRAM_CS0 + 0x00010000)
+ (LPC17_40_EXTDRAM_CS0 + 0x00010000)
-config LPC17_LCD_REFRESH_FREQ
+config LPC17_40_LCD_REFRESH_FREQ
int "LCD refesh rate (Hz)"
default 50
---help---
LCD refesh rate (Hz)
-config LPC17_LCD_BACKLIGHT
+config LPC17_40_LCD_BACKLIGHT
bool "Enable backlight"
default y
---help---
- Enable backlight support. If LPC17_LCD_BACKLIGHT is selected, then
- the board-specific logic must provide this lpc17_backlight()
+ Enable backlight support. If LPC17_40_LCD_BACKLIGHT is selected, then
+ the board-specific logic must provide this lpc17_40_backlight()
interface so that the LCD driver can turn the backlight on and off
as necessary. You should select this option and implement
- lpc17_backlight() if your board provides GPIO control over the
+ lpc17_40_backlight() if your board provides GPIO control over the
backlight. This interface provides only ON/OFF control of the
backlight. If you want finer control over the backlight level (for
example, using PWM), then this interface would need to be extended.
-config LPC17_LCD_TFTPANEL
+config LPC17_40_LCD_TFTPANEL
bool "TFT Panel"
default y
---help---
@@ -771,103 +832,103 @@ config LPC17_LCD_TFTPANEL
display panels require the digital color value of each pixel to be
applied to the display data inputs.
-config LPC17_LCD_MONOCHROME
+config LPC17_40_LCD_MONOCHROME
bool "Monochrome LCD"
default n
- depends on !LPC17_LCD_TFTPANEL
+ depends on !LPC17_40_LCD_TFTPANEL
---help---
STN LCD monochrome/color selection. Selects monochrome LCD. This
selection has no meaning for a TFT panel.
choice
prompt "Bits per pixel"
- default LPC17_LCD_BPP24 if LPC17_LCD_TFTPANEL
- default LPC17_LCD_BPP16_565 if !LPC17_LCD_TFTPANEL
+ default LPC17_40_LCD_BPP24 if LPC17_40_LCD_TFTPANEL
+ default LPC17_40_LCD_BPP16_565 if !LPC17_40_LCD_TFTPANEL
-config LPC17_LCD_BPP1
+config LPC17_40_LCD_BPP1
bool "1 bit per pixel"
-config LPC17_LCD_BPP2
+config LPC17_40_LCD_BPP2
bool "2 bit per pixel"
-config LPC17_LCD_BPP4
+config LPC17_40_LCD_BPP4
bool "4 bit per pixel"
-config LPC17_LCD_BPP8
+config LPC17_40_LCD_BPP8
bool "8 bit per pixel"
-config LPC17_LCD_BPP16
+config LPC17_40_LCD_BPP16
bool "16 bit per pixel"
- depends on !LPC17_LCD_MONOCHROME
+ depends on !LPC17_40_LCD_MONOCHROME
-config LPC17_LCD_BPP24
+config LPC17_40_LCD_BPP24
bool "24 bit per pixel"
- depends on LPC17_LCD_TFTPANEL
+ depends on LPC17_40_LCD_TFTPANEL
-config LPC17_LCD_BPP16_565
+config LPC17_40_LCD_BPP16_565
bool "16 bpp, 5:6:5 mode"
- depends on !LPC17_LCD_MONOCHROME
+ depends on !LPC17_40_LCD_MONOCHROME
-config LPC17_LCD_BPP12_444
+config LPC17_40_LCD_BPP12_444
bool "12 bpp, 4:4:4 mode"
- depends on !LPC17_LCD_MONOCHROME
+ depends on !LPC17_40_LCD_MONOCHROME
endchoice
-config LPC17_LCD_BACKCOLOR
+config LPC17_40_LCD_BACKCOLOR
hex "Initial background color"
default 0x0
---help---
Initial background color
-config LPC17_LCD_HWIDTH
+config LPC17_40_LCD_HWIDTH
int "Display width (pixels)"
default 480
---help---
Horizontal width the display in pixels
-config LPC17_LCD_HPULSE
+config LPC17_40_LCD_HPULSE
int "Horizontal pulse"
default 2
-config LPC17_LCD_HFRONTPORCH
+config LPC17_40_LCD_HFRONTPORCH
int "Horizontal front porch"
default 5
-config LPC17_LCD_HBACKPORCH
+config LPC17_40_LCD_HBACKPORCH
int "Horizontal back porch"
default 40
-config LPC17_LCD_VHEIGHT
+config LPC17_40_LCD_VHEIGHT
int "Display height (rows)"
default 272
---help---
Vertical height of the display in rows
-config LPC17_LCD_VPULSE
+config LPC17_40_LCD_VPULSE
int "Vertical pulse"
default 2
-config LPC17_LCD_VFRONTPORCH
+config LPC17_40_LCD_VFRONTPORCH
int "Vertical front porch"
default 8
-config LPC17_LCD_VBACKPORCH
+config LPC17_40_LCD_VBACKPORCH
int "Vertical back porch"
default 8
endmenu
menu "USB device driver options"
- depends on LPC17_USBDEV
+ depends on LPC17_40_USBDEV
-config LPC17_USBDEV_EP0_MAXSIZE
+config LPC17_40_USBDEV_EP0_MAXSIZE
int "EP0 Max packet size"
default 64
---help---
Endpoint 0 maximum packet size. Default: 64
-config LPC17_USBDEV_FRAME_INTERRUPT
+config LPC17_40_USBDEV_FRAME_INTERRUPT
bool "USB frame interrupt"
default n
---help---
@@ -875,37 +936,37 @@ config LPC17_USBDEV_FRAME_INTERRUPT
handler vs. simply reading on demand. Probably a bad idea... Unless
there is some issue with sampling the SOF from hardware asynchronously.
-config LPC17_USBDEV_EPFAST_INTERRUPT
+config LPC17_40_USBDEV_EPFAST_INTERRUPT
bool "EP fast interrupt handling"
default n
---help---
Enable high priority interrupts. I have no idea why you might want to do that
-config LPC17_USBDEV_NDMADESCRIPTORS
+config LPC17_40_USBDEV_NDMADESCRIPTORS
int "Number of DMA descriptors"
default 8
---help---
Number of DMA descriptors to allocate in SRAM. Default: 8
-config LPC17_USBDEV_DMA
+config LPC17_40_USBDEV_DMA
bool "Enable USB device DMA"
default n
---help---
- Enable lpc17xx-specific DMA support
+ Enable lpc17xx/lpc40xx-specific DMA support
-config LPC17_USBDEV_NOVBUS
+config LPC17_40_USBDEV_NOVBUS
bool "Disable VBUS support"
default n
---help---
Define if the hardware implementation does not support the VBUS signal
-config LPC17_USBDEV_NOLED
+config LPC17_40_USBDEV_NOLED
bool "Disable USB device LCD support"
default n
---help---
Define if the hardware implementation does not support the LED output
-config LPC17_USBDEV_REGDEBUG
+config LPC17_40_USBDEV_REGDEBUG
bool "Register level debug"
depends on DEBUG_USB_INFO
default n
@@ -916,46 +977,46 @@ config LPC17_USBDEV_REGDEBUG
endmenu
menu "USB host driver options"
- depends on LPC17_USBHOST
+ depends on LPC17_40_USBHOST
-config LPC17_OHCIRAM_SIZE
+config LPC17_40_OHCIRAM_SIZE
int "OHCI RAM Size"
default 16384
---help---
Total size of OHCI RAM (in AHB SRAM Bank 1). Default: 16384
-config LPC17_USBHOST_NEDS
+config LPC17_40_USBHOST_NEDS
int "Number of Endpoint Descriptors"
default 2
---help---
Number of endpoint descriptors. Default: 2
-config LPC17_USBHOST_NTDS
+config LPC17_40_USBHOST_NTDS
int "Number of transfer descriptors"
default 3
---help---
Number of transfer descriptors. Default: 3
-config LPC17_USBHOST_TDBUFFERS
+config LPC17_40_USBHOST_TDBUFFERS
int "Number of descriptor buffers"
default 2
---help---
Number of transfer descriptor buffers. Default: 2
-config LPC17_USBHOST_TDBUFSIZE
+config LPC17_40_USBHOST_TDBUFSIZE
int "Descriptor buffer size"
default 128
---help---
Size of one transfer descriptor buffer. Default 128
-config LPC17_USBHOST_IOBUFSIZE
+config LPC17_40_USBHOST_IOBUFSIZE
int "I/O buffer size"
default 512
---help---
Size of one end-user I/O buffer. This can be zero if the application
can guarantee that all end-user I/O buffers reside in AHB SRAM.
-config LPC17_USBHOST_NPREALLOC
+config LPC17_40_USBHOST_NPREALLOC
int "Max concurrent transfers"
default 8 if USBHOST_HUB
default 4 if !USBHOST_HUB
@@ -964,7 +1025,7 @@ config LPC17_USBHOST_NPREALLOC
concurrent data transfers. This number limits that number of concurrent
asynchronous IN endpoint transfer that can be supported.
-config LPC17_USBHOST_REGDEBUG
+config LPC17_40_USBHOST_REGDEBUG
bool "Register level debug"
depends on DEBUG_USB_INFO
default n
@@ -975,9 +1036,9 @@ config LPC17_USBHOST_REGDEBUG
endmenu
menu "Memory-Technolgy-Device Options (PROGMEM)"
- depends on LPC17_PROGMEM
+ depends on LPC17_40_PROGMEM
-config LPC17_PROGMEM_NSECTORS
+config LPC17_40_PROGMEM_NSECTORS
int "Size in 32 kB sectors"
default 2
---help---
diff --git a/arch/arm/src/lpc17xx/Make.defs b/arch/arm/src/lpc17xx_40xx/Make.defs
similarity index 74%
rename from arch/arm/src/lpc17xx/Make.defs
rename to arch/arm/src/lpc17xx_40xx/Make.defs
index 446330c022a..b4004d03a50 100644
--- a/arch/arm/src/lpc17xx/Make.defs
+++ b/arch/arm/src/lpc17xx_40xx/Make.defs
@@ -1,5 +1,5 @@
############################################################################
-# arch/arm/src/lpc17xx/Make.defs
+# arch/arm/src/lpc17xx_40xx/Make.defs
#
# Copyright (C) 2010-2011, 2013-2015, 2018 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt
@@ -80,7 +80,7 @@ endif
# up_initialize(). Then this stub would not be needed.
ifeq ($(CONFIG_NET),y)
-ifneq ($(CONFIG_LPC17_ETHERNET),y)
+ifneq ($(CONFIG_LPC17_40_ETHERNET),y)
CMN_CSRCS += up_etherstub.c
endif
endif
@@ -94,90 +94,90 @@ endif
CHIP_ASRCS =
-CHIP_CSRCS = lpc17_allocateheap.c lpc17_clockconfig.c lpc17_clrpend.c
-CHIP_CSRCS += lpc17_gpio.c lpc17_i2c.c lpc17_irq.c lpc17_lowputc.c
-CHIP_CSRCS += lpc17_serial.c lpc17_spi.c lpc17_ssp.c lpc17_start.c
+CHIP_CSRCS = lpc17_40_allocateheap.c lpc17_40_clockconfig.c lpc17_40_clrpend.c
+CHIP_CSRCS += lpc17_40_gpio.c lpc17_40_i2c.c lpc17_40_irq.c lpc17_40_lowputc.c
+CHIP_CSRCS += lpc17_40_serial.c lpc17_40_spi.c lpc17_40_ssp.c lpc17_40_start.c
# Configuration-dependent LPC17xx files
ifneq ($(CONFIG_ARCH_IDLE_CUSTOM),y)
-CHIP_CSRCS += lpc17_idle.c
+CHIP_CSRCS += lpc17_40_idle.c
endif
ifneq ($(CONFIG_SCHED_TICKLESS),y)
-CHIP_CSRCS += lpc17_timerisr.c
+CHIP_CSRCS += lpc17_40_timerisr.c
endif
ifeq ($(CONFIG_BUILD_PROTECTED),y)
-CHIP_CSRCS += lpc17_userspace.c lpc17_mpuinit.c
+CHIP_CSRCS += lpc17_40_userspace.c lpc17_40_mpuinit.c
endif
-ifeq ($(CONFIG_LPC17_EMC),y)
-CHIP_CSRCS += lpc17_emc.c
+ifeq ($(CONFIG_LPC17_40_EMC),y)
+CHIP_CSRCS += lpc17_40_emc.c
endif
-ifeq ($(CONFIG_LPC17_GPIOIRQ),y)
-CHIP_CSRCS += lpc17_gpioint.c
+ifeq ($(CONFIG_LPC17_40_GPIOIRQ),y)
+CHIP_CSRCS += lpc17_40_gpioint.c
endif
ifeq ($(CONFIG_DEBUG_GPIO_INFO),y)
-CHIP_CSRCS += lpc17_gpiodbg.c
+CHIP_CSRCS += lpc17_40_gpiodbg.c
endif
-ifeq ($(CONFIG_LPC17_LCD),y)
-CHIP_CSRCS += lpc17_lcd.c
+ifeq ($(CONFIG_LPC17_40_LCD),y)
+CHIP_CSRCS += lpc17_40_lcd.c
endif
ifeq ($(CONFIG_USBDEV),y)
-CHIP_CSRCS += lpc17_usbdev.c
+CHIP_CSRCS += lpc17_40_usbdev.c
endif
ifeq ($(CONFIG_USBHOST),y)
-CHIP_CSRCS += lpc17_usbhost.c
+CHIP_CSRCS += lpc17_40_usbhost.c
endif
-ifeq ($(CONFIG_LPC17_GPDMA),y)
-CHIP_CSRCS += lpc17_gpdma.c
+ifeq ($(CONFIG_LPC17_40_GPDMA),y)
+CHIP_CSRCS += lpc17_40_gpdma.c
endif
-ifeq ($(CONFIG_LPC17_SDCARD),y)
-CHIP_CSRCS += lpc17_sdcard.c
+ifeq ($(CONFIG_LPC17_40_SDCARD),y)
+CHIP_CSRCS += lpc17_40_sdcard.c
endif
ifeq ($(CONFIG_NET),y)
-ifeq ($(CONFIG_LPC17_ETHERNET),y)
-CHIP_CSRCS += lpc17_ethernet.c
+ifeq ($(CONFIG_LPC17_40_ETHERNET),y)
+CHIP_CSRCS += lpc17_40_ethernet.c
endif
endif
ifeq ($(CONFIG_CAN),y)
-CHIP_CSRCS += lpc17_can.c
+CHIP_CSRCS += lpc17_40_can.c
endif
-ifeq ($(CONFIG_LPC17_ADC),y)
-CHIP_CSRCS += lpc17_adc.c
+ifeq ($(CONFIG_LPC17_40_ADC),y)
+CHIP_CSRCS += lpc17_40_adc.c
endif
-ifeq ($(CONFIG_LPC17_DAC),y)
-CHIP_CSRCS += lpc17_dac.c
+ifeq ($(CONFIG_LPC17_40_DAC),y)
+CHIP_CSRCS += lpc17_40_dac.c
endif
-ifeq ($(CONFIG_LPC17_RTC),y)
+ifeq ($(CONFIG_LPC17_40_RTC),y)
CHIP_CSRCS += lpc176x_rtc.c
endif
-ifeq ($(CONFIG_LPC17_PWM1),y)
-CHIP_CSRCS += lpc17_pwm.c
+ifeq ($(CONFIG_LPC17_40_PWM1),y)
+CHIP_CSRCS += lpc17_40_pwm.c
endif
-ifeq ($(CONFIG_LPC17_MCPWM),y)
-CHIP_CSRCS += lpc17_mcpwm.c
+ifeq ($(CONFIG_LPC17_40_MCPWM),y)
+CHIP_CSRCS += lpc17_40_mcpwm.c
endif
-ifeq ($(CONFIG_LPC17_TMR0),y)
-CHIP_CSRCS += lpc17_timer.c
+ifeq ($(CONFIG_LPC17_40_TMR0),y)
+CHIP_CSRCS += lpc17_40_timer.c
endif
ifeq ($(CONFIG_MTD_PROGMEM),y)
-CHIP_CSRCS += lpc17_progmem.c
+CHIP_CSRCS += lpc17_40_progmem.c
endif
diff --git a/arch/arm/src/lpc17xx/chip.h b/arch/arm/src/lpc17xx_40xx/chip.h
similarity index 86%
rename from arch/arm/src/lpc17xx/chip.h
rename to arch/arm/src/lpc17xx_40xx/chip.h
index 391901a2717..f4df7fd8c27 100644
--- a/arch/arm/src/lpc17xx/chip.h
+++ b/arch/arm/src/lpc17xx_40xx/chip.h
@@ -1,5 +1,5 @@
/************************************************************************************
- * arch/arm/src/lpc17xx/chip.h
+ * arch/arm/src/lpc17xx_40xx/chip.h
*
* Copyright (C) 2010-2011, 2013, 2018 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt
@@ -33,8 +33,8 @@
*
************************************************************************************/
-#ifndef __ARCH_ARM_SRC_LPC17XX_CHIP_H
-#define __ARCH_ARM_SRC_LPC17XX_CHIP_H
+#ifndef __ARCH_ARM_SRC_LPC17XX_40XX_CHIP_H
+#define __ARCH_ARM_SRC_LPC17XX_40XX_CHIP_H
/************************************************************************************
* Included Files
@@ -45,28 +45,28 @@
/* Include the chip capabilities file */
-#include
+#include
/* Include the chip interrupt definition file */
-#include
+#include
/* Include the memory map file. Other chip hardware files should then include
* this file for the proper setup.
*/
-#include "hardware/lpc17_memorymap.h"
+#include "hardware/lpc17_40_memorymap.h"
/************************************************************************************
* Pre-processor Definitions
************************************************************************************/
/* Provide the required number of peripheral interrupt vector definitions as well.
- * The definition LPC17_IRQ_NEXTINT simply comes from the chip-specific IRQ header
- * file included by arch/lpc17xx/irq.h.
+ * The definition LPC17_40_IRQ_NEXTINT simply comes from the chip-specific IRQ header
+ * file included by arch/lpc17xx_40xx/irq.h.
*/
-#define ARMV7M_PERIPHERAL_INTERRUPTS LPC17_IRQ_NEXTINT
+#define ARMV7M_PERIPHERAL_INTERRUPTS LPC17_40_IRQ_NEXTINT
/* Vector Table Offset Register (VECTAB). Redefine the mask defined in
* arch/arm/src/armv7-m/nvic.h; The LPC178x/7x User manual definitions
@@ -78,4 +78,4 @@
#undef NVIC_VECTAB_TBLOFF_MASK
#define NVIC_VECTAB_TBLOFF_MASK (0x3fffff00)
-#endif /* __ARCH_ARM_SRC_LPC17XX_CHIP_H */
+#endif /* __ARCH_ARM_SRC_LPC17XX_40XX_CHIP_H */
diff --git a/arch/arm/src/lpc17xx_40xx/hardware/lpc176x_memorymap.h b/arch/arm/src/lpc17xx_40xx/hardware/lpc176x_memorymap.h
new file mode 100644
index 00000000000..14f8a4c3dcd
--- /dev/null
+++ b/arch/arm/src/lpc17xx_40xx/hardware/lpc176x_memorymap.h
@@ -0,0 +1,136 @@
+/************************************************************************************
+ * arch/arm/src/lpc17xx_40xx/hardware/lpc176x_memorymap.h
+ *
+ * Copyright (C) 2010, 2013 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ * 3. Neither the name NuttX 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 THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#ifndef __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC176X_MEMORYMAP_H
+#define __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC176X_MEMORYMAP_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include
+
+#include "chip.h"
+
+/************************************************************************************
+ * Pre-processor Definitions
+ ************************************************************************************/
+
+/* Memory Map ***********************************************************************/
+
+#define LPC17_40_FLASH_BASE 0x00000000 /* -0x1fffffff: On-chip non-volatile memory */
+#define LPC17_40_SRAM_BASE 0x10000000 /* -0x10007fff: On-chip SRAM (devices <=32Kb) */
+#define LPC17_40_ROM_BASE 0x1fff0000 /* -0x1fffffff: 8Kb Boot ROM with flash services */
+#define LPC17_40_AHBSRAM_BASE 0x20000000 /* -0x3fffffff: On-chip AHB SRAM (devices >32Kb) */
+# define LPC17_40_SRAM_BANK0 0x2007c000 /* -0x2007ffff: On-chip AHB SRAM Bank0 (devices >=32Kb) */
+# define LPC17_40_SRAM_BANK1 0x20080000 /* -0x2008ffff: On-chip AHB SRAM Bank1 (devices 64Kb) */
+#define LPC17_40_GPIO_BASE 0x2009c000 /* -0x2009ffff: GPIO */
+#define LPC17_40_APB_BASE 0x40000000 /* -0x5fffffff: APB Peripherals */
+# define LPC17_40_APB0_BASE 0x40000000 /* -0x4007ffff: APB0 Peripherals */
+# define LPC17_40_APB1_BASE 0x40080000 /* -0x400fffff: APB1 Peripherals */
+# define LPC17_40_AHB_BASE 0x50000000 /* -0x501fffff: DMA Controller, Ethernet, and USB */
+#define LPC17_40_CORTEXM3_BASE 0xe0000000 /* -0xe00fffff: (see armv7-m/nvic.h) */
+#define LPC17_40_SCS_BASE 0xe000e000
+#define LPC17_40_DEBUGMCU_BASE 0xe0042000
+
+/* AHB SRAM Bank sizes **************************************************************/
+
+#define LPC17_40_BANK0_SIZE (16*1024) /* Size of AHB SRAM Bank0 (if present) */
+#define LPC17_40_BANK1_SIZE (16*1024) /* Size of AHB SRAM Bank1 (if present) */
+
+/* APB0 Peripherals *****************************************************************/
+
+#define LPC17_40_WDT_BASE 0x40000000 /* -0x40003fff: Watchdog timer */
+#define LPC17_40_TMR0_BASE 0x40004000 /* -0x40007fff: Timer 0 */
+#define LPC17_40_TMR1_BASE 0x40008000 /* -0x4000bfff: Timer 1 */
+#define LPC17_40_UART0_BASE 0x4000c000 /* -0x4000ffff: UART 0 */
+#define LPC17_40_UART1_BASE 0x40010000 /* -0x40013fff: UART 1 */
+ /* -0x40017fff: Reserved */
+#define LPC17_40_PWM1_BASE 0x40018000 /* -0x4001bfff: PWM 1 */
+#define LPC17_40_I2C0_BASE 0x4001c000 /* -0x4001ffff: I2C 0 */
+#define LPC17_40_SPI_BASE 0x40020000 /* -0x40023fff: SPI */
+#define LPC17_40_RTC_BASE 0x40024000 /* -0x40027fff: RTC + backup registers */
+#define LPC17_40_GPIOINT_BASE 0x40028000 /* -0x4002bfff: GPIO interrupts */
+#define LPC17_40_PINCONN_BASE 0x4002c000 /* -0x4002ffff: Pin connect block */
+#define LPC17_40_SSP1_BASE 0x40030000 /* -0x40033fff: SSP 1 */
+#define LPC17_40_ADC_BASE 0x40034000 /* -0x40037fff: ADC */
+#define LPC17_40_CANAFRAM_BASE 0x40038000 /* -0x4003bfff: CAN acceptance filter (AF) RAM */
+#define LPC17_40_CANAF_BASE 0x4003c000 /* -0x4003ffff: CAN acceptance filter (AF) registers */
+#define LPC17_40_CAN_BASE 0x40040000 /* -0x40043fff: CAN common registers */
+#define LPC17_40_CAN1_BASE 0x40044000 /* -0x40047fff: CAN controller l */
+#define LPC17_40_CAN2_BASE 0x40048000 /* -0x4004bfff: CAN controller 2 */
+ /* -0x4005bfff: Reserved */
+#define LPC17_40_I2C1_BASE 0x4005c000 /* -0x4005ffff: I2C 1 */
+ /* -0x4007ffff: Reserved */
+
+/* APB1 Peripherals *****************************************************************/
+
+ /* -0x40087fff: Reserved */
+#define LPC17_40_SSP0_BASE 0x40088000 /* -0x4008bfff: SSP 0 */
+#define LPC17_40_DAC_BASE 0x4008c000 /* -0x4008ffff: DAC */
+#define LPC17_40_TMR2_BASE 0x40090000 /* -0x40093fff: Timer 2 */
+#define LPC17_40_TMR3_BASE 0x40094000 /* -0x40097fff: Timer 3 */
+#define LPC17_40_UART2_BASE 0x40098000 /* -0x4009bfff: UART 2 */
+#define LPC17_40_UART3_BASE 0x4009c000 /* -0x4009ffff: UART 3 */
+#define LPC17_40_I2C2_BASE 0x400a0000 /* -0x400a3fff: I2C 2 */
+ /* -0x400a7fff: Reserved */
+#define LPC17_40_I2S_BASE 0x400a8000 /* -0x400abfff: I2S */
+ /* -0x400affff: Reserved */
+#define LPC17_40_RIT_BASE 0x400b0000 /* -0x400b3fff: Repetitive interrupt timer */
+ /* -0x400b7fff: Reserved */
+#define LPC17_40_MCPWM_BASE 0x400b8000 /* -0x400bbfff: Motor control PWM */
+#define LPC17_40_QEI_BASE 0x400bc000 /* -0x400bffff: Quadrature encoder interface */
+ /* -0x400fbfff: Reserved */
+#define LPC17_40_SYSCON_BASE 0x400fc000 /* -0x400fffff: System control */
+
+/* AHB Peripherals ******************************************************************/
+
+#define LPC17_40_ETH_BASE 0x50000000 /* -0x50003fff: Ethernet controller */
+#define LPC17_40_GPDMA_BASE 0x50004000 /* -0x50007fff: GPDMA controller */
+#define LPC17_40_USB_BASE 0x5000c000 /* -0x5000cfff: USB controller */
+
+/************************************************************************************
+ * Public Types
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Data
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+#endif /* __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC176X_MEMORYMAP_H */
diff --git a/arch/arm/src/lpc17xx/hardware/lpc176x_pinconfig.h b/arch/arm/src/lpc17xx_40xx/hardware/lpc176x_pinconfig.h
similarity index 98%
rename from arch/arm/src/lpc17xx/hardware/lpc176x_pinconfig.h
rename to arch/arm/src/lpc17xx_40xx/hardware/lpc176x_pinconfig.h
index 3adb293adc9..d1f7b84c4b9 100644
--- a/arch/arm/src/lpc17xx/hardware/lpc176x_pinconfig.h
+++ b/arch/arm/src/lpc17xx_40xx/hardware/lpc176x_pinconfig.h
@@ -1,5 +1,5 @@
/************************************************************************************
- * arch/arm/src/lpc17xx/hardware/lpc176x_pinconfig.h
+ * arch/arm/src/lpc17xx_40xx/hardware/lpc176x_pinconfig.h
*
* Copyright (C) 2009-2011, 2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt
@@ -33,8 +33,8 @@
*
************************************************************************************/
-#ifndef __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC176X_PINCONFIG_H
-#define __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC176X_PINCONFIG_H
+#ifndef __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC176X_PINCONFIG_H
+#define __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC176X_PINCONFIG_H
/************************************************************************************
* Included Files
@@ -231,4 +231,4 @@
* Public Function Prototypes
************************************************************************************/
-#endif /* __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC176X_PINCONFIG_H */
+#endif /* __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC176X_PINCONFIG_H */
diff --git a/arch/arm/src/lpc17xx_40xx/hardware/lpc176x_pinconn.h b/arch/arm/src/lpc17xx_40xx/hardware/lpc176x_pinconn.h
new file mode 100644
index 00000000000..8354530a6b4
--- /dev/null
+++ b/arch/arm/src/lpc17xx_40xx/hardware/lpc176x_pinconn.h
@@ -0,0 +1,635 @@
+/************************************************************************************
+ * arch/arm/src/lpc17xx_40xx/hardware/lpc176x_pinconn.h
+ *
+ * Copyright (C) 2010, 2013 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ * 3. Neither the name NuttX 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 THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#ifndef __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC176X_PINCONN_H
+#define __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC176X_PINCONN_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include
+
+#include "chip.h"
+#include "hardware/lpc17_40_memorymap.h"
+
+/************************************************************************************
+ * Pre-processor Definitions
+ ************************************************************************************/
+
+/* Register offsets *****************************************************************/
+
+#define LPC17_40_PINCONN_PINSEL0_OFFSET 0x0000 /* Pin function select register 0 */
+#define LPC17_40_PINCONN_PINSEL1_OFFSET 0x0004 /* Pin function select register 1 */
+#define LPC17_40_PINCONN_PINSEL2_OFFSET 0x0008 /* Pin function select register 2 */
+#define LPC17_40_PINCONN_PINSEL3_OFFSET 0x000c /* Pin function select register 3 */
+#define LPC17_40_PINCONN_PINSEL4_OFFSET 0x0010 /* Pin function select register 4 */
+#define LPC17_40_PINCONN_PINSEL7_OFFSET 0x001c /* Pin function select register 7 */
+#define LPC17_40_PINCONN_PINSEL8_OFFSET 0x0020 /* Pin function select register 8 */
+#define LPC17_40_PINCONN_PINSEL9_OFFSET 0x0024 /* Pin function select register 9 */
+#define LPC17_40_PINCONN_PINSEL10_OFFSET 0x0028 /* Pin function select register 10 */
+#define LPC17_40_PINCONN_PINMODE0_OFFSET 0x0040 /* Pin mode select register 0 */
+#define LPC17_40_PINCONN_PINMODE1_OFFSET 0x0044 /* Pin mode select register 1 */
+#define LPC17_40_PINCONN_PINMODE2_OFFSET 0x0048 /* Pin mode select register 2 */
+#define LPC17_40_PINCONN_PINMODE3_OFFSET 0x004c /* Pin mode select register 3 */
+#define LPC17_40_PINCONN_PINMODE4_OFFSET 0x0050 /* Pin mode select register 4 */
+#define LPC17_40_PINCONN_PINMODE5_OFFSET 0x0054 /* Pin mode select register 5 */
+#define LPC17_40_PINCONN_PINMODE6_OFFSET 0x0058 /* Pin mode select register 6 */
+#define LPC17_40_PINCONN_PINMODE7_OFFSET 0x005c /* Pin mode select register 7 */
+#define LPC17_40_PINCONN_PINMODE9_OFFSET 0x0064 /* Pin mode select register 9 */
+#define LPC17_40_PINCONN_ODMODE0_OFFSET 0x0068 /* Open drain mode control register 0 */
+#define LPC17_40_PINCONN_ODMODE1_OFFSET 0x006c /* Open drain mode control register 1 */
+#define LPC17_40_PINCONN_ODMODE2_OFFSET 0x0070 /* Open drain mode control register 2 */
+#define LPC17_40_PINCONN_ODMODE3_OFFSET 0x0074 /* Open drain mode control register 3 */
+#define LPC17_40_PINCONN_ODMODE4_OFFSET 0x0078 /* Open drain mode control register 4 */
+#define LPC17_40_PINCONN_I2CPADCFG_OFFSET 0x007c /* I2C Pin Configuration register */
+
+/* Register addresses ***************************************************************/
+
+#define LPC17_40_PINCONN_PINSEL0 (LPC17_40_PINCONN_BASE+LPC17_40_PINCONN_PINSEL0_OFFSET)
+#define LPC17_40_PINCONN_PINSEL1 (LPC17_40_PINCONN_BASE+LPC17_40_PINCONN_PINSEL1_OFFSET)
+#define LPC17_40_PINCONN_PINSEL2 (LPC17_40_PINCONN_BASE+LPC17_40_PINCONN_PINSEL2_OFFSET)
+#define LPC17_40_PINCONN_PINSEL3 (LPC17_40_PINCONN_BASE+LPC17_40_PINCONN_PINSEL3_OFFSET)
+#define LPC17_40_PINCONN_PINSEL4 (LPC17_40_PINCONN_BASE+LPC17_40_PINCONN_PINSEL4_OFFSET)
+#define LPC17_40_PINCONN_PINSEL7 (LPC17_40_PINCONN_BASE+LPC17_40_PINCONN_PINSEL7_OFFSET)
+#define LPC17_40_PINCONN_PINSEL8 (LPC17_40_PINCONN_BASE+LPC17_40_PINCONN_PINSEL8_OFFSET)
+#define LPC17_40_PINCONN_PINSEL9 (LPC17_40_PINCONN_BASE+LPC17_40_PINCONN_PINSEL9_OFFSET)
+#define LPC17_40_PINCONN_PINSEL10 (LPC17_40_PINCONN_BASE+LPC17_40_PINCONN_PINSEL10_OFFSET)
+#define LPC17_40_PINCONN_PINMODE0 (LPC17_40_PINCONN_BASE+LPC17_40_PINCONN_PINMODE0_OFFSET)
+#define LPC17_40_PINCONN_PINMODE1 (LPC17_40_PINCONN_BASE+LPC17_40_PINCONN_PINMODE1_OFFSET)
+#define LPC17_40_PINCONN_PINMODE2 (LPC17_40_PINCONN_BASE+LPC17_40_PINCONN_PINMODE2_OFFSET)
+#define LPC17_40_PINCONN_PINMODE3 (LPC17_40_PINCONN_BASE+LPC17_40_PINCONN_PINMODE3_OFFSET)
+#define LPC17_40_PINCONN_PINMODE4 (LPC17_40_PINCONN_BASE+LPC17_40_PINCONN_PINMODE4_OFFSET)
+#define LPC17_40_PINCONN_PINMODE5 (LPC17_40_PINCONN_BASE+LPC17_40_PINCONN_PINMODE5_OFFSET)
+#define LPC17_40_PINCONN_PINMODE6 (LPC17_40_PINCONN_BASE+LPC17_40_PINCONN_PINMODE6_OFFSET)
+#define LPC17_40_PINCONN_PINMODE7 (LPC17_40_PINCONN_BASE+LPC17_40_PINCONN_PINMODE7_OFFSET)
+#define LPC17_40_PINCONN_PINMODE9 (LPC17_40_PINCONN_BASE+LPC17_40_PINCONN_PINMODE9_OFFSET)
+#define LPC17_40_PINCONN_ODMODE0 (LPC17_40_PINCONN_BASE+LPC17_40_PINCONN_ODMODE0_OFFSET)
+#define LPC17_40_PINCONN_ODMODE1 (LPC17_40_PINCONN_BASE+LPC17_40_PINCONN_ODMODE1_OFFSET)
+#define LPC17_40_PINCONN_ODMODE2 (LPC17_40_PINCONN_BASE+LPC17_40_PINCONN_ODMODE2_OFFSET)
+#define LPC17_40_PINCONN_ODMODE3 (LPC17_40_PINCONN_BASE+LPC17_40_PINCONN_ODMODE3_OFFSET)
+#define LPC17_40_PINCONN_ODMODE4 (LPC17_40_PINCONN_BASE+LPC17_40_PINCONN_ODMODE4_OFFSET)
+#define LPC17_40_PINCONN_I2CPADCFG (LPC17_40_PINCONN_BASE+LPC17_40_PINCONN_I2CPADCFG_OFFSET)
+
+/* Register bit definitions *********************************************************/
+/* Pin Function Select register 0 (PINSEL0: 0x4002c000) */
+
+#define PINCONN_PINSEL_GPIO (0)
+#define PINCONN_PINSEL_ALT1 (1)
+#define PINCONN_PINSEL_ALT2 (2)
+#define PINCONN_PINSEL_ALT3 (3)
+#define PINCONN_PINSEL_MASK (3)
+
+#define PINCONN_PINSELL_SHIFT(n) ((n) << 1) /* n=0,1,..,15 */
+#define PINCONN_PINSELL_MASK(n) (3 << PINCONN_PINSELL_SHIFT(n))
+#define PINCONN_PINSELH_SHIFT(n) (((n)-16) << 1) /* n=16,17,..31 */
+#define PINCONN_PINSELH_MASK(n) (3 << PINCONN_PINSELH_SHIFT(n))
+
+#define PINCONN_PINSEL0_P0_SHIFT(n) PINCONN_PINSELL_SHIFT(n) /* n=0,1,..,15 */
+#define PINCONN_PINSEL0_P0_MASK(n) PINCONN_PINSELL_MASK(n) /* n=0,1,..,15 */
+
+#define PINCONN_PINSEL0_P0p0_SHIFT (0) /* Bits 0-1: P0.0 00=GPIO 01=RD1 10=TXD3 11=SDA1 */
+#define PINCONN_PINSEL0_P0p0_MASK (3 << PINCONN_PINSEL0_P0p0_SHIFT)
+#define PINCONN_PINSEL0_P0p1_SHIFT (2) /* Bits 2-3: P0.1 00=GPIO 01=TD1 10=RXD3 11=SCL1 */
+#define PINCONN_PINSEL0_P0p1_MASK (3 << PINCONN_PINSEL0_P0p1_SHIFT)
+#define PINCONN_PINSEL0_P0p2_SHIFT (4) /* Bits 4-5: P0.2 00=GPIO 01=TXD0 10=AD0.7 11=Reserved */
+#define PINCONN_PINSEL0_P0p2_MASK (3 << PINCONN_PINSEL0_P0p2_SHIFT)
+#define PINCONN_PINSEL0_P0p3_SHIFT (6) /* Bits 6-7: P0.3 00=GPIO 01=RXD0 10=AD0.6 11=Reserved */
+#define PINCONN_PINSEL0_P0p3_MASK (3 << PINCONN_PINSEL0_P0p3_SHIFT)
+#define PINCONN_PINSEL0_P0p4_SHIFT (8) /* Bits 8-9: P0.4 00=GPIO 01=I2SRX_CLK 10=RD2 11=CAP2.0 */
+#define PINCONN_PINSEL0_P0p4_MASK (3 << PINCONN_PINSEL0_P0p4_SHIFT)
+#define PINCONN_PINSEL0_P0p5_SHIFT (10) /* Bits 10-11: P0.5 00=GPIO 01=I2SRX_WS 10=TD2 11=CAP2.1 */
+#define PINCONN_PINSEL0_P0p5_MASK (3 << PINCONN_PINSEL0_P0p5_SHIFT)
+#define PINCONN_PINSEL0_P0p6_SHIFT (12) /* Bits 12-13: P0.6 00=GPIO 01=I2SRX_SDA 10=SSEL1 11=MAT2.0 */
+#define PINCONN_PINSEL0_P0p6_MASK (3 << PINCONN_PINSEL0_P0p6_SHIFT)
+#define PINCONN_PINSEL0_P0p7_SHIFT (14) /* Bits 14-15: P0.7 00=GPIO 01=I2STX_CLK 10=SCK1 11=MAT2.1 */
+#define PINCONN_PINSEL0_P0p7_MASK (3 << PINCONN_PINSEL0_P0p7_SHIFT)
+#define PINCONN_PINSEL0_P0p8_SHIFT (16) /* Bits 16-17: P0.8 00=GPIO 01=I2STX_WS 10=MISO1 11=MAT2.2 */
+#define PINCONN_PINSEL0_P0p8_MASK (3 << PINCONN_PINSEL0_P0p8_SHIFT)
+#define PINCONN_PINSEL0_P0p9_SHIFT (18) /* Bits 18-19: P0.9 00=GPIO 01=I2STX_SDA 10=MOSI1 11=MAT2.3 */
+#define PINCONN_PINSEL0_P0p9_MASK (3 << PINCONN_PINSEL0_P0p9_SHIFT)
+#define PINCONN_PINSEL0_P0p10_SHIFT (20) /* Bits 20-21: P0.10 00=GPIO 01=TXD2 10=SDA2 11=MAT3.0 */
+#define PINCONN_PINSEL0_P0p10_MASK (3 << PINCONN_PINSEL0_P0p10_SHIFT)
+#define PINCONN_PINSEL0_P0p11_SHIFT (22) /* Bits 22-23: P0.11 00=GPIO 01=RXD2 10=SCL2 11=MAT3.1 */
+#define PINCONN_PINSEL0_P0p11_MASK (3 << PINCONN_PINSEL0_P0p11_SHIFT)
+ /* Bits 24-29: Reserved */
+#define PINCONN_PINSEL0_P0p15_SHIFT (30) /* Bits 30-31: P0.15 00=GPIO 01=TXD1 10=SCK0 11=SCK */
+#define PINCONN_PINSEL0_P0p15_MASK (3 << PINCONN_PINSEL0_P0p15_SHIFT)
+
+/* Pin Function Select Register 1 (PINSEL1: 0x4002c004) */
+
+#define PINCONN_PINSEL1_P0_SHIFT(n) PINCONN_PINSELH_SHIFT(n) /* n=16,17,..31 */
+#define PINCONN_PINSEL1_P0_MASK(n) PINCONN_PINSELH_MASK(n) /* n=16,17,..31 */
+
+#define PINCONN_PINSEL1_P0p16_SHIFT (0) /* Bits 0-1: P0.16 00=GPIO 01=RXD1 10=SSEL0 11=SSEL */
+#define PINCONN_PINSEL1_P0p16_MASK (3 << PINCONN_PINSEL1_P0p16_SHIFT)
+#define PINCONN_PINSEL1_P0p17_SHIFT (2) /* Bits 2-3: P0.17 00=GPIO 01=CTS1 10=MISO0 11=MISO */
+#define PINCONN_PINSEL1_P0p17_MASK (3 << PINCONN_PINSEL1_P0p17_SHIFT)
+#define PINCONN_PINSEL1_P0p18_SHIFT (4) /* Bits 4-5: P0.18 00=GPIO 01=DCD1 10=MOSI0 11=MOSI */
+#define PINCONN_PINSEL1_P0p18_MASK (3 << PINCONN_PINSEL1_P0p18_SHIFT)
+#define PINCONN_PINSEL1_P0p19_SHIFT (6) /* Bits 6-7: P0.19 00=GPIO 01=DSR1 10=Reserved 11=SDA1 */
+#define PINCONN_PINSEL1_P0p19_MASK (3 << PINCONN_PINSEL1_P0p19_SHIFT)
+#define PINCONN_PINSEL1_P0p20_SHIFT (8) /* Bits 8-9: P0.20 00=GPIO 01=DTR1 10=Reserved 11=SCL1 */
+#define PINCONN_PINSEL1_P0p20_MASK (3 << PINCONN_PINSEL1_P0p20_SHIFT)
+#define PINCONN_PINSEL1_P0p21_SHIFT (10) /* Bits 10-11: P0.21 00=GPIO 01=RI1 10=Reserved 11=RD1 */
+#define PINCONN_PINSEL1_P0p21_MASK (3 << PINCONN_PINSEL1_P0p21_SHIFT)
+#define PINCONN_PINSEL1_P0p22_SHIFT (12) /* Bits 12-13: P0.22 00=GPIO 01=RTS1 10=Reserved 11=TD1 */
+#define PINCONN_PINSEL1_P0p22_MASK (3 << PINCONN_PINSEL1_P0p22_SHIFT)
+#define PINCONN_PINSEL1_P0p23_SHIFT (14) /* Bits 14-15: P0.23 00=GPIO 01=AD0.0 10=I2SRX_CLK 11=CAP3.0 */
+#define PINCONN_PINSEL1_P0p23_MASK (3 << PINCONN_PINSEL1_P0p23_SHIFT)
+#define PINCONN_PINSEL1_P0p24_SHIFT (16) /* Bits 16-17: P0.24 00=GPIO 01=AD0.1 10=I2SRX_WS 11=CAP3.1 */
+#define PINCONN_PINSEL1_P0p24_MASK (3 << PINCONN_PINSEL1_P0p24_SHIFT)
+#define PINCONN_PINSEL1_P0p25_SHIFT (18) /* Bits 18-19: P0.25 00=GPIO 01=AD0.2 10=I2SRX_SDA 11=TXD3 */
+#define PINCONN_PINSEL1_P0p25_MASK (3 << PINCONN_PINSEL1_P0p25_SHIFT)
+#define PINCONN_PINSEL1_P0p26_SHIFT (20) /* Bits 20-21: P0.26 00=GPIO 01=AD0.3 10=AOUT 11=RXD3 */
+#define PINCONN_PINSEL1_P0p26_MASK (3 << PINCONN_PINSEL1_P0p26_SHIFT)
+#define PINCONN_PINSEL1_P0p27_SHIFT (22) /* Bits 22-23: P0.27 00=GPIO 01=SDA0 10=USB_SDA 11=Reserved */
+#define PINCONN_PINSEL1_P0p27_MASK (3 << PINCONN_PINSEL1_P0p27_SHIFT)
+#define PINCONN_PINSEL1_P0p28_SHIFT (24) /* Bits 24-25: P0.28 00=GPIO 01=SCL0 10=USB_SCL 11=Reserved */
+#define PINCONN_PINSEL1_P0p28_MASK (3 << PINCONN_PINSEL1_P0p28_SHIFT)
+#define PINCONN_PINSEL1_P0p29_SHIFT (26) /* Bits 26-27: P0.29 00=GPIO 01=USB_D+ 10=Reserved 11=Reserved */
+#define PINCONN_PINSEL1_P0p29_MASK (3 << PINCONN_PINSEL1_P0p29_SHIFT)
+#define PINCONN_PINSEL1_P0p30_SHIFT (28) /* Bits 28-29: P0.30 00=GPIO 01=USB_D- 10=Reserved 11=Reserved */
+#define PINCONN_PINSEL1_P0p30_MASK (3 << PINCONN_PINSEL1_P0p30_SHIFT)
+ /* Bits 30-31: Reserved */
+/* Pin Function Select register 2 (PINSEL2: 0x4002c008) */
+
+#define PINCONN_PINSEL2_P1_SHIFT(n) PINCONN_PINSELL_SHIFT(n) /* n=0,1,..,15 */
+#define PINCONN_PINSEL2_P1_MASK(n) PINCONN_PINSELL_MASK(n) /* n=0,1,..,15 */
+
+#define PINCONN_PINSEL2_P1p0_SHIFT (0) /* Bits 0-1: P1.0 00=GPIO 01=ENET_TXD0 10=Reserved 11=Reserved */
+#define PINCONN_PINSEL2_P1p0_MASK (3 << PINCONN_PINSEL2_P1p0_SHIFT)
+#define PINCONN_PINSEL2_P1p1_SHIFT (2) /* Bits 2-3: P1.1 00=GPIO 01=ENET_TXD1 10=Reserved 11=Reserved */
+#define PINCONN_PINSEL2_P1p1_MASK (3 << PINCONN_PINSEL2_P1p1_SHIFT)
+ /* Bits 4-7: Reserved */
+#define PINCONN_PINSEL2_P1p4_SHIFT (8) /* Bits 8-9: P1.4 00=GPIO 01=ENET_TX_EN 10=Reserved 11=Reserved */
+#define PINCONN_PINSEL2_P1p4_MASK (3 << PINCONN_PINSEL2_P1p4_SHIFT)
+ /* Bits 10-15: Reserved */
+#define PINCONN_PINSEL2_P1p8_SHIFT (16) /* Bits 16-17: P1.8 00=GPIO 01=ENET_CRS 10=Reserved 11=Reserved */
+#define PINCONN_PINSEL2_P1p8_MASK (3 << PINCONN_PINSEL2_P1p8_SHIFT)
+#define PINCONN_PINSEL2_P1p9_SHIFT (18) /* Bits 18-19: P1.9 00=GPIO 01=ENET_RXD0 10=Reserved 11=Reserved */
+#define PINCONN_PINSEL2_P1p9_MASK (3 << PINCONN_PINSEL2_P1p9_SHIFT)
+#define PINCONN_PINSEL2_P1p10_SHIFT (20) /* Bits 20-21: P1.10 00=GPIO 01=ENET_RXD1 10=Reserved 11=Reserved */
+#define PINCONN_PINSEL2_P1p10_MASK (3 << PINCONN_PINSEL2_P1p10_SHIFT)
+ /* Bits 22-27: Reserved */
+#define PINCONN_PINSEL2_P1p14_SHIFT (28) /* Bits 28-29: P1.14 00=GPIO 01=ENET_RX_ER 10=Reserved 11=Reserved */
+#define PINCONN_PINSEL2_P1p14_MASK (3 << PINCONN_PINSEL2_P1p14_SHIFT)
+#define PINCONN_PINSEL2_P1p15_SHIFT (30) /* Bits 30-31: P1.15 00=GPIO 01=ENET_REF_CLK 10=Reserved 11=Reserved */
+#define PINCONN_PINSEL2_P1p15_MASK (3 << PINCONN_PINSEL2_P1p15_SHIFT)
+
+/* Pin Function Select Register 3 (PINSEL3: 0x4002c00c) */
+
+#define PINCONN_PINSEL3_P1_SHIFT(n) PINCONN_PINSELH_SHIFT(n) /* n=16,17,..31 */
+#define PINCONN_PINSEL3_P1_MASK(n) PINCONN_PINSELH_MASK(n) /* n=16,17,..31 */
+
+#define PINCONN_PINSEL3_P1p16_SHIFT (0) /* Bits 0-1: P1.16 00=GPIO 01=ENET_MDC 10=Reserved 11=Reserved */
+#define PINCONN_PINSEL3_P1p16_MASK (3 << PINCONN_PINSEL3_P1p16_SHIFT)
+#define PINCONN_PINSEL3_P1p17_SHIFT (2) /* Bits 2-3: P1.17 00=GPIO 01=ENET_MDIO 10=Reserved 11=Reserved */
+#define PINCONN_PINSEL3_P1p17_MASK (3 << PINCONN_PINSEL3_P1p17_SHIFT)
+#define PINCONN_PINSEL3_P1p18_SHIFT (4) /* Bits 4-5: P1.18 00=GPIO 01=USB_UP_LED 10=PWM1.1 11=CAP1.0 */
+#define PINCONN_PINSEL3_P1p18_MASK (3 << PINCONN_PINSEL3_P1p18_SHIFT)
+#define PINCONN_PINSEL3_P1p19_SHIFT (6) /* Bits 6-7: P1.19 00=GPIO 01=MCOA0 10=USB_PPWR 11=CAP1.1 */
+#define PINCONN_PINSEL3_P1p19_MASK (3 << PINCONN_PINSEL3_P1p19_SHIFT)
+#define PINCONN_PINSEL3_P1p20_SHIFT (8) /* Bits 8-9: P1.20 00=GPIO 01=MCI0 10=PWM1.2 11=SCK0 */
+#define PINCONN_PINSEL3_P1p20_MASK (3 << PINCONN_PINSEL3_P1p20_SHIFT)
+#define PINCONN_PINSEL3_P1p21_SHIFT (10) /* Bits 10-11: P1.21 00=GPIO 01=MCABORT 10=PWM1.3 11=SSEL0 */
+#define PINCONN_PINSEL3_P1p21_MASK (3 << PINCONN_PINSEL3_P1p21_SHIFT)
+#define PINCONN_PINSEL3_P1p22_SHIFT (12) /* Bits 12-13: P1.22 00=GPIO 01=MCOB0 10=USB_PWRD 11=MAT1.0 */
+#define PINCONN_PINSEL3_P1p22_MASK (3 << PINCONN_PINSEL3_P1p22_SHIFT)
+#define PINCONN_PINSEL3_P1p23_SHIFT (14) /* Bits 14-15: P1.23 00=GPIO 01=MCI1 10=PWM1.4 11=MISO0 */
+#define PINCONN_PINSEL3_P1p23_MASK (3 << PINCONN_PINSEL3_P1p23_SHIFT)
+#define PINCONN_PINSEL3_P1p24_SHIFT (16) /* Bits 16-17: P1.24 00=GPIO 01=MCI2 10=PWM1.5 11=MOSI0 */
+#define PINCONN_PINSEL3_P1p24_MASK (3 << PINCONN_PINSEL3_P1p24_SHIFT)
+#define PINCONN_PINSEL3_P1p25_SHIFT (18) /* Bits 18-19: P1.25 00=GPIO 01=MCOA1 10=Reserved 11=MAT1.1 */
+#define PINCONN_PINSEL3_P1p25_MASK (3 << PINCONN_PINSEL3_P1p25_SHIFT)
+#define PINCONN_PINSEL3_P1p26_SHIFT (20) /* Bits 20-21: P1.26 00=GPIO 01=MCOB1 10=PWM1.6 11=CAP0.0 */
+#define PINCONN_PINSEL3_P1p26_MASK (3 << PINCONN_PINSEL3_P1p26_SHIFT)
+#define PINCONN_PINSEL3_P1p27_SHIFT (22) /* Bits 22-23: P1.27 00=GPIO 01=CLKOUT 10=USB_OVRCR 11=CAP0.1 */
+#define PINCONN_PINSEL3_P1p27_MASK (3 << PINCONN_PINSEL3_P1p27_SHIFT)
+#define PINCONN_PINSEL3_P1p28_SHIFT (24) /* Bits 24-25: P1.28 00=GPIO 01=MCOA2 10=PCAP1.0 11=MAT0.0 */
+#define PINCONN_PINSEL3_P1p28_MASK (3 << PINCONN_PINSEL3_P1p28_SHIFT)
+#define PINCONN_PINSEL3_P1p29_SHIFT (26) /* Bits 26-27: P1.29 00=GPIO 01=MCOB2 10=PCAP1.1 11=MAT0.1 */
+#define PINCONN_PINSEL3_P1p29_MASK (3 << PINCONN_PINSEL3_P1p29_SHIFT)
+#define PINCONN_PINSEL3_P1p30_SHIFT (28) /* Bits 28-29: P1.30 00=GPIO 01=Reserved 10=VBUS 11=AD0.4 */
+#define PINCONN_PINSEL3_P1p30_MASK (3 << PINCONN_PINSEL3_P1p30_SHIFT)
+#define PINCONN_PINSEL3_P1p31_SHIFT (30) /* Bits 30-31: P1.31 00=GPIO 01=Reserved 10=SCK1 11=AD0.5 */
+#define PINCONN_PINSEL3_P1p31_MASK (3 << PINCONN_PINSEL3_P1p31_SHIFT)
+
+/* Pin Function Select Register 4 (PINSEL4: 0x4002c010) */
+
+#define PINCONN_PINSEL4_P2_SHIFT(n) PINCONN_PINSELL_SHIFT(n) /* n=0,1,..,15 */
+#define PINCONN_PINSEL4_P2_MASK(n) PINCONN_PINSELL_MASK(n) /* n=0,1,..,15 */
+
+#define PINCONN_PINSEL4_P2p0_SHIFT (0) /* Bits 0-1: P2.0 00=GPIO 01=PWM1.1 10=TXD1 11=Reserved */
+#define PINCONN_PINSEL4_P2p0_MASK (3 << PINCONN_PINSEL4_P2p0_SHIFT)
+#define PINCONN_PINSEL4_P2p1_SHIFT (2) /* Bits 2-3: P2.1 00=GPIO 01=PWM1.2 10=RXD1 11=Reserved */
+#define PINCONN_PINSEL4_P2p1_MASK (3 << PINCONN_PINSEL4_P2p1_SHIFT)
+#define PINCONN_PINSEL4_P2p2_SHIFT (4) /* Bits 4-5: P2.2 00=GPIO 01=PWM1.3 10=CTS1 11=Reserved */
+#define PINCONN_PINSEL4_P2p2_MASK (3 << PINCONN_PINSEL4_P2p2_SHIFT)
+#define PINCONN_PINSEL4_P2p3_SHIFT (6) /* Bits 6-7: P2.3 00=GPIO 01=PWM1.4 10=DCD1 11=Reserved */
+#define PINCONN_PINSEL4_P2p3_MASK (3 << PINCONN_PINSEL4_P2p3_SHIFT)
+#define PINCONN_PINSEL4_P2p4_SHIFT (8) /* Bits 8-9: P2.4 00=GPIO 01=PWM1.5 10=DSR1 11=Reserved */
+#define PINCONN_PINSEL4_P2p4_MASK (3 << PINCONN_PINSEL4_P2p4_SHIFT)
+#define PINCONN_PINSEL4_P2p5_SHIFT (10) /* Bits 10-11: P2.5 00=GPIO 01=PWM1.6 10=DTR1 11=Reserved */
+#define PINCONN_PINSEL4_P2p5_MASK (3 << PINCONN_PINSEL4_P2p5_SHIFT)
+#define PINCONN_PINSEL4_P2p6_SHIFT (12) /* Bits 12-13: P2.6 00=GPIO 01=PCAP1.0 10=RI1 11=Reserved */
+#define PINCONN_PINSEL4_P2p6_MASK (3 << PINCONN_PINSEL4_P2p6_SHIFT)
+#define PINCONN_PINSEL4_P2p7_SHIFT (14) /* Bits 14-15: P2.7 00=GPIO 01=RD2 10=RTS1 11=Reserved */
+#define PINCONN_PINSEL4_P2p7_MASK (3 << PINCONN_PINSEL4_P2p7_SHIFT)
+#define PINCONN_PINSEL4_P2p8_SHIFT (16) /* Bits 16-17: P2.8 00=GPIO 01=TD2 10=TXD2 11=ENET_MDC */
+#define PINCONN_PINSEL4_P2p8_MASK (3 << PINCONN_PINSEL4_P2p8_SHIFT)
+#define PINCONN_PINSEL4_P2p9_SHIFT (18) /* Bits 18-19: P2.9 00=GPIO 01=USB_CONNECT 10=RXD2 11=ENET_MDIO */
+#define PINCONN_PINSEL4_P2p9_MASK (3 << PINCONN_PINSEL4_P2p9_SHIFT)
+#define PINCONN_PINSEL4_P2p10_SHIFT (20) /* Bits 20-21: P2.10 00=GPIO 01=EINT0 10=NMI 11=Reserved */
+#define PINCONN_PINSEL4_P2p10_MASK (3 << PINCONN_PINSEL4_P2p10_SHIFT)
+#define PINCONN_PINSEL4_P2p11_SHIFT (22) /* Bits 22-23: P2.11 00=GPIO 01=EINT1 10=Reserved 11=I2STX_CLK */
+#define PINCONN_PINSEL4_P2p11_MASK (3 << PINCONN_PINSEL4_P2p11_SHIFT)
+#define PINCONN_PINSEL4_P2p12_SHIFT (24) /* Bits 24-25: P2.12 00=GPIO 01=PEINT2 10=Reserved 11=I2STX_WS */
+#define PINCONN_PINSEL4_P2p12_MASK (3 << PINCONN_PINSEL4_P2p12_SHIFT)
+#define PINCONN_PINSEL4_P2p13_SHIFT (26) /* Bits 26-27: P2.13 00=GPIO 01=EINT3 10=Reserved 11=I2STX_SDA */
+#define PINCONN_PINSEL4_P2p13_MASK (3 << PINCONN_PINSEL4_P2p13_SHIFT)
+ /* Bits 28-31: Reserved */
+/* Pin Function Select Register 7 (PINSEL7: 0x4002c01c) */
+
+#define PINCONN_PINSEL7_P3_SHIFT(n) PINCONN_PINSELH_SHIFT(n) /* n=16,17,..31 */
+#define PINCONN_PINSEL7_P3_MASK(n) PINCONN_PINSELH_MASK(n) /* n=16,17,..31 */
+
+ /* Bits 0-17: Reserved */
+#define PINCONN_PINSEL7_P3p25_SHIFT (18) /* Bits 18-19: P3.25 00=GPIO 01=Reserved 10=MAT0.0 11=PWM1.2 */
+#define PINCONN_PINSEL7_P3p25_MASK (3 << PINCONN_PINSEL7_P3p25_SHIFT)
+#define PINCONN_PINSEL7_P3p26_SHIFT (20) /* Bits 20-21: P3.26 00=GPIO 01=STCLK 10=MAT0.1 11=PWM1.3 */
+#define PINCONN_PINSEL7_P3p26_MASK (3 << PINCONN_PINSEL7_P3p26_SHIFT)
+ /* Bits 22-31: Reserved */
+
+/* Pin Function Select Register 8 (PINSEL8: 0x4002c020) */
+/* No description of bits -- Does this register exist? */
+
+/* Pin Function Select Register 9 (PINSEL9: 0x4002c024) */
+
+#define PINCONN_PINSEL9_P4_SHIFT(n) PINCONN_PINSELH_SHIFT(n) /* n=16,17,..31 */
+#define PINCONN_PINSEL9_P4_MASK(n) PINCONN_PINSELH_MASK(n) /* n=16,17,..31 */
+
+ /* Bits 0-23: Reserved */
+#define PINCONN_PINSEL9_P4p28_SHIFT (24) /* Bits 24-25: P4.28 00=GPIO 01=RX_MCLK 10=MAT2.0 11=TXD3 */
+#define PINCONN_PINSEL9_P4p28_MASK (3 << PINCONN_PINSEL9_P4p28_SHIFT)
+#define PINCONN_PINSEL9_P4p29_SHIFT (26) /* Bits 26-27: P4.29 00=GPIO 01=TX_MCLK 10=MAT2.1 11=RXD3 */
+#define PINCONN_PINSEL9_P4p29_MASK (3 << PINCONN_PINSEL9_P4p29_SHIFT)
+ /* Bits 28-31: Reserved */
+/* Pin Function Select Register 10 (PINSEL10: 0x4002c028) */
+ /* Bits 0-2: Reserved */
+#define PINCONN_PINSEL10_TPIU (1 << 3) /* Bit 3: 0=TPIU interface disabled; 1=TPIU interface enabled */
+ /* Bits 4-31: Reserved */
+/* Pin Mode select register 0 (PINMODE0: 0x4002c040) */
+
+#define PINCONN_PINMODE_PU (0) /* 00: pin has a pull-up resistor enabled */
+#define PINCONN_PINMODE_RM (1) /* 01: pin has repeater mode enabled */
+#define PINCONN_PINMODE_FLOAT (2) /* 10: pin has neither pull-up nor pull-down */
+#define PINCONN_PINMODE_PD (3) /* 11: pin has a pull-down resistor enabled */
+#define PINCONN_PINMODE_MASK (3)
+
+#define PINCONN_PINMODEL_SHIFT(n) ((n) << 1) /* n=0,1,..,15 */
+#define PINCONN_PINMODEL_MASK(n) (3 << PINCONN_PINMODEL_SHIFT(n))
+#define PINCONN_PINMODEH_SHIFT(n) (((n)-16) << 1) /* n=16,17,..31 */
+#define PINCONN_PINMODEH_MASK(n) (3 << PINCONN_PINMODEH_SHIFT(n))
+
+#define PINCONN_PINMODE0_P0_SHIFT(n) PINCONN_PINMODEL_SHIFT(n) /* n=0,1,..,15 */
+#define PINCONN_PINMODE0_P0_MASK(n) PINCONN_PINMODEL_MASK(n) /* n=0,1,..,15 */
+
+#define PINCONN_PINMODE0_P0p0_SHIFT (0) /* Bits 0-1: P0.0 mode control */
+#define PINCONN_PINMODE0_P0p0_MASK (3 << PINCONN_PINMODE0_P0p0_SHIFT)
+#define PINCONN_PINMODE0_P0p1_SHIFT (2) /* Bits 2-3: P0.1 mode control */
+#define PINCONN_PINMODE0_P0p1_MASK (3 << PINCONN_PINMODE0_P0p1_SHIFT)
+#define PINCONN_PINMODE0_P0p2_SHIFT (4) /* Bits 4-5: P0.2 mode control */
+#define PINCONN_PINMODE0_P0p2_MASK (3 << PINCONN_PINMODE0_P0p2_SHIFT)
+#define PINCONN_PINMODE0_P0p3_SHIFT (6) /* Bits 6-7: P0.3 mode control */
+#define PINCONN_PINMODE0_P0p3_MASK (3 << PINCONN_PINMODE0_P0p3_SHIFT)
+#define PINCONN_PINMODE0_P0p4_SHIFT (8) /* Bits 8-9: P0.4 mode control */
+#define PINCONN_PINMODE0_P0p4_MASK (3 << PINCONN_PINMODE0_P0p4_SHIFT)
+#define PINCONN_PINMODE0_P0p5_SHIFT (10) /* Bits 10-11: P0.5 mode control */
+#define PINCONN_PINMODE0_P0p5_MASK (3 << PINCONN_PINMODE0_P0p5_SHIFT)
+#define PINCONN_PINMODE0_P0p6_SHIFT (12) /* Bits 12-13: P0.6 mode control */
+#define PINCONN_PINMODE0_P0p6_MASK (3 << PINCONN_PINMODE0_P0p6_SHIFT)
+#define PINCONN_PINMODE0_P0p7_SHIFT (14) /* Bits 14-15: P0.7 mode control */
+#define PINCONN_PINMODE0_P0p7_MASK (3 << PINCONN_PINMODE0_P0p7_SHIFT)
+#define PINCONN_PINMODE0_P0p8_SHIFT (16) /* Bits 16-17: P0.8 mode control */
+#define PINCONN_PINMODE0_P0p8_MASK (3 << PINCONN_PINMODE0_P0p8_SHIFT)
+#define PINCONN_PINMODE0_P0p9_SHIFT (18) /* Bits 18-19: P0.9 mode control */
+#define PINCONN_PINMODE0_P0p9_MASK (3 << PINCONN_PINMODE0_P0p9_SHIFT)
+#define PINCONN_PINMODE0_P0p10_SHIFT (20) /* Bits 20-21: P0.10 mode control */
+#define PINCONN_PINMODE0_P0p10_MASK (3 << PINCONN_PINMODE0_P0p10_SHIFT)
+#define PINCONN_PINMODE0_P0p11_SHIFT (22) /* Bits 22-23: P0.11 mode control */
+#define PINCONN_PINMODE0_P0p11_MASK (3 << PINCONN_PINMODE0_P0p11_SHIFT)
+ /* Bits 24-29: Reserved */
+#define PINCONN_PINMODE0_P0p15_SHIFT (30) /* Bits 30-31: P0.15 mode control */
+#define PINCONN_PINMODE0_P0p15_MASK (3 << PINCONN_PINMODE0_P0p15_SHIFT)
+
+/* Pin Mode select register 1 (PINMODE1: 0x4002c044) */
+
+#define PINCONN_PINMODE1_P0_SHIFT(n) PINCONN_PINMODEH_SHIFT(n) /* n=16,17,..31 */
+#define PINCONN_PINMODE1_P0_MASK(n) PINCONN_PINMODEH_MASK(n) /* n=16,17,..31 */
+
+#define PINCONN_PINMODE1_P0p16_SHIFT (0) /* Bits 0-1: P0.16 mode control */
+#define PINCONN_PINMODE1_P0p16_MASK (3 << PINCONN_PINMODE1_P0p16_SHIFT)
+#define PINCONN_PINMODE1_P0p17_SHIFT (2) /* Bits 2-3: P0.17 mode control */
+#define PINCONN_PINMODE1_P0p17_MASK (3 << PINCONN_PINMODE1_P0p17_SHIFT)
+#define PINCONN_PINMODE1_P0p18_SHIFT (4) /* Bits 4-5: P0.18 mode control */
+#define PINCONN_PINMODE1_P0p18_MASK (3 << PINCONN_PINMODE1_P0p18_SHIFT)
+#define PINCONN_PINMODE1_P0p19_SHIFT (6) /* Bits 6-7: P0.19 mode control */
+#define PINCONN_PINMODE1_P0p19_MASK (3 << PINCONN_PINMODE1_P0p19_SHIFT)
+#define PINCONN_PINMODE1_P0p20_SHIFT (8) /* Bits 8-9: P0.20 mode control */
+#define PINCONN_PINMODE1_P0p20_MASK (3 << PINCONN_PINMODE1_P0p20_SHIFT)
+#define PINCONN_PINMODE1_P0p21_SHIFT (10) /* Bits 10-11: P0.21 mode control */
+#define PINCONN_PINMODE1_P0p21_MASK (3 << PINCONN_PINMODE1_P0p21_SHIFT)
+#define PINCONN_PINMODE1_P0p22_SHIFT (12) /* Bits 12-13: P0.22 mode control */
+#define PINCONN_PINMODE1_P0p22_MASK (3 << PINCONN_PINMODE1_P0p22_SHIFT)
+#define PINCONN_PINMODE1_P0p23_SHIFT (14) /* Bits 14-15: P0.23 mode control */
+#define PINCONN_PINMODE1_P0p23_MASK (3 << PINCONN_PINMODE1_P0p23_SHIFT)
+#define PINCONN_PINMODE1_P0p24_SHIFT (16) /* Bits 16-17: P0.24 mode control */
+#define PINCONN_PINMODE1_P0p24_MASK (3 << PINCONN_PINMODE1_P0p24_SHIFT)
+#define PINCONN_PINMODE1_P0p25_SHIFT (18) /* Bits 18-19: P0.25 mode control */
+#define PINCONN_PINMODE1_P0p25_MASK (3 << PINCONN_PINMODE1_P0p25_SHIFT)
+#define PINCONN_PINMODE1_P0p26_SHIFT (20) /* Bits 20-21: P0.26 mode control */
+#define PINCONN_PINMODE1_P0p26_MASK (3 << PINCONN_PINMODE1_P0p26_SHIFT)
+ /* Bits 22-31: Reserved */
+
+/* Pin Mode select register 2 (PINMODE2: 0x4002c048) */
+
+#define PINCONN_PINMODE2_P1_SHIFT(n) PINCONN_PINMODEL_SHIFT(n) /* n=0,1,..,15 */
+#define PINCONN_PINMODE2_P1_MASK(n) PINCONN_PINMODEL_MASK(n) /* n=0,1,..,15 */
+
+#define PINCONN_PINMODE2_P1p0_SHIFT (0) /* Bits 2-1: P1.0 mode control */
+#define PINCONN_PINMODE2_P1p0_MASK (3 << PINCONN_PINMODE2_P1p0_SHIFT)
+#define PINCONN_PINMODE2_P1p1_SHIFT (2) /* Bits 2-3: P1.1 mode control */
+#define PINCONN_PINMODE2_P1p1_MASK (3 << PINCONN_PINMODE2_P1p1_SHIFT)
+ /* Bits 4-7: Reserved */
+#define PINCONN_PINMODE2_P1p4_SHIFT (8) /* Bits 8-9: P1.4 mode control */
+#define PINCONN_PINMODE2_P1p4_MASK (3 << PINCONN_PINMODE2_P1p4_SHIFT)
+ /* Bits 10-15: Reserved */
+#define PINCONN_PINMODE2_P1p8_SHIFT (16) /* Bits 16-17: P1.8 mode control */
+#define PINCONN_PINMODE2_P1p8_MASK (3 << PINCONN_PINMODE2_P1p8_SHIFT)
+#define PINCONN_PINMODE2_P1p9_SHIFT (18) /* Bits 18-19: P1.9 mode control */
+#define PINCONN_PINMODE2_P1p9_MASK (3 << PINCONN_PINMODE2_P1p9_SHIFT)
+#define PINCONN_PINMODE2_P1p10_SHIFT (20) /* Bits 20-21: P1.10 mode control */
+#define PINCONN_PINMODE2_P1p10_MASK (3 << PINCONN_PINMODE2_P1p10_SHIFT)
+ /* Bits 22-27: Reserved */
+#define PINCONN_PINMODE2_P1p14_SHIFT (28) /* Bits 28-29: P1.14 mode control */
+#define PINCONN_PINMODE2_P1p14_MASK (3 << PINCONN_PINMODE2_P1p14_SHIFT)
+#define PINCONN_PINMODE2_P1p15_SHIFT (30) /* Bits 30-31: P1.15 mode control */
+#define PINCONN_PINMODE2_P1p15_MASK (3 << PINCONN_PINMODE2_P1p15_SHIFT)
+
+/* Pin Mode select register 3 (PINMODE3: 0x4002c04c) */
+
+#define PINCONN_PINMODE3_P1_SHIFT(n) PINCONN_PINMODEH_SHIFT(n) /* n=16,17,..31 */
+#define PINCONN_PINMODE3_P1_MASK(n) PINCONN_PINMODEH_MASK(n) /* n=16,17,..31 */
+
+#define PINCONN_PINMODE3_P1p16_SHIFT (0) /* Bits 0-1: P1.16 mode control */
+#define PINCONN_PINMODE3_P1p16_MASK (3 << PINCONN_PINMODE3_P1p16_SHIFT)
+#define PINCONN_PINMODE3_P1p17_SHIFT (2) /* Bits 2-3: P1.17 mode control */
+#define PINCONN_PINMODE3_P1p17_MASK (3 << PINCONN_PINMODE3_P1p17_SHIFT)
+#define PINCONN_PINMODE3_P1p18_SHIFT (4) /* Bits 4-5: P1.18 mode control */
+#define PINCONN_PINMODE3_P1p18_MASK (3 << PINCONN_PINMODE3_P1p18_SHIFT)
+#define PINCONN_PINMODE3_P1p19_SHIFT (6) /* Bits 6-7: P1.19 mode control */
+#define PINCONN_PINMODE3_P1p19_MASK (3 << PINCONN_PINMODE3_P1p19_SHIFT)
+#define PINCONN_PINMODE3_P1p20_SHIFT (8) /* Bits 8-9: P1.20 mode control */
+#define PINCONN_PINMODE3_P1p20_MASK (3 << PINCONN_PINMODE3_P1p20_SHIFT)
+#define PINCONN_PINMODE3_P1p21_SHIFT (10) /* Bits 10-11: P1.21 mode control */
+#define PINCONN_PINMODE3_P1p21_MASK (3 << PINCONN_PINMODE3_P1p21_SHIFT)
+#define PINCONN_PINMODE3_P1p22_SHIFT (12) /* Bits 12-13: P1.22 mode control */
+#define PINCONN_PINMODE3_P1p22_MASK (3 << PINCONN_PINMODE3_P1p22_SHIFT)
+#define PINCONN_PINMODE3_P1p23_SHIFT (14) /* Bits 14-15: P1.23 mode control */
+#define PINCONN_PINMODE3_P1p23_MASK (3 << PINCONN_PINMODE3_P1p23_SHIFT)
+#define PINCONN_PINMODE3_P1p24_SHIFT (16) /* Bits 16-17: P1.24 mode control */
+#define PINCONN_PINMODE3_P1p24_MASK (3 << PINCONN_PINMODE3_P1p24_SHIFT)
+#define PINCONN_PINMODE3_P1p25_SHIFT (18) /* Bits 18-19: P1.25 mode control */
+#define PINCONN_PINMODE3_P1p25_MASK (3 << PINCONN_PINMODE3_P1p25_SHIFT)
+#define PINCONN_PINMODE3_P1p26_SHIFT (20) /* Bits 20-21: P1.26 mode control */
+#define PINCONN_PINMODE3_P1p26_MASK (3 << PINCONN_PINMODE3_P1p26_SHIFT)
+#define PINCONN_PINMODE3_P1p27_SHIFT (22) /* Bits 22-23: P1.27 mode control */
+#define PINCONN_PINMODE3_P1p27_MASK (3 << PINCONN_PINMODE3_P1p27_SHIFT)
+#define PINCONN_PINMODE3_P1p28_SHIFT (24) /* Bits 24-25: P1.28 mode control */
+#define PINCONN_PINMODE3_P1p28_MASK (3 << PINCONN_PINMODE3_P1p28_SHIFT)
+#define PINCONN_PINMODE3_P1p29_SHIFT (26) /* Bits 26-27: P1.29 mode control */
+#define PINCONN_PINMODE3_P1p29_MASK (3 << PINCONN_PINMODE3_P1p29_SHIFT)
+#define PINCONN_PINMODE3_P1p30_SHIFT (28) /* Bits 28-29: P1.30 mode control */
+#define PINCONN_PINMODE3_P1p30_MASK (3 << PINCONN_PINMODE3_P1p30_SHIFT)
+#define PINCONN_PINMODE3_P1p31_SHIFT (30) /* Bits 30-31: P1.31 mode control */
+#define PINCONN_PINMODE3_P1p31_MASK (3 << PINCONN_PINMODE3_P1p31_SHIFT)
+
+/* Pin Mode select register 4 (PINMODE4: 0x4002c050) */
+
+#define PINCONN_PINMODE4_P2_SHIFT(n) PINCONN_PINMODEL_SHIFT(n) /* n=0,1,..,15 */
+#define PINCONN_PINMODE4_P2_MASK(n) PINCONN_PINMODEL_MASK(n) /* n=0,1,..,15 */
+
+#define PINCONN_PINMODE4_P2p0_SHIFT (0) /* Bits 0-1: P2.0 mode control */
+#define PINCONN_PINMODE4_P2p0_MASK (3 << PINCONN_PINMODE4_P2p0_SHIFT)
+#define PINCONN_PINMODE4_P2p1_SHIFT (2) /* Bits 2-3: P2.1 mode control */
+#define PINCONN_PINMODE4_P2p1_MASK (3 << PINCONN_PINMODE4_P2p1_SHIFT)
+#define PINCONN_PINMODE4_P2p2_SHIFT (4) /* Bits 4-5: P2.2 mode control */
+#define PINCONN_PINMODE4_P2p2_MASK (3 << PINCONN_PINMODE4_P2p2_SHIFT)
+#define PINCONN_PINMODE4_P2p3_SHIFT (6) /* Bits 6-7: P2.3 mode control */
+#define PINCONN_PINMODE4_P2p3_MASK (3 << PINCONN_PINMODE4_P2p3_SHIFT)
+#define PINCONN_PINMODE4_P2p4_SHIFT (8) /* Bits 8-9: P2.4 mode control */
+#define PINCONN_PINMODE4_P2p4_MASK (3 << PINCONN_PINMODE4_P2p4_SHIFT)
+#define PINCONN_PINMODE4_P2p5_SHIFT (10) /* Bits 10-11: P2.5 mode control */
+#define PINCONN_PINMODE4_P2p5_MASK (3 << PINCONN_PINMODE4_P2p5_SHIFT)
+#define PINCONN_PINMODE4_P2p6_SHIFT (12) /* Bits 12-13: P2.6 mode control */
+#define PINCONN_PINMODE4_P2p6_MASK (3 << PINCONN_PINMODE4_P2p6_SHIFT)
+#define PINCONN_PINMODE4_P2p7_SHIFT (14) /* Bits 14-15: P2.7 mode control */
+#define PINCONN_PINMODE4_P2p7_MASK (3 << PINCONN_PINMODE4_P2p7_SHIFT)
+#define PINCONN_PINMODE4_P2p8_SHIFT (16) /* Bits 16-17: P2.8 mode control */
+#define PINCONN_PINMODE4_P2p8_MASK (3 << PINCONN_PINMODE4_P2p8_SHIFT)
+#define PINCONN_PINMODE4_P2p9_SHIFT (18) /* Bits 18-19: P2.9 mode control */
+#define PINCONN_PINMODE4_P2p9_MASK (3 << PINCONN_PINMODE4_P2p9_SHIFT)
+#define PINCONN_PINMODE4_P2p10_SHIFT (20) /* Bits 20-21: P2.10 mode control */
+#define PINCONN_PINMODE4_P2p10_MASK (3 << PINCONN_PINMODE4_P2p10_SHIFT)
+#define PINCONN_PINMODE4_P2p11_SHIFT (22) /* Bits 22-23: P2.11 mode control */
+#define PINCONN_PINMODE4_P2p11_MASK (3 << PINCONN_PINMODE4_P2p11_SHIFT)
+#define PINCONN_PINMODE4_P2p12_SHIFT (24) /* Bits 24-25: P2.12 mode control */
+#define PINCONN_PINMODE4_P2p12_MASK (3 << PINCONN_PINMODE4_P2p12_SHIFT)
+#define PINCONN_PINMODE4_P2p13_SHIFT (26) /* Bits 26-27: P2.13 mode control */
+#define PINCONN_PINMODE4_P2p13_MASK (3 << PINCONN_PINMODE4_P2p13_SHIFT)
+ /* Bits 28-31: Reserved */
+/* Pin Mode select register 5 (PINMODE5: 0x4002c054)
+ * Pin Mode select register 6 (PINMODE6: 0x4002c058)
+ * No bit definitions -- do these registers exist?
+ */
+
+#define PINCONN_PINMODE5_P2_SHIFT(n) PINCONN_PINMODEH_SHIFT(n) /* n=16,17,..31 */
+#define PINCONN_PINMODE5_P2_MASK(n) PINCONN_PINMODEH_MASK(n) /* n=16,17,..31 */
+
+#define PINCONN_PINMODE6_P3_SHIFT(n) PINCONN_PINMODEL_SHIFT(n) /* n=0,1,..,15 */
+#define PINCONN_PINMODE6_P3_MASK(n) PINCONN_PINMODEL_MASK(n) /* n=0,1,..,15 */
+
+/* Pin Mode select register 7 (PINMODE7: 0x4002c05c) */
+
+#define PINCONN_PINMODE7_P3_SHIFT(n) PINCONN_PINMODEH_SHIFT(n) /* n=16,17,..31 */
+#define PINCONN_PINMODE7_P3_MASK(n) PINCONN_PINMODEH_MASK(n) /* n=16,17,..31 */
+ /* Bits 0-17: Reserved */
+#define PINCONN_PINMODE7_P3p25_SHIFT (18) /* Bits 18-19: P3.25 mode control */
+#define PINCONN_PINMODE7_P3p25_MASK (3 << PINCONN_PINMODE7_P3p25_SHIFT)
+#define PINCONN_PINMODE7_P3p26_SHIFT (20) /* Bits 20-21: P3.26 mode control */
+#define PINCONN_PINMODE7_P3p26_MASK (3 << PINCONN_PINMODE7_P3p26_SHIFT)
+ /* Bits 22-31: Reserved */
+/* Pin Mode select register 9 (PINMODE9: 0x4002c064) */
+
+#define PINCONN_PINMODE9_P4_SHIFT(n) PINCONN_PINMODEH_SHIFT(n) /* n=16,17,..31 */
+#define PINCONN_PINMODE9_P4_MASK(n) PINCONN_PINMODEH_MASK(n) /* n=16,17,..31 */
+ /* Bits 0-23: Reserved */
+#define PINCONN_PINMODE9_P4p28_SHIFT (24) /* Bits 24-25: P4.28 mode control */
+#define PINCONN_PINMODE9_P4p28_MASK (3 << PINCONN_PINMODE9_P4p28_SHIFT)
+#define PINCONN_PINMODE9_P4p29_SHIFT (26) /* Bits 26-27: P4.29 mode control */
+#define PINCONN_PINMODE9_P4p29_MASK (3 << PINCONN_PINMODE9_P4p29_SHIFT)
+ /* Bits 28-31: Reserved */
+/* Open Drain Pin Mode select register 0 (PINMODE_OD0: 0x4002c068) */
+
+#define PINCONN_ODMODE0_P0(n) (1 << (n))
+
+#define PINCONN_ODMODE0_P0p0 (1 << 0) /* Bit 0: P0.0 open drain mode */
+#define PINCONN_ODMODE0_P0p1 (1 << 1) /* Bit 1: P0.1 open drain mode */
+#define PINCONN_ODMODE0_P0p2 (1 << 2) /* Bit 2: P0.2 open drain mode */
+#define PINCONN_ODMODE0_P0p3 (1 << 3) /* Bit 3: P0.3 open drain mode */
+#define PINCONN_ODMODE0_P0p4 (1 << 4) /* Bit 4: P0.4 open drain mode */
+#define PINCONN_ODMODE0_P0p5 (1 << 5) /* Bit 5: P0.5 open drain mode */
+#define PINCONN_ODMODE0_P0p6 (1 << 6) /* Bit 6: P0.6 open drain mode */
+#define PINCONN_ODMODE0_P0p7 (1 << 7) /* Bit 7: P0.7 open drain mode */
+#define PINCONN_ODMODE0_P0p8 (1 << 8) /* Bit 8: P0.8 open drain mode */
+#define PINCONN_ODMODE0_P0p9 (1 << 9) /* Bit 9: P0.9 open drain mode */
+#define PINCONN_ODMODE0_P0p10 (1 << 10) /* Bit 10: P0.10 open drain mode */
+#define PINCONN_ODMODE0_P0p11 (1 << 11) /* Bit 11: P0.11 open drain mode */
+ /* Bits 12-14: Reserved */
+#define PINCONN_ODMODE0_P0p15 (1 << 15) /* Bit 15: P0.15 open drain mode */
+#define PINCONN_ODMODE0_P0p16 (1 << 16) /* Bit 16: P0.16 open drain mode */
+#define PINCONN_ODMODE0_P0p17 (1 << 17) /* Bit 17: P0.17 open drain mode */
+#define PINCONN_ODMODE0_P0p18 (1 << 18) /* Bit 18: P0.18 open drain mode */
+#define PINCONN_ODMODE0_P0p19 (1 << 19) /* Bit 19: P0.19 open drain mode */
+#define PINCONN_ODMODE0_P0p20 (1 << 20) /* Bit 20: P0.20 open drain mode */
+#define PINCONN_ODMODE0_P0p21 (1 << 21) /* Bit 21: P0.21 open drain mode */
+#define PINCONN_ODMODE0_P0p22 (1 << 22) /* Bit 22: P0.22 open drain mode */
+#define PINCONN_ODMODE0_P0p23 (1 << 23) /* Bit 23: P0.23 open drain mode */
+#define PINCONN_ODMODE0_P0p24 (1 << 24) /* Bit 24: P0.24 open drain mode */
+#define PINCONN_ODMODE0_P0p25 (1 << 25) /* Bit 25: P0.25 open drain mode */
+#define PINCONN_ODMODE0_P0p26 (1 << 25) /* Bit 26: P0.26 open drain mode */
+ /* Bits 27-28: Reserved */
+#define PINCONN_ODMODE0_P0p29 (1 << 29) /* Bit 29: P0.29 open drain mode */
+#define PINCONN_ODMODE0_P0p30 (1 << 30) /* Bit 30: P0.30 open drain mode */
+ /* Bit 31: Reserved */
+/* Open Drain Pin Mode select register 1 (PINMODE_OD1: 0x4002c06c) */
+
+#define PINCONN_ODMODE1_P1(n) (1 << (n))
+
+#define PINCONN_ODMODE1_P1p0 (1 << 0) /* Bit 0: P1.0 open drain mode */
+#define PINCONN_ODMODE1_P1p1 (1 << 1) /* Bit 1: P1.1 open drain mode */
+ /* Bits 2-3: Reserved */
+#define PINCONN_ODMODE1_P1p4 (1 << 4) /* Bit 4: P1.4 open drain mode */
+ /* Bits 5-7: Reserved */
+#define PINCONN_ODMODE1_P1p8 (1 << 8) /* Bit 8: P1.8 open drain mode */
+#define PINCONN_ODMODE1_P1p9 (1 << 9) /* Bit 9: P1.9 open drain mode */
+#define PINCONN_ODMODE1_P1p10 (1 << 10) /* Bit 10: P1.10 open drain mode */
+ /* Bits 11-13: Reserved */
+#define PINCONN_ODMODE1_P1p14 (1 << 14) /* Bit 14: P1.14 open drain mode */
+#define PINCONN_ODMODE1_P1p15 (1 << 15) /* Bit 15: P1.15 open drain mode */
+#define PINCONN_ODMODE1_P1p16 (1 << 16) /* Bit 16: P1.16 open drain mode */
+#define PINCONN_ODMODE1_P1p17 (1 << 17) /* Bit 17: P1.17 open drain mode */
+#define PINCONN_ODMODE1_P1p18 (1 << 18) /* Bit 18: P1.18 open drain mode */
+#define PINCONN_ODMODE1_P1p19 (1 << 19) /* Bit 19: P1.19 open drain mode */
+#define PINCONN_ODMODE1_P1p20 (1 << 20) /* Bit 20: P1.20 open drain mode */
+#define PINCONN_ODMODE1_P1p21 (1 << 21) /* Bit 21: P1.21 open drain mode */
+#define PINCONN_ODMODE1_P1p22 (1 << 22) /* Bit 22: P1.22 open drain mode */
+#define PINCONN_ODMODE1_P1p23 (1 << 23) /* Bit 23: P1.23 open drain mode */
+#define PINCONN_ODMODE1_P1p24 (1 << 24) /* Bit 24: P1.24 open drain mode */
+#define PINCONN_ODMODE1_P1p25 (1 << 25) /* Bit 25: P1.25 open drain mode */
+#define PINCONN_ODMODE1_P1p26 (1 << 25) /* Bit 26: P1.26 open drain mode */
+#define PINCONN_ODMODE1_P1p27 (1 << 27) /* Bit 27: P1.27 open drain mode */
+#define PINCONN_ODMODE1_P1p28 (1 << 28) /* Bit 28: P1.28 open drain mode */
+#define PINCONN_ODMODE1_P1p29 (1 << 29) /* Bit 29: P1.29 open drain mode */
+#define PINCONN_ODMODE1_P1p30 (1 << 30) /* Bit 30: P1.30 open drain mode */
+#define PINCONN_ODMODE1_P1p31 (1 << 31) /* Bit 31: P1.31 open drain mode */
+
+/* Open Drain Pin Mode select register 2 (PINMODE_OD2: 0x4002c070) */
+
+#define PINCONN_ODMODE2_P2(n) (1 << (n))
+
+#define PINCONN_ODMODE2_P2p0 (1 << 0) /* Bit 0: P2.0 open drain mode */
+#define PINCONN_ODMODE2_P2p1 (1 << 1) /* Bit 1: P2.1 open drain mode */
+#define PINCONN_ODMODE2_P2p2 (1 << 2) /* Bit 2: P2.2 open drain mode */
+#define PINCONN_ODMODE2_P2p3 (1 << 3) /* Bit 3: P2.3 open drain mode */
+#define PINCONN_ODMODE2_P2p4 (1 << 4) /* Bit 4: P2.4 open drain mode */
+#define PINCONN_ODMODE2_P2p5 (1 << 5) /* Bit 5: P2.5 open drain mode */
+#define PINCONN_ODMODE2_P2p6 (1 << 6) /* Bit 6: P2.6 open drain mode */
+#define PINCONN_ODMODE2_P2p7 (1 << 7) /* Bit 7: P2.7 open drain mode */
+#define PINCONN_ODMODE2_P2p8 (1 << 8) /* Bit 8: P2.8 open drain mode */
+#define PINCONN_ODMODE2_P2p9 (1 << 9) /* Bit 9: P2.9 open drain mode */
+#define PINCONN_ODMODE2_P2p10 (1 << 10) /* Bit 10: P2.10 open drain mode */
+#define PINCONN_ODMODE2_P2p11 (1 << 11) /* Bit 11: P2.11 open drain mode */
+#define PINCONN_ODMODE2_P2p12 (1 << 12) /* Bit 12: P2.12 open drain mode */
+#define PINCONN_ODMODE2_P2p13 (1 << 13) /* Bit 13: P2.13 open drain mode */
+ /* Bits 14-31: Reserved */
+/* Open Drain Pin Mode select register 3 (PINMODE_OD3: 0x4002c074) */
+
+#define PINCONN_ODMODE3_P3(n) (1 << (n))
+ /* Bits 0-24: Reserved */
+#define PINCONN_ODMODE3_P3p25 (1 << 25) /* Bit 25: P3.25 open drain mode */
+#define PINCONN_ODMODE3_P3p26 (1 << 25) /* Bit 26: P3.26 open drain mode */
+ /* Bits 17-31: Reserved */
+/* Open Drain Pin Mode select register 4 (PINMODE_OD4: 0x4002c078) */
+
+#define PINCONN_ODMODE4_P4(n) (1 << (n))
+ /* Bits 0-27: Reserved */
+#define PINCONN_ODMODE4_P4p28 (1 << 28) /* Bit 28: P4.28 open drain mode */
+#define PINCONN_ODMODE4_P4p29 (1 << 29) /* Bit 29: P4.29 open drain mode */
+ /* Bits 30-31: Reserved */
+/* I2C Pin Configuration register (I2CPADCFG: 0x4002c07c) */
+
+#define PINCONN_I2CPADCFG_SDADRV0 (1 << 0) /* Bit 0: SDA0 pin, P0.27 in Fast Mode Plus */
+#define PINCONN_I2CPADCFG_SDAI2C0 (1 << 1) /* Bit 1: SDA0 pin, P0.27 I2C glitch
+ * filtering/slew rate control */
+#define PINCONN_I2CPADCFG_SCLDRV0 (1 << 2) /* Bit 2: SCL0 pin, P0.28 in Fast Mode Plus */
+#define PINCONN_I2CPADCFG_SCLI2C0 (1 << 3) /* Bit 3: SCL0 pin, P0.28 I2C glitch
+ * filtering/slew rate control */
+ /* Bits 4-31: Reserved */
+
+/************************************************************************************
+ * Public Types
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Data
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+#endif /* __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC176X_PINCONN_H */
diff --git a/arch/arm/src/lpc17xx_40xx/hardware/lpc176x_syscon.h b/arch/arm/src/lpc17xx_40xx/hardware/lpc176x_syscon.h
new file mode 100644
index 00000000000..9bec63ef559
--- /dev/null
+++ b/arch/arm/src/lpc17xx_40xx/hardware/lpc176x_syscon.h
@@ -0,0 +1,494 @@
+/************************************************************************************
+ * arch/arm/src/lpc17xx_40xx/hardware/lpc176x_syscon.h
+ *
+ * Copyright (C) 2010, 2013 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ * 3. Neither the name NuttX 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 THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#ifndef __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC176X_SYSCON_H
+#define __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC176X_SYSCON_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include
+
+#include "chip.h"
+#include "hardware/lpc17_40_memorymap.h"
+
+/************************************************************************************
+ * Pre-processor Definitions
+ ************************************************************************************/
+
+/* Register offsets *****************************************************************/
+/* Flash accelerator module */
+
+#define LPC17_40_SYSCON_FLASHCFG_OFFSET 0x0000 /* Flash Accelerator Configuration Register */
+
+/* Memory Mapping Control register (MEMMAP - 0x400F C040) */
+
+#define LPC17_40_SYSCON_MEMMAP_OFFSET 0x0040 /* Memory Mapping Control register */
+
+/* Clocking and power control - Phase locked loops */
+
+#define LPC17_40_SYSCON_PLL0CON_OFFSET 0x0080 /* PLL0 Control Register */
+#define LPC17_40_SYSCON_PLL0CFG_OFFSET 0x0084 /* PLL0 Configuration Register */
+#define LPC17_40_SYSCON_PLL0STAT_OFFSET 0x0088 /* PLL0 Status Register */
+#define LPC17_40_SYSCON_PLL0FEED_OFFSET 0x008c /* PLL0 Feed Register */
+
+#define LPC17_40_SYSCON_PLL1CON_OFFSET 0x00a0 /* PLL1 Control Register */
+#define LPC17_40_SYSCON_PLL1CFG_OFFSET 0x00a4 /* PLL1 Configuration Register */
+#define LPC17_40_SYSCON_PLL1STAT_OFFSET 0x00a8 /* PLL1 Status Register */
+#define LPC17_40_SYSCON_PLL1FEED_OFFSET 0x00ac /* PLL1 Feed Register */
+
+/* Clocking and power control - Peripheral power control registers */
+
+#define LPC17_40_SYSCON_PCON_OFFSET 0x00c0 /* Power Control Register */
+#define LPC17_40_SYSCON_PCONP_OFFSET 0x00c4 /* Power Control for Peripherals Register */
+
+/* Clocking and power control -- Clock dividers */
+
+#define LPC17_40_SYSCON_CCLKCFG_OFFSET 0x0104 /* CPU Clock Configuration Register */
+#define LPC17_40_SYSCON_USBCLKCFG_OFFSET 0x0108 /* USB Clock Configuration Register */
+
+/* 0x400f c110 - 0x400f c114: CAN Wake and Sleep Registers */
+
+/* Clocking and power control -- Clock source selection */
+
+#define LPC17_40_SYSCON_CLKSRCSEL_OFFSET 0x010c /* Clock Source Select Register */
+
+/* System control registers -- External Interrupts */
+
+#define LPC17_40_SYSCON_EXTINT_OFFSET 0x0140 /* External Interrupt Flag Register */
+
+#define LPC17_40_SYSCON_EXTMODE_OFFSET 0x0148 /* External Interrupt Mode register */
+#define LPC17_40_SYSCON_EXTPOLAR_OFFSET 0x014c /* External Interrupt Polarity Register */
+
+/* System control registers -- Reset */
+
+#define LPC17_40_SYSCON_RSID_OFFSET 0x0180 /* Reset Source Identification Register */
+
+/* System control registers -- Syscon Miscellaneous Registers */
+
+#define LPC17_40_SYSCON_SCS_OFFSET 0x01a0 /* System Control and Status */
+
+/* More clocking and power control -- Clock dividers */
+
+#define LPC17_40_SYSCON_PCLKSEL0_OFFSET 0x01a8 /* Peripheral Clock Selection register 0 */
+#define LPC17_40_SYSCON_PCLKSEL1_OFFSET 0x01ac /* Peripheral Clock Selection register 1 */
+
+/* Device Interrupt Registers (Might be a error in the User Manual, might be at 0x5000c1c0) */
+
+#define LPC17_40_SYSCON_USBINTST_OFFSET 0x01c0 /* USB Interrupt Status */
+
+/* DMA Request Select Register */
+
+#define LPC17_40_SYSCON_DMAREQSEL_OFFSET 0x01c4 /* Selects between UART and timer DMA requests */
+
+/* More clocking and power control -- Utility */
+
+#define LPC17_40_SYSCON_CLKOUTCFG_OFFSET 0x01c8 /* Clock Output Configuration Register */
+
+/* Register addresses ***************************************************************/
+/* Flash accelerator module */
+
+#define LPC17_40_SYSCON_FLASHCFG (LPC17_40_SYSCON_BASE+LPC17_40_SYSCON_FLASHCFG_OFFSET)
+
+/* Memory Mapping Control register (MEMMAP - 0x400F C040) */
+
+#define LPC17_40_SYSCON_MEMMAP (LPC17_40_SYSCON_BASE+LPC17_40_SYSCON_MEMMAP_OFFSET)
+
+/* Clocking and power control - Phase locked loops */
+
+#define LPC17_40_SYSCON_PLL0CON (LPC17_40_SYSCON_BASE+LPC17_40_SYSCON_PLL0CON_OFFSET)
+#define LPC17_40_SYSCON_PLL0CFG (LPC17_40_SYSCON_BASE+LPC17_40_SYSCON_PLL0CFG_OFFSET)
+#define LPC17_40_SYSCON_PLL0STAT (LPC17_40_SYSCON_BASE+LPC17_40_SYSCON_PLL0STAT_OFFSET)
+#define LPC17_40_SYSCON_PLL0FEED (LPC17_40_SYSCON_BASE+LPC17_40_SYSCON_PLL0FEED_OFFSET)
+
+#define LPC17_40_SYSCON_PLL1CON (LPC17_40_SYSCON_BASE+LPC17_40_SYSCON_PLL1CON_OFFSET)
+#define LPC17_40_SYSCON_PLL1CFG (LPC17_40_SYSCON_BASE+LPC17_40_SYSCON_PLL1CFG_OFFSET)
+#define LPC17_40_SYSCON_PLL1STAT (LPC17_40_SYSCON_BASE+LPC17_40_SYSCON_PLL1STAT_OFFSET)
+#define LPC17_40_SYSCON_PLL1FEED (LPC17_40_SYSCON_BASE+LPC17_40_SYSCON_PLL1FEED_OFFSET)
+
+/* Clocking and power control - Peripheral power control registers */
+
+#define LPC17_40_SYSCON_PCON (LPC17_40_SYSCON_BASE+LPC17_40_SYSCON_PCON_OFFSET)
+#define LPC17_40_SYSCON_PCONP (LPC17_40_SYSCON_BASE+LPC17_40_SYSCON_PCONP_OFFSET)
+
+/* Clocking and power control -- Clock dividers */
+
+#define LPC17_40_SYSCON_CCLKCFG (LPC17_40_SYSCON_BASE+LPC17_40_SYSCON_CCLKCFG_OFFSET)
+#define LPC17_40_SYSCON_USBCLKCFG (LPC17_40_SYSCON_BASE+LPC17_40_SYSCON_USBCLKCFG_OFFSET)
+
+/* 0x400f c110 - 0x400f c114: CAN Wake and Sleep Registers */
+
+/* Clocking and power control -- Clock source selection */
+
+#define LPC17_40_SYSCON_CLKSRCSEL (LPC17_40_SYSCON_BASE+LPC17_40_SYSCON_CLKSRCSEL_OFFSET)
+
+/* System control registers -- External Interrupts */
+
+#define LPC17_40_SYSCON_EXTINT (LPC17_40_SYSCON_BASE+LPC17_40_SYSCON_EXTINT_OFFSET)
+
+#define LPC17_40_SYSCON_EXTMODE (LPC17_40_SYSCON_BASE+LPC17_40_SYSCON_EXTMODE_OFFSET)
+#define LPC17_40_SYSCON_EXTPOLAR (LPC17_40_SYSCON_BASE+LPC17_40_SYSCON_EXTPOLAR_OFFSET)
+
+/* System control registers -- Reset */
+
+#define LPC17_40_SYSCON_RSID (LPC17_40_SYSCON_BASE+LPC17_40_SYSCON_RSID_OFFSET)
+
+/* System control registers -- Syscon Miscellaneous Registers */
+
+#define LPC17_40_SYSCON_SCS (LPC17_40_SYSCON_BASE+LPC17_40_SYSCON_SCS_OFFSET)
+
+/* More clocking and power control -- Clock dividers */
+
+#define LPC17_40_SYSCON_PCLKSEL0 (LPC17_40_SYSCON_BASE+LPC17_40_SYSCON_PCLKSEL0_OFFSET)
+#define LPC17_40_SYSCON_PCLKSEL1 (LPC17_40_SYSCON_BASE+LPC17_40_SYSCON_PCLKSEL1_OFFSET)
+
+/* Device Interrupt Registers (Might be a error in the User Manual, might be at 0x5000c1c0) */
+
+#define LPC17_40_SYSCON_USBINTST (LPC17_40_SYSCON_BASE+LPC17_40_SYSCON_USBINTST_OFFSET)
+
+/* DMA Request Select Register */
+
+#define LPC17_40_SYSCON_DMAREQSEL (LPC17_40_SYSCON_BASE+LPC17_40_SYSCON_DMAREQSEL_OFFSET)
+
+/* More clocking and power control -- Utility */
+
+#define LPC17_40_SYSCON_CLKOUTCFG (LPC17_40_SYSCON_BASE+LPC17_40_SYSCON_CLKOUTCFG_OFFSET)
+
+/* Register bit definitions *********************************************************/
+/* Flash accelerator module */
+ /* Bits 0-11: Reserved */
+#define SYSCON_FLASHCFG_TIM_SHIFT (12) /* Bits 12-15: FLASHTIM Flash access time */
+#define SYSCON_FLASHCFG_TIM_MASK (15 << SYSCON_FLASHCFG_TIM_SHIFT)
+# define SYSCON_FLASHCFG_TIM_1 (0 << SYSCON_FLASHCFG_TIM_SHIFT) /* 1 CPU clock <= 20 MHz CPU clock */
+# define SYSCON_FLASHCFG_TIM_2 (1 << SYSCON_FLASHCFG_TIM_SHIFT) /* 2 CPU clock <= 40 MHz CPU clock */
+# define SYSCON_FLASHCFG_TIM_3 (2 << SYSCON_FLASHCFG_TIM_SHIFT) /* 3 CPU clock <= 60 MHz CPU clock */
+# define SYSCON_FLASHCFG_TIM_4 (3 << SYSCON_FLASHCFG_TIM_SHIFT) /* 4 CPU clock <= 80 MHz CPU clock */
+# define SYSCON_FLASHCFG_TIM_5 (4 << SYSCON_FLASHCFG_TIM_SHIFT) /* 5 CPU clock <= 100 MHz CPU clock
+ * (Up to 120 Mhz for LPC1759/69 only */
+# define SYSCON_FLASHCFG_TIM_6 (5 << SYSCON_FLASHCFG_TIM_SHIFT) /* "safe" setting for any conditions */
+ /* Bits 16-31: Reserved */
+
+/* Memory Mapping Control register (MEMMAP - 0x400F C040) */
+
+#define SYSCON_MEMMAP_MAP (1 << 0) /* Bit 0:
+ * 0:Boot mode. A portion of the Boot ROM is mapped to address 0.
+ * 1:User mode. The on-chip Flash memory is mapped to address 0 */
+ /* Bits 1-31: Reserved */
+
+/* Clocking and power control -- Clock source selection */
+
+#define SYSCON_CLKSRCSEL_SHIFT (0) /* Bits 0-1: Clock selection */
+#define SYSCON_CLKSRCSEL_MASK (3 << SYSCON_CLKSRCSEL_SHIFT)
+# define SYSCON_CLKSRCSEL_INTRC (0 << SYSCON_CLKSRCSEL_SHIFT) /* PLL0 source = internal RC oscillator */
+# define SYSCON_CLKSRCSEL_MAIN (1 << SYSCON_CLKSRCSEL_SHIFT) /* PLL0 source = main oscillator */
+# define SYSCON_CLKSRCSEL_RTC (2 << SYSCON_CLKSRCSEL_SHIFT) /* PLL0 source = RTC oscillator */
+ /* Bits 2-31: Reserved */
+
+/* Clocking and power control - Phase locked loops */
+/* PLL0/1 Control register */
+
+#define SYSCON_PLLCON_PLLE (1 << 0) /* Bit 0: PLL0/1 Enable */
+#define SYSCON_PLLCON_PLLC (1 << 1) /* Bit 1: PLL0/1 Connect */
+ /* Bits 2-31: Reserved */
+/* PLL0 Configuration register */
+
+#define SYSCON_PLL0CFG_MSEL_SHIFT (0) /* Bit 0-14: PLL0 Multiplier value */
+#define SYSCON_PLL0CFG_MSEL_MASK (0x7fff << SYSCON_PLL0CFG_MSEL_SHIFT)
+ /* Bit 15: Reserved */
+#define SYSCON_PLL0CFG_NSEL_SHIFT (16) /* Bit 16-23: PLL0 Pre-Divider value */
+#define SYSCON_PLL0CFG_NSEL_MASK (0xff << SYSCON_PLL0CFG_NSEL_SHIFT)
+ /* Bits 24-31: Reserved */
+/* PLL1 Configuration register */
+
+#define SYSCON_PLL1CFG_MSEL_SHIFT (0) /* Bit 0-4: PLL1 Multiplier value */
+#define SYSCON_PLL1CFG_MSEL_MASK (0x1f < SYSCON_PLL1CFG_MSEL_SHIFT)
+#define SYSCON_PLL1CFG_NSEL_SHIFT (5) /* Bit 5-6: PLL1 Pre-Divider value */
+#define SYSCON_PLL1CFG_NSEL_MASK (3 << SYSCON_PLL1CFG_NSEL_SHIFT)
+ /* Bits 7-31: Reserved */
+/* PLL0 Status register */
+
+#define SYSCON_PLL0STAT_MSEL_SHIFT (0) /* Bit 0-14: PLL0 Multiplier value readback */
+#define SYSCON_PLL0STAT_MSEL_MASK (0x7fff << SYSCON_PLL0STAT_MSEL_SHIFT)
+ /* Bit 15: Reserved */
+#define SYSCON_PLL0STAT_NSEL_SHIFT (16) /* Bit 16-23: PLL0 Pre-Divider value readback */
+#define SYSCON_PLL0STAT_NSEL_MASK (0xff << SYSCON_PLL0STAT_NSEL_SHIFT)
+#define SYSCON_PLL0STAT_PLLE (1 << 24) /* Bit 24: PLL0 enable readback */
+#define SYSCON_PLL0STAT_PLLC (1 << 25) /* Bit 25: PLL0 connect readback */
+#define SYSCON_PLL0STAT_PLOCK (1 << 26) /* Bit 26: PLL0 lock status */
+ /* Bits 27-31: Reserved */
+/* PLL1 Status register */
+
+#define SYSCON_PLL1STAT_MSEL_SHIFT (0) /* Bit 0-4: PLL1 Multiplier value readback */
+#define SYSCON_PLL1STAT_MSEL_MASK (0x1f << SYSCON_PLL1STAT_MSEL_SHIFT)
+#define SYSCON_PLL1STAT_NSEL_SHIFT (5) /* Bit 5-6: PLL1 Pre-Divider value readback */
+#define SYSCON_PLL1STAT_NSEL_MASK (3 << SYSCON_PLL1STAT_NSEL_SHIFT)
+ /* Bit 7: Reserved */
+#define SYSCON_PLL1STAT_PLLE (1 << 8) /* Bit 8: PLL1 enable readback */
+#define SYSCON_PLL1STAT_PLLC (1 << 9) /* Bit 9: PLL1 connect readback */
+#define SYSCON_PLL1STAT_PLOCK (1 << 10) /* Bit 10: PLL1 lock status */
+ /* Bits 11-31: Reserved */
+/* PLL0/1 Feed register */
+
+#define SYSCON_PLLFEED_SHIFT (0) /* Bit 0-7: PLL0/1 feed sequence */
+#define SYSCON_PLLFEED_MASK (0xff << SYSCON_PLLFEED_SHIFT)
+ /* Bits 8-31: Reserved */
+/* Clocking and power control -- Clock dividers */
+/* CPU Clock Configuration register */
+
+#define SYSCON_CCLKCFG_SHIFT (0) /* 0-7: Divide value for CPU clock (CCLK) */
+#define SYSCON_CCLKCFG_MASK (0xff << SYSCON_CCLKCFG_SHIFT)
+# define SYSCON_CCLKCFG_DIV(n) ((n-1) << SYSCON_CCLKCFG_SHIFT) /* n=2,3,..255 */
+ /* Bits 8-31: Reserved */
+/* USB Clock Configuration register */
+
+#define SYSCON_USBCLKCFG_SHIFT (0) /* Bits 0-3: PLL0 divide value USB clock */
+#define SYSCON_USBCLKCFG_MASK (15 << SYSCON_USBCLKCFG_SHIFT)
+# define SYSCON_USBCLKCFG_DIV6 (5 << SYSCON_USBCLKCFG_SHIFT) /* PLL0/6 for PLL0=288 MHz */
+# define SYSCON_USBCLKCFG_DIV8 (7 << SYSCON_USBCLKCFG_SHIFT) /* PLL0/8 for PLL0=384 MHz */
+# define SYSCON_USBCLKCFG_DIV10 (9 << SYSCON_USBCLKCFG_SHIFT) /* PLL0/10 for PLL0=480 MHz */
+ /* Bits 8-31: Reserved */
+/* Peripheral Clock Selection registers 0 and 1 */
+
+#define SYSCON_PCLKSEL_CCLK4 (0) /* PCLK_peripheral = CCLK/4 */
+#define SYSCON_PCLKSEL_CCLK (1) /* PCLK_peripheral = CCLK */
+#define SYSCON_PCLKSEL_CCLK2 (2) /* PCLK_peripheral = CCLK/2 */
+#define SYSCON_PCLKSEL_CCLK8 (3) /* PCLK_peripheral = CCLK/8 (except CAN1, CAN2, and CAN) */
+#define SYSCON_PCLKSEL_CCLK6 (3) /* PCLK_peripheral = CCLK/6 (CAN1, CAN2, and CAN) */
+#define SYSCON_PCLKSEL_MASK (3)
+
+#define SYSCON_PCLKSEL0_WDT_SHIFT (0) /* Bits 0-1: Peripheral clock WDT */
+#define SYSCON_PCLKSEL0_WDT_MASK (3 << SYSCON_PCLKSEL0_WDT_SHIFT)
+#define SYSCON_PCLKSEL0_TMR0_SHIFT (2) /* Bits 2-3: Peripheral clock TIMER0 */
+#define SYSCON_PCLKSEL0_TMR0_MASK (3 << SYSCON_PCLKSEL0_TMR0_SHIFT)
+#define SYSCON_PCLKSEL0_TMR1_SHIFT (4) /* Bits 4-5: Peripheral clock TIMER1 */
+#define SYSCON_PCLKSEL0_TMR1_MASK (3 << SYSCON_PCLKSEL0_TMR1_SHIFT)
+#define SYSCON_PCLKSEL0_UART0_SHIFT (6) /* Bits 6-7: Peripheral clock UART0 */
+#define SYSCON_PCLKSEL0_UART0_MASK (3 << SYSCON_PCLKSEL0_UART0_SHIFT)
+#define SYSCON_PCLKSEL0_UART1_SHIFT (8) /* Bits 8-9: Peripheral clock UART1 */
+#define SYSCON_PCLKSEL0_UART1_MASK (3 << SYSCON_PCLKSEL0_UART1_SHIFT)
+ /* Bits 10-11: Reserved */
+#define SYSCON_PCLKSEL0_PWM1_SHIFT (12) /* Bits 12-13: Peripheral clock PWM1 */
+#define SYSCON_PCLKSEL0_PWM1_MASK (3 << SYSCON_PCLKSEL0_PWM1_SHIFT)
+#define SYSCON_PCLKSEL0_I2C0_SHIFT (14) /* Bits 14-15: Peripheral clock I2C0 */
+#define SYSCON_PCLKSEL0_I2C0_MASK (3 << SYSCON_PCLKSEL0_I2C0_SHIFT)
+#define SYSCON_PCLKSEL0_SPI_SHIFT (16) /* Bits 16-17: Peripheral clock SPI */
+#define SYSCON_PCLKSEL0_SPI_MASK (3 << SYSCON_PCLKSEL0_SPI_SHIFT)
+ /* Bits 18-19: Reserved */
+#define SYSCON_PCLKSEL0_SSP1_SHIFT (20) /* Bits 20-21: Peripheral clock SSP1 */
+#define SYSCON_PCLKSEL0_SSP1_MASK (3 << SYSCON_PCLKSEL0_SSP1_SHIFT)
+#define SYSCON_PCLKSEL0_DAC_SHIFT (22) /* Bits 22-23: Peripheral clock DAC */
+#define SYSCON_PCLKSEL0_DAC_MASK (3 << SYSCON_PCLKSEL0_DAC_SHIFT)
+#define SYSCON_PCLKSEL0_ADC_SHIFT (24) /* Bits 24-25: Peripheral clock ADC */
+#define SYSCON_PCLKSEL0_ADC_MASK (3 << SYSCON_PCLKSEL0_ADC_SHIFT)
+#define SYSCON_PCLKSEL0_CAN1_SHIFT (26) /* Bits 26-27: Peripheral clock CAN1 */
+#define SYSCON_PCLKSEL0_CAN1_MASK (3 << SYSCON_PCLKSEL0_CAN1_SHIFT)
+#define SYSCON_PCLKSEL0_CAN2_SHIFT (28) /* Bits 28-29: Peripheral clock CAN2 */
+#define SYSCON_PCLKSEL0_CAN2_MASK (3 << SYSCON_PCLKSEL0_CAN2_SHIFT)
+#define SYSCON_PCLKSEL0_ACF_SHIFT (30) /* Bits 30-31: Peripheral clock CAN AF */
+#define SYSCON_PCLKSEL0_ACF_MASK (3 << SYSCON_PCLKSEL0_ACF_SHIFT)
+
+#define SYSCON_PCLKSEL1_QEI_SHIFT (0) /* Bits 0-1: Peripheral clock Quadrature Encoder */
+#define SYSCON_PCLKSEL1_QEI_MASK (3 << SYSCON_PCLKSEL1_QEI_SHIFT)
+#define SYSCON_PCLKSEL1_GPIOINT_SHIFT (2) /* Bits 2-3: Peripheral clock GPIO interrupts */
+#define SYSCON_PCLKSEL1_GPIOINT_MASK (3 << SYSCON_PCLKSEL1_GPIOINT_SHIFT)
+#define SYSCON_PCLKSEL1_PCB_SHIFT (4) /* Bits 4-5: Peripheral clock the Pin Connect block */
+#define SYSCON_PCLKSEL1_PCB_MASK (3 << SYSCON_PCLKSEL1_PCB_SHIFT)
+#define SYSCON_PCLKSEL1_I2C1_SHIFT (6) /* Bits 6-7: Peripheral clock I2C1 */
+#define SYSCON_PCLKSEL1_I2C1_MASK (3 << SYSCON_PCLKSEL1_I2C1_SHIFT)
+ /* Bits 8-9: Reserved */
+#define SYSCON_PCLKSEL1_SSP0_SHIFT (10) /* Bits 10-11: Peripheral clock SSP0 */
+#define SYSCON_PCLKSEL1_SSP0_MASK (3 << SYSCON_PCLKSEL1_SSP0_SHIFT)
+#define SYSCON_PCLKSEL1_TMR2_SHIFT (12) /* Bits 12-13: Peripheral clock TIMER2 */
+#define SYSCON_PCLKSEL1_TMR2_MASK (3 << SYSCON_PCLKSEL1_TMR2_SHIFT)
+#define SYSCON_PCLKSEL1_TMR3_SHIFT (14) /* Bits 14-15: Peripheral clock TIMER3 */
+#define SYSCON_PCLKSEL1_TMR3_MASK (3 << SYSCON_PCLKSEL1_TMR3_SHIFT)
+#define SYSCON_PCLKSEL1_UART2_SHIFT (16) /* Bits 16-17: Peripheral clock UART2 */
+#define SYSCON_PCLKSEL1_UART2_MASK (3 << SYSCON_PCLKSEL1_UART2_SHIFT)
+#define SYSCON_PCLKSEL1_UART3_SHIFT (18) /* Bits 18-19: Peripheral clock UART3 */
+#define SYSCON_PCLKSEL1_UART3_MASK (3 << SYSCON_PCLKSEL1_UART3_SHIFT)
+#define SYSCON_PCLKSEL1_I2C2_SHIFT (20) /* Bits 20-21: Peripheral clock I2C2 */
+#define SYSCON_PCLKSEL1_I2C2_MASK (3 << SYSCON_PCLKSEL1_I2C2_SHIFT)
+#define SYSCON_PCLKSEL1_I2S_SHIFT (22) /* Bits 22-23: Peripheral clock I2S */
+#define SYSCON_PCLKSEL1_I2S_MASK (3 << SYSCON_PCLKSEL1_I2S_SHIFT)
+ /* Bits 24-25: Reserved */
+#define SYSCON_PCLKSEL1_RIT_SHIFT (26) /* Bits 26-27: Peripheral clock Repetitive Interrupt Timer */
+#define SYSCON_PCLKSEL1_RIT_MASK (3 << SYSCON_PCLKSEL1_RIT_SHIFT)
+#define SYSCON_PCLKSEL1_SYSCON_SHIFT (28) /* Bits 28-29: Peripheral clock the System Control block */
+#define SYSCON_PCLKSEL1_SYSCON_MASK (3 << SYSCON_PCLKSEL1_SYSCON_SHIFT)
+#define SYSCON_PCLKSEL1_MC_SHIFT (30) /* Bits 30-31: Peripheral clock the Motor Control PWM */
+#define SYSCON_PCLKSEL1_MC_MASK (3 << SYSCON_PCLKSEL1_MC_SHIFT)
+
+/* Clocking and power control - Peripheral power control registers */
+/* Power Control Register */
+
+#define SYSCON_PCON_PM0 (1 << 0) /* Bit 0: Power mode control bit 0 */
+#define SYSCON_PCON_PM1 (1 << 1) /* Bit 1: Power mode control bit 1 */
+#define SYSCON_PCON_BODRPM (1 << 2) /* Bit 2: Brown-Out Reduced Power Mode */
+#define SYSCON_PCON_BOGD (1 << 3) /* Bit 3: Brown-Out Global Disable */
+#define SYSCON_PCON_BORD (1 << 4) /* Bit 4: Brown-Out Reset Disable */
+ /* Bits 5-7: Reserved */
+#define SYSCON_PCON_SMFLAG (1 << 8) /* Bit 8: Sleep Mode entry flag */
+#define SYSCON_PCON_DSFLAG (1 << 9) /* Bit 9: Deep Sleep entry flag */
+#define SYSCON_PCON_PDFLAG (1 << 10) /* Bit 10: Power-down entry flag */
+#define SYSCON_PCON_DPDFLAG (1 << 11) /* Bit 11: Deep Power-down entry flag */
+ /* Bits 12-31: Reserved */
+/* Power Control for Peripherals Register */
+
+ /* Bit 0: Reserved */
+#define SYSCON_PCONP_PCTIM0 (1 << 1) /* Bit 1: Timer/Counter 0 power/clock control */
+#define SYSCON_PCONP_PCTIM1 (1 << 2) /* Bit 2: Timer/Counter 1 power/clock control */
+#define SYSCON_PCONP_PCUART0 (1 << 3) /* Bit 3: UART0 power/clock control */
+#define SYSCON_PCONP_PCUART1 (1 << 4) /* Bit 4: UART1 power/clock control */
+ /* Bit 5: Reserved */
+#define SYSCON_PCONP_PCPWM1 (1 << 6) /* Bit 6: PWM1 power/clock control */
+#define SYSCON_PCONP_PCI2C0 (1 << 7) /* Bit 7: I2C0 power/clock control */
+#define SYSCON_PCONP_PCSPI (1 << 8) /* Bit 8: SPI power/clock control */
+#define SYSCON_PCONP_PCRTC (1 << 9) /* Bit 9: RTC power/clock control */
+#define SYSCON_PCONP_PCSSP1 (1 << 10) /* Bit 10: SSP 1 power/clock control */
+ /* Bit 11: Reserved */
+#define SYSCON_PCONP_PCADC (1 << 12) /* Bit 12: A/D converter (ADC) power/clock control */
+#define SYSCON_PCONP_PCCAN1 (1 << 13) /* Bit 13: CAN Controller 1 power/clock control */
+#define SYSCON_PCONP_PCCAN2 (1 << 14) /* Bit 14: CAN Controller 2 power/clock control */
+#define SYSCON_PCONP_PCGPIO (1 << 15) /* Bit 15: GPIOs power/clock enable */
+#define SYSCON_PCONP_PCRIT (1 << 16) /* Bit 16: Repetitive Interrupt Timer power/clock control */
+#define SYSCON_PCONP_PCMCPWM (1 << 17) /* Bit 17: Motor Control PWM */
+#define SYSCON_PCONP_PCQEI (1 << 18) /* Bit 18: Quadrature Encoder power/clock control */
+#define SYSCON_PCONP_PCI2C1 (1 << 19) /* Bit 19: I2C1 power/clock control */
+ /* Bit 20: Reserved */
+#define SYSCON_PCONP_PCSSP0 (1 << 21) /* Bit 21: SSP0 power/clock control */
+#define SYSCON_PCONP_PCTIM2 (1 << 22) /* Bit 22: Timer 2 power/clock control */
+#define SYSCON_PCONP_PCTIM3 (1 << 23) /* Bit 23: Timer 3 power/clock control */
+#define SYSCON_PCONP_PCUART2 (1 << 24) /* Bit 24: UART 2 power/clock control */
+#define SYSCON_PCONP_PCUART3 (1 << 25) /* Bit 25: UART 3 power/clock control */
+#define SYSCON_PCONP_PCI2C2 (1 << 26) /* Bit 26: I2C 2 power/clock control */
+#define SYSCON_PCONP_PCI2S (1 << 27) /* Bit 27: I2S power/clock control */
+ /* Bit 28: Reserved */
+#define SYSCON_PCONP_PCGPDMA (1 << 29) /* Bit 29: GPDMA function power/clock control */
+#define SYSCON_PCONP_PCENET (1 << 30) /* Bit 30: Ethernet block power/clock control */
+#define SYSCON_PCONP_PCUSB (1 << 31) /* Bit 31: USB power/clock control */
+
+/* More clocking and power control -- Utility */
+
+#define SYSCON_CLKOUTCFG_SEL_SHIFT (0) /* Bits 0-3: Selects clock source for CLKOUT */
+#define SYSCON_CLKOUTCFG_SEL_MASK (15 << SYSCON_CLKOUTCFG_SEL_SHIFT)
+# define SYSCON_CLKOUTCFG_SEL_CPU (0 << SYSCON_CLKOUTCFG_SEL_SHIFT) /* CLKOUT source=CPU clock */
+# define SYSCON_CLKOUTCFG_SEL_MAIN (1 << SYSCON_CLKOUTCFG_SEL_SHIFT) /* CLKOUT source=main osc */
+# define SYSCON_CLKOUTCFG_SEL_INTRC (2 << SYSCON_CLKOUTCFG_SEL_SHIFT) /* CLKOUT source=internal RC osc */
+# define SYSCON_CLKOUTCFG_SEL_USB (3 << SYSCON_CLKOUTCFG_SEL_SHIFT) /* CLKOUT source=USB clock */
+# define SYSCON_CLKOUTCFG_SEL_RTC (4 << SYSCON_CLKOUTCFG_SEL_SHIFT) /* CLKOUT source=RTC osc */
+#define SYSCON_CLKOUTCFG_DIV_SHIFT (4) /* Bits 4-7: CLKOUT divisor */
+#define SYSCON_CLKOUTCFG_DIV_MASK (15 << SYSCON_CLKOUTCFG_DIV_SHIFT)
+# define SYSCON_CLKOUTCFG_DIV(n) ((n-1) << SYSCON_CLKOUTCFG_DIV_SHIFT) /* n=1..16 */
+#define SYSCON_CLKOUTCFG_EN (1 << 8) /* Bit 8: CLKOUT enable control */
+#define SYSCON_CLKOUTCFG_ACT (1 << 9) /* Bit 9: CLKOUT activity indication */
+ /* Bits 10-31: Reserved */
+/* System control registers -- External Interrupts */
+/* External Interrupt Flag register */
+
+#define SYSCON_EXTINT_EINT0 (1 << 0) /* Bit 0: EINT0 */
+#define SYSCON_EXTINT_EINT1 (1 << 1) /* Bit 1: EINT1 */
+#define SYSCON_EXTINT_EINT2 (1 << 2) /* Bit 2: EINT2 */
+#define SYSCON_EXTINT_EINT3 (1 << 3) /* Bit 3: EINT3 */
+ /* Bits 4-31: Reserved */
+/* External Interrupt Mode register */
+
+#define SYSCON_EXTMODE_EINT0 (1 << 0) /* Bit 0: 1=EINT0 edge sensitive */
+#define SYSCON_EXTMODE_EINT1 (1 << 1) /* Bit 1: 1=EINT1 edge sensitive */
+#define SYSCON_EXTMODE_EINT2 (1 << 2) /* Bit 2: 1=EINT2 edge sensitive */
+#define SYSCON_EXTMODE_EINT3 (1 << 3) /* Bit 3: 1=EINT3 edge sensitive */
+ /* Bits 4-31: Reserved */
+/* External Interrupt Polarity register */
+
+#define SYSCON_EXTPOLAR_EINT0 (1 << 0) /* Bit 0: 1=EINT0 high active/rising edge */
+#define SYSCON_EXTPOLAR_EINT1 (1 << 1) /* Bit 1: 1=EINT1 high active/rising edge */
+#define SYSCON_EXTPOLAR_EINT2 (1 << 2) /* Bit 2: 1=EINT2 high active/rising edge */
+#define SYSCON_EXTPOLAR_EINT3 (1 << 3) /* Bit 3: 1=EINT3 high active/rising edge */
+ /* Bits 4-31: Reserved */
+/* System control registers -- Reset */
+/* Reset Source Identification Register */
+
+#define SYSCON_RSID_POR (1 << 0) /* Bit 0: Power on reset */
+#define SYSCON_RSID_EXTR (1 << 1) /* Bit 1: external RESET signal */
+#define SYSCON_RSID_WDTR (1 << 2) /* Bit 2: Watchdog Timer time out w/WDTRESET */
+#define SYSCON_RSID_BODR (1 << 3) /* Bit 3: Brown out detection */
+ /* Bits 4-31: Reserved */
+/* System control registers -- Syscon Miscellaneous Registers */
+
+ /* Bits 0-3: Reserved */
+#define SYSCON_SCS_OSCRS (1 << 4) /* Bit 4: Main oscillator range select */
+#define SYSCON_SCS_OSCEN (1 << 5) /* Bit 5: Main oscillator enable */
+#define SYSCON_SCS_OSCSTAT (1 << 6) /* Bit 6: Main oscillator status */
+ /* Bits 7-31: Reserved */
+/* Device Interrupt Registers */
+/* USB Interrupt Status register */
+
+#define SYSCON_USBINTST_REQLP (1 << 0) /* Bit 0: Low priority interrupt line status */
+#define SYSCON_USBINTST_REQHP (1 << 1) /* Bit 1: High priority interrupt line status */
+#define SYSCON_USBINTST_REQDMA (1 << 2) /* Bit 2: DMA interrupt line status */
+#define SYSCON_USBINTST_HOSTINT (1 << 3) /* Bit 3: USB host interrupt line status */
+#define SYSCON_USBINTST_ATXINT (1 << 4) /* Bit 4: External ATX interrupt line status */
+#define SYSCON_USBINTST_OTGINT (1 << 5) /* Bit 5: OTG interrupt line status */
+#define SYSCON_USBINTST_I2CINT (1 << 6) /* Bit 6: I2C module interrupt line status */
+ /* Bit 7: Reserved */
+#define SYSCON_USBINTST_NEEDCLK (1 << 8) /* Bit 8: USB need clock indicator */
+ /* Bits 9-30: Reserved */
+#define SYSCON_USBINTST_ENINTS (1 << 31) /* Bit 31: Enable all USB interrupts */
+
+/* DMA Request Select Register */
+
+#define SYSCON_DMAREQSEL_INP8 (1 << 0) /* Bit 0: Input 8 0=UART0 TX 1=Timer 0 match 0 */
+#define SYSCON_DMAREQSEL_INP9 (1 << 1) /* Bit 1: Input 8 0=UART0 RX 1=Timer 0 match 1 */
+#define SYSCON_DMAREQSEL_INP10 (1 << 2) /* Bit 2: Input 8 0=UART1 TX 1=Timer 1 match 0 */
+#define SYSCON_DMAREQSEL_INP11 (1 << 3) /* Bit 3: Input 8 0=UART1 RX 1=Timer 1 match 1 */
+#define SYSCON_DMAREQSEL_INP12 (1 << 4) /* Bit 4: Input 8 0=UART2 TX 1=Timer 2 match 0 */
+#define SYSCON_DMAREQSEL_INP13 (1 << 5) /* Bit 5: Input 8 0=UART2 RX 1=Timer 2 match 1 */
+#define SYSCON_DMAREQSEL_INP14 (1 << 6) /* Bit 6: Input 8 0=UART3 TX 1=Timer 3 match 0 */
+#define SYSCON_DMAREQSEL_INP15 (1 << 7) /* Bit 7: Input 8 0=UART3 RX 1=Timer 3 match 1 */
+ /* Bits 8-31: Reserved */
+
+/************************************************************************************
+ * Public Types
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Data
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+#endif /* __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC176X_SYSCON_H */
diff --git a/arch/arm/src/lpc17xx_40xx/hardware/lpc178x_40xx_iocon.h b/arch/arm/src/lpc17xx_40xx/hardware/lpc178x_40xx_iocon.h
new file mode 100644
index 00000000000..b335b94f43a
--- /dev/null
+++ b/arch/arm/src/lpc17xx_40xx/hardware/lpc178x_40xx_iocon.h
@@ -0,0 +1,375 @@
+/************************************************************************************
+ * arch/arm/src/lpc17xx_40xx/hardware/lpc178x_40xx_iocon.h
+ *
+ * Copyright (C) 2013 Gregory Nutt. All rights reserved.
+ * Author: Rommel Marcelo
+ * Gregory Nutt
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ * 3. Neither the name NuttX 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 THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#ifndef __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC178X_IOCON_H
+#define __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC178X_IOCON_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include
+
+#include "chip.h"
+#include "hardware/lpc17_40_memorymap.h"
+
+/************************************************************************************
+ * Pre-processor Definitions
+ ************************************************************************************/
+
+/* Register offsets *****************************************************************/
+
+#define LPC17_40_IOCON_PP_OFFSET(p) ((unsigned int)(p) << 2)
+#define LPC17_40_IOCON_PP0_OFFSET (0x0000) /* IOCON Port(n) register 0 */
+#define LPC17_40_IOCON_PP1_OFFSET (0x0004) /* IOCON Port(n) register 1 */
+#define LPC17_40_IOCON_PP2_OFFSET (0x0008) /* IOCON Port(n) register 2 */
+#define LPC17_40_IOCON_PP3_OFFSET (0x000c) /* IOCON Port(n) register 3 */
+#define LPC17_40_IOCON_PP4_OFFSET (0x0010) /* IOCON Port(n) register 4 */
+#define LPC17_40_IOCON_PP5_OFFSET (0x0014) /* IOCON Port(n) register 5 */
+#define LPC17_40_IOCON_PP6_OFFSET (0x0018) /* IOCON Port(n) register 6 */
+#define LPC17_40_IOCON_PP7_OFFSET (0x001c) /* IOCON Port(n) register 7 */
+#define LPC17_40_IOCON_PP8_OFFSET (0x0020) /* IOCON Port(n) register 8 */
+#define LPC17_40_IOCON_PP9_OFFSET (0x0024) /* IOCON Port(n) register 9 */
+#define LPC17_40_IOCON_PP10_OFFSET (0x0028) /* IOCON Port(n) register 10 */
+#define LPC17_40_IOCON_PP11_OFFSET (0x002c) /* IOCON Port(n) register 11 */
+#define LPC17_40_IOCON_PP12_OFFSET (0x0030) /* IOCON Port(n) register 12 */
+#define LPC17_40_IOCON_PP13_OFFSET (0x0034) /* IOCON Port(n) register 13 */
+#define LPC17_40_IOCON_PP14_OFFSET (0x0038) /* IOCON Port(n) register 14 */
+#define LPC17_40_IOCON_PP15_OFFSET (0x003c) /* IOCON Port(n) register 15 */
+#define LPC17_40_IOCON_PP16_OFFSET (0x0040) /* IOCON Port(n) register 16 */
+#define LPC17_40_IOCON_PP17_OFFSET (0x0044) /* IOCON Port(n) register 17 */
+#define LPC17_40_IOCON_PP18_OFFSET (0x0048) /* IOCON Port(n) register 18 */
+#define LPC17_40_IOCON_PP19_OFFSET (0x004c) /* IOCON Port(n) register 19 */
+#define LPC17_40_IOCON_PP20_OFFSET (0x0050) /* IOCON Port(n) register 20 */
+#define LPC17_40_IOCON_PP21_OFFSET (0x0054) /* IOCON Port(n) register 21 */
+#define LPC17_40_IOCON_PP22_OFFSET (0x0058) /* IOCON Port(n) register 22 */
+#define LPC17_40_IOCON_PP23_OFFSET (0x005c) /* IOCON Port(n) register 23 */
+#define LPC17_40_IOCON_PP24_OFFSET (0x0060) /* IOCON Port(n) register 24 */
+#define LPC17_40_IOCON_PP25_OFFSET (0x0064) /* IOCON Port(n) register 25 */
+#define LPC17_40_IOCON_PP26_OFFSET (0x0068) /* IOCON Port(n) register 26 */
+#define LPC17_40_IOCON_PP27_OFFSET (0x006c) /* IOCON Port(n) register 27 */
+#define LPC17_40_IOCON_PP28_OFFSET (0x0070) /* IOCON Port(n) register 28 */
+#define LPC17_40_IOCON_PP29_OFFSET (0x0074) /* IOCON Port(n) register 29 */
+#define LPC17_40_IOCON_PP30_OFFSET (0x0078) /* IOCON Port(n) register 30 */
+#define LPC17_40_IOCON_PP31_OFFSET (0x007c) /* IOCON Port(n) register 31 */
+
+/* Register addresses ***************************************************************/
+
+#define LPC17_40_IOCON_P_BASE(b) (LPC17_40_IOCON_BASE + ((unsigned int)(b) << 7))
+#define LPC17_40_IOCON_P0_BASE (LPC17_40_IOCON_BASE + 0x0000)
+#define LPC17_40_IOCON_P1_BASE (LPC17_40_IOCON_BASE + 0x0080)
+#define LPC17_40_IOCON_P2_BASE (LPC17_40_IOCON_BASE + 0x0100)
+#define LPC17_40_IOCON_P3_BASE (LPC17_40_IOCON_BASE + 0x0180)
+#define LPC17_40_IOCON_P4_BASE (LPC17_40_IOCON_BASE + 0x0200)
+#define LPC17_40_IOCON_P5_BASE (LPC17_40_IOCON_BASE + 0x0280)
+
+#define LPC17_40_IOCON_P(b,p) (LPC17_40_IOCON_P_BASE(b) + LPC17_40_IOCON_PP_OFFSET(p))
+
+#define LPC17_40_IOCON_P0_0 (LPC17_40_IOCON_P0_BASE + LPC17_40_IOCON_PP0_OFFSET)
+#define LPC17_40_IOCON_P0_1 (LPC17_40_IOCON_P0_BASE + LPC17_40_IOCON_PP1_OFFSET)
+#define LPC17_40_IOCON_P0_2 (LPC17_40_IOCON_P0_BASE + LPC17_40_IOCON_PP2_OFFSET)
+#define LPC17_40_IOCON_P0_3 (LPC17_40_IOCON_P0_BASE + LPC17_40_IOCON_PP3_OFFSET)
+#define LPC17_40_IOCON_P0_4 (LPC17_40_IOCON_P0_BASE + LPC17_40_IOCON_PP4_OFFSET)
+#define LPC17_40_IOCON_P0_5 (LPC17_40_IOCON_P0_BASE + LPC17_40_IOCON_PP5_OFFSET)
+#define LPC17_40_IOCON_P0_6 (LPC17_40_IOCON_P0_BASE + LPC17_40_IOCON_PP6_OFFSET)
+#define LPC17_40_IOCON_P0_7 (LPC17_40_IOCON_P0_BASE + LPC17_40_IOCON_PP7_OFFSET)
+#define LPC17_40_IOCON_P0_8 (LPC17_40_IOCON_P0_BASE + LPC17_40_IOCON_PP8_OFFSET)
+#define LPC17_40_IOCON_P0_9 (LPC17_40_IOCON_P0_BASE + LPC17_40_IOCON_PP9_OFFSET)
+#define LPC17_40_IOCON_P0_10 (LPC17_40_IOCON_P0_BASE + LPC17_40_IOCON_PP10_OFFSET)
+#define LPC17_40_IOCON_P0_11 (LPC17_40_IOCON_P0_BASE + LPC17_40_IOCON_PP11_OFFSET)
+#define LPC17_40_IOCON_P0_12 (LPC17_40_IOCON_P0_BASE + LPC17_40_IOCON_PP12_OFFSET)
+#define LPC17_40_IOCON_P0_13 (LPC17_40_IOCON_P0_BASE + LPC17_40_IOCON_PP13_OFFSET)
+#define LPC17_40_IOCON_P0_14 (LPC17_40_IOCON_P0_BASE + LPC17_40_IOCON_PP14_OFFSET)
+#define LPC17_40_IOCON_P0_15 (LPC17_40_IOCON_P0_BASE + LPC17_40_IOCON_PP15_OFFSET)
+#define LPC17_40_IOCON_P0_16 (LPC17_40_IOCON_P0_BASE + LPC17_40_IOCON_PP16_OFFSET)
+#define LPC17_40_IOCON_P0_17 (LPC17_40_IOCON_P0_BASE + LPC17_40_IOCON_PP17_OFFSET)
+#define LPC17_40_IOCON_P0_18 (LPC17_40_IOCON_P0_BASE + LPC17_40_IOCON_PP18_OFFSET)
+#define LPC17_40_IOCON_P0_19 (LPC17_40_IOCON_P0_BASE + LPC17_40_IOCON_PP19_OFFSET)
+#define LPC17_40_IOCON_P0_20 (LPC17_40_IOCON_P0_BASE + LPC17_40_IOCON_PP20_OFFSET)
+#define LPC17_40_IOCON_P0_21 (LPC17_40_IOCON_P0_BASE + LPC17_40_IOCON_PP21_OFFSET)
+#define LPC17_40_IOCON_P0_22 (LPC17_40_IOCON_P0_BASE + LPC17_40_IOCON_PP22_OFFSET)
+#define LPC17_40_IOCON_P0_23 (LPC17_40_IOCON_P0_BASE + LPC17_40_IOCON_PP23_OFFSET)
+#define LPC17_40_IOCON_P0_24 (LPC17_40_IOCON_P0_BASE + LPC17_40_IOCON_PP24_OFFSET)
+#define LPC17_40_IOCON_P0_25 (LPC17_40_IOCON_P0_BASE + LPC17_40_IOCON_PP25_OFFSET)
+#define LPC17_40_IOCON_P0_26 (LPC17_40_IOCON_P0_BASE + LPC17_40_IOCON_PP26_OFFSET)
+#define LPC17_40_IOCON_P0_27 (LPC17_40_IOCON_P0_BASE + LPC17_40_IOCON_PP27_OFFSET)
+#define LPC17_40_IOCON_P0_28 (LPC17_40_IOCON_P0_BASE + LPC17_40_IOCON_PP28_OFFSET)
+#define LPC17_40_IOCON_P0_29 (LPC17_40_IOCON_P0_BASE + LPC17_40_IOCON_PP29_OFFSET)
+#define LPC17_40_IOCON_P0_30 (LPC17_40_IOCON_P0_BASE + LPC17_40_IOCON_PP30_OFFSET)
+#define LPC17_40_IOCON_P0_31 (LPC17_40_IOCON_P0_BASE + LPC17_40_IOCON_PP31_OFFSET)
+
+#define LPC17_40_IOCON_P1_0 (LPC17_40_IOCON_P1_BASE + LPC17_40_IOCON_PP0_OFFSET)
+#define LPC17_40_IOCON_P1_1 (LPC17_40_IOCON_P1_BASE + LPC17_40_IOCON_PP1_OFFSET)
+#define LPC17_40_IOCON_P1_2 (LPC17_40_IOCON_P1_BASE + LPC17_40_IOCON_PP2_OFFSET)
+#define LPC17_40_IOCON_P1_3 (LPC17_40_IOCON_P1_BASE + LPC17_40_IOCON_PP3_OFFSET)
+#define LPC17_40_IOCON_P1_4 (LPC17_40_IOCON_P1_BASE + LPC17_40_IOCON_PP4_OFFSET)
+#define LPC17_40_IOCON_P1_5 (LPC17_40_IOCON_P1_BASE + LPC17_40_IOCON_PP5_OFFSET)
+#define LPC17_40_IOCON_P1_6 (LPC17_40_IOCON_P1_BASE + LPC17_40_IOCON_PP6_OFFSET)
+#define LPC17_40_IOCON_P1_7 (LPC17_40_IOCON_P1_BASE + LPC17_40_IOCON_PP7_OFFSET)
+#define LPC17_40_IOCON_P1_8 (LPC17_40_IOCON_P1_BASE + LPC17_40_IOCON_PP8_OFFSET)
+#define LPC17_40_IOCON_P1_9 (LPC17_40_IOCON_P1_BASE + LPC17_40_IOCON_PP9_OFFSET)
+#define LPC17_40_IOCON_P1_10 (LPC17_40_IOCON_P1_BASE + LPC17_40_IOCON_PP10_OFFSET)
+#define LPC17_40_IOCON_P1_11 (LPC17_40_IOCON_P1_BASE + LPC17_40_IOCON_PP11_OFFSET)
+#define LPC17_40_IOCON_P1_12 (LPC17_40_IOCON_P1_BASE + LPC17_40_IOCON_PP12_OFFSET)
+#define LPC17_40_IOCON_P1_13 (LPC17_40_IOCON_P1_BASE + LPC17_40_IOCON_PP13_OFFSET)
+#define LPC17_40_IOCON_P1_14 (LPC17_40_IOCON_P1_BASE + LPC17_40_IOCON_PP14_OFFSET)
+#define LPC17_40_IOCON_P1_15 (LPC17_40_IOCON_P1_BASE + LPC17_40_IOCON_PP15_OFFSET)
+#define LPC17_40_IOCON_P1_16 (LPC17_40_IOCON_P1_BASE + LPC17_40_IOCON_PP16_OFFSET)
+#define LPC17_40_IOCON_P1_17 (LPC17_40_IOCON_P1_BASE + LPC17_40_IOCON_PP17_OFFSET)
+#define LPC17_40_IOCON_P1_18 (LPC17_40_IOCON_P1_BASE + LPC17_40_IOCON_PP18_OFFSET)
+#define LPC17_40_IOCON_P1_19 (LPC17_40_IOCON_P1_BASE + LPC17_40_IOCON_PP19_OFFSET)
+#define LPC17_40_IOCON_P1_20 (LPC17_40_IOCON_P1_BASE + LPC17_40_IOCON_PP20_OFFSET)
+#define LPC17_40_IOCON_P1_21 (LPC17_40_IOCON_P1_BASE + LPC17_40_IOCON_PP21_OFFSET)
+#define LPC17_40_IOCON_P1_22 (LPC17_40_IOCON_P1_BASE + LPC17_40_IOCON_PP22_OFFSET)
+#define LPC17_40_IOCON_P1_23 (LPC17_40_IOCON_P1_BASE + LPC17_40_IOCON_PP23_OFFSET)
+#define LPC17_40_IOCON_P1_24 (LPC17_40_IOCON_P1_BASE + LPC17_40_IOCON_PP24_OFFSET)
+#define LPC17_40_IOCON_P1_25 (LPC17_40_IOCON_P1_BASE + LPC17_40_IOCON_PP25_OFFSET)
+#define LPC17_40_IOCON_P1_26 (LPC17_40_IOCON_P1_BASE + LPC17_40_IOCON_PP26_OFFSET)
+#define LPC17_40_IOCON_P1_27 (LPC17_40_IOCON_P1_BASE + LPC17_40_IOCON_PP27_OFFSET)
+#define LPC17_40_IOCON_P1_28 (LPC17_40_IOCON_P1_BASE + LPC17_40_IOCON_PP28_OFFSET)
+#define LPC17_40_IOCON_P1_29 (LPC17_40_IOCON_P1_BASE + LPC17_40_IOCON_PP29_OFFSET)
+#define LPC17_40_IOCON_P1_30 (LPC17_40_IOCON_P1_BASE + LPC17_40_IOCON_PP30_OFFSET)
+#define LPC17_40_IOCON_P1_31 (LPC17_40_IOCON_P1_BASE + LPC17_40_IOCON_PP31_OFFSET)
+
+#define LPC17_40_IOCON_P2_0 (LPC17_40_IOCON_P2_BASE + LPC17_40_IOCON_PP0_OFFSET)
+#define LPC17_40_IOCON_P2_1 (LPC17_40_IOCON_P2_BASE + LPC17_40_IOCON_PP1_OFFSET)
+#define LPC17_40_IOCON_P2_2 (LPC17_40_IOCON_P2_BASE + LPC17_40_IOCON_PP2_OFFSET)
+#define LPC17_40_IOCON_P2_3 (LPC17_40_IOCON_P2_BASE + LPC17_40_IOCON_PP3_OFFSET)
+#define LPC17_40_IOCON_P2_4 (LPC17_40_IOCON_P2_BASE + LPC17_40_IOCON_PP4_OFFSET)
+#define LPC17_40_IOCON_P2_5 (LPC17_40_IOCON_P2_BASE + LPC17_40_IOCON_PP5_OFFSET)
+#define LPC17_40_IOCON_P2_6 (LPC17_40_IOCON_P2_BASE + LPC17_40_IOCON_PP6_OFFSET)
+#define LPC17_40_IOCON_P2_7 (LPC17_40_IOCON_P2_BASE + LPC17_40_IOCON_PP7_OFFSET)
+#define LPC17_40_IOCON_P2_8 (LPC17_40_IOCON_P2_BASE + LPC17_40_IOCON_PP8_OFFSET)
+#define LPC17_40_IOCON_P2_9 (LPC17_40_IOCON_P2_BASE + LPC17_40_IOCON_PP9_OFFSET)
+#define LPC17_40_IOCON_P2_10 (LPC17_40_IOCON_P2_BASE + LPC17_40_IOCON_PP10_OFFSET)
+#define LPC17_40_IOCON_P2_11 (LPC17_40_IOCON_P2_BASE + LPC17_40_IOCON_PP11_OFFSET)
+#define LPC17_40_IOCON_P2_12 (LPC17_40_IOCON_P2_BASE + LPC17_40_IOCON_PP12_OFFSET)
+#define LPC17_40_IOCON_P2_13 (LPC17_40_IOCON_P2_BASE + LPC17_40_IOCON_PP13_OFFSET)
+#define LPC17_40_IOCON_P2_14 (LPC17_40_IOCON_P2_BASE + LPC17_40_IOCON_PP14_OFFSET)
+#define LPC17_40_IOCON_P2_15 (LPC17_40_IOCON_P2_BASE + LPC17_40_IOCON_PP15_OFFSET)
+#define LPC17_40_IOCON_P2_16 (LPC17_40_IOCON_P2_BASE + LPC17_40_IOCON_PP16_OFFSET)
+#define LPC17_40_IOCON_P2_17 (LPC17_40_IOCON_P2_BASE + LPC17_40_IOCON_PP17_OFFSET)
+#define LPC17_40_IOCON_P2_18 (LPC17_40_IOCON_P2_BASE + LPC17_40_IOCON_PP18_OFFSET)
+#define LPC17_40_IOCON_P2_19 (LPC17_40_IOCON_P2_BASE + LPC17_40_IOCON_PP19_OFFSET)
+#define LPC17_40_IOCON_P2_20 (LPC17_40_IOCON_P2_BASE + LPC17_40_IOCON_PP20_OFFSET)
+#define LPC17_40_IOCON_P2_21 (LPC17_40_IOCON_P2_BASE + LPC17_40_IOCON_PP21_OFFSET)
+#define LPC17_40_IOCON_P2_22 (LPC17_40_IOCON_P2_BASE + LPC17_40_IOCON_PP22_OFFSET)
+#define LPC17_40_IOCON_P2_23 (LPC17_40_IOCON_P2_BASE + LPC17_40_IOCON_PP23_OFFSET)
+#define LPC17_40_IOCON_P2_24 (LPC17_40_IOCON_P2_BASE + LPC17_40_IOCON_PP24_OFFSET)
+#define LPC17_40_IOCON_P2_25 (LPC17_40_IOCON_P2_BASE + LPC17_40_IOCON_PP25_OFFSET)
+#define LPC17_40_IOCON_P2_26 (LPC17_40_IOCON_P2_BASE + LPC17_40_IOCON_PP26_OFFSET)
+#define LPC17_40_IOCON_P2_27 (LPC17_40_IOCON_P2_BASE + LPC17_40_IOCON_PP27_OFFSET)
+#define LPC17_40_IOCON_P2_28 (LPC17_40_IOCON_P2_BASE + LPC17_40_IOCON_PP28_OFFSET)
+#define LPC17_40_IOCON_P2_29 (LPC17_40_IOCON_P2_BASE + LPC17_40_IOCON_PP29_OFFSET)
+#define LPC17_40_IOCON_P2_30 (LPC17_40_IOCON_P2_BASE + LPC17_40_IOCON_PP30_OFFSET)
+#define LPC17_40_IOCON_P2_31 (LPC17_40_IOCON_P2_BASE + LPC17_40_IOCON_PP31_OFFSET)
+
+#define LPC17_40_IOCON_P3_0 (LPC17_40_IOCON_P3_BASE + LPC17_40_IOCON_PP0_OFFSET)
+#define LPC17_40_IOCON_P3_1 (LPC17_40_IOCON_P3_BASE + LPC17_40_IOCON_PP1_OFFSET)
+#define LPC17_40_IOCON_P3_2 (LPC17_40_IOCON_P3_BASE + LPC17_40_IOCON_PP2_OFFSET)
+#define LPC17_40_IOCON_P3_3 (LPC17_40_IOCON_P3_BASE + LPC17_40_IOCON_PP3_OFFSET)
+#define LPC17_40_IOCON_P3_4 (LPC17_40_IOCON_P3_BASE + LPC17_40_IOCON_PP4_OFFSET)
+#define LPC17_40_IOCON_P3_5 (LPC17_40_IOCON_P3_BASE + LPC17_40_IOCON_PP5_OFFSET)
+#define LPC17_40_IOCON_P3_6 (LPC17_40_IOCON_P3_BASE + LPC17_40_IOCON_PP6_OFFSET)
+#define LPC17_40_IOCON_P3_7 (LPC17_40_IOCON_P3_BASE + LPC17_40_IOCON_PP7_OFFSET)
+#define LPC17_40_IOCON_P3_8 (LPC17_40_IOCON_P3_BASE + LPC17_40_IOCON_PP8_OFFSET)
+#define LPC17_40_IOCON_P3_9 (LPC17_40_IOCON_P3_BASE + LPC17_40_IOCON_PP9_OFFSET)
+#define LPC17_40_IOCON_P3_10 (LPC17_40_IOCON_P3_BASE + LPC17_40_IOCON_PP10_OFFSET)
+#define LPC17_40_IOCON_P3_11 (LPC17_40_IOCON_P3_BASE + LPC17_40_IOCON_PP11_OFFSET)
+#define LPC17_40_IOCON_P3_12 (LPC17_40_IOCON_P3_BASE + LPC17_40_IOCON_PP12_OFFSET)
+#define LPC17_40_IOCON_P3_13 (LPC17_40_IOCON_P3_BASE + LPC17_40_IOCON_PP13_OFFSET)
+#define LPC17_40_IOCON_P3_14 (LPC17_40_IOCON_P3_BASE + LPC17_40_IOCON_PP14_OFFSET)
+#define LPC17_40_IOCON_P3_15 (LPC17_40_IOCON_P3_BASE + LPC17_40_IOCON_PP15_OFFSET)
+#define LPC17_40_IOCON_P3_16 (LPC17_40_IOCON_P3_BASE + LPC17_40_IOCON_PP16_OFFSET)
+#define LPC17_40_IOCON_P3_17 (LPC17_40_IOCON_P3_BASE + LPC17_40_IOCON_PP17_OFFSET)
+#define LPC17_40_IOCON_P3_18 (LPC17_40_IOCON_P3_BASE + LPC17_40_IOCON_PP18_OFFSET)
+#define LPC17_40_IOCON_P3_19 (LPC17_40_IOCON_P3_BASE + LPC17_40_IOCON_PP19_OFFSET)
+#define LPC17_40_IOCON_P3_20 (LPC17_40_IOCON_P3_BASE + LPC17_40_IOCON_PP20_OFFSET)
+#define LPC17_40_IOCON_P3_21 (LPC17_40_IOCON_P3_BASE + LPC17_40_IOCON_PP21_OFFSET)
+#define LPC17_40_IOCON_P3_22 (LPC17_40_IOCON_P3_BASE + LPC17_40_IOCON_PP22_OFFSET)
+#define LPC17_40_IOCON_P3_23 (LPC17_40_IOCON_P3_BASE + LPC17_40_IOCON_PP23_OFFSET)
+#define LPC17_40_IOCON_P3_24 (LPC17_40_IOCON_P3_BASE + LPC17_40_IOCON_PP24_OFFSET)
+#define LPC17_40_IOCON_P3_25 (LPC17_40_IOCON_P3_BASE + LPC17_40_IOCON_PP25_OFFSET)
+#define LPC17_40_IOCON_P3_26 (LPC17_40_IOCON_P3_BASE + LPC17_40_IOCON_PP26_OFFSET)
+#define LPC17_40_IOCON_P3_27 (LPC17_40_IOCON_P3_BASE + LPC17_40_IOCON_PP27_OFFSET)
+#define LPC17_40_IOCON_P3_28 (LPC17_40_IOCON_P3_BASE + LPC17_40_IOCON_PP28_OFFSET)
+#define LPC17_40_IOCON_P3_29 (LPC17_40_IOCON_P3_BASE + LPC17_40_IOCON_PP29_OFFSET)
+#define LPC17_40_IOCON_P3_30 (LPC17_40_IOCON_P3_BASE + LPC17_40_IOCON_PP30_OFFSET)
+#define LPC17_40_IOCON_P3_31 (LPC17_40_IOCON_P3_BASE + LPC17_40_IOCON_PP31_OFFSET)
+
+#define LPC17_40_IOCON_P4_0 (LPC17_40_IOCON_P4_BASE + LPC17_40_IOCON_PP0_OFFSET)
+#define LPC17_40_IOCON_P4_1 (LPC17_40_IOCON_P4_BASE + LPC17_40_IOCON_PP1_OFFSET)
+#define LPC17_40_IOCON_P4_2 (LPC17_40_IOCON_P4_BASE + LPC17_40_IOCON_PP2_OFFSET)
+#define LPC17_40_IOCON_P4_3 (LPC17_40_IOCON_P4_BASE + LPC17_40_IOCON_PP3_OFFSET)
+#define LPC17_40_IOCON_P4_4 (LPC17_40_IOCON_P4_BASE + LPC17_40_IOCON_PP4_OFFSET)
+#define LPC17_40_IOCON_P4_5 (LPC17_40_IOCON_P4_BASE + LPC17_40_IOCON_PP5_OFFSET)
+#define LPC17_40_IOCON_P4_6 (LPC17_40_IOCON_P4_BASE + LPC17_40_IOCON_PP6_OFFSET)
+#define LPC17_40_IOCON_P4_7 (LPC17_40_IOCON_P4_BASE + LPC17_40_IOCON_PP7_OFFSET)
+#define LPC17_40_IOCON_P4_8 (LPC17_40_IOCON_P4_BASE + LPC17_40_IOCON_PP8_OFFSET)
+#define LPC17_40_IOCON_P4_9 (LPC17_40_IOCON_P4_BASE + LPC17_40_IOCON_PP9_OFFSET)
+#define LPC17_40_IOCON_P4_10 (LPC17_40_IOCON_P4_BASE + LPC17_40_IOCON_PP10_OFFSET)
+#define LPC17_40_IOCON_P4_11 (LPC17_40_IOCON_P4_BASE + LPC17_40_IOCON_PP11_OFFSET)
+#define LPC17_40_IOCON_P4_12 (LPC17_40_IOCON_P4_BASE + LPC17_40_IOCON_PP12_OFFSET)
+#define LPC17_40_IOCON_P4_13 (LPC17_40_IOCON_P4_BASE + LPC17_40_IOCON_PP13_OFFSET)
+#define LPC17_40_IOCON_P4_14 (LPC17_40_IOCON_P4_BASE + LPC17_40_IOCON_PP14_OFFSET)
+#define LPC17_40_IOCON_P4_15 (LPC17_40_IOCON_P4_BASE + LPC17_40_IOCON_PP15_OFFSET)
+#define LPC17_40_IOCON_P4_16 (LPC17_40_IOCON_P4_BASE + LPC17_40_IOCON_PP16_OFFSET)
+#define LPC17_40_IOCON_P4_17 (LPC17_40_IOCON_P4_BASE + LPC17_40_IOCON_PP17_OFFSET)
+#define LPC17_40_IOCON_P4_18 (LPC17_40_IOCON_P4_BASE + LPC17_40_IOCON_PP18_OFFSET)
+#define LPC17_40_IOCON_P4_19 (LPC17_40_IOCON_P4_BASE + LPC17_40_IOCON_PP19_OFFSET)
+#define LPC17_40_IOCON_P4_20 (LPC17_40_IOCON_P4_BASE + LPC17_40_IOCON_PP20_OFFSET)
+#define LPC17_40_IOCON_P4_21 (LPC17_40_IOCON_P4_BASE + LPC17_40_IOCON_PP21_OFFSET)
+#define LPC17_40_IOCON_P4_22 (LPC17_40_IOCON_P4_BASE + LPC17_40_IOCON_PP22_OFFSET)
+#define LPC17_40_IOCON_P4_23 (LPC17_40_IOCON_P4_BASE + LPC17_40_IOCON_PP23_OFFSET)
+#define LPC17_40_IOCON_P4_24 (LPC17_40_IOCON_P4_BASE + LPC17_40_IOCON_PP24_OFFSET)
+#define LPC17_40_IOCON_P4_25 (LPC17_40_IOCON_P4_BASE + LPC17_40_IOCON_PP25_OFFSET)
+#define LPC17_40_IOCON_P4_26 (LPC17_40_IOCON_P4_BASE + LPC17_40_IOCON_PP26_OFFSET)
+#define LPC17_40_IOCON_P4_27 (LPC17_40_IOCON_P4_BASE + LPC17_40_IOCON_PP27_OFFSET)
+#define LPC17_40_IOCON_P4_28 (LPC17_40_IOCON_P4_BASE + LPC17_40_IOCON_PP28_OFFSET)
+#define LPC17_40_IOCON_P4_29 (LPC17_40_IOCON_P4_BASE + LPC17_40_IOCON_PP29_OFFSET)
+#define LPC17_40_IOCON_P4_30 (LPC17_40_IOCON_P4_BASE + LPC17_40_IOCON_PP30_OFFSET)
+#define LPC17_40_IOCON_P4_31 (LPC17_40_IOCON_P4_BASE + LPC17_40_IOCON_PP31_OFFSET)
+
+#define LPC17_40_IOCON_P5_0 (LPC17_40_IOCON_P5_BASE + LPC17_40_IOCON_PP0_OFFSET)
+#define LPC17_40_IOCON_P5_1 (LPC17_40_IOCON_P5_BASE + LPC17_40_IOCON_PP1_OFFSET)
+#define LPC17_40_IOCON_P5_2 (LPC17_40_IOCON_P5_BASE + LPC17_40_IOCON_PP2_OFFSET)
+#define LPC17_40_IOCON_P5_3 (LPC17_40_IOCON_P5_BASE + LPC17_40_IOCON_PP3_OFFSET)
+#define LPC17_40_IOCON_P5_4 (LPC17_40_IOCON_P5_BASE + LPC17_40_IOCON_PP4_OFFSET)
+#define LPC17_40_IOCON_P5_5 (LPC17_40_IOCON_P5_BASE + LPC17_40_IOCON_PP5_OFFSET)
+#define LPC17_40_IOCON_P5_6 (LPC17_40_IOCON_P5_BASE + LPC17_40_IOCON_PP6_OFFSET)
+#define LPC17_40_IOCON_P5_7 (LPC17_40_IOCON_P5_BASE + LPC17_40_IOCON_PP7_OFFSET)
+#define LPC17_40_IOCON_P5_8 (LPC17_40_IOCON_P5_BASE + LPC17_40_IOCON_PP8_OFFSET)
+#define LPC17_40_IOCON_P5_9 (LPC17_40_IOCON_P5_BASE + LPC17_40_IOCON_PP9_OFFSET)
+#define LPC17_40_IOCON_P5_10 (LPC17_40_IOCON_P5_BASE + LPC17_40_IOCON_PP10_OFFSET)
+#define LPC17_40_IOCON_P5_11 (LPC17_40_IOCON_P5_BASE + LPC17_40_IOCON_PP11_OFFSET)
+#define LPC17_40_IOCON_P5_12 (LPC17_40_IOCON_P5_BASE + LPC17_40_IOCON_PP12_OFFSET)
+#define LPC17_40_IOCON_P5_13 (LPC17_40_IOCON_P5_BASE + LPC17_40_IOCON_PP13_OFFSET)
+#define LPC17_40_IOCON_P5_14 (LPC17_40_IOCON_P5_BASE + LPC17_40_IOCON_PP14_OFFSET)
+#define LPC17_40_IOCON_P5_15 (LPC17_40_IOCON_P5_BASE + LPC17_40_IOCON_PP15_OFFSET)
+#define LPC17_40_IOCON_P5_16 (LPC17_40_IOCON_P5_BASE + LPC17_40_IOCON_PP16_OFFSET)
+#define LPC17_40_IOCON_P5_17 (LPC17_40_IOCON_P5_BASE + LPC17_40_IOCON_PP17_OFFSET)
+#define LPC17_40_IOCON_P5_18 (LPC17_40_IOCON_P5_BASE + LPC17_40_IOCON_PP18_OFFSET)
+#define LPC17_40_IOCON_P5_19 (LPC17_40_IOCON_P5_BASE + LPC17_40_IOCON_PP19_OFFSET)
+#define LPC17_40_IOCON_P5_20 (LPC17_40_IOCON_P5_BASE + LPC17_40_IOCON_PP20_OFFSET)
+#define LPC17_40_IOCON_P5_21 (LPC17_40_IOCON_P5_BASE + LPC17_40_IOCON_PP21_OFFSET)
+#define LPC17_40_IOCON_P5_22 (LPC17_40_IOCON_P5_BASE + LPC17_40_IOCON_PP22_OFFSET)
+#define LPC17_40_IOCON_P5_23 (LPC17_40_IOCON_P5_BASE + LPC17_40_IOCON_PP23_OFFSET)
+#define LPC17_40_IOCON_P5_24 (LPC17_40_IOCON_P5_BASE + LPC17_40_IOCON_PP24_OFFSET)
+#define LPC17_40_IOCON_P5_25 (LPC17_40_IOCON_P5_BASE + LPC17_40_IOCON_PP25_OFFSET)
+#define LPC17_40_IOCON_P5_26 (LPC17_40_IOCON_P5_BASE + LPC17_40_IOCON_PP26_OFFSET)
+#define LPC17_40_IOCON_P5_27 (LPC17_40_IOCON_P5_BASE + LPC17_40_IOCON_PP27_OFFSET)
+#define LPC17_40_IOCON_P5_28 (LPC17_40_IOCON_P5_BASE + LPC17_40_IOCON_PP28_OFFSET)
+#define LPC17_40_IOCON_P5_29 (LPC17_40_IOCON_P5_BASE + LPC17_40_IOCON_PP29_OFFSET)
+#define LPC17_40_IOCON_P5_30 (LPC17_40_IOCON_P5_BASE + LPC17_40_IOCON_PP30_OFFSET)
+#define LPC17_40_IOCON_P5_31 (LPC17_40_IOCON_P5_BASE + LPC17_40_IOCON_PP31_OFFSET)
+
+/* Register bit definitions *********************************************************/
+/* IOCON pin function select */
+
+#define IOCON_FUNC_GPIO (0)
+#define IOCON_FUNC_ALT1 (1)
+#define IOCON_FUNC_ALT2 (2)
+#define IOCON_FUNC_ALT3 (3)
+#define IOCON_FUNC_ALT4 (4)
+#define IOCON_FUNC_ALT5 (5)
+#define IOCON_FUNC_ALT6 (6)
+#define IOCON_FUNC_ALT7 (7)
+
+#define IOCON_FUNC_SHIFT (0) /* Bits 0-2: All types */
+#define IOCON_FUNC_MASK (7 << IOCON_FUNC_SHIFT)
+#define IOCON_MODE_SHIFT (3) /* Bits 3-4: Type D,A,W */
+#define IOCON_MODE_MASK (3 << IOCON_MODE_SHIFT )
+#define IOCON_HYS_SHIFT (5) /* Bit 5: Type D,W */
+#define IOCON_HYS_MASK (1 << IOCON_HYS_SHIFT)
+#define IOCON_INV_SHIFT (6) /* Bit 6: Type D,A,I,W */
+#define IOCON_INV_MASK (1 << IOCON_INV_SHIFT)
+#define IOCON_ADMODE_SHIFT (7) /* Bit 7: Type A */
+#define IOCON_ADMODE_MASK (1 << IOCON_ADMODE_SHIFT)
+#define IOCON_FILTER_SHIFT (8) /* Bit 8: Type A */
+#define IOCON_FILTER_MASK (1 << IOCON_FILTER_SHIFT)
+#define IOCON_I2CHS_SHIFT (8) /* Bit 8: Type I */
+#define IOCON_I2CHS_MASK (1 << IOCON_I2CHS_SHIFT)
+#define IOCON_SLEW_SHIFT (9) /* Bit 9: Type W */
+#define IOCON_SLEW_MASK (1 << IOCON_SLEW_SHIFT)
+#define IOCON_HIDRIVE_SHIFT (9) /* Bit 9: Type I */
+#define IOCON_HIDRIVE_MASK (1 << IOCON_HIDRIVE_SHIFT)
+#define IOCON_OD_SHIFT (10) /* Bit 10: Type D,A,W */
+#define IOCON_OD_MASK (1 << IOCON_OD_SHIFT)
+#define IOCON_DACEN_SHIFT (16) /* Bit 16: Type A */
+#define IOCON_DACEN_MASK (1 << IOCON_DACEN_SHIFT)
+
+/* Pin modes */
+
+#define IOCON_MODE_FLOAT (0) /* 00: pin has neither pull-up nor pull-down */
+#define IOCON_MODE_PD (1) /* 01: pin has a pull-down resistor enabled */
+#define IOCON_MODE_PU (2) /* 10: pin has a pull-up resistor enabled */
+#define IOCON_MODE_RM (3) /* 11: pin has repeater mode enabled */
+
+/* Pin types */
+
+#define IOCON_TYPE_D_MASK (0x0000067f) /* All ports except where ADC/DAC, USB, I2C is present */
+#define IOCON_TYPE_A_MASK (0x000105df) /* USB/ADC/DAC P0:12-13, P0:23-26, P1:30-31 */
+#define IOCON_TYPE_U_MASK (0x00000007) /* USB P0:29 to 31 */
+#define IOCON_TYPE_I_MASK (0x00000347) /* I2C/USB P0:27-28, P5:2-3 */
+#define IOCON_TYPE_W_MASK (0x000007ff) /* I2S P0:7-9 */
+
+/* Slew rate modes */
+
+#define IOCON_SLEWMODE_NORMAL (0 << IOCON_SLEW_SHIFT)
+#define IOCON_SLEWMODE_FAST (1 << IOCON_SLEW_SHIFT)
+
+/* I2C modes */
+
+#define IOCON_I2CMODE_SHIFT (IOCON_I2CHS_SHIFT)
+#define IOCON_I2CMODE_MASK (3 << IOCON_I2CMODE_SHIFT)
+# define IOCON_I2CMODE_FAST (0 << IOCON_I2CMODE_SHIFT)
+# define IOCON_I2CMODE_FASTPLUS (1 << IOCON_I2CMODE_SHIFT)/* */
+# define IOCON_I2CMODE_HIOPENDRAIN (2 << IOCON_I2CMODE_SHIFT)/* */
+# define IOCON_I2CMODE_OPENDRAIN (3 << IOCON_I2CMODE_SHIFT)/* */
+
+/************************************************************************************
+ * Public Types
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Data
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+#endif /* __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC178X_IOCON_H */
diff --git a/arch/arm/src/lpc17xx_40xx/hardware/lpc178x_40xx_memorymap.h b/arch/arm/src/lpc17xx_40xx/hardware/lpc178x_40xx_memorymap.h
new file mode 100644
index 00000000000..e91beb6740e
--- /dev/null
+++ b/arch/arm/src/lpc17xx_40xx/hardware/lpc178x_40xx_memorymap.h
@@ -0,0 +1,159 @@
+/************************************************************************************
+ * arch/arm/src/lpc17xx_40xx/hardware/lpc178x_40xx_memorymap.h
+ *
+ * Copyright (C) 2013 Gregory Nutt. All rights reserved.
+ * Authors: Rommel Marcelo
+ * Gregory Nutt
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ * 3. Neither the name NuttX 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 THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#ifndef __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC178X_MEMORYMAP_H
+#define __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC178X_MEMORYMAP_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include
+
+#include "chip.h"
+
+/************************************************************************************
+ * Pre-processor Definitions
+ ************************************************************************************/
+/* Memory Map ***********************************************************************/
+
+#define LPC17_40_FLASH_BASE 0x00000000 /* -0x1fffffff: On-chip non-volatile memory */
+#define LPC17_40_SRAM_BASE 0x10000000 /* -0x10007fff: On-chip SRAM (devices <=32Kb) */
+#define LPC17_40_ROM_BASE 0x1fff0000 /* -0x1fffffff: 8Kb Boot ROM with flash services */
+#define LPC17_40_AHBSRAM_BASE 0x20000000 /* -0x3fffffff: On-chip Peripheral SRAM (devices >32Kb) */
+# define LPC17_40_SRAM_BANK0 0x20000000 /* -0x20003fff: On-chip Peripheral SRAM Bank0 (devices >=32Kb) */
+# define LPC17_40_SRAM_BANK1 0x20004000 /* -0x20007fff: On-chip Peripheral SRAM Bank1 (devices 64Kb) */
+#define LPC17_40_AHB_BASE 0x20080000 /* -0x2008ffff: DMA Controller, Ethernet, and USB */
+#define LPC17_40_SPIFI_BASE 0x28000000 /* -0x28ffffff: SPIFI memory mapped region */
+#define LPC17_40_APB_BASE 0x40000000 /* -0x5fffffff: APB Peripherals */
+# define LPC17_40_APB0_BASE 0x40000000 /* -0x4007ffff: APB0 Peripherals */
+# define LPC17_40_APB1_BASE 0x40080000 /* -0x400fffff: APB1 Peripherals */
+
+/* Off chip Memory via External Memory Interface */
+
+#define LPC17_40_EXTRAM_BASE 0x80000000 /* */
+# define LPC17_40_EXTSRAM_CS0 0x80000000 /* Chip select 0 /up to 64MB/ */
+# define LPC17_40_EXTSRAM_CS1 0x90000000 /* Chip select 1 /up to 64MB/ */
+# define LPC17_40_EXTSRAM_CS2 0x98000000 /* Chip select 2 /up to 64MB/ */
+# define LPC17_40_EXTSRAM_CS3 0x9c000000 /* Chip select 3 /up to 64MB/ */
+
+# define LPC17_40_EXTDRAM_CS0 0xa0000000 /* Chip select 0 /up to 256MB/ */
+# define LPC17_40_EXTDRAM_CS1 0xb0000000 /* Chip select 1 /up to 256MB/ */
+# define LPC17_40_EXTDRAM_CS2 0xc0000000 /* Chip select 2 /up to 256MB/ */
+# define LPC17_40_EXTDRAM_CS3 0xd0000000 /* Chip select 3 /up to 256MB/ */
+
+#define LPC17_40_CORTEXM3_BASE 0xe0000000 /* -0xe00fffff: (see armv7-m/nvic.h) */
+#define LPC17_40_SCS_BASE 0xe000e000
+#define LPC17_40_DEBUGMCU_BASE 0xe0042000
+
+/* AHB SRAM Bank sizes **************************************************************/
+
+#define LPC17_40_BANK0_SIZE (16*1024) /* Size of AHB SRAM Bank0 (if present) */
+#define LPC17_40_BANK1_SIZE (16*1024) /* Size of AHB SRAM Bank1 (if present) */
+
+/* APB0 Peripherals *****************************************************************/
+
+#define LPC17_40_WDT_BASE 0x40000000 /* -0x40003fff: Watchdog timer */
+#define LPC17_40_TMR0_BASE 0x40004000 /* -0x40007fff: Timer 0 */
+#define LPC17_40_TMR1_BASE 0x40008000 /* -0x4000bfff: Timer 1 */
+#define LPC17_40_UART0_BASE 0x4000c000 /* -0x4000ffff: UART 0 */
+#define LPC17_40_UART1_BASE 0x40010000 /* -0x40013fff: UART 1 */
+#define LPC17_40_PWM0_BASE 0x40014000 /* -0x40017fff: PWM 0 */
+#define LPC17_40_PWM1_BASE 0x40018000 /* -0x4001bfff: PWM 1 */
+#define LPC17_40_I2C0_BASE 0x4001c000 /* -0x4001ffff: I2C 0 */
+#define LPC17_40_CMP_BASE 0x40020000 /* -0x40023fff: Analog Comparators (LPC40xx only)*/
+#define LPC17_40_RTC_BASE 0x40024000 /* -0x40027fff: RTC + backup registers */
+#define LPC17_40_GPIOINT_BASE 0x40028000 /* -0x4002bfff: GPIO interrupts */
+#define LPC17_40_IOCON_BASE 0x4002c000 /* -0x4002ffff: Pin connect block */
+#define LPC17_40_SSP1_BASE 0x40030000 /* -0x40033fff: SSP 1 */
+#define LPC17_40_ADC_BASE 0x40034000 /* -0x40037fff: ADC */
+#define LPC17_40_CANAFRAM_BASE 0x40038000 /* -0x4003bfff: CAN acceptance filter (AF) RAM */
+#define LPC17_40_CANAF_BASE 0x4003c000 /* -0x4003ffff: CAN acceptance filter (AF) registers */
+#define LPC17_40_CAN_BASE 0x40040000 /* -0x40043fff: CAN common registers */
+#define LPC17_40_CAN1_BASE 0x40044000 /* -0x40047fff: CAN controller l */
+#define LPC17_40_CAN2_BASE 0x40048000 /* -0x4004bfff: CAN controller 2 */
+ /* -0x4005bfff: Reserved */
+#define LPC17_40_I2C1_BASE 0x4005c000 /* -0x4005ffff: I2C 1 */
+ /* -0x4007ffff: Reserved */
+
+/* APB1 Peripherals *****************************************************************/
+
+ /* -0x40087fff: Reserved */
+#define LPC17_40_SSP0_BASE 0x40088000 /* -0x4008bfff: SSP 0 */
+#define LPC17_40_DAC_BASE 0x4008c000 /* -0x4008ffff: DAC */
+#define LPC17_40_TMR2_BASE 0x40090000 /* -0x40093fff: Timer 2 */
+#define LPC17_40_TMR3_BASE 0x40094000 /* -0x40097fff: Timer 3 */
+#define LPC17_40_UART2_BASE 0x40098000 /* -0x4009bfff: UART 2 */
+#define LPC17_40_UART3_BASE 0x4009c000 /* -0x4009ffff: UART 3 */
+#define LPC17_40_I2C2_BASE 0x400a0000 /* -0x400a3fff: I2C 2 */
+#define LPC17_40_UART4_BASE 0x400a4000 /* -0x400a7fff: UART4 */
+#define LPC17_40_I2S_BASE 0x400a8000 /* -0x400abfff: I2S */
+#define LPC17_40_SSP2_BASE 0x400ac000 /* -0x400affff: SSP2 */
+ /* -0x400b3fff: Reserved */
+ /* -0x400b7fff: Reserved */
+#define LPC17_40_MCPWM_BASE 0x400b8000 /* -0x400bbfff: Motor control PWM */
+#define LPC17_40_QEI_BASE 0x400bc000 /* -0x400bffff: Quadrature encoder interface */
+#define LPC17_40_MCI_BASE 0x400c0000 /* -0x400fbfff: SD interface */
+#define LPC17_40_SYSCON_BASE 0x400fc000 /* -0x400fffff: System control */
+
+/* AHB Peripherals ******************************************************************/
+
+#define LPC17_40_GPDMA_BASE 0x20080000 /* GPDMA controller */
+#define LPC17_40_ETH_BASE 0x20084000 /* Ethernet controller */
+#define LPC17_40_LCD_BASE 0x20088000 /* LCD controller */
+#define LPC17_40_USB_BASE 0x2008c000 /* USB controller */
+#define LPC17_40_CRC_BASE 0x20090000 /* CRC engine */
+#define LPC17_40_SPIFICFG_BASE 0x20094000 /* SPIFI configuration registers */
+#define LPC17_40_GPIO_BASE 0x20098000 /* GPIO */
+#define LPC17_40_EMC_BASE 0x2009c000 /* External Memory Controller */
+
+/* EEPROM */
+
+#define LPC17_40_EEPROM_BASE 0x00200000 /* EEPROM controller */
+
+/************************************************************************************
+ * Public Types
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Data
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+#endif /* __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC178X_MEMORYMAP_H */
diff --git a/arch/arm/src/lpc17xx/hardware/lpc178x_pinconfig.h b/arch/arm/src/lpc17xx_40xx/hardware/lpc178x_40xx_pinconfig.h
similarity index 92%
rename from arch/arm/src/lpc17xx/hardware/lpc178x_pinconfig.h
rename to arch/arm/src/lpc17xx_40xx/hardware/lpc178x_40xx_pinconfig.h
index acafae871ad..6ef9d848099 100644
--- a/arch/arm/src/lpc17xx/hardware/lpc178x_pinconfig.h
+++ b/arch/arm/src/lpc17xx_40xx/hardware/lpc178x_40xx_pinconfig.h
@@ -1,5 +1,5 @@
/************************************************************************************
- * arch/arm/src/lpc17xx/hardware/lpc178x_pinconfig.h
+ * arch/arm/src/lpc17xx_40xx/hardware/lpc178x_40xx_pinconfig.h
*
* Copyright (C) 2013 Gregory Nutt. All rights reserved.
* Authors: Rommel Marcelo
@@ -34,8 +34,8 @@
*
************************************************************************************/
-#ifndef __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC178X_PINCONFIG_H
-#define __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC178X_PINCONFIG_H
+#ifndef __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC178X_PINCONFIG_H
+#define __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC178X_PINCONFIG_H
/************************************************************************************
* Included Files
@@ -76,44 +76,52 @@
#define GPIO_I2S_RXCLK_1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN4)
#define GPIO_CAN2_RD_1 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN4)
#define GPIO_CAP2p0_1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN4)
+#define GPIO_CMP_ROSC_1 (GPIO_ALT5 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN4) /* Only on LPC40xx */
#define GPIO_LCD_VD0_1 (GPIO_ALT7 | GPIO_FLOAT | GPIO_SLEW_FAST | GPIO_PORT0 | GPIO_PIN4)
#define GPIO_I2S_RXWS_1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN5)
#define GPIO_CAN2_TD_1 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN5)
#define GPIO_CAP2p1_1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN5)
+#define GPIO_CMP_RESET (GPIO_ALT5 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN5) /* Only on LPC40xx */
#define GPIO_LCD_VD1_1 (GPIO_ALT7 | GPIO_FLOAT | GPIO_SLEW_FAST | GPIO_PORT0 | GPIO_PIN5)
#define GPIO_I2S_RXSDA_1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN6)
#define GPIO_SSP1_SSEL_1 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN6)
#define GPIO_MAT2p0_1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN6)
#define GPIO_UART1_RTS_1 (GPIO_ALT4 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN6)
+#define GPIO_CMP_ROSC_2 (GPIO_ALT5 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN6) /* Only on LPC40xx */
#define GPIO_LCD_VD8_1 (GPIO_ALT7 | GPIO_FLOAT | GPIO_SLEW_FAST | GPIO_PORT0 | GPIO_PIN6)
#define GPIO_I2S_TXCLK_1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN7)
#define GPIO_SSP1_SCK_1 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN7)
#define GPIO_MAT2p1_1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN7)
#define GPIO_RTC_EV0_1 (GPIO_ALT4 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN7)
+#define GPIO_CMP_VREF (GPIO_ALT5 | GPIO_FLOAT | GPIO_MODE_ANALOG | GPIO_PORT0 | GPIO_PIN7) /* Only on LPC40xx */
#define GPIO_LCD_VD9_1 (GPIO_ALT7 | GPIO_FLOAT | GPIO_SLEW_FAST | GPIO_PORT0 | GPIO_PIN7)
#define GPIO_I2S_TXWS_1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN8)
#define GPIO_SSP1_MISO_1 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN8)
#define GPIO_MAT2p2_1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN8)
#define GPIO_RTC_EV1_1 (GPIO_ALT4 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN8)
+#define GPIO_CMP1_IN_4 (GPIO_ALT5 | GPIO_FLOAT | GPIO_MODE_ANALOG | GPIO_PORT0 | GPIO_PIN8) /* Only on LPC40xx */
#define GPIO_LCD_VD16 (GPIO_ALT7 | GPIO_FLOAT | GPIO_SLEW_FAST | GPIO_PORT0 | GPIO_PIN8)
#define GPIO_I2S_TXSDA_1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN9)
#define GPIO_SSP1_MOSI_1 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN9)
#define GPIO_MAT2p3_1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN9)
#define GPIO_RTC_EV2_1 (GPIO_ALT4 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN9)
+#define GPIO_CMP1_IN_3 (GPIO_ALT5 | GPIO_FLOAT | GPIO_MODE_ANALOG | GPIO_PORT0 | GPIO_PIN9) /* Only on LPC40xx */
#define GPIO_LCD_VD17 (GPIO_ALT7 | GPIO_FLOAT | GPIO_SLEW_FAST | GPIO_PORT0 | GPIO_PIN9)
#define GPIO_UART2_TXD_1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN10)
#define GPIO_I2C2_SDA_1 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN10)
#define GPIO_MAT3p0_1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN10)
+#define GPIO_LCD_VD5_3 (GPIO_ALT7 | GPIO_FLOAT | GPIO_SLEW_FAST | GPIO_PORT0 | GPIO_PIN10) /* Only on LPC40xx */
#define GPIO_UART2_RXD_1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN11)
#define GPIO_I2C2_SCL_1 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN11)
#define GPIO_MAT3p1_1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN11)
+#define GPIO_LCD_VD10_4 (GPIO_ALT7 | GPIO_FLOAT | GPIO_SLEW_FAST | GPIO_PORT0 | GPIO_PIN11) /* Only on LPC40xx */
#define GPIO_USB_PPWR2 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN12)
#define GPIO_SSP1_MISO_2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN12)
@@ -146,14 +154,16 @@
#define GPIO_UART1_DSR_1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN19)
#define GPIO_SD_CLK_1 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN19)
#define GPIO_I2C1_SDA_2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN19)
+#define GPIO_LCD_VD13_3 (GPIO_ALT7 | GPIO_FLOAT | GPIO_SLEW_FAST | GPIO_PORT0 | GPIO_PIN19) /* Only on LPC40xx */
#define GPIO_UART1_DTR_1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN20)
#define GPIO_SD_CMD_1 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN20)
#define GPIO_I2C1_SCL_2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN20)
+#define GPIO_LCD_VD14_3 (GPIO_ALT7 | GPIO_FLOAT | GPIO_SLEW_FAST | GPIO_PORT0 | GPIO_PIN20) /* Only on LPC40xx */
#define GPIO_UART1_RI_1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN21)
#define GPIO_SD_PWR_1 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN21)
-#define GPIO_UART4_OE_1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN21)
+#define GPIO_UART4_OE (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN21)
#define GPIO_CAN1_RD_2 (GPIO_ALT4 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN21)
#define GPIO_UART4_SCLK (GPIO_ALT5 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN21)
@@ -195,11 +205,11 @@
#define GPIO_ENET_TXD0 (GPIO_ALT1 | GPIO_FLOAT | GPIO_PORT1 | GPIO_PIN0)
#define GPIO_CAP3p1_2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN0)
-#define GPIO_SSP2_SCK (GPIO_ALT4 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN0)
+#define GPIO_SSP2_SCK_1 (GPIO_ALT4 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN0)
#define GPIO_ENET_TXD1 (GPIO_ALT1 | GPIO_FLOAT | GPIO_PORT1 | GPIO_PIN1)
#define GPIO_MAT3p3_1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN1)
-#define GPIO_SSP2_MOSI (GPIO_ALT4 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN1)
+#define GPIO_SSP2_MOSI_1 (GPIO_ALT4 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN1)
#define GPIO_ENET_TXD2 (GPIO_ALT1 | GPIO_FLOAT | GPIO_PORT1 | GPIO_PIN2)
#define GPIO_SD_CLK_2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN2)
@@ -216,18 +226,22 @@
#define GPIO_ENET_TX_ER (GPIO_ALT1 | GPIO_FLOAT | GPIO_PORT1 | GPIO_PIN5)
#define GPIO_SD_PWR_2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN5)
#define GPIO_PWM0p3_1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN5)
+#define GPIO_CMP1_IN_2 (GPIO_ALT5 | GPIO_FLOAT | GPIO_MODE_ANALOG | GPIO_PORT1 | GPIO_PIN5) /* Only on LPC40xx */
#define GPIO_ENET_TX_CLK (GPIO_ALT1 | GPIO_FLOAT | GPIO_PORT1 | GPIO_PIN6)
#define GPIO_SD_DAT0_2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN6)
#define GPIO_PWM0p4_1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN6)
+#define GPIO_CMP0_IN_4 (GPIO_ALT5 | GPIO_FLOAT | GPIO_MODE_ANALOG | GPIO_PORT1 | GPIO_PIN6) /* Only on LPC40xx */
#define GPIO_ENET_COL (GPIO_ALT1 | GPIO_FLOAT | GPIO_PORT1 | GPIO_PIN7)
#define GPIO_SD_DAT1_1 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN7)
#define GPIO_PWM0p5_1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN7)
+#define GPIO_CMP1_IN_1 (GPIO_ALT5 | GPIO_FLOAT | GPIO_MODE_ANALOG | GPIO_PORT1 | GPIO_PIN7) /* Only on LPC40xx */
#define GPIO_ENET_CRSDV (GPIO_ALT1 | GPIO_FLOAT | GPIO_PORT1 | GPIO_PIN8)
+#define GPIO_ENET_CRS (GPIO_ENET_CRSDV) /* Alternate pin name for LPC17 Ethernet driver */
#define GPIO_MAT3p1_2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN8)
-#define GPIO_SSP2_SSEL (GPIO_ALT4 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN8)
+#define GPIO_SSP2_SSEL_1 (GPIO_ALT4 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN8)
#define GPIO_ENET_RXD0 (GPIO_ALT1 | GPIO_FLOAT | GPIO_PORT1 | GPIO_PIN9)
#define GPIO_MAT3p0_2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN9)
@@ -242,20 +256,24 @@
#define GPIO_ENET_RXD3 (GPIO_ALT1 | GPIO_FLOAT | GPIO_PORT1 | GPIO_PIN12)
#define GPIO_SD_DAT3_1 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN12)
#define GPIO_PWM0CAPp0_1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN12)
+#define GPIO_CMP1_OUT (GPIO_ALT5 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN12) /* Only on LPC40xx */
#define GPIO_ENET_RX_DV (GPIO_ALT1 | GPIO_FLOAT | GPIO_PORT1 | GPIO_PIN13)
#define GPIO_ENET_RXER (GPIO_ALT1 | GPIO_FLOAT | GPIO_PORT1 | GPIO_PIN14)
#define GPIO_CAP2p0_2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN14)
+#define GPIO_CMP0_IN_1 (GPIO_ALT5 | GPIO_FLOAT | GPIO_MODE_ANALOG | GPIO_PORT1 | GPIO_PIN14) /* Only on LPC40xx */
#define GPIO_ENET_REFCLK (GPIO_ALT1 | GPIO_FLOAT | GPIO_PORT1 | GPIO_PIN15)
#define GPIO_I2C2_SDA_2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN15)
#define GPIO_ENET_MDC_1 (GPIO_ALT1 | GPIO_FLOAT | GPIO_PORT1 | GPIO_PIN16)
#define GPIO_I2S_TXMCLK (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN16)
+#define GPIO_CMP0_IN_2 (GPIO_ALT5 | GPIO_FLOAT | GPIO_MODE_ANALOG | GPIO_PORT1 | GPIO_PIN16) /* Only on LPC40xx */
#define GPIO_ENET_MDIO_1 (GPIO_ALT1 | GPIO_FLOAT | GPIO_PORT1 | GPIO_PIN17)
#define GPIO_I2S_RXMCLK (GPIO_ALT2 | GPIO_FLOAT | GPIO_PORT1 | GPIO_PIN17)
+#define GPIO_CMP0_IN_3 (GPIO_ALT5 | GPIO_FLOAT | GPIO_MODE_ANALOG | GPIO_PORT1 | GPIO_PIN17) /* Only on LPC40xx */
#define GPIO_USB_UPLED (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN18)
#define GPIO_PWM1p1_1 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN18)
@@ -626,21 +644,27 @@
#define GPIO_LCD_VD3_3 (GPIO_ALT7 | GPIO_FLOAT | GPIO_SLEW_FAST | GPIO_PORT4 | GPIO_PIN29)
#define GPIO_EMC_CS0 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN30)
+#define GPIO_CMP0_OUT (GPIO_ALT5 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN30) /* Only on LPC40xx */
+
#define GPIO_EMC_CS1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN31)
#define GPIO_EMC_A24 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT5 | GPIO_PIN0)
+#define GPIO_SSP2_MOSI_2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT5 | GPIO_PIN0)
#define GPIO_MAT2p2_3 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT5 | GPIO_PIN0)
#define GPIO_EMC_A25 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT5 | GPIO_PIN1)
+#define GPIO_SSP2_MISO_2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT5 | GPIO_PIN1)
#define GPIO_MAT2p3_3 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT5 | GPIO_PIN1)
+#define GPIO_SSP2_SCK_2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT5 | GPIO_PIN2) /* Only on LPC40xx */
#define GPIO_MAT3p2_3 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT5 | GPIO_PIN2)
#define GPIO_I2C0_SDA_3 (GPIO_ALT5 | GPIO_PULLUP | GPIO_PORT5 | GPIO_PIN2)
+#define GPIO_SSP2_SSEL_2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT5 | GPIO_PIN3) /* Only on LPC40xx */
#define GPIO_UART4_RXD_2 (GPIO_ALT4 | GPIO_PULLUP | GPIO_PORT5 | GPIO_PIN3)
#define GPIO_I2C0_SCL0 (GPIO_ALT5 | GPIO_PULLUP | GPIO_PORT5 | GPIO_PIN3)
-#define GPIO_UART4_OE_2 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT5 | GPIO_PIN4)
+#define GPIO_UART0_OE (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT5 | GPIO_PIN4)
#define GPIO_MAT3p3_3 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT5 | GPIO_PIN4)
#define GPIO_UART4_TXD_3 (GPIO_ALT4 | GPIO_PULLUP | GPIO_PORT5 | GPIO_PIN4)
@@ -656,4 +680,4 @@
* Public Function Prototypes
************************************************************************************/
-#endif /* __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC178X_PINCONFIG_H */
+#endif /* __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC178X_PINCONFIG_H */
diff --git a/arch/arm/src/lpc17xx_40xx/hardware/lpc178x_40xx_syscon.h b/arch/arm/src/lpc17xx_40xx/hardware/lpc178x_40xx_syscon.h
new file mode 100644
index 00000000000..96625e79ec8
--- /dev/null
+++ b/arch/arm/src/lpc17xx_40xx/hardware/lpc178x_40xx_syscon.h
@@ -0,0 +1,644 @@
+/****************************************************************************************************
+ * arch/arm/src/lpc17xx_40xx/hardware/lpc178x_40xx_syscon.h
+ *
+ * Copyright (C) 2013 Gregory Nutt. All rights reserved.
+ * Authors: Rommel Marcelo
+ * Gregory Nutt
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ * 3. Neither the name NuttX 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 THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************************************/
+
+#ifndef __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC178X_SYSCON_H
+#define __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC178X_SYSCON_H
+
+/****************************************************************************************************
+ * Included Files
+ ****************************************************************************************************/
+
+#include
+
+#include "chip.h"
+#include "hardware/lpc17_40_memorymap.h"
+
+/****************************************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************************************/
+
+/* Register offsets *********************************************************************************/
+/* Flash accelerator module */
+
+#define LPC17_40_SYSCON_FLASHCFG_OFFSET 0x0000 /* Flash Accelerator Configuration Register */
+
+/* Memory Mapping Control register (MEMMAP - 0x400F C040) */
+
+#define LPC17_40_SYSCON_MEMMAP_OFFSET 0x0040 /* Memory Mapping Control Register */
+
+/* Clocking and power control - Phase locked loops */
+
+#define LPC17_40_SYSCON_PLL0CON_OFFSET 0x0080 /* PLL0 Control Register */
+#define LPC17_40_SYSCON_PLL0CFG_OFFSET 0x0084 /* PLL0 Configuration Register */
+#define LPC17_40_SYSCON_PLL0STAT_OFFSET 0x0088 /* PLL0 Status Register */
+#define LPC17_40_SYSCON_PLL0FEED_OFFSET 0x008c /* PLL0 Feed Register */
+
+#define LPC17_40_SYSCON_PLL1CON_OFFSET 0x00a0 /* PLL1 Control Register */
+#define LPC17_40_SYSCON_PLL1CFG_OFFSET 0x00a4 /* PLL1 Configuration Register */
+#define LPC17_40_SYSCON_PLL1STAT_OFFSET 0x00a8 /* PLL1 Status Register */
+#define LPC17_40_SYSCON_PLL1FEED_OFFSET 0x00ac /* PLL1 Feed Register */
+
+/* Clocking and power control - Peripheral power control registers */
+
+#define LPC17_40_SYSCON_PCON_OFFSET 0x00c0 /* Power Control Register */
+#define LPC17_40_SYSCON_PCONP_OFFSET 0x00c4 /* Power Control for Peripherals Register */
+#define LPC17_40_SYSCON_PCONP1_OFFSET 0x00c8 /* Power Control for Peripherals Register 1 */
+
+/* Clocking and power control -- Clock dividers */
+
+#define LPC17_40_SYSCON_EMCCLKSEL_OFFSET 0x0100 /* EMC Clock Selection Register */
+#define LPC17_40_SYSCON_CCLKSEL_OFFSET 0x0104 /* CPU Clock Selection Register */
+#define LPC17_40_SYSCON_USBCLKSEL_OFFSET 0x0108 /* USB Clock Selection Register */
+
+/* 0x400f c110 - 0x400f c114: CAN Wake and Sleep Registers */
+
+/* Clocking and power control -- Clock source selection */
+
+#define LPC17_40_SYSCON_CLKSRCSEL_OFFSET 0x010c /* Clock Source Select Register */
+#define LPC17_40_SYSCON_CANSLEEPCLR_OFFSET 0x0110 /* CAN Channel Sleep State Register */
+#define LPC17_40_SYSCON_CANWAKEFLAGS_OFFSET 0x0114 /* CAN Channel Wake-Up State Register */
+
+/* System control registers -- External Interrupts */
+
+#define LPC17_40_SYSCON_EXTINT_OFFSET 0x0140 /* External Interrupt Flag Register */
+#define LPC17_40_SYSCON_EXTMODE_OFFSET 0x0148 /* External Interrupt Mode register */
+#define LPC17_40_SYSCON_EXTPOLAR_OFFSET 0x014c /* External Interrupt Polarity Register */
+
+/* System control registers -- Reset */
+
+#define LPC17_40_SYSCON_RSID_OFFSET 0x0180 /* Reset Source Identification Register */
+
+/* System control registers -- Syscon Miscellaneous Registers */
+
+#define LPC17_40_SYSCON_MATRIXARB_OFFSET 0x0188 /* Matrix Arbitration Register */
+#define LPC17_40_SYSCON_SCS_OFFSET 0x01a0 /* System Control and Status */
+#define LPC17_40_SYSCON_PCLKSEL_OFFSET 0x01a8 /* Peripheral Clock Selection Register */
+#define LPC17_40_SYSCON_PBOOST_OFFSET 0x01b0 /* Power Boost Register */
+#define LPC17_40_SYSCON_SPIFICLKSEL_OFFSET 0x01b4 /* SPIFI Clock Selection Register */
+#define LPC17_40_SYSCON_LCDCFG_OFFSET 0x01b8 /* LCD Clock Configuration Register */
+
+/* Device Interrupt Registers (Might be a error in the User Manual, might be at 0x5000c1c0) */
+
+#define LPC17_40_SYSCON_USBINTST_OFFSET 0x01c0 /* USB Interrupt Status */
+
+/* DMA Request Select Register */
+
+#define LPC17_40_SYSCON_DMAREQSEL_OFFSET 0x01c4 /* Selects between UART and timer DMA requests */
+
+/* More clocking and power control -- Utility */
+
+#define LPC17_40_SYSCON_CLKOUTCFG_OFFSET 0x01c8 /* Clock Output Configuration Register */
+
+/* Peripheral Reset Control */
+
+#define LPC17_40_SYSCON_RSTCON0_OFFSET 0x01cc /* Individual Peripheral Reset Control Bits */
+#define LPC17_40_SYSCON_RSTCON1_OFFSET 0x01d0 /* Individual Peripheral Reset Control Bits */
+
+/* EMC Clock Control and Calibration */
+
+#define LPC17_40_SYSCON_EMCDLYCTL_OFFSET 0x01dc /* Programmable Delays for SDRAM Operation */
+#define LPC17_40_SYSCON_EMCCAL_OFFSET 0x01e0 /* Calibration Counter for EMCDLYCTL */
+
+
+/* Register addresses *******************************************************************************/
+/* Flash accelerator module */
+
+#define LPC17_40_SYSCON_FLASHCFG (LPC17_40_SYSCON_BASE+LPC17_40_SYSCON_FLASHCFG_OFFSET)
+
+/* Memory Mapping Control register (MEMMAP - 0x400F C040) */
+
+#define LPC17_40_SYSCON_MEMMAP (LPC17_40_SYSCON_BASE+LPC17_40_SYSCON_MEMMAP_OFFSET)
+
+/* Clocking and power control - Phase locked loops */
+
+#define LPC17_40_SYSCON_PLL0CON (LPC17_40_SYSCON_BASE+LPC17_40_SYSCON_PLL0CON_OFFSET)
+#define LPC17_40_SYSCON_PLL0CFG (LPC17_40_SYSCON_BASE+LPC17_40_SYSCON_PLL0CFG_OFFSET)
+#define LPC17_40_SYSCON_PLL0STAT (LPC17_40_SYSCON_BASE+LPC17_40_SYSCON_PLL0STAT_OFFSET)
+#define LPC17_40_SYSCON_PLL0FEED (LPC17_40_SYSCON_BASE+LPC17_40_SYSCON_PLL0FEED_OFFSET)
+
+#define LPC17_40_SYSCON_PLL1CON (LPC17_40_SYSCON_BASE+LPC17_40_SYSCON_PLL1CON_OFFSET)
+#define LPC17_40_SYSCON_PLL1CFG (LPC17_40_SYSCON_BASE+LPC17_40_SYSCON_PLL1CFG_OFFSET)
+#define LPC17_40_SYSCON_PLL1STAT (LPC17_40_SYSCON_BASE+LPC17_40_SYSCON_PLL1STAT_OFFSET)
+#define LPC17_40_SYSCON_PLL1FEED (LPC17_40_SYSCON_BASE+LPC17_40_SYSCON_PLL1FEED_OFFSET)
+
+/* Clocking and power control - Peripheral power control registers */
+
+#define LPC17_40_SYSCON_PCON (LPC17_40_SYSCON_BASE+LPC17_40_SYSCON_PCON_OFFSET)
+#define LPC17_40_SYSCON_PCONP (LPC17_40_SYSCON_BASE+LPC17_40_SYSCON_PCONP_OFFSET)
+#define LPC17_40_SYSCON_PCONP1 (LPC17_40_SYSCON_BASE+LPC17_40_SYSCON_PCONP1_OFFSET)
+
+/* Clocking and power control -- Clock dividers */
+
+#define LPC17_40_SYSCON_EMCCLKSEL (LPC17_40_SYSCON_BASE+LPC17_40_SYSCON_EMCCLKSEL_OFFSET)
+#define LPC17_40_SYSCON_CCLKSEL (LPC17_40_SYSCON_BASE+LPC17_40_SYSCON_CCLKSEL_OFFSET)
+#define LPC17_40_SYSCON_USBCLKSEL (LPC17_40_SYSCON_BASE+LPC17_40_SYSCON_USBCLKSEL_OFFSET)
+
+/* 0x400f c110 - 0x400f c114: CAN Wake and Sleep Registers */
+
+/* Clocking and power control -- Clock source selection */
+
+#define LPC17_40_SYSCON_CLKSRCSEL (LPC17_40_SYSCON_BASE+LPC17_40_SYSCON_CLKSRCSEL_OFFSET)
+#define LPC17_40_SYSCON_CANSLEEPCLR (LPC17_40_SYSCON_BASE+LPC17_40_SYSCON_CANSLEEPCLR_OFFSET)
+#define LPC17_40_SYSCON_CANWAKEFLAGS (LPC17_40_SYSCON_BASE+LPC17_40_SYSCON_CANWAKEFLAGS_OFFSET)
+
+/* System control registers -- External Interrupts */
+
+#define LPC17_40_SYSCON_EXTINT (LPC17_40_SYSCON_BASE+LPC17_40_SYSCON_EXTINT_OFFSET)
+
+#define LPC17_40_SYSCON_EXTMODE (LPC17_40_SYSCON_BASE+LPC17_40_SYSCON_EXTMODE_OFFSET)
+#define LPC17_40_SYSCON_EXTPOLAR (LPC17_40_SYSCON_BASE+LPC17_40_SYSCON_EXTPOLAR_OFFSET)
+
+/* System control registers -- Reset */
+
+#define LPC17_40_SYSCON_RSID (LPC17_40_SYSCON_BASE+LPC17_40_SYSCON_RSID_OFFSET)
+
+/* System control registers -- Syscon Miscellaneous Registers */
+
+#define LPC17_40_SYSCON_MATRIXARB (LPC17_40_SYSCON_BASE+LPC17_40_SYSCON_MATRIXARB_OFFSET)
+#define LPC17_40_SYSCON_SCS (LPC17_40_SYSCON_BASE+LPC17_40_SYSCON_SCS_OFFSET)
+#define LPC17_40_SYSCON_PCLKSEL (LPC17_40_SYSCON_BASE+LPC17_40_SYSCON_PCLKSEL_OFFSET)
+#define LPC17_40_SYSCON_PBOOST (LPC17_40_SYSCON_BASE+LPC17_40_SYSCON_PBOOST_OFFSET)
+#define LPC17_40_SYSCON_SPIFICLKSEL (LPC17_40_SYSCON_BASE+LPC17_40_SYSCON_SPIFICLKSEL_OFFSET)
+#define LPC17_40_SYSCON_LCDCFG (LPC17_40_SYSCON_BASE+LPC17_40_SYSCON_LCDCFG_OFFSET)
+
+/* Device Interrupt Registers (Might be a error in the User Manual, might be at 0x5000c1c0) */
+
+#define LPC17_40_SYSCON_USBINTST (LPC17_40_SYSCON_BASE+LPC17_40_SYSCON_USBINTST_OFFSET)
+
+/* DMA Request Select Register */
+
+#define LPC17_40_SYSCON_DMAREQSEL (LPC17_40_SYSCON_BASE+LPC17_40_SYSCON_DMAREQSEL_OFFSET)
+
+/* More clocking and power control -- Utility */
+
+#define LPC17_40_SYSCON_CLKOUTCFG (LPC17_40_SYSCON_BASE+LPC17_40_SYSCON_CLKOUTCFG_OFFSET)
+
+
+/* Peripheral Reset Control */
+
+#define LPC17_40_SYSCON_RSTCON0 (LPC17_40_SYSCON_BASE+LPC17_40_SYSCON_RSTCON0_OFFSET)
+#define LPC17_40_SYSCON_RSTCON1 (LPC17_40_SYSCON_BASE+LPC17_40_SYSCON_RSTCON1_OFFSET)
+
+/* EMC Clock Control and Calibration */
+
+#define LPC17_40_SYSCON_EMCDLYCTL (LPC17_40_SYSCON_BASE+LPC17_40_SYSCON_EMCDLYCTL_OFFSET)
+#define LPC17_40_SYSCON_EMCCAL (LPC17_40_SYSCON_BASE+LPC17_40_SYSCON_EMCCAL_OFFSET)
+
+/* Register bit definitions *************************************************************************/
+/* Flash accelerator module */
+ /* Bits 0-11: Reserved */
+#define SYSCON_FLASHCFG_TIM_SHIFT (12) /* Bits 12-15: FLASHTIM Flash access time */
+#define SYSCON_FLASHCFG_TIM_MASK (15 << SYSCON_FLASHCFG_TIM_SHIFT)
+# define SYSCON_FLASHCFG_TIM_0 (0) /* 1 CPU clock <= 20 MHz CPU clock */
+# define SYSCON_FLASHCFG_TIM_1 (1 << SYSCON_FLASHCFG_TIM_SHIFT) /* 2 CPU clock <= 40 MHz CPU clock */
+# define SYSCON_FLASHCFG_TIM_2 (2 << SYSCON_FLASHCFG_TIM_SHIFT) /* 3 CPU clock <= 60 MHz CPU clock */
+# define SYSCON_FLASHCFG_TIM_3 (3 << SYSCON_FLASHCFG_TIM_SHIFT) /* 4 CPU clock <= 80 MHz CPU clock */
+# define SYSCON_FLASHCFG_TIM_4 (4 << SYSCON_FLASHCFG_TIM_SHIFT) /* 5 CPU clock <= 100 MHz CPU clock
+ * (Up to 120 Mhz for LPC1788x) */
+# define SYSCON_FLASHCFG_TIM_5 (5 << SYSCON_FLASHCFG_TIM_SHIFT) /* "safe" setting for any conditions */
+ /* Bits 16-31: Reserved */
+/* Memory Mapping Control register (MEMMAP - 0x400F C040) */
+
+#define SYSCON_MEMMAP_MAP (1 << 0) /* Bit 0:
+ * 0:Boot mode. A portion of the Boot ROM is mapped to address 0.
+ * 1:User mode. The on-chip Flash memory is mapped to address 0 */
+ /* Bits 1-31: Reserved */
+/* Clocking and power control -- Clock source selection */
+
+#define SYSCON_CLKSRCSEL_SHIFT (0) /* Bits 0: Clock selection */
+#define SYSCON_CLKSRCSEL_MASK (1 << SYSCON_CLKSRCSEL_SHIFT)
+# define SYSCON_CLKSRCSEL_INTRC (0 << SYSCON_CLKSRCSEL_SHIFT) /* PLL0 source = internal RC oscillator */
+# define SYSCON_CLKSRCSEL_MAIN (1 << SYSCON_CLKSRCSEL_SHIFT) /* PLL0 source = main oscillator */
+ /* Bits 1-31: Reserved */
+/* Clocking and power control - Phase locked loops */
+/* PLL0/1 Control register */
+
+#define SYSCON_PLLCON_PLLE (1 << 0) /* Bit 0: PLL Enable */
+ /* Bits 1-31: Reserved */
+/* PLL0/1 Configuration register */
+
+#define SYSCON_PLLCFG_MSEL_SHIFT (0) /* Bit 0-4: PLL Multiplier value */
+#define SYSCON_PLLCFG_MSEL_MASK (0x1f << SYSCON_PLLCFG_MSEL_SHIFT)
+#define SYSCON_PLLCFG_PSEL_SHIFT (5) /* Bit 5-6: PLL Pre-Divider value */
+#define SYSCON_PLLCFG_PSEL_MASK (3 << SYSCON_PLLCFG_PSEL_SHIFT)
+
+/* PLL0/1 Status register */
+
+#define SYSCON_PLLSTAT_MSEL_SHIFT (0) /* Bit 0-4: PLLMultiplier value readback */
+#define SYSCON_PLLSTAT_MSEL_MASK (0x1f << SYSCON_PLLSTAT_MSEL_SHIFT)
+#define SYSCON_PLLSTAT_PSEL_SHIFT (5) /* Bit 5-6: PLL Pre-Divider value readback */
+#define SYSCON_PLLSTAT_PSEL_MASK (3 << SYSCON_PLLSTAT_PSEL_SHIFT)
+ /* Bit 7: Reserved */
+#define SYSCON_PLLSTAT_PLLE (1 << 8) /* Bit 8: PLL enable readback */
+#define SYSCON_PLLSTAT_PLLC (1 << 9) /* Bit 9: PLL connect readback */
+#define SYSCON_PLLSTAT_PLOCK (1 << 10) /* Bit 10: PLL lock status */
+ /* Bits 11-31: Reserved */
+/* PLL0/1 Feed register */
+
+#define SYSCON_PLLFEED_SHIFT (0) /* Bit 0-7: PLL0/1 feed sequence */
+#define SYSCON_PLLFEED_MASK (0xff << SYSCON_PLLFEED_SHIFT)
+ /* Bits 8-31: Reserved */
+/* Clocking and power control -- Clock dividers */
+
+/* EMC Clock Selection Register */
+
+#define SYSCON_EMCDIV (1 << 0) /* Bit 0: EMC Clock rate relative to CPU */
+ /* 0: EMC uses same clock as CPU */
+ /* 1: EMC uses half the rate of CPU */
+ /* Bits 1-31: Reserved */
+/* EMC Clock Selection Register */
+
+#define SYSCON_EMCCLKSEL_CCLK_DIV2 (1 << 0) /* Bit 0: 1=EMC used CPU clock / 2 */
+#define SYSCON_EMCCLKSEL_CCLK_DIV1 (0) /* 0=EMC used CPU clock */
+
+/* CPU Clock Selection Register */
+
+#define SYSCON_CCLKSEL_CCLKDIV_SHIFT (0) /* 0-4: Divide value for CPU clock (CCLK) */
+#define SYSCON_CCLKSEL_CCLKDIV_MASK (0x1f << SYSCON_CCLKSEL_CCLKDIV_SHIFT)
+# define SYSCON_CCLKSEL_CCLKDIV(n) ((n-1) << SYSCON_CCLKSEL_CCLKDIV_SHIFT) /* n = 2 - 31 */
+ /* Bits 5-7: Reserved */
+#define SYSCON_CCLKSEL_CCLKSEL (1 << 8) /* Bit 8: Select input clock to CPU clock divider */
+ /* 0: Sysclk used as input to CCLKDIV */
+ /* 1: Main PLL used as input to CCLKDIV */
+ /* Bits 9-31: Reserved */
+/* USB Clock Selection register */
+
+#define SYSCON_USBCLKSEL_USBDIV_SHIFT (0) /* Bits 0-4: PLL0/1 divide value USB clock */
+#define SYSCON_USBCLKSEL_USBDIV_MASK (0x1f << SYSCON_USBCLKSEL_USBDIV_SHIFT)
+# define SYSCON_USBCLKSEL_USBDIV_DIV1 (1 << SYSCON_USBCLKSEL_USBDIV_SHIFT) /* PLL0/1 output must be 48MHz */
+# define SYSCON_USBCLKSEL_USBDIV_DIV2 (2 << SYSCON_USBCLKSEL_USBDIV_SHIFT) /* PLL0/1 output must be 96MHz */
+# define SYSCON_USBCLKSEL_USBDIV_DIV3 (3 << SYSCON_USBCLKSEL_USBDIV_SHIFT) /* PLL0/1 output must be 144MHz */
+ /* Bits 5-7: Reserved */
+#define SYSCON_USBCLKSEL_USBSEL_SHIFT (8) /* Bits 8-9: Input clock to USBDIV */
+#define SYSCON_USBCLKSEL_USBSEL_MASK (3 << SYSCON_USBCLKSEL_USBSEL_SHIFT)
+#define SYSCON_USBCLKSEL_USBSEL_PLL0 (1 << SYSCON_USBCLKSEL_USBSEL_SHIFT) /* 01: PLL0 is used as input clock to USBDIV */
+#define SYSCON_USBCLKSEL_USBSEL_PLL1 (2 << SYSCON_USBCLKSEL_USBSEL_SHIFT) /* 10: PLL1 is used as input clock to USBDIV */
+ /* 11: unused */
+ /* Bits 10-31: Reserved */
+/* CAN0/1 Sleep Clear Register */
+ /* Bit 0: Reserved */
+#define SYSCON_CANSLEEPCLR_SHIFT (1) /* Bits 1-2: CAN0/1 Sleep Status and Control */
+#define SYSCON_CANSLEEPCLR_MASK (3 << SYSCON_CANSLEEPCLR_SHIFT) /* */
+#define SYSCON_CANSLEEPCLR_CAN1 (1 << SYSCON_CANSLEEPCLR_SHIFT) /* CAN1 Sleep Status */
+#define SYSCON_CANSLEEPCLR_CAN2 (2 << SYSCON_CANSLEEPCLR_SHIFT) /* CAN2 Sleep Status */
+ /* Read 1: CAN channel in sleep mode */
+ /* Write 1: CAN channel clocks restored */
+ /* Bits 3-31: Reserved */
+/* CAN0/1 WakeUp Flags Register */
+ /* Bit 0: Reserved */
+#define SYSCON_CANWAKEFLAGS_SHIFT (1) /* Bits 1-2: CAN0/1 WakeUp Status */
+#define SYSCON_CANWAKEFLAGS_MASK (3 << SYSCON_CANWAKEFLAGS_SHIFT) /* */
+#define SYSCON_CANWAKEFLAGS_CAN1 (1 << SYSCON_CANWAKEFLAGS_SHIFT) /* CAN1 WakeUp Status */
+#define SYSCON_CANWAKEFLAGS_CAN2 (2 << SYSCON_CANWAKEFLAGS_SHIFT) /* CAN2 WakeUp Status */
+ /* Read 1: CAN channel falling edge occur on receive line */
+ /* Write 1: CAN channel clears wakeup flag bit */
+ /* Bits 3-31: Reserved */
+/* Peripheral Clock Selection register */
+/* PCLK is common to all peripheral */
+
+#define SYSCON_PCLKSEL_PCLKDIV_SHIFT (0) /* Bits 0-4: Clock divide value for all APB peripherals */
+#define SYSCON_PCLKSEL_PCLKDIV_MASK (0x1f << SYSCON_PCLKSEL_PCLKDIV_SHIFT)
+# define SYSCON_PCLKSEL_PCLKDIV(n) ((n) & SYSCON_PCLKSEL_PCLKDIV_MASK) /* n = 1 - 31 */
+ /* Bits 5-31: Reserved */
+/* Power Boost Control Register */
+
+#define SYSCON_PBOOST_BOOST_SHIFT (0) /* Bits 0-1: Boost control bits */
+#define SYSCON_PBOOST_BOOST_MASK (3 << SYSCON_PBOOST_BOOST_SHIFT)
+#define SYSCON_PBOOST_BOOST_OFF (0) /* Boost OFF, operation must be below 100MHz */
+#define SYSCON_PBOOST_BOOST_ON (3) /* Boost ON, operation upto 120MHz allowed */
+ /* Bits 2-31: Reserved */
+/* SPIFI Clock Selection Register */
+
+#define SYSCON_SPIFICLKSEL_SPIFIDIV_SHIFT (0) /* Bits 0-4: divide value for SPIFI clock */
+#define SYSCON_SPIFICLKSEL_SPIFIDIV_MASK (0x1f << SYSCON_SPIFICLKSEL_SPIFIDIV_SHIFT)
+# define SYSCON_SPIFICLKSEL_SPIFIDIV(n) ((n-1) << SYSCON_SPIFICLKSEL_SPIFIDIV_SHIFT) /* n = 2 - 31 */
+ /* Bits 5-7: Reserved */
+#define SYSCON_SPIFICLKSEL_SPIFISEL_SHIFT (8) /* Bits 8-9: Selects input clock for SPIFI clock divider */
+#define SYSCON_SPIFICLKSEL_SPIFISEL_MASK (3 << SYSCON_SPIFICLKSEL_SPIFISEL_SHIFT)
+#define SYSCON_SPIFICLKSEL_SPIFISEL_SYSCLK (0) /* Sysclk used as input to SPIFIDIV */
+#define SYSCON_SPIFICLKSEL_SPIFISEL_PLL0 (1 << SYSCON_SPIFICLKSEL_SPIFISEL_SHIFT) /* Main PLL used as input to SPIFIDIV */
+#define SYSCON_SPIFICLKSEL_SPIFISEL_PLL1 (2 << SYSCON_SPIFICLKSEL_SPIFISEL_SHIFT) /* Alt PLL used as input to SPIFIDIV */
+ /* Bits 10-31: Reserved */
+/* LCD Configuration Register */
+
+#define SYSCON_LCDCFG_CLKDIV_SHIFT (0) /* Bits 0-4: LCD Panel clock prescaler */
+#define SYSCON_LCDCFG_CLKDIV_MASK (0x1f << SYSCON_LCDCFG_CLKDIV_SHIFT)
+#define SYSCON_LCDCFG_CLKDIV(n) ((n-1) << SYSCON_LCDCFG_CLKDIV_SHIFT) /* n = 1 - 32 */
+ /* Bits 5-31: Reserved */
+/* Clocking and power control - Peripheral power control registers */
+/* Power Control Register */
+
+#define SYSCON_PCON_PM0 (1 << 0) /* Bit 0: Power mode control bit 0 */
+#define SYSCON_PCON_PM1 (1 << 1) /* Bit 1: Power mode control bit 1 */
+#define SYSCON_PCON_BODRPM (1 << 2) /* Bit 2: Brown-Out Reduced Power Mode */
+#define SYSCON_PCON_BOGD (1 << 3) /* Bit 3: Brown-Out Global Disable */
+#define SYSCON_PCON_BORD (1 << 4) /* Bit 4: Brown-Out Reset Disable */
+ /* Bits 5-7: Reserved */
+#define SYSCON_PCON_SMFLAG (1 << 8) /* Bit 8: Sleep Mode entry flag */
+#define SYSCON_PCON_DSFLAG (1 << 9) /* Bit 9: Deep Sleep entry flag */
+#define SYSCON_PCON_PDFLAG (1 << 10) /* Bit 10: Power-down entry flag */
+#define SYSCON_PCON_DPDFLAG (1 << 11) /* Bit 11: Deep Power-down entry flag */
+ /* Bits 12-31: Reserved */
+/* Power Control for Peripherals Register */
+
+#define SYSCON_PCONP_PCLCD (1 << 0) /* Bit 0: LCD power/clock control */
+#define SYSCON_PCONP_PCTIM0 (1 << 1) /* Bit 1: Timer/Counter 0 power/clock control */
+#define SYSCON_PCONP_PCTIM1 (1 << 2) /* Bit 2: Timer/Counter 1 power/clock control */
+#define SYSCON_PCONP_PCUART0 (1 << 3) /* Bit 3: UART0 power/clock control */
+#define SYSCON_PCONP_PCUART1 (1 << 4) /* Bit 4: UART1 power/clock control */
+#define SYSCON_PCONP_PCPWM0 (1 << 5) /* Bit 5: PWM0 power/clock control */
+#define SYSCON_PCONP_PCPWM1 (1 << 6) /* Bit 6: PWM1 power/clock control */
+#define SYSCON_PCONP_PCI2C0 (1 << 7) /* Bit 7: I2C0 power/clock control */
+#define SYSCON_PCONP_PCSPI (1 << 8) /* Bit 8: SPI power/clock control */
+#define SYSCON_PCONP_PCRTC (1 << 9) /* Bit 9: RTC power/clock control */
+#define SYSCON_PCONP_PCSSP1 (1 << 10) /* Bit 10: SSP 1 power/clock control */
+#define SYSCON_PCONP_PCEMC (1 << 11) /* Bit 11: External Memory */
+#define SYSCON_PCONP_PCADC (1 << 12) /* Bit 12: A/D converter (ADC) power/clock control */
+#define SYSCON_PCONP_PCCAN1 (1 << 13) /* Bit 13: CAN Controller 1 power/clock control */
+#define SYSCON_PCONP_PCCAN2 (1 << 14) /* Bit 14: CAN Controller 2 power/clock control */
+#define SYSCON_PCONP_PCGPIO (1 << 15) /* Bit 15: GPIOs power/clock enable */
+#define SYSCON_PCONP_PCSPIFI (1 << 16) /* Bit 16: SPI Flash Interface power/clock control */
+#define SYSCON_PCONP_PCMCPWM (1 << 17) /* Bit 17: Motor Control PWM */
+#define SYSCON_PCONP_PCQEI (1 << 18) /* Bit 18: Quadrature Encoder power/clock control */
+#define SYSCON_PCONP_PCI2C1 (1 << 19) /* Bit 19: I2C1 power/clock control */
+#define SYSCON_PCONP_PCSSP2 (1 << 20) /* Bit 20: SSP2 power/clock control */
+#define SYSCON_PCONP_PCSSP0 (1 << 21) /* Bit 21: SSP0 power/clock control */
+#define SYSCON_PCONP_PCTIM2 (1 << 22) /* Bit 22: Timer 2 power/clock control */
+#define SYSCON_PCONP_PCTIM3 (1 << 23) /* Bit 23: Timer 3 power/clock control */
+#define SYSCON_PCONP_PCUART2 (1 << 24) /* Bit 24: UART 2 power/clock control */
+#define SYSCON_PCONP_PCUART3 (1 << 25) /* Bit 25: UART 3 power/clock control */
+#define SYSCON_PCONP_PCI2C2 (1 << 26) /* Bit 26: I2C 2 power/clock control */
+#define SYSCON_PCONP_PCI2S (1 << 27) /* Bit 27: I2S power/clock control */
+#define SYSCON_PCONP_PCSDC (1 << 28) /* Bit 28: SD Card power/clock control */
+#define SYSCON_PCONP_PCGPDMA (1 << 29) /* Bit 29: GPDMA function power/clock control */
+#define SYSCON_PCONP_PCENET (1 << 30) /* Bit 30: Ethernet block power/clock control */
+#define SYSCON_PCONP_PCUSB (1 << 31) /* Bit 31: USB power/clock control */
+
+/* Power Control for Peripherals Register 1 */
+
+ /* Bits 0-2: Reserved */
+#define SYSCON_PCONP1_PCCMP (1 << 3) /* Bit 3: Comparator power/clock control */
+ /* Bits 4-31: Reserved */
+
+/* More clocking and power control -- Utility */
+
+#define SYSCON_CLKOUTCFG_SEL_SHIFT (0) /* Bits 0-3: Selects clock source for CLKOUT */
+#define SYSCON_CLKOUTCFG_SEL_MASK (15 << SYSCON_CLKOUTCFG_SEL_SHIFT)
+# define SYSCON_CLKOUTCFG_SEL_CPU (0 << SYSCON_CLKOUTCFG_SEL_SHIFT) /* CLKOUT source=CPU clock */
+# define SYSCON_CLKOUTCFG_SEL_MAIN (1 << SYSCON_CLKOUTCFG_SEL_SHIFT) /* CLKOUT source=main osc */
+# define SYSCON_CLKOUTCFG_SEL_INTRC (2 << SYSCON_CLKOUTCFG_SEL_SHIFT) /* CLKOUT source=internal RC osc */
+# define SYSCON_CLKOUTCFG_SEL_USB (3 << SYSCON_CLKOUTCFG_SEL_SHIFT) /* CLKOUT source=USB clock */
+# define SYSCON_CLKOUTCFG_SEL_RTC (4 << SYSCON_CLKOUTCFG_SEL_SHIFT) /* CLKOUT source=RTC osc */
+# define SYSCON_CLKOUTCFG_SEL_SPIFI (5 << SYSCON_CLKOUTCFG_SEL_SHIFT) /* CLKOUT source=SPIFI osc */
+#define SYSCON_CLKOUTCFG_DIV_SHIFT (4) /* Bits 4-7: CLKOUT divisor */
+#define SYSCON_CLKOUTCFG_DIV_MASK (15 << SYSCON_CLKOUTCFG_DIV_SHIFT)
+# define SYSCON_CLKOUTCFG_DIV(n) ((n-1) << SYSCON_CLKOUTCFG_DIV_SHIFT) /* n=1..16 */
+#define SYSCON_CLKOUTCFG_EN (1 << 8) /* Bit 8: CLKOUT enable control */
+#define SYSCON_CLKOUTCFG_ACT (1 << 9) /* Bit 9: CLKOUT activity indication */
+ /* Bits 10-31: Reserved */
+/* System control registers -- External Interrupts */
+/* External Interrupt Flag register */
+
+#define SYSCON_EXTINT_EINT0 (1 << 0) /* Bit 0: EINT0 */
+#define SYSCON_EXTINT_EINT1 (1 << 1) /* Bit 1: EINT1 */
+#define SYSCON_EXTINT_EINT2 (1 << 2) /* Bit 2: EINT2 */
+#define SYSCON_EXTINT_EINT3 (1 << 3) /* Bit 3: EINT3 */
+ /* Bits 4-31: Reserved */
+/* External Interrupt Mode register */
+
+#define SYSCON_EXTMODE_EINT0 (1 << 0) /* Bit 0: 1=EINT0 edge sensitive */
+#define SYSCON_EXTMODE_EINT1 (1 << 1) /* Bit 1: 1=EINT1 edge sensitive */
+#define SYSCON_EXTMODE_EINT2 (1 << 2) /* Bit 2: 1=EINT2 edge sensitive */
+#define SYSCON_EXTMODE_EINT3 (1 << 3) /* Bit 3: 1=EINT3 edge sensitive */
+ /* Bits 4-31: Reserved */
+/* External Interrupt Polarity register */
+
+#define SYSCON_EXTPOLAR_EINT0 (1 << 0) /* Bit 0: 1=EINT0 high active/rising edge */
+#define SYSCON_EXTPOLAR_EINT1 (1 << 1) /* Bit 1: 1=EINT1 high active/rising edge */
+#define SYSCON_EXTPOLAR_EINT2 (1 << 2) /* Bit 2: 1=EINT2 high active/rising edge */
+#define SYSCON_EXTPOLAR_EINT3 (1 << 3) /* Bit 3: 1=EINT3 high active/rising edge */
+ /* Bits 4-31: Reserved */
+/* System control registers -- Reset */
+/* Reset Source Identification Register */
+
+#define SYSCON_RSID_POR (1 << 0) /* Bit 0: Power on reset */
+#define SYSCON_RSID_EXTR (1 << 1) /* Bit 1: external RESET signal */
+#define SYSCON_RSID_WDTR (1 << 2) /* Bit 2: Watchdog Timer time out w/WDTRESET */
+#define SYSCON_RSID_BODR (1 << 3) /* Bit 3: Brown out detection */
+#define SYSCON_RSID_SYSRESET (1 << 4) /* Bit 4: System Reset */
+#define SYSCON_RSID_LOCKUP (1 << 5) /* Bit 5: Lockup Reset */
+ /* Bits 6-31: Reserved */
+/* System control registers -- Matrix Arbitration Priorities */
+
+# define SYSCON_MATRIXARB_PRI_LOWEST (0)
+# define SYSCON_MATRIXARB_PRI_LOW (1)
+# define SYSCON_MATRIXARB_PRI_HIGH (2)
+# define SYSCON_MATRIXARB_PRI_HIGHEST (3)
+
+#define SYSCON_MATRIXARB_PRI_ICODE_SHIFT (0) /* Bits 0-1: I-Code bus priority (should be lower than D-Code) */
+#define SYSCON_MATRIXARB_PRI_ICODE_MASK (3 << SYSCON_MATRIXARB_PRI_ICODE_SHIFT)
+# define SYSCON_MATRIXARB_PRI_ICODE(n) ((n) << SYSCON_MATRIXARB_PRI_ICODE_SHIFT)
+#define SYSCON_MATRIXARB_PRI_DCODE_SHIFT (2) /* Bits 2-3: D-Code bus priority */
+#define SYSCON_MATRIXARB_PRI_DCODE_MASK (3 << SYSCON_MATRIXARB_PRI_DCODE_SHIFT)
+# define SYSCON_MATRIXARB_PRI_DCODE(n) ((n) << SYSCON_MATRIXARB_PRI_DCODE_SHIFT)
+#define SYSCON_MATRIXARB_PRI_SYS_SHIFT (4) /* Bits 4-5: System bus priority */
+#define SYSCON_MATRIXARB_PRI_SYS_MASK (3 << SYSCON_MATRIXARB_PRI_SYS_SHIFT)
+# define SYSCON_MATRIXARB_PRI_SYS(n) ((n) << SYSCON_MATRIXARB_PRI_SYS_SHIFT)
+#define SYSCON_MATRIXARB_PRI_GPDMA_SHIFT (6) /* Bits 6-7: General Purpose DMA priority */
+#define SYSCON_MATRIXARB_PRI_GPDMA_MASK (3 << SYSCON_MATRIXARB_PRI_GPDMA_SHIFT)
+# define SYSCON_MATRIXARB_PRI_GPDMA(n) ((n) << SYSCON_MATRIXARB_PRI_GPDMA_SHIFT)
+#define SYSCON_MATRIXARB_PRI_ETH_SHIFT (8) /* Bits 8-9: Ethernet DMA priority */
+#define SYSCON_MATRIXARB_PRI_ETH_MASK (3 << SYSCON_MATRIXARB_PRI_ETH_SHIFT)
+# define SYSCON_MATRIXARB_PRI_ETH(n) ((n) << SYSCON_MATRIXARB_PRI_ETH_SHIFT)
+#define SYSCON_MATRIXARB_PRI_LCD_SHIFT (10) /* Bits 10-11: LCD DMA priority */
+#define SYSCON_MATRIXARB_PRI_LCD_MASK (3 << SYSCON_MATRIXARB_PRI_LCD_SHIFT)
+# define SYSCON_MATRIXARB_PRI_LCD(n) ((n) << SYSCON_MATRIXARB_PRI_LCD_SHIFT)
+#define SYSCON_MATRIXARB_PRI_USB_SHIFT (12) /* Bits 12-13: USB DMA priority */
+#define SYSCON_MATRIXARB_PRI_USB_MASK (3 << SYSCON_MATRIXARB_PRI_USB_SHIFT)
+# define SYSCON_MATRIXARB_PRI_USB(n) ((n) << SYSCON_MATRIXARB_PRI_USB_SHIFT)
+ /* Bits 14-15: Reserved */
+#define SYSCON_MATRIXARB_ROM_LAT_SHIFT (16) /* Bit 16: ROM Latency select (should always be zero) */
+#define SYSCON_MATRIXARB_ROM_LAT (1 << SYSCON_MATRIXARB_ROM_LAT_SHIFT)
+ /* Bits 17-31: Reserved */
+
+#define SYSCON_MATRIXARB_PRI_MASK (0x00013fff)
+
+/* System control registers -- Syscon Miscellaneous Registers */
+
+#define SYSCON_SCS_EMCSC (1 << 0) /* Bit 0: EMC shift control */
+#define SYSCON_SCS_EMCRD (1 << 1) /* Bit 1: EMC reset disable */
+#define SYSCON_SCS_EMCBC (1 << 2) /* Bit 2: EMC burst control */
+#define SYSCON_SCS_MCIPWRAL (1 << 3) /* Bit 3: MCI power active level */
+#define SYSCON_SCS_OSCRS (1 << 4) /* Bit 4: Main oscillator range select */
+#define SYSCON_SCS_OSCEN (1 << 5) /* Bit 5: Main oscillator enable */
+#define SYSCON_SCS_OSCSTAT (1 << 6) /* Bit 6: Main oscillator status */
+ /* Bits 7-31: Reserved */
+/* Device Interrupt Registers */
+/* USB Interrupt Status register */
+
+#define SYSCON_USBINTST_REQLP (1 << 0) /* Bit 0: Low priority interrupt line status */
+#define SYSCON_USBINTST_REQHP (1 << 1) /* Bit 1: High priority interrupt line status */
+#define SYSCON_USBINTST_REQDMA (1 << 2) /* Bit 2: DMA interrupt line status */
+#define SYSCON_USBINTST_HOSTINT (1 << 3) /* Bit 3: USB host interrupt line status */
+#define SYSCON_USBINTST_ATXINT (1 << 4) /* Bit 4: External ATX interrupt line status */
+#define SYSCON_USBINTST_OTGINT (1 << 5) /* Bit 5: OTG interrupt line status */
+#define SYSCON_USBINTST_I2CINT (1 << 6) /* Bit 6: I2C module interrupt line status */
+ /* Bit 7: Reserved */
+#define SYSCON_USBINTST_NEEDCLK (1 << 8) /* Bit 8: USB need clock indicator */
+ /* Bits 9-30: Reserved */
+#define SYSCON_USBINTST_ENINTS (1 << 31) /* Bit 31: Enable all USB interrupts */
+
+/* DMA Request Select Register */
+
+#define SYSCON_DMAREQSEL_INP0 (1 << 0) /* Bit 0: Input 0 0=unused 1=Timer 0 match 0 */
+#define SYSCON_DMAREQSEL_INP1 (1 << 1) /* Bit 1: Input 1 0=SD 1=Timer 0 match 1 */
+#define SYSCON_DMAREQSEL_INP2 (1 << 2) /* Bit 2: Input 2 0=SSP0 TX 1=Timer 1 match 0 */
+#define SYSCON_DMAREQSEL_INP3 (1 << 3) /* Bit 3: Input 3 0=SSP0 RX 1=Timer 1 match 1 */
+#define SYSCON_DMAREQSEL_INP4 (1 << 4) /* Bit 4: Input 4 0=SSP1 TX 1=Timer 2 match 0 */
+#define SYSCON_DMAREQSEL_INP5 (1 << 5) /* Bit 5: Input 5 0=SSP1 RX 1=Timer 2 match 1 */
+#define SYSCON_DMAREQSEL_INP6 (1 << 6) /* Bit 6: Input 6 0=SSP2 TX 1=I2S0 */
+#define SYSCON_DMAREQSEL_INP7 (1 << 7) /* Bit 7: Input 7 0=SSP2 RX 1=I2S1 */
+ /* Bits 8-9: Reserved */
+#define SYSCON_DMAREQSEL_INP10 (1 << 10) /* Bit 10: Input 10 0=UART0 TX 1=UART3 TX */
+#define SYSCON_DMAREQSEL_INP11 (1 << 11) /* Bit 11: Input 11 0=UART0 RX 1=UART3 RX */
+#define SYSCON_DMAREQSEL_INP12 (1 << 12) /* Bit 12: Input 12 0=UART1 TX 1=UART4 TX */
+#define SYSCON_DMAREQSEL_INP13 (1 << 13) /* Bit 13: Input 13 0=UART1 RX 1=UART4 RX */
+#define SYSCON_DMAREQSEL_INP14 (1 << 14) /* Bit 14: Input 14 0=UART2 TX 1=Timer 3 match 0 */
+#define SYSCON_DMAREQSEL_INP15 (1 << 15) /* Bit 15: Input 15 0=UART2 RX 1=Timer 3 match 1 */
+ /* Bits 16-31: Reserved */
+/* Reset Control Register 0 */
+
+#define SYSCON_RSTCON0_RSTLCD (1 << 0) /* LCD controller reset control bit */
+#define SYSCON_RSTCON0_RSTTIM0 (1 << 1) /* Timer/Counter 0 reset control bit */
+#define SYSCON_RSTCON0_RSTTIM1 (1 << 2) /* Timer/Counter 1 reset control bit */
+#define SYSCON_RSTCON0_RSTUART0 (1 << 3) /* UART0 reset control bit */
+#define SYSCON_RSTCON0_RSTUART1 (1 << 4) /* UART1 reset control bit */
+#define SYSCON_RSTCON0_RSTPWM0 (1 << 5) /* PWM0 reset control bit */
+#define SYSCON_RSTCON0_RSTPWM1 (1 << 6) /* PWM1 reset control bit */
+#define SYSCON_RSTCON0_RSTI2C0 (1 << 7) /* The I2C0 interface reset control bit */
+#define SYSCON_RSTCON0_RSTUART4 (1 << 8) /* UART4 reset control bit */
+#define SYSCON_RSTCON0_RSTRTC (1 << 9) /* RTC and Event Monitor/Recorder reset control bit. RTC reset is limited */
+#define SYSCON_RSTCON0_RSTSSP1 (1 << 10) /* The SSP 1 interface reset control bit */
+#define SYSCON_RSTCON0_RSTEMC (1 << 11) /* External Memory Controller reset control bit */
+#define SYSCON_RSTCON0_RSTADC (1 << 12) /* A/D converter (ADC) reset control bit */
+#define SYSCON_RSTCON0_RSTCAN1 (1 << 13) /* CAN Controller 1 reset control bit */
+ /* Note: The CAN acceptance filter may be reset by 0
+ * a separate bit in the RSTCON1 register. */
+#define SYSCON_RSTCON0_RSTCAN2 (1 << 14) /* CAN Controller 2 reset control bit */
+ /* Note: The CAN acceptance filter may be reset by 0
+ * a separate bit in the RSTCON1 register */
+#define SYSCON_RSTCON0_RSTGPIO (1 << 15) /* Reset control bit for GPIO, and GPIO interrupts */
+ /* Note: IOCON may be reset by a 0
+ * separate bit in the RSTCON1 register */
+#define SYSCON_RSTCON0_RSTSPIFI (1 << 16) /* SPI Flash Interface reset control bit (LPC1773 only) */
+#define SYSCON_RSTCON0_RSTMCPWM (1 << 17) /* Motor Control PWM reset control bit */
+#define SYSCON_RSTCON0_RSTQEI (1 << 18) /* Quadrature Encoder Interface reset control bit */
+#define SYSCON_RSTCON0_RSTI2C1 (1 << 19) /* The I2C1 interface reset control bit */
+#define SYSCON_RSTCON0_RSTSSP2 (1 << 20) /* The SSP2 interface reset control bit */
+#define SYSCON_RSTCON0_RSTSSP0 (1 << 21) /* The SSP0 interface reset control bit */
+#define SYSCON_RSTCON0_RSTTIM2 (1 << 22) /* Timer 2 reset control bit */
+#define SYSCON_RSTCON0_RSTTIM3 (1 << 23) /* Timer 3 reset control bit */
+#define SYSCON_RSTCON0_RSTUART2 (1 << 24) /* UART 2 reset control bit */
+#define SYSCON_RSTCON0_RSTUART3 (1 << 25) /* UART 3 reset control bit */
+#define SYSCON_RSTCON0_RSTI2C2 (1 << 26) /* I2C2 interface reset control bit.*/
+#define SYSCON_RSTCON0_RSTI2S (1 << 27) /* I2S interface reset control bit */
+#define SYSCON_RSTCON0_RSTSDC (1 << 28) /* SD Card interface reset control bit */
+#define SYSCON_RSTCON0_RSTGPDMA (1 << 29) /* GPDMA function reset control bit */
+
+#define SYSCON_RSTCON0_RSTENET (1 << 30) /* Ethernet block reset control bit */
+#define SYSCON_RSTCON0_RSTUSB (1 << 31) /* USB interface reset control bit */
+
+/* Reset Control Register 1 */
+
+#define SYSCON_RSTCON1_RSTIOCON (1 << 0) /* Reset control bit for the IOCON registers */
+#define SYSCON_RSTCON1_RSTDAC (1 << 1) /* D/A converter (DAC) reset control bit */
+#define SYSCON_RSTCON1_RSTCANACC (1 << 2) /* CAN acceptance filter reset control bit */
+ /* Bits 3-31: Reserved */
+/* Delay Control Register - EMC */
+ /* Delay values multiplied by 250 picoseconds */
+#define SYSCON_EMCDLYCTL_CMDDLY_SHIFT (0) /* Bits 0-4: Delay value for EMC outputs in command delayed mode */
+#define SYSCON_EMCDLYCTL_CMDDLY_MASK (0x1f << SYSCON_EMCDLYCTL_CMDDLY_SHIFT)
+# define SYSCON_EMCDLYCTL_CMDDLY(n) ((n-1) << SYSCON_EMCDLYCTL_CMDDLY_SHIFT) /* n = 3 - 32 */
+ /* Bits 5-7: Reserved */
+#define SYSCON_EMCDLYCTL_FBCLKDLY_SHIFT (8) /* Bits 8-12: Delay value for the feedback clock that controls input data sampling */
+#define SYSCON_EMCDLYCTL_FBCLKDLY_MASK (0x1f << SYSCON_EMCDLYCTL_FBCLKDLY_SHIFT)
+#define SYSCON_EMCDLYCTL_FBCLKDLY(n) ((n-1)<< SYSCON_EMCDLYCTL_FBCLKDLY_SHIFT) /* n = 3 - 32 */
+ /* Bits 13-15: Reserved */
+#define SYSCON_EMCDLYCTL_CLKOUT0DLY_SHIFT (16) /* Bits 16-20: Delay value for the CLKOUT0 output */
+#define SYSCON_EMCDLYCTL_CLKOUT0DLY_MASK (0x1f << SYSCON_EMCDLYCTL_CLKOUT0DLY_SHIFT)
+# define SYSCON_EMCDLYCTL_CLKOUT0DLY(n) ((n-1) << SYSCON_EMCDLYCTL_CLKOUT0DLY_SHIFT) /* n = 3 - 32 */
+ /* Bits 21-23: Reserved */
+#define SYSCON_EMCDLYCTL_CLKOUT1DLY_SHIFT (24) /* Bits 24-28: Delay value for the CLKOUT1 output */
+#define SYSCON_EMCDLYCTL_CLKOUT1DLY_MASK (0x1f << SYSCON_EMCDLYCTL_CLKOUT1DLY_SHIFT)
+# define SYSCON_EMCDLYCTL_CLKOUT1DLY(n) ((n-1) << SYSCON_EMCDLYCTL_CLKOUT1DLY_SHIFT) /* n = 3 - 32 */
+ /* Bits 29-31: Reserved */
+/* Calibration Register - EMC */
+
+#define SYSCON_EMCCAL_CALVALUE_SHIFT (0) /* Bits 0-7: Ring oscillator count during 32 clocks of Internal RC */
+#define SYSCON_EMCCAL_CALVALUE_MASK (0xff << SYSCON_EMCCAL_CALVALUE_SHIFT)
+ /* Bits 8-13: Reserved */
+#define SYSCON_EMCCAL_START_SHIFT (14) /* Bit 14: Start control bit for EMC calibration counter */
+#define SYSCON_EMCCAL_START_MASK (1 << SYSCON_EMCCAL_START_SHIFT)
+# define SYSCON_EMCCAL_START (1) /* Automatically cleared when measurement is done */
+#define SYSCON_EMCCAL_DONE_SHIFT (15) /* Bit 15: Measurement completetion flag bit */
+#define SYSCON_EMCCAL_DONE_MASK (1 << SYSCON_EMCCAL_DONE_SHIFT)
+ /* Automatically cleared when START bit is set */
+ /* Bits 16-31: Reserved */
+
+/* Compatibility Definitions ************************************************************************/
+/* Need in lpc17_40_clockconfig.h for compatibility with the LPC176x family: */
+
+#define SYSCON_PLLCON_PLLC (0) /* Bit does not exist in LPC178x/40xx family */
+#define SYSCON_PLL0STAT_PLLE SYSCON_PLLSTAT_PLLE /* PLL enable readback */
+#define SYSCON_PLL0STAT_PLLC SYSCON_PLLSTAT_PLLC /* PLL connect readback */
+#define SYSCON_PLL0STAT_PLOCK SYSCON_PLLSTAT_PLOCK /* PLL lock status */
+#define SYSCON_PLL1STAT_PLLE SYSCON_PLLSTAT_PLLE /* PLL enable readback */
+#define SYSCON_PLL1STAT_PLLC SYSCON_PLLSTAT_PLLC /* PLL connect readback */
+#define SYSCON_PLL1STAT_PLOCK SYSCON_PLLSTAT_PLOCK /* PLL lock status */
+
+/****************************************************************************************************
+ * Public Types
+ ****************************************************************************************************/
+
+/****************************************************************************************************
+ * Public Data
+ ****************************************************************************************************/
+
+/****************************************************************************************************
+ * Public Functions
+ ****************************************************************************************************/
+
+#endif /* __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC178X_SYSCON_H */
diff --git a/arch/arm/src/lpc17xx/hardware/lpc17_adc.h b/arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_adc.h
similarity index 77%
rename from arch/arm/src/lpc17xx/hardware/lpc17_adc.h
rename to arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_adc.h
index fc6fb80b000..7b46983dadd 100644
--- a/arch/arm/src/lpc17xx/hardware/lpc17_adc.h
+++ b/arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_adc.h
@@ -1,5 +1,5 @@
/************************************************************************************
- * arch/arm/src/lpc17xx/hardware/lpc17_adc.h
+ * arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_adc.h
*
* Copyright (C) 2010, 2012, 2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt
@@ -33,8 +33,8 @@
*
************************************************************************************/
-#ifndef __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC17_CHIP_ADC_H
-#define __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC17_CHIP_ADC_H
+#ifndef __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC17_40_CHIP_ADC_H
+#define __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC17_40_CHIP_ADC_H
/************************************************************************************
* Included Files
@@ -43,7 +43,7 @@
#include
#include "chip.h"
-#include "hardware/lpc17_memorymap.h"
+#include "hardware/lpc17_40_memorymap.h"
/************************************************************************************
* Pre-processor Definitions
@@ -51,41 +51,41 @@
/* Register offsets *****************************************************************/
-#define LPC17_ADC_CR_OFFSET 0x0000 /* A/D Control Register */
-#define LPC17_ADC_GDR_OFFSET 0x0004 /* A/D Global Data Register */
-#define LPC17_ADC_INTEN_OFFSET 0x000c /* A/D Interrupt Enable Register */
+#define LPC17_40_ADC_CR_OFFSET 0x0000 /* A/D Control Register */
+#define LPC17_40_ADC_GDR_OFFSET 0x0004 /* A/D Global Data Register */
+#define LPC17_40_ADC_INTEN_OFFSET 0x000c /* A/D Interrupt Enable Register */
-#define LPC17_ADC_DR_OFFSET(n) (0x0010+((n) << 2))
-#define LPC17_ADC_DR0_OFFSET 0x0010 /* A/D Channel 0 Data Register */
-#define LPC17_ADC_DR1_OFFSET 0x0014 /* A/D Channel 1 Data Register */
-#define LPC17_ADC_DR2_OFFSET 0x0018 /* A/D Channel 2 Data Register */
-#define LPC17_ADC_DR3_OFFSET 0x001c /* A/D Channel 3 Data Register */
-#define LPC17_ADC_DR4_OFFSET 0x0020 /* A/D Channel 4 Data Register */
-#define LPC17_ADC_DR5_OFFSET 0x0024 /* A/D Channel 5 Data Register */
-#define LPC17_ADC_DR6_OFFSET 0x0028 /* A/D Channel 6 Data Register */
-#define LPC17_ADC_DR7_OFFSET 0x002c /* A/D Channel 7 Data Register */
+#define LPC17_40_ADC_DR_OFFSET(n) (0x0010+((n) << 2))
+#define LPC17_40_ADC_DR0_OFFSET 0x0010 /* A/D Channel 0 Data Register */
+#define LPC17_40_ADC_DR1_OFFSET 0x0014 /* A/D Channel 1 Data Register */
+#define LPC17_40_ADC_DR2_OFFSET 0x0018 /* A/D Channel 2 Data Register */
+#define LPC17_40_ADC_DR3_OFFSET 0x001c /* A/D Channel 3 Data Register */
+#define LPC17_40_ADC_DR4_OFFSET 0x0020 /* A/D Channel 4 Data Register */
+#define LPC17_40_ADC_DR5_OFFSET 0x0024 /* A/D Channel 5 Data Register */
+#define LPC17_40_ADC_DR6_OFFSET 0x0028 /* A/D Channel 6 Data Register */
+#define LPC17_40_ADC_DR7_OFFSET 0x002c /* A/D Channel 7 Data Register */
-#define LPC17_ADC_STAT_OFFSET 0x0030 /* A/D Status Register */
-#define LPC17_ADC_TRM_OFFSET 0x0034 /* ADC trim register */
+#define LPC17_40_ADC_STAT_OFFSET 0x0030 /* A/D Status Register */
+#define LPC17_40_ADC_TRM_OFFSET 0x0034 /* ADC trim register */
/* Register addresses ***************************************************************/
-#define LPC17_ADC_CR (LPC17_ADC_BASE+LPC17_ADC_CR_OFFSET)
-#define LPC17_ADC_GDR (LPC17_ADC_BASE+LPC17_ADC_GDR_OFFSET)
-#define LPC17_ADC_INTEN (LPC17_ADC_BASE+LPC17_ADC_INTEN_OFFSET)
+#define LPC17_40_ADC_CR (LPC17_40_ADC_BASE+LPC17_40_ADC_CR_OFFSET)
+#define LPC17_40_ADC_GDR (LPC17_40_ADC_BASE+LPC17_40_ADC_GDR_OFFSET)
+#define LPC17_40_ADC_INTEN (LPC17_40_ADC_BASE+LPC17_40_ADC_INTEN_OFFSET)
-#define LPC17_ADC_DR(n) (LPC17_ADC_BASE+LPC17_ADC_DR_OFFSET(n))
-#define LPC17_ADC_DR0 (LPC17_ADC_BASE+LPC17_ADC_DR0_OFFSET)
-#define LPC17_ADC_DR1 (LPC17_ADC_BASE+LPC17_ADC_DR1_OFFSET)
-#define LPC17_ADC_DR2 (LPC17_ADC_BASE+LPC17_ADC_DR2_OFFSET)
-#define LPC17_ADC_DR3 (LPC17_ADC_BASE+LPC17_ADC_DR3_OFFSET)
-#define LPC17_ADC_DR4 (LPC17_ADC_BASE+LPC17_ADC_DR4_OFFSET)
-#define LPC17_ADC_DR5 (LPC17_ADC_BASE+LPC17_ADC_DR5_OFFSET)
-#define LPC17_ADC_DR6 (LPC17_ADC_BASE+LPC17_ADC_DR6_OFFSET)
-#define LPC17_ADC_DR7 (LPC17_ADC_BASE+LPC17_ADC_DR7_OFFSET)
+#define LPC17_40_ADC_DR(n) (LPC17_40_ADC_BASE+LPC17_40_ADC_DR_OFFSET(n))
+#define LPC17_40_ADC_DR0 (LPC17_40_ADC_BASE+LPC17_40_ADC_DR0_OFFSET)
+#define LPC17_40_ADC_DR1 (LPC17_40_ADC_BASE+LPC17_40_ADC_DR1_OFFSET)
+#define LPC17_40_ADC_DR2 (LPC17_40_ADC_BASE+LPC17_40_ADC_DR2_OFFSET)
+#define LPC17_40_ADC_DR3 (LPC17_40_ADC_BASE+LPC17_40_ADC_DR3_OFFSET)
+#define LPC17_40_ADC_DR4 (LPC17_40_ADC_BASE+LPC17_40_ADC_DR4_OFFSET)
+#define LPC17_40_ADC_DR5 (LPC17_40_ADC_BASE+LPC17_40_ADC_DR5_OFFSET)
+#define LPC17_40_ADC_DR6 (LPC17_40_ADC_BASE+LPC17_40_ADC_DR6_OFFSET)
+#define LPC17_40_ADC_DR7 (LPC17_40_ADC_BASE+LPC17_40_ADC_DR7_OFFSET)
-#define LPC17_ADC_STAT (LPC17_ADC_BASE+LPC17_ADC_STAT_OFFSET)
-#define LPC17_ADC_TRM (LPC17_ADC_BASE+LPC17_ADC_TRM_OFFSET)
+#define LPC17_40_ADC_STAT (LPC17_40_ADC_BASE+LPC17_40_ADC_STAT_OFFSET)
+#define LPC17_40_ADC_TRM (LPC17_40_ADC_BASE+LPC17_40_ADC_TRM_OFFSET)
/* Register bit definitions *********************************************************/
@@ -177,4 +177,4 @@
* Public Functions
************************************************************************************/
-#endif /* __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC17_CHIP_ADC_H */
+#endif /* __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC17_40_CHIP_ADC_H */
diff --git a/arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_can.h b/arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_can.h
new file mode 100644
index 00000000000..0195e1ac204
--- /dev/null
+++ b/arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_can.h
@@ -0,0 +1,510 @@
+/************************************************************************************
+ * arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_can.h
+ *
+ * Copyright (C) 2010-2012, 2013 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ * 3. Neither the name NuttX 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 THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#ifndef __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC17_40_CHIP_CAN_H
+#define __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC17_40_CHIP_CAN_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include
+
+#include "chip.h"
+#include "hardware/lpc17_40_memorymap.h"
+
+/************************************************************************************
+ * Pre-processor Definitions
+ ************************************************************************************/
+
+/* Register offsets *****************************************************************/
+/* CAN acceptance filter registers */
+
+#define LPC17_40_CANAF_AFMR_OFFSET 0x0000 /* Acceptance Filter Register */
+#define LPC17_40_CANAF_SFFSA_OFFSET 0x0004 /* Standard Frame Individual Start Address Register */
+#define LPC17_40_CANAF_SFFGRPSA_OFFSET 0x0008 /* Standard Frame Group Start Address Register */
+#define LPC17_40_CANAF_EFFSA_OFFSET 0x000c /* Extended Frame Start Address Register */
+#define LPC17_40_CANAF_EFFGRPSA_OFFSET 0x0010 /* Extended Frame Group Start Address Register */
+#define LPC17_40_CANAF_EOT_OFFSET 0x0014 /* End of AF Tables register */
+#define LPC17_40_CANAF_LUTERRAD_OFFSET 0x0018 /* LUT Error Address register */
+#define LPC17_40_CANAF_LUTERR_OFFSET 0x001c /* LUT Error Register */
+#define LPC17_40_CANAF_FCANIE_OFFSET 0x0020 /* FullCAN interrupt enable register */
+#define LPC17_40_CANAF_FCANIC0_OFFSET 0x0024 /* FullCAN interrupt and capture register 0 */
+#define LPC17_40_CANAF_FCANIC1_OFFSET 0x0028 /* FullCAN interrupt and capture register 1 */
+
+/* Central CAN registers */
+
+#define LPC17_40_CAN_TXSR_OFFSET 0x0000 /* CAN Central Transmit Status Register */
+#define LPC17_40_CAN_RXSR_OFFSET 0x0004 /* CAN Central Receive Status Register */
+#define LPC17_40_CAN_MSR_OFFSET 0x0008 /* CAN Central Miscellaneous Register */
+
+/* CAN1/2 registers */
+
+#define LPC17_40_CAN_MOD_OFFSET 0x0000 /* CAN operating mode */
+#define LPC17_40_CAN_CMR_OFFSET 0x0004 /* Command bits */
+#define LPC17_40_CAN_GSR_OFFSET 0x0008 /* Controller Status and Error Counters */
+#define LPC17_40_CAN_ICR_OFFSET 0x000c /* Interrupt and capure register */
+#define LPC17_40_CAN_IER_OFFSET 0x0010 /* Interrupt Enable */
+#define LPC17_40_CAN_BTR_OFFSET 0x0014 /* Bus Timing */
+#define LPC17_40_CAN_EWL_OFFSET 0x0018 /* Error Warning Limit */
+#define LPC17_40_CAN_SR_OFFSET 0x001c /* Status Register */
+#define LPC17_40_CAN_RFS_OFFSET 0x0020 /* Receive frame status */
+#define LPC17_40_CAN_RID_OFFSET 0x0024 /* Received Identifier */
+#define LPC17_40_CAN_RDA_OFFSET 0x0028 /* Received data bytes 1-4 */
+#define LPC17_40_CAN_RDB_OFFSET 0x002c /* Received data bytes 5-8 */
+#define LPC17_40_CAN_TFI1_OFFSET 0x0030 /* Transmit frame info (Tx Buffer 1) */
+#define LPC17_40_CAN_TID1_OFFSET 0x0034 /* Transmit Identifier (Tx Buffer 1) */
+#define LPC17_40_CAN_TDA1_OFFSET 0x0038 /* Transmit data bytes 1-4 (Tx Buffer 1) */
+#define LPC17_40_CAN_TDB1_OFFSET 0x003c /* Transmit data bytes 5-8 (Tx Buffer 1) */
+#define LPC17_40_CAN_TFI2_OFFSET 0x0040 /* Transmit frame info (Tx Buffer 2) */
+#define LPC17_40_CAN_TID2_OFFSET 0x0044 /* Transmit Identifier (Tx Buffer 2) */
+#define LPC17_40_CAN_TDA2_OFFSET 0x0048 /* Transmit data bytes 1-4 (Tx Buffer 2) */
+#define LPC17_40_CAN_TDB2_OFFSET 0x004c /* Transmit data bytes 5-8 (Tx Buffer 2) */
+#define LPC17_40_CAN_TFI3_OFFSET 0x0050 /* Transmit frame info (Tx Buffer 3) */
+#define LPC17_40_CAN_TID3_OFFSET 0x0054 /* Transmit Identifier (Tx Buffer 3) */
+#define LPC17_40_CAN_TDA3_OFFSET 0x0058 /* Transmit data bytes 1-4 (Tx Buffer 3) */
+#define LPC17_40_CAN_TDB3_OFFSET 0x005c /* Transmit data bytes 5-8 (Tx Buffer 3) */
+
+/* Register addresses ***************************************************************/
+/* CAN acceptance filter registers */
+
+#define LPC17_40_CANAF_AFMR (LPC17_40_CANAF_BASE+LPC17_40_CANAF_AFMR_OFFSET)
+#define LPC17_40_CANAF_SFFSA (LPC17_40_CANAF_BASE+LPC17_40_CANAF_SFFSA_OFFSET)
+#define LPC17_40_CANAF_SFFGRPSA (LPC17_40_CANAF_BASE+LPC17_40_CANAF_SFFGRPSA_OFFSET)
+#define LPC17_40_CANAF_EFFSA (LPC17_40_CANAF_BASE+LPC17_40_CANAF_EFFSA_OFFSET)
+#define LPC17_40_CANAF_EFFGRPSA (LPC17_40_CANAF_BASE+LPC17_40_CANAF_EFFGRPSA_OFFSET)
+#define LPC17_40_CANAF_EOT (LPC17_40_CANAF_BASE+LPC17_40_CANAF_EOT_OFFSET)
+#define LPC17_40_CANAF_LUTERRAD (LPC17_40_CANAF_BASE+LPC17_40_CANAF_LUTERRAD_OFFSET)
+#define LPC17_40_CANAF_LUTERR (LPC17_40_CANAF_BASE+LPC17_40_CANAF_LUTERR_OFFSET)
+#define LPC17_40_CANAF_FCANIE (LPC17_40_CANAF_BASE+LPC17_40_CANAF_FCANIE_OFFSET)
+#define LPC17_40_CANAF_FCANIC0 (LPC17_40_CANAF_BASE+LPC17_40_CANAF_FCANIC0_OFFSET)
+#define LPC17_40_CANAF_FCANIC1 (LPC17_40_CANAF_BASE+LPC17_40_CANAF_FCANIC1_OFFSET)
+
+/* Central CAN registers */
+
+#define LPC17_40_CAN_TXSR (LPC17_40_CAN_BASE+LPC17_40_CAN_TXSR_OFFSET)
+#define LPC17_40_CAN_RXSR (LPC17_40_CAN_BASE+LPC17_40_CAN_RXSR_OFFSET)
+#define LPC17_40_CAN_MSR (LPC17_40_CAN_BASE+LPC17_40_CAN_MSR_OFFSET)
+
+/* CAN1/2 registers */
+
+#define LPC17_40_CAN1_MOD (LPC17_40_CAN1_BASE+LPC17_40_CAN_MOD_OFFSET)
+#define LPC17_40_CAN1_CMR (LPC17_40_CAN1_BASE+LPC17_40_CAN_CMR_OFFSET)
+#define LPC17_40_CAN1_GSR (LPC17_40_CAN1_BASE+LPC17_40_CAN_GSR_OFFSET)
+#define LPC17_40_CAN1_ICR (LPC17_40_CAN1_BASE+LPC17_40_CAN_ICR_OFFSET)
+#define LPC17_40_CAN1_IER (LPC17_40_CAN1_BASE+LPC17_40_CAN_IER_OFFSET)
+#define LPC17_40_CAN1_BTR (LPC17_40_CAN1_BASE+LPC17_40_CAN_BTR_OFFSET)
+#define LPC17_40_CAN1_EWL (LPC17_40_CAN1_BASE+LPC17_40_CAN_EWL_OFFSET)
+#define LPC17_40_CAN1_SR (LPC17_40_CAN1_BASE+LPC17_40_CAN_SR_OFFSET)
+#define LPC17_40_CAN1_RFS (LPC17_40_CAN1_BASE+LPC17_40_CAN_RFS_OFFSET)
+#define LPC17_40_CAN1_RID (LPC17_40_CAN1_BASE+LPC17_40_CAN_RID_OFFSET)
+#define LPC17_40_CAN1_RDA (LPC17_40_CAN1_BASE+LPC17_40_CAN_RDA_OFFSET)
+#define LPC17_40_CAN1_RDB (LPC17_40_CAN1_BASE+LPC17_40_CAN_RDB_OFFSET)
+#define LPC17_40_CAN1_TFI1 (LPC17_40_CAN1_BASE+LPC17_40_CAN_TFI1_OFFSET)
+#define LPC17_40_CAN1_TID1 (LPC17_40_CAN1_BASE+LPC17_40_CAN_TID1_OFFSET)
+#define LPC17_40_CAN1_TDA1 (LPC17_40_CAN1_BASE+LPC17_40_CAN_TDA1_OFFSET)
+#define LPC17_40_CAN1_TDB1 (LPC17_40_CAN1_BASE+LPC17_40_CAN_TDB1_OFFSET)
+#define LPC17_40_CAN1_TFI2 (LPC17_40_CAN1_BASE+LPC17_40_CAN_TFI2_OFFSET)
+#define LPC17_40_CAN1_TID2 (LPC17_40_CAN1_BASE+LPC17_40_CAN_TID2_OFFSET)
+#define LPC17_40_CAN1_TDA2 (LPC17_40_CAN1_BASE+LPC17_40_CAN_TDA2_OFFSET)
+#define LPC17_40_CAN1_TDB2 (LPC17_40_CAN1_BASE+LPC17_40_CAN_TDB2_OFFSET)
+#define LPC17_40_CAN1_TFI3 (LPC17_40_CAN1_BASE+LPC17_40_CAN_TFI3_OFFSET)
+#define LPC17_40_CAN1_TID3 (LPC17_40_CAN1_BASE+LPC17_40_CAN_TID3_OFFSET)
+#define LPC17_40_CAN1_TDA3 (LPC17_40_CAN1_BASE+LPC17_40_CAN_TDA3_OFFSET)
+#define LPC17_40_CAN1_TDB3 (LPC17_40_CAN1_BASE+LPC17_40_CAN_TDB3_OFFSET)
+
+#define LPC17_40_CAN2_MOD (LPC17_40_CAN2_BASE+LPC17_40_CAN_MOD_OFFSET)
+#define LPC17_40_CAN2_CMR (LPC17_40_CAN2_BASE+LPC17_40_CAN_CMR_OFFSET)
+#define LPC17_40_CAN2_GSR (LPC17_40_CAN2_BASE+LPC17_40_CAN_GSR_OFFSET)
+#define LPC17_40_CAN2_ICR (LPC17_40_CAN2_BASE+LPC17_40_CAN_ICR_OFFSET)
+#define LPC17_40_CAN2_IER (LPC17_40_CAN2_BASE+LPC17_40_CAN_IER_OFFSET)
+#define LPC17_40_CAN2_BTR (LPC17_40_CAN2_BASE+LPC17_40_CAN_BTR_OFFSET)
+#define LPC17_40_CAN2_EWL (LPC17_40_CAN2_BASE+LPC17_40_CAN_EWL_OFFSET)
+#define LPC17_40_CAN2_SR (LPC17_40_CAN2_BASE+LPC17_40_CAN_SR_OFFSET)
+#define LPC17_40_CAN2_RFS (LPC17_40_CAN2_BASE+LPC17_40_CAN_RFS_OFFSET)
+#define LPC17_40_CAN2_RID (LPC17_40_CAN2_BASE+LPC17_40_CAN_RID_OFFSET)
+#define LPC17_40_CAN2_RDA (LPC17_40_CAN2_BASE+LPC17_40_CAN_RDA_OFFSET)
+#define LPC17_40_CAN2_RDB (LPC17_40_CAN2_BASE+LPC17_40_CAN_RDB_OFFSET)
+#define LPC17_40_CAN2_TFI1 (LPC17_40_CAN2_BASE+LPC17_40_CAN_TFI1_OFFSET)
+#define LPC17_40_CAN2_TID1 (LPC17_40_CAN2_BASE+LPC17_40_CAN_TID1_OFFSET)
+#define LPC17_40_CAN2_TDA1 (LPC17_40_CAN2_BASE+LPC17_40_CAN_TDA1_OFFSET)
+#define LPC17_40_CAN2_TDB1 (LPC17_40_CAN2_BASE+LPC17_40_CAN_TDB1_OFFSET)
+#define LPC17_40_CAN2_TFI2 (LPC17_40_CAN2_BASE+LPC17_40_CAN_TFI2_OFFSET)
+#define LPC17_40_CAN2_TID2 (LPC17_40_CAN2_BASE+LPC17_40_CAN_TID2_OFFSET)
+#define LPC17_40_CAN2_TDA2 (LPC17_40_CAN2_BASE+LPC17_40_CAN_TDA2_OFFSET)
+#define LPC17_40_CAN2_TDB2 (LPC17_40_CAN2_BASE+LPC17_40_CAN_TDB2_OFFSET)
+#define LPC17_40_CAN2_TFI3 (LPC17_40_CAN2_BASE+LPC17_40_CAN_TFI3_OFFSET)
+#define LPC17_40_CAN2_TID3 (LPC17_40_CAN2_BASE+LPC17_40_CAN_TID3_OFFSET)
+#define LPC17_40_CAN2_TDA3 (LPC17_40_CAN2_BASE+LPC17_40_CAN_TDA3_OFFSET)
+#define LPC17_40_CAN2_TDB3 (LPC17_40_CAN2_BASE+LPC17_40_CAN_TDB3_OFFSET)
+
+/* Register bit definitions *********************************************************/
+/* CAN acceptance filter registers */
+/* Acceptance Filter Register */
+
+#define CANAF_AFMR_ACCOFF (1 << 0) /* Bit 0: AF non-operational; All RX messages ignored */
+#define CANAF_AFMR_ACCBP (1 << 1) /* Bit 1: AF bypass: All RX messages accepted */
+#define CANAF_AFMR_EFCAN (1 << 2) /* Bit 2: Enable Full CAN mode */
+ /* Bits 3-31: Reserved */
+/* Standard Frame Individual Start Address Register */
+ /* Bits 0-1: Reserved */
+#define CANAF_SFFSA_SHIFT (2) /* Bits 2-10: Address of Standard Identifiers in AF Lookup RAM */
+#define CANAF_SFFSA_MASK (0x01ff << CANAF_SFFSA_SHIFT)
+ /* Bits 11-31: Reserved */
+/* Standard Frame Group Start Address Register */
+ /* Bits 0-1: Reserved */
+#define CANAF_SFFGRPSA_SHIFT (2) /* Bits 2-10: Address of grouped Standard Identifiers in AF Lookup RAM */
+#define CANAF_SFFGRPSA_MASK (0x01ff << CANAF_SFFGRPSA_SHIFT)
+ /* Bits 11-31: Reserved */
+/* Extended Frame Start Address Register */
+ /* Bits 0-1: Reserved */
+#define CANAF_EFFSA_SHIFT (2) /* Bits 2-10: Address of Extended Identifiers in AF Lookup RAM */
+#define CANAF_EFFSA_MASK (0x01ff << CANAF_EFFSA_SHIFT)
+ /* Bits 11-31: Reserved */
+/* Extended Frame Group Start Address Register */
+ /* Bits 0-1: Reserved */
+#define CANAF_EFFGRPSA_SHIFT (2) /* Bits 2-10: Address of grouped Extended Identifiers in AF Lookup RAM */
+#define CANAF_EFFGRPSA_MASK (0x01ff << CANAF_EFFGRPSA_SHIFT)
+ /* Bits 11-31: Reserved */
+/* End of AF Tables register */
+ /* Bits 0-1: Reserved */
+#define CANAF_EOT_SHIFT (2) /* Bits 2-10: Last active address in last active AF table */
+#define CANAF_EOT_MASK (0x01ff << CANAF_EOT_SHIFT)
+ /* Bits 11-31: Reserved */
+/* LUT Error Address register */
+ /* Bits 0-1: Reserved */
+#define CANAF_LUTERRAD_SHIFT (2) /* Bits 2-10: Address in AF Lookup RAM of error */
+#define CANAF_LUTERRAD_MASK (0x01ff << CANAF_EOT_SHIFT)
+ /* Bits 11-31: Reserved */
+/* LUT Error Register */
+
+#define CANAF_LUTERR_LUTERR (1 << 0) /* Bit 0: AF error in AF RAM tables */
+ /* Bits 1-31: Reserved */
+/* FullCAN interrupt enable register */
+
+#define CANAF_FCANIE_FCANIE (1 << 0) /* Bit 0: Global FullCAN Interrupt Enable */
+ /* Bits 1-31: Reserved */
+
+/* FullCAN interrupt and capture register 0 */
+
+#define CANAF_FCANIC0_INTPND(n) (1 << (n)) /* n=0,1,2,... 31 */
+
+/* FullCAN interrupt and capture register 1 */
+
+#define CANAF_FCANIC1_INTPND(n) (1 << ((n)-32)) /* n=32,33,...63 */
+
+/* Central CAN registers */
+/* CAN Central Transmit Status Register */
+
+#define CAN_TXSR_TS1 (1 << 0) /* Bit 0: CAN1 sending */
+#define CAN_TXSR_TS2 (1 << 1) /* Bit 1: CAN2 sending */
+ /* Bits 2-7: Reserved */
+#define CAN_TXSR_TBS1 (1 << 8) /* Bit 8: All 3 CAN1 TX buffers available */
+#define CAN_TXSR_TBS2 (1 << 9) /* Bit 9: All 3 CAN2 TX buffers available */
+ /* Bits 10-15: Reserved */
+#define CAN_TXSR_TCS1 (1 << 16) /* Bit 16: All CAN1 xmissions completed */
+#define CAN_TXSR_TCS2 (1 << 17) /* Bit 17: All CAN2 xmissions completed */
+ /* Bits 18-31: Reserved */
+/* CAN Central Receive Status Register */
+
+#define CAN_RXSR_RS1 (1 << 0) /* Bit 0: CAN1 receiving */
+#define CAN_RXSR_RS2 (1 << 1) /* Bit 1: CAN2 receiving */
+ /* Bits 2-7: Reserved */
+#define CAN_RXSR_RB1 (1 << 8) /* Bit 8: CAN1 received message available */
+#define CAN_RXSR_RB2 (1 << 9) /* Bit 9: CAN2 received message available */
+ /* Bits 10-15: Reserved */
+#define CAN_RXSR_DOS1 (1 << 16) /* Bit 16: All CAN1 message lost */
+#define CAN_RXSR_DOS2 (1 << 17) /* Bit 17: All CAN2 message lost */
+ /* Bits 18-31: Reserved */
+/* CAN Central Miscellaneous Register */
+
+#define CAN_MSR_E1 (1 << 0) /* Bit 0: CAN1 error counters at limit */
+#define CAN_MSR_E2 (1 << 1) /* Bit 1: CAN2 error counters at limit */
+ /* Bits 2-7: Reserved */
+#define CAN_MSR_BS1 (1 << 8) /* Bit 8: CAN1 busy */
+#define CAN_MSR_BS2 (1 << 9) /* Bit 7: CAN2 busy */
+ /* Bits 10-31: Reserved */
+/* CAN1/2 registers */
+/* CAN operating mode */
+
+#define CAN_MOD_RM (1 << 0) /* Bit 0: Reset Mode */
+#define CAN_MOD_LOM (1 << 1) /* Bit 1: Listen Only Mode */
+#define CAN_MOD_STM (1 << 2) /* Bit 2: Self Test Mode */
+#define CAN_MOD_TPM (1 << 3) /* Bit 3: Transmit Priority Mode */
+#define CAN_MOD_SM (1 << 4) /* Bit 4: Sleep Mode */
+#define CAN_MOD_RPM (1 << 5) /* Bit 5: Receive Polarity Mode */
+ /* Bit 6: Reserved */
+#define CAN_MOD_TM (1 << 7) /* Bit 7: Test Mode */
+ /* Bits 8-31: Reserved */
+/* Command bits */
+
+#define CAN_CMR_TR (1 << 0) /* Bit 0: Transmission Request */
+#define CAN_CMR_AT (1 << 1) /* Bit 1: Abort Transmission */
+#define CAN_CMR_RRB (1 << 2) /* Bit 2: Release Receive Buffer */
+#define CAN_CMR_CDO (1 << 3) /* Bit 3: Clear Data Overrun */
+#define CAN_CMR_SRR (1 << 4) /* Bit 4: Self Reception Request */
+#define CAN_CMR_STB1 (1 << 5) /* Bit 5: Select Tx Buffer 1 */
+#define CAN_CMR_STB2 (1 << 6) /* Bit 6: Select Tx Buffer 2 */
+#define CAN_CMR_STB3 (1 << 7) /* Bit 7: Select Tx Buffer 3 */
+ /* Bits 8-31: Reserved */
+/* Controller Status and Error Counters */
+
+#define CAN_GSR_RBS (1 << 0) /* Bit 0: Receive Buffer Status */
+#define CAN_GSR_DOS (1 << 1) /* Bit 1: Data Overrun Status */
+#define CAN_GSR_TBS (1 << 2) /* Bit 2: Transmit Buffer Status */
+#define CAN_GSR_TCS (1 << 3) /* Bit 3: Transmit Complete Status */
+#define CAN_GSR_RS (1 << 4) /* Bit 4: Receive Status */
+#define CAN_GSR_TS (1 << 5) /* Bit 5: Transmit Status */
+#define CAN_GSR_ES (1 << 6) /* Bit 6: Error Status */
+#define CAN_GSR_BS (1 << 7) /* Bit 7: Bus Status */
+ /* Bits 8-15: Reserved */
+#define CAN_GSR_RXERR_SHIFT (16) /* Bits 16-23: Rx Error Counter */
+#define CAN_GSR_RXERR_MASK (0xff << CAN_GSR_RXERR_SHIFT)
+#define CAN_GSR_TXERR_SHIFT (24) /* Bits 24-31: Tx Error Counter */
+#define CAN_GSR_TXERR_MASK (0xff << CAN_GSR_TXERR_SHIFT)
+
+/* Interrupt and capture register */
+
+#define CAN_ICR_RI (1 << 0) /* Bit 0: Receive Interrupt */
+#define CAN_ICR_TI1 (1 << 1) /* Bit 1: Transmit Interrupt 1 */
+#define CAN_ICR_EI (1 << 2) /* Bit 2: Error Warning Interrupt */
+#define CAN_ICR_DOI (1 << 3) /* Bit 3: Data Overrun Interrupt */
+#define CAN_ICR_WUI (1 << 4) /* Bit 4: Wake-Up Interrupt */
+#define CAN_ICR_EPI (1 << 5) /* Bit 5: Error Passive Interrupt */
+#define CAN_ICR_ALI (1 << 6) /* Bit 6: Arbitration Lost Interrupt */
+#define CAN_ICR_BEI (1 << 7) /* Bit 7: Bus Error Interrupt */
+#define CAN_ICR_IDI (1 << 8) /* Bit 8: ID Ready Interrupt */
+#define CAN_ICR_TI2 (1 << 9) /* Bit 9: Transmit Interrupt 2 */
+#define CAN_ICR_TI3 (1 << 10) /* Bit 10: Transmit Interrupt 3 */
+ /* Bits 11-15: Reserved */
+#define CAN_ICR_ERRBIT_SHIFT (16) /* Bits 16-20: Error Code Capture */
+#define CAN_ICR_ERRBIT_MASK (0x1f << CAN_ICR_ERRBIT_SHIFT)
+# define CAN_ICR_ERRBIT_SOF (3 << CAN_ICR_ERRBIT_SHIFT) /* Start of Frame */
+# define CAN_ICR_ERRBIT_ID28 (2 << CAN_ICR_ERRBIT_SHIFT) /* ID28 ... ID21 */
+# define CAN_ICR_ERRBIT_SRTR (4 << CAN_ICR_ERRBIT_SHIFT) /* SRTR Bit */
+# define CAN_ICR_ERRBIT_IDE (5 << CAN_ICR_ERRBIT_SHIFT) /* DE bit */
+# define CAN_ICR_ERRBIT_ID20 (6 << CAN_ICR_ERRBIT_SHIFT) /* ID20 ... ID18 */
+# define CAN_ICR_ERRBIT_ID17 (7 << CAN_ICR_ERRBIT_SHIFT) /* ID17 ... 13 */
+# define CAN_ICR_ERRBIT_CRC (8 << CAN_ICR_ERRBIT_SHIFT) /* CRC Sequence */
+# define CAN_ICR_ERRBIT_DATA (10 << CAN_ICR_ERRBIT_SHIFT) /* Data Field */
+# define CAN_ICR_ERRBIT_LEN (11 << CAN_ICR_ERRBIT_SHIFT) /* Data Length Code */
+# define CAN_ICR_ERRBIT_ RTR (12 << CAN_ICR_ERRBIT_SHIFT) /* RTR Bit */
+# define CAN_ICR_ERRBIT_ID4 (14 << CAN_ICR_ERRBIT_SHIFT) /* ID4 ... ID0 */
+# define CAN_ICR_ERRBIT_ID12 (15 << CAN_ICR_ERRBIT_SHIFT) /* ID12 ... ID5 */
+# define CAN_ICR_ERRBIT_AERR (17 << CAN_ICR_ERRBIT_SHIFT) /* Active Error Flag */
+# define CAN_ICR_ERRBIT_INTERMSN (18 << CAN_ICR_ERRBIT_SHIFT) /* Intermission */
+# define CAN_ICR_ERRBIT_DOM (19 << CAN_ICR_ERRBIT_SHIFT) /* Tolerate Dominant Bits */
+# define CAN_ICR_ERRBIT_PERR (22 << CAN_ICR_ERRBIT_SHIFT) /* Passive Error Flag */
+# define CAN_ICR_ERRBIT_ERRDLM (23 << CAN_ICR_ERRBIT_SHIFT) /* Error Delimiter */
+# define CAN_ICR_ERRBIT_CRCDLM (24 << CAN_ICR_ERRBIT_SHIFT) /* CRC Delimiter */
+# define CAN_ICR_ERRBIT_ACKSLT (25 << CAN_ICR_ERRBIT_SHIFT) /* Acknowledge Slot */
+# define CAN_ICR_ERRBIT_EOF (26 << CAN_ICR_ERRBIT_SHIFT) /* End of Frame */
+# define CAN_ICR_ERRBIT_ACKDLM (27 << CAN_ICR_ERRBIT_SHIFT) /* Acknowledge Delimiter */
+# define CAN_ICR_ERRBIT_OVLD (28 << CAN_ICR_ERRBIT_SHIFT) /* Overload flag */
+#define CAN_ICR_ERRDIR (1 << 21) /* Bit 21: Direction bit at time of error */
+#define CAN_ICR_ERRC_SHIFT (22) /* Bits 22-23: Type of error */
+#define CAN_ICR_ERRC_MASK (3 << CAN_ICR_ERRC_SHIFT)
+# define CAN_ICR_ERRC_BIT (0 << CAN_ICR_ERRC_SHIFT)
+# define CAN_ICR_ERRC_FORM (1 << CAN_ICR_ERRC_SHIFT)
+# define CAN_ICR_ERRC_STUFF (2 << CAN_ICR_ERRC_SHIFT)
+# define CAN_ICR_ERRC_OTHER (3 << CAN_ICR_ERRC_SHIFT)
+#define CAN_ICR_ALCBIT_SHIFT (24) /* Bits 24-31: Bit number within frame */
+#define CAN_ICR_ALCBIT_MASK (0xff << CAN_ICR_ALCBIT_SHIFT)
+
+/* Interrupt Enable */
+
+#define CAN_IER_RIE (1 << 0) /* Bit 0: Receiver Interrupt Enable */
+#define CAN_IER_TIE1 (1 << 1) /* Bit 1: Transmit Interrupt Enable for Buffer1 */
+#define CAN_IER_EIE (1 << 2) /* Bit 2: Error Warning Interrupt Enable */
+#define CAN_IER_DOIE (1 << 3) /* Bit 3: Data Overrun Interrupt Enable */
+#define CAN_IER_WUIE (1 << 4) /* Bit 4: Wake-Up Interrupt Enable */
+#define CAN_IER_EPIE (1 << 5) /* Bit 5: Error Passive Interrupt Enable */
+#define CAN_IER_ALIE (1 << 6) /* Bit 6: Arbitration Lost Interrupt Enable */
+#define CAN_IER_BEIE (1 << 7) /* Bit 7: Bus Error Interrupt */
+#define CAN_IER_IDIE (1 << 8) /* Bit 8: ID Ready Interrupt Enable */
+#define CAN_IER_TIE2 (1 << 9) /* Bit 9: Transmit Interrupt Enable for Buffer2 */
+#define CAN_IER_TIE3 (1 << 10) /* Bit 10: Transmit Interrupt Enable for Buffer3 */
+ /* Bits 11-31: Reserved */
+/* Bus Timing */
+
+#define CAN_BTR_BRP_SHIFT (0) /* Bits 0-9: Baud Rate Prescaler */
+#define CAN_BTR_BRP_MASK (0x3ff << CAN_BTR_BRP_SHIFT)
+ /* Bits 10-13: Reserved */
+#define CAN_BTR_SJW_SHIFT (14) /* Bits 14-15: Synchronization Jump Width */
+#define CAN_BTR_SJW_MASK (3 << CAN_BTR_SJW_SHIFT)
+#define CAN_BTR_TSEG1_SHIFT (16) /* Bits 16-19: Sync to sample delay */
+#define CAN_BTR_TSEG1_MASK (15 << CAN_BTR_TSEG1_SHIFT)
+#define CAN_BTR_TSEG2_SHIFT (20) /* Bits 20-22: smaple to next delay */
+#define CAN_BTR_TSEG2_MASK (7 << CAN_BTR_TSEG2_SHIFT)
+#define CAN_BTR_SAM (1 << 23) /* Bit 23: Sampling */
+ /* Bits 24-31: Reserved */
+
+#define CAN_BTR_BRP_MAX (1024) /* Maximum BTR value (without decrement) */
+#define CAN_BTR_TSEG1_MAX (16) /* Maximum TSEG1 value (without decrement) */
+#define CAN_BTR_TSEG2_MAX (8) /* Maximum TSEG2 value (without decrement) */
+
+/* Error Warning Limit */
+
+#define CAN_EWL_SHIFT (0) /* Bits 0-7: Error warning limit */
+#define CAN_EWL_MASK (0xff << CAN_EWL_SHIFT)
+ /* Bits 8-31: Reserved */
+/* Status Register */
+
+#define CAN_SR_RBS1 (1 << 0) /* Bit 0: Receive Buffer Status */
+#define CAN_SR_DOS1 (1 << 1) /* Bit 1: Data Overrun Status */
+#define CAN_SR_TBS1 (1 << 2) /* Bit 2: Transmit Buffer Status 1 */
+#define CAN_SR_TCS1 (1 << 3) /* Bit 3: Transmission Complete Status */
+#define CAN_SR_RS1 (1 << 4) /* Bit 4: Receive Status */
+#define CAN_SR_TS1 (1 << 5) /* Bit 5: Transmit Status 1 */
+#define CAN_SR_ES1 (1 << 6) /* Bit 6: Error Status */
+#define CAN_SR_BS1 (1 << 7) /* Bit 7: Bus Status */
+#define CAN_SR_RBS2 (1 << 8) /* Bit 8: Receive Buffer Status */
+#define CAN_SR_DOS2 (1 << 9) /* Bit 9: Data Overrun Status */
+#define CAN_SR_TBS2 (1 << 10) /* Bit 10: Transmit Buffer Status 2 */
+#define CAN_SR_TCS2 (1 << 11) /* Bit 11: Transmission Complete Status */
+#define CAN_SR_RS2 (1 << 12) /* Bit 12: Receive Status */
+#define CAN_SR_TS2 (1 << 13) /* Bit 13: Transmit Status 2 */
+#define CAN_SR_ES2 (1 << 14) /* Bit 14: Error Status */
+#define CAN_SR_BS2 (1 << 15) /* Bit 15: Bus Status */
+#define CAN_SR_RBS3 (1 << 16) /* Bit 16: Receive Buffer Status */
+#define CAN_SR_DOS3 (1 << 17) /* Bit 17: Data Overrun Status */
+#define CAN_SR_TBS3 (1 << 18) /* Bit 18: Transmit Buffer Status 3 */
+#define CAN_SR_TCS3 (1 << 19) /* Bit 19: Transmission Complete Status */
+#define CAN_SR_RS3 (1 << 20) /* Bit 20: Receive Status */
+#define CAN_SR_TS3 (1 << 21) /* Bit 21: Transmit Status 3 */
+#define CAN_SR_ES3 (1 << 22) /* Bit 22: Error Status */
+#define CAN_SR_BS3 (1 << 23) /* Bit 23: Bus Status */
+ /* Bits 24-31: Reserved */
+/* Receive frame status */
+
+#define CAN_RFS_ID_SHIFT (0) /* Bits 0-9: ID Index */
+#define CAN_RFS_ID_MASK (0x03ff << CAN_RFS_ID_SHIFT)
+#define CAN_RFS_BP (1 << 10) /* Bit 10: Received in AF Bypass mode */
+ /* Bits 11-15: Reserved */
+#define CAN_RFS_DLC_SHIFT (16) /* Bits 16-19: Message Data Length Code (DLC) */
+#define CAN_RFS_DLC_MASK (15 << CAN_RFS_DLC_SHIFT)
+ /* Bits 20-29: Reserved */
+#define CAN_RFS_RTR (1 << 30) /* Bit 30: Message Remote Transmission Request */
+#define CAN_RFS_FF (1 << 31) /* Bit 31: Message 29-bit vs 11-bit ID */
+
+/* Received Identifier */
+
+#define CAN_RID_ID11_MASK (0x7ff) /* Bits 0-10: 11-bit Identifier (FF=0) */
+ /* Bits 11-31: Reserved */
+#define CAN_RID_ID29_MASK (0x1fffffff) /* Bits 0-28: 29-bit Identifiter (FF=1) */
+ /* Bits 29-31: Reserved */
+/* Received data bytes 1-4 */
+
+#define CAN_RDA_DATA1_SHIFT (0) /* Bits 0-7: If CANRFS >= 1 */
+#define CAN_RDA_DATA1_MASK (0x0ff << CAN_RDA_DATA1_SHIFT)
+#define CAN_RDA_DATA2_SHIFT (8) /* Bits 8-15: If CANRFS >= 2 */
+#define CAN_RDA_DATA2_MASK (0x0ff << CAN_RDA_DATA2_SHIFT)
+#define CAN_RDA_DATA3_SHIFT (16) /* Bits 16-23: If CANRFS >= 3 */
+#define CAN_RDA_DATA3_MASK (0x0ff << CAN_RDA_DATA3_SHIFT)
+#define CAN_RDA_DATA4_SHIFT (24) /* Bits 24-31: If CANRFS >= 4 */
+#define CAN_RDA_DATA4_MASK (0x0ff << CAN_RDA_DATA4_SHIFT)
+
+/* Received data bytes 5-8 */
+
+#define CAN_RDB_DATA5_SHIFT (0) /* Bits 0-7: If CANRFS >= 5 */
+#define CAN_RDB_DATA5_MASK (0x0ff << CAN_RDB_DATA5_SHIFT)
+#define CAN_RDB_DATA6_SHIFT (8) /* Bits 8-15: If CANRFS >= 6 */
+#define CAN_RDB_DATA6_MASK (0x0ff << CAN_RDB_DATA6_SHIFT)
+#define CAN_RDB_DATA7_SHIFT (16) /* Bits 16-23: If CANRFS >= 7 */
+#define CAN_RDB_DATA7_MASK (0x0ff << CAN_RDB_DATA7_SHIFT)
+#define CAN_RDB_DATA8_SHIFT (24) /* Bits 24-31: If CANRFS >= 8 */
+#define CAN_RDB_DATA8_MASK (0x0ff << CAN_RDB_DATA8_SHIFT)
+
+/* Transmit frame info (Tx Buffer 1), Transmit frame info (Tx Buffer 2), and
+ * Transmit frame info (Tx Buffer 3) common bit field definitions
+ */
+
+#define CAN_TFI_PRIO_SHIFT (0) /* Bits 0-7: TX buffer priority */
+#define CAN_TFI_PRIO_MASK (0xff << CAN_TFI_PRIO_SHIFT)
+ /* Bits 8-15: Reserved */
+#define CAN_TFI_DLC_SHIFT (16) /* Bits 16-19: TX Data Length Code */
+#define CAN_TFI_DLC_MASK (15 << CAN_TFI_DLC_SHIFT)
+ /* Bits 20-29: Reserved */
+#define CAN_TFI_RTR (1 << 30) /* Bit 30: TX RTR bit */
+#define CAN_TFI_FF (1 << 31) /* Bit 31: Message 29-bit vs 11-bit ID */
+
+/* Transmit Identifier (Tx Buffer 1), Transmit Identifier (Tx Buffer 2), and
+ * Transmit Identifier (Tx Buffer 3) common bit field definitions.
+ */
+
+#define CAN_TID_ID11_MASK (0x7ff) /* Bits 0-10: 11-bit Identifier (FF=0) */
+ /* Bits 11-31: Reserved */
+#define CAN_TID_ID29_MASK (0x1fffffff) /* Bits 0-28: 29-bit Identifiter (FF=1) */
+ /* Bits 29-31: Reserved */
+
+/* Transmit data bytes 1-4 (Tx Buffer 1), Transmit data bytes 1-4 (Tx Buffer 2), and
+ * Transmit data bytes 1-4 (Tx Buffer 3) common bit field definitions.
+ */
+
+#define CAN_TDA_DATA1_SHIFT (0) /* Bits 0-7: RTR=0 && DLC >= 1 */
+#define CAN_TDA_DATA1_MASK (0x0ff << CAN_TDA_DATA1_SHIFT)
+#define CAN_TDA_DATA2_SHIFT (8) /* Bits 8-15: RTR=0 && DLC >= 2 */
+#define CAN_TDA_DATA2_MASK (0x0ff << CAN_TDA_DATA2_SHIFT)
+#define CAN_TDA_DATA3_SHIFT (16) /* Bits 16-23: RTR=0 && DLC >= 3 */
+#define CAN_TDA_DATA3_MASK (0x0ff << CAN_TDA_DATA3_SHIFT)
+#define CAN_TDA_DATA4_SHIFT (24) /* Bits 24-31: RTR=0 && DLC >= 4 */
+#define CAN_TDA_DATA4_MASK (0x0ff << CAN_TDA_DATA4_SHIFT)
+
+/* Transmit data bytes 5-8 (Tx Buffer 1), Transmit data bytes 5-8 (Tx Buffer 2), and
+ * Transmit data bytes 5-8 (Tx Buffer 3) common bit field definitions.
+ */
+
+#define CAN_RDB_DATA5_SHIFT (0) /* Bits 0-7: RTR=0 && DLC >= 5 */
+#define CAN_RDB_DATA5_MASK (0x0ff << CAN_RDB_DATA5_SHIFT)
+#define CAN_RDB_DATA6_SHIFT (8) /* Bits 8-15: RTR=0 && DLC >= 6 */
+#define CAN_RDB_DATA6_MASK (0x0ff << CAN_RDB_DATA6_SHIFT)
+#define CAN_RDB_DATA7_SHIFT (16) /* Bits 16-23: RTR=0 && DLC >= 7 */
+#define CAN_RDB_DATA7_MASK (0x0ff << CAN_RDB_DATA7_SHIFT)
+#define CAN_RDB_DATA8_SHIFT (24) /* Bits 24-31: RTR=0 && DLC >= 8 */
+#define CAN_RDB_DATA8_MASK (0x0ff << CAN_RDB_DATA8_SHIFT)
+
+/************************************************************************************
+ * Public Types
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Data
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+#endif /* __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC17_40_CHIP_CAN_H */
diff --git a/arch/arm/src/lpc17xx/hardware/lpc17_dac.h b/arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_dac.h
similarity index 64%
rename from arch/arm/src/lpc17xx/hardware/lpc17_dac.h
rename to arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_dac.h
index 9e39c1e9825..8b46edb525f 100644
--- a/arch/arm/src/lpc17xx/hardware/lpc17_dac.h
+++ b/arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_dac.h
@@ -1,5 +1,5 @@
/************************************************************************************
- * arch/arm/src/lpc17xx/hardware/lpc17_dac.h
+ * arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_dac.h
*
* Copyright (C) 2010, 2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt
@@ -33,8 +33,8 @@
*
************************************************************************************/
-#ifndef __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC17_CHIP_DAC_H
-#define __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC17_CHIP_DAC_H
+#ifndef __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC17_40_CHIP_DAC_H
+#define __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC17_40_CHIP_DAC_H
/************************************************************************************
* Included Files
@@ -43,7 +43,7 @@
#include
#include "chip.h"
-#include "hardware/lpc17_memorymap.h"
+#include "hardware/lpc17_40_memorymap.h"
/************************************************************************************
* Pre-processor Definitions
@@ -51,36 +51,36 @@
/* Register offsets *****************************************************************/
-#define LPC17_DAC_CR_OFFSET 0x0000 /* D/A Converter Register */
-#define LPC17_DAC_CTRL_OFFSET 0x0004 /* DAC Control register */
-#define LPC17_DAC_CNTVAL_OFFSET 0x0008 /* DAC Counter Value register */
+#define LPC17_40_DAC_CR_OFFSET 0x0000 /* D/A Converter Register */
+#define LPC17_40_DAC_CTRL_OFFSET 0x0004 /* DAC Control register */
+#define LPC17_40_DAC_CNTVAL_OFFSET 0x0008 /* DAC Counter Value register */
/* Register addresses ***************************************************************/
-#define LPC17_DAC_CR (LPC17_DAC_BASE+LPC17_DAC_CR_OFFSET)
-#define LPC17_DAC_CTRL (LPC17_DAC_BASE+LPC17_DAC_CTRL_OFFSET)
-#define LPC17_DAC_CNTVAL (LPC17_DAC_BASE+LPC17_DAC_CNTVAL_OFFSET)
+#define LPC17_40_DAC_CR (LPC17_40_DAC_BASE+LPC17_40_DAC_CR_OFFSET)
+#define LPC17_40_DAC_CTRL (LPC17_40_DAC_BASE+LPC17_40_DAC_CTRL_OFFSET)
+#define LPC17_40_DAC_CNTVAL (LPC17_40_DAC_BASE+LPC17_40_DAC_CNTVAL_OFFSET)
/* Register bit definitions *********************************************************/
/* D/A Converter Register */
- /* Bits 0-5: Reserved */
-#define DAC_CR_VALUE_SHIFT (6) /* Bits 6-15: Controls voltage on the AOUT pin */
-#define DAC_CR_VALUE_MASK (0x3ff << DAC_CR_VALUE_SHIFT)
-#define DAC_CR_BIAS (1 << 16) /* Bit 16: Controls DAC settling time */
- /* Bits 17-31: Reserved */
+ /* Bits 0-5: Reserved */
+#define DAC_CR_VALUE_SHIFT (6) /* Bits 6-15: Controls voltage on the AOUT pin */
+#define DAC_CR_VALUE_MASK (0x3ff << DAC_CR_VALUE_SHIFT)
+#define DAC_CR_BIAS (1 << 16) /* Bit 16: Controls DAC settling time */
+ /* Bits 17-31: Reserved */
/* DAC Control register */
-#define DAC_CTRL_INTDMAREQ (1 << 0) /* Bit 0: Timer timed out */
-#define DAC_CTRL_DBLBUFEN (1 << 1) /* Bit 1: Enable DACR double-buffering */
-#define DAC_CTRL_CNTEN (1 << 2) /* Bit 2: Enable timeout counter */
-#define DAC_CTRL_DMAEN (1 << 3) /* Bit 3: Enable DMA access */
- /* Bits 4-31: Reserved */
+#define DAC_CTRL_INTDMAREQ (1 << 0) /* Bit 0: Timer timed out */
+#define DAC_CTRL_DBLBUFEN (1 << 1) /* Bit 1: Enable DACR double-buffering */
+#define DAC_CTRL_CNTEN (1 << 2) /* Bit 2: Enable timeout counter */
+#define DAC_CTRL_DMAEN (1 << 3) /* Bit 3: Enable DMA access */
+ /* Bits 4-31: Reserved */
/* DAC Counter Value register */
-#define DAC_CNTVAL_SHIFT (0) /* Bits 0-15: Reload value for DAC interrupt/DMA timer */
-#define DAC_CNTVAL_MASK (0xffff << DAC_CNTVAL_SHIFT)
- /* Bits 8-31: Reserved */
+#define DAC_CNTVAL_SHIFT (0) /* Bits 0-15: Reload value for DAC interrupt/DMA timer */
+#define DAC_CNTVAL_MASK (0xffff << DAC_CNTVAL_SHIFT)
+ /* Bits 8-31: Reserved */
/************************************************************************************
* Public Types
@@ -94,4 +94,4 @@
* Public Functions
************************************************************************************/
-#endif /* __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC17_CHIP_DAC_H */
+#endif /* __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC17_40_CHIP_DAC_H */
diff --git a/arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_eeprom.h b/arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_eeprom.h
new file mode 100644
index 00000000000..b216ecdf1e4
--- /dev/null
+++ b/arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_eeprom.h
@@ -0,0 +1,186 @@
+/************************************************************************************
+ * arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_eeprom.h
+ *
+ * Copyright (C) 2013 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ * 3. Neither the name NuttX 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 THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#ifndef __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC17_40_EEPROM_H
+#define __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC17_40_EEPROM_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include
+
+#include "chip.h"
+#include "hardware/lpc17_40_memorymap.h"
+
+/************************************************************************************
+ * Pre-processor Definitions
+ ************************************************************************************/
+
+/* Register offsets *****************************************************************/
+
+#define LPC17_40_EEPROM_EECMD_OFFSET 0x0080 /* Command register */
+#define LPC17_40_EEPROM_EEADDR_OFFSET 0x0084 /* Address register */
+#define LPC17_40_EEPROM_EEWDATA_OFFSET 0x0088 /* Write Data register */
+#define LPC17_40_EEPROM_EERDATA_OFFSET 0x008c /* Read Data register */
+#define LPC17_40_EEPROM_EEWSTATE_OFFSET 0x0090 /* Wait state register */
+#define LPC17_40_EEPROM_EECLKDIV_OFFSET 0x0094 /* Clock divider register */
+#define LPC17_40_EEPROM_EEPWRDWN_OFFSET 0x0098 /* Power down register */
+
+#define LPC17_40_EEPROM_INTSTAT_OFFSET 0x0fe0 /* Interrupt status */
+#define LPC17_40_EEPROM_INTEN_OFFSET 0x0fe4 /* Interrupt enable */
+#define LPC17_40_EEPROM_INTSTATCLR_OFFSET 0x0fe8 /* Interrupt status clear */
+#define LPC17_40_EEPROM_INTENCLR_OFFSET 0x0fd8 /* Interrupt enable clear */
+#define LPC17_40_EEPROM_INTENSET_OFFSET 0x0fdc /* Interrupt enable set */
+#define LPC17_40_EEPROM_INTSTATSET_OFFSET 0x0fec /* Interrupt status set */
+
+#define LPC17_40_EEPROM_EECMD (LPC17_40_EEPROM_BASE+LPC17_40_EEPROM_EECMD_OFFSET)
+#define LPC17_40_EEPROM_EEADDR (LPC17_40_EEPROM_BASE+LPC17_40_EEPROM_EEADDR_OFFSET)
+#define LPC17_40_EEPROM_EEWDATA (LPC17_40_EEPROM_BASE+LPC17_40_EEPROM_EEWDATA_OFFSET)
+#define LPC17_40_EEPROM_EERDATA (LPC17_40_EEPROM_BASE+LPC17_40_EEPROM_EERDATA_OFFSET)
+#define LPC17_40_EEPROM_EEWSTATE (LPC17_40_EEPROM_BASE+LPC17_40_EEPROM_EEWSTATE_OFFSET)
+#define LPC17_40_EEPROM_EECLKDIV (LPC17_40_EEPROM_BASE+LPC17_40_EEPROM_EECLKDIV_OFFSET)
+#define LPC17_40_EEPROM_EEPWRDWN (LPC17_40_EEPROM_BASE+LPC17_40_EEPROM_EEPWRDWN_OFFSET)
+
+#define LPC17_40_EEPROM_INTSTAT (LPC17_40_EEPROM_BASE+LPC17_40_EEPROM_INTSTAT_OFFSET)
+#define LPC17_40_EEPROM_INTEN (LPC17_40_EEPROM_BASE+LPC17_40_EEPROM_INTEN_OFFSET)
+#define LPC17_40_EEPROM_INTSTATCLR (LPC17_40_EEPROM_BASE+LPC17_40_EEPROM_INTSTATCLR_OFFSET)
+#define LPC17_40_EEPROM_INTENCLR (LPC17_40_EEPROM_BASE+LPC17_40_EEPROM_INTENCLR_OFFSET)
+#define LPC17_40_EEPROM_INTENSET (LPC17_40_EEPROM_BASE+LPC17_40_EEPROM_INTENSET_OFFSET)
+#define LPC17_40_EEPROM_INTSTATSET (LPC17_40_EEPROM_BASE+LPC17_40_EEPROM_INTSTATSET_OFFSET)
+
+/* EECMD - EEPROM Command Register */
+
+#define EEPROM_CMD_SHIFT (0) /* Bit 0-2: Command */
+#define EEPROM_CMD_MASK (7 << EEPROM_CMD_SHIFT)
+# define EECMD_READ8 (0) /* 000: 8bit read */
+# define EECMD_READ16 (1) /* 001: 16bit read */
+# define EECMD_READ32 (2) /* 010: 32bit read */
+# define EECMD_WRITE8 (3) /* 011: 8bit write */
+# define EECMD_WRITE16 (4) /* 100: 16bit write */
+# define EECMD_WRITE32 (5) /* 101: 32bit write */
+# define EEMCD_ERASE (6) /* 110: erase/program page */
+ /* 111: Reserved */
+#define EEPROM_RDPREFETCH (1 << 3) /* Bit 3: Read data prefetch bit */
+ /* Bits 4-31: Reserved */
+/* EEADDR - EEPROM Address Register */
+
+#define EEPROM_ADDR_SHIFT (0) /* Bits 0-11: Address */
+#define EEPROM_ADDR_MASK (0x7ff << EEPROM_EEADDR_ADDR_SHIFT)
+ /* Bits 12-31: Reserved */
+/* EEPROM Read/Write Data Registers */
+/* R/W registers has no bitfields, data read/write
+ * must conforms to the expected sizes
+ */
+
+/* EEWSTATE - EEPROM Wait State Register */
+
+#define EEPROM_WSTATE_PHASE3_SHIFT (0) /* Bits 0-7: Wait states 3 (minus 1 encoded) */
+#define EEPROM_WSTATE_PHASE3_MASK (0xff << EEWSTATE_PHASE3_SHIFT)
+#define EEPROM_WSTATE_PHASE2_SHIFT (8) /* Bits 8-15: Wait states 2 (minus 1 encoded) */
+#define EEPROM_WSTATE_PHASE2_MASK (0xff << EEWSTATE_PHASE2_SHIFT)
+#define EEPROM_WSTATE_PHASE1_SHIFT (16) /* Bits 16-23: Wait states 1 (minus 1 encoded) */
+#define EEPROM_WSTATE_PHASE1_MASK (0xff << EEWSTATE_PHASE1_SHIFT)
+ /* Bits 24-31: Reserved */
+
+/* EECLKDIV - EEPROM Clock Divider Register */
+
+#define EEPROM_CLKDIV_SHIFT (0) /* Bits 0-15: Division factor (minus 1 encoded) */
+#define EEPROM_CLKDIV_MASK (0xffff << EECLKDIV_CLKDIV_SHIFT)
+ /* Bits 16-31: Reserved */
+
+/* EEPWRDWN - EEPROM Power Down Register */
+
+#define EEPROM_PWRDWN (1) /* Bit 0: Power down mode bit */
+ /* Bits 1-31: Reserved */
+
+/* EEPROM Interrupt Registers ******************************************/
+
+/* INTEN - Interrupt Enable Register */
+
+ /* Bits 0-25: Reserved */
+#define EEPROM_INTEN_RW_DONE (1 << 26) /* Bit 26: Read/Write finished interrupt bit */
+ /* Bit 27: Reserved */
+#define EEPROM_INTEN_PROG_DONE (1 << 28) /* Bit 28: Program finished interrupt bit */
+ /* Bits 29-31: Reserved */
+
+/* INTENCLR - Interrupt Enable Clear Register */
+ /* Bits 0-25: Reserved */
+#define EEPROM_INTENCLR_RWCLR_EN (1 << 26) /* Bit 26: Clear R/W interrupt enable bit */
+ /* Bits27: Reserved */
+#define EEPROM_INTENCLR_PROG1CLR_EN (1 << 28) /* Bit 28: Clear program interrupt bit */
+ /* Bits 29-31: Reserved */
+
+/* INTENSET - Interrupt Enable Set Register */
+ /* Bits 0-25: Reserved */
+#define EEPROM_INTENSET_RWSET_EN (1 << 26) /* Bit 26: Set Read/Write finished interrupt bit */
+ /* Bit 27: Reserved */
+#define EEPROM_INTENSET_PROG1SET_EN (1 << 28) /* Bit 28: Set program interrupt bit */
+ /* Bits 29-31: Reserved */
+
+/* INTSTAT - Interrupt Status Register */
+ /* Bits 0-25: Reserved */
+#define EEPROM_INTSTAT_RW_END (1 << 26) /* Bit 26: Read/Write done status bit */
+ /* Bit 27: Reserved */
+#define EEPROM_INTSTAT_PROG1_END (1 << 28) /* Bit 28: Program done status bit */
+ /* Bits 29-31: Reserved */
+
+/* INTSTATCLR - Interrupt Status Clear Register */
+ /* Bits 0-25: Reserved */
+#define EEPROM_INTSTATCLR_RW_CLR (1 << 26) /* Bit 26: Set Read/Write finished interrupt bit */
+ /* Bit 27: Reserved */
+#define EEPROM_INTSTATCLR_PROG_1CLR (1 << 28) /* Bit 28: Set program interrupt bit */
+ /* Bits 29-31: Reserved */
+
+/* INTSTATSET - Interrupt Status Set Register */
+ /* Bits 0-25: Reserved */
+#define EEPROM_INTSTATSET_RW_SET (1 << 26) /* Bit 26: Read/Write done status bit */
+ /* Bit 27: Reserved */
+#define EEPROM_INTSTATSET_PROG1_SET (1 << 28) /* Bit 28: Program done status bit */
+ /* Bits 29-31: Reserved */
+
+/************************************************************************************
+ * Public Types
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Data
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+#endif /* __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC17_40_EEPROM_H */
diff --git a/arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_emc.h b/arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_emc.h
new file mode 100644
index 00000000000..544702bba34
--- /dev/null
+++ b/arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_emc.h
@@ -0,0 +1,350 @@
+/****************************************************************************************************
+ * arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_emc
+ *
+ * Copyright (C) 2013 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ * 3. Neither the name NuttX 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 THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************************************/
+
+#ifndef __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC17_40_EMC_H
+#define __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC17_40_EMC_H
+
+/****************************************************************************************************
+ * Included Files
+ ****************************************************************************************************/
+
+#include
+
+#include "chip.h"
+#include "hardware/lpc17_40_memorymap.h"
+
+/****************************************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************************************/
+/* Register Offsets */
+
+#define LPC17_40_EMC_CONTROL_OFFSET 0x0000 /* EMC Control register */
+#define LPC17_40_EMC_STATUS_OFFSET 0x0004 /* EMC Status register */
+#define LPC17_40_EMC_CONFIG_OFFSET 0x0008 /* EMC Configuration register */
+#define LPC17_40_EMC_DYNAMICCONTROL_OFFSET 0x0020 /* Dynamic Memory Control register */
+#define LPC17_40_EMC_DYNAMICREFRESH_OFFSET 0x0024 /* Dynamic Memory Refresh Timer register */
+#define LPC17_40_EMC_DYNAMICREADCONFIG_OFFSET 0x0028 /* Dynamic Memory Read Configuration register */
+#define LPC17_40_EMC_DYNAMICRP_OFFSET 0x0030 /* Dynamic Memory Precharge Command Period register */
+#define LPC17_40_EMC_DYNAMICRAS_OFFSET 0x0034 /* Dynamic Memory Active to Precharge Command Period register */
+#define LPC17_40_EMC_DYNAMICSREX_OFFSET 0x0038 /* Dynamic Memory Self-refresh Exit Time register */
+#define LPC17_40_EMC_DYNAMICAPR_OFFSET 0x003c /* Dynamic Memory Last Data Out to Active Time register */
+#define LPC17_40_EMC_DYNAMICDAL_OFFSET 0x0040 /* Dynamic Memory Data-in to Active Command Time register */
+#define LPC17_40_EMC_DYNAMICWR_OFFSET 0x0044 /* Dynamic Memory Write Recovery Time register */
+#define LPC17_40_EMC_DYNAMICRC_OFFSET 0x0048 /* Dynamic Memory Active to Active Command Period register */
+#define LPC17_40_EMC_DYNAMICRFC_OFFSET 0x004c /* Dynamic Memory Auto-refresh Period register */
+#define LPC17_40_EMC_DYNAMICXSR_OFFSET 0x0050 /* Dynamic Memory Exit Self-refresh register */
+#define LPC17_40_EMC_DYNAMICRRD_OFFSET 0x0054 /* Dynamic Memory Active Bank A to Active Bank B Time register */
+#define LPC17_40_EMC_DYNAMICMRD_OFFSET 0x0058 /* Dynamic Memory Load Mode register to Active Command Time */
+#define LPC17_40_EMC_STATICEXTENDEDWAIT_OFFSET 0x0080 /* Static Memory Extended Wait register */
+
+#define LPC17_40_EMC_DYNAMICCONFIG0_OFFSET 0x0100 /* Dynamic Memory Configuration register 0 */
+#define LPC17_40_EMC_DYNAMICRASCAS0_OFFSET 0x0104 /* Dynamic Memory RAS & CAS Delay register 0 */
+
+#define LPC17_40_EMC_DYNAMICCONFIG1_OFFSET 0x0120 /* Dynamic Memory Configuration register 1 */
+#define LPC17_40_EMC_DYNAMICRASCAS1_OFFSET 0x0124 /* Dynamic Memory RAS & CAS Delay register 1 */
+
+#define LPC17_40_EMC_DYNAMICCONFIG2_OFFSET 0x0140 /* Dynamic Memory Configuration register 2 */
+#define LPC17_40_EMC_DYNAMICRASCAS2_OFFSET 0x0144 /* Dynamic Memory RAS & CAS Delay register 2 */
+
+#define LPC17_40_EMC_DYNAMICCONFIG3_OFFSET 0x0160 /* Dynamic Memory Configuration register 3 */
+#define LPC17_40_EMC_DYNAMICRASCAS3_OFFSET 0x0164 /* Dynamic Memory RAS & CAS Delay register 3 */
+
+#define LPC17_40_EMC_STATICCONFIG0_OFFSET 0x0200 /* Static Memory Configuration register 0 */
+#define LPC17_40_EMC_STATICWAITWEN0_OFFSET 0x0204 /* Static Memory Write Enable Delay register 0 */
+#define LPC17_40_EMC_STATICWAITOEN0_OFFSET 0x0208 /* Static Memory Output Enable Delay registers 0 */
+#define LPC17_40_EMC_STATICWAITRD0_OFFSET 0x020c /* Static Memory Read Delay register 0 */
+#define LPC17_40_EMC_STATICWAITPAGE0_OFFSET 0x0210 /* Static Memory Page Mode Read Delay register 0*/
+#define LPC17_40_EMC_STATICWAITWR0_OFFSET 0x0214 /* Static Memory Write Delay register 0 */
+#define LPC17_40_EMC_STATICWAITTURN0_OFFSET 0x0218 /* Static Memory Turn Round Delay register 0 */
+
+#define LPC17_40_EMC_STATICCONFIG1_OFFSET 0x0220 /* Static Memory Configuration register 1 */
+#define LPC17_40_EMC_STATICWAITWEN1_OFFSET 0x0224 /* Static Memory Write Enable Delay register 1 */
+#define LPC17_40_EMC_STATICWAITOEN1_OFFSET 0x0228 /* Static Memory Output Enable Delay register 1 */
+#define LPC17_40_EMC_STATICWAITRD1_OFFSET 0x022c /* Static Memory Read Delay register 1 */
+#define LPC17_40_EMC_STATICWAITPAGE1_OFFSET 0x0230 /* Static Memory Page Mode Read Delay register 1 */
+#define LPC17_40_EMC_STATICWAITWR1_OFFSET 0x0234 /* Static Memory Write Delay register 1 */
+#define LPC17_40_EMC_STATICWAITTURN1_OFFSET 0x0238 /* Static Memory Turn Round Delay register 1 */
+
+#define LPC17_40_EMC_STATICCONFIG2_OFFSET 0x0240 /* Static Memory Configuration register 2 */
+#define LPC17_40_EMC_STATICWAITWEN2_OFFSET 0x0244 /* Static Memory Write Enable Delay register 2 */
+#define LPC17_40_EMC_STATICWAITOEN2_OFFSET 0x0248 /* Static Memory Output Enable Delay register 2 */
+#define LPC17_40_EMC_STATICWAITRD2_OFFSET 0x024c /* Static Memory Read Delay register 2 */
+#define LPC17_40_EMC_STATICWAITPAGE2_OFFSET 0x0250 /* Static Memory Page Mode Read Delay registers 3 */
+#define LPC17_40_EMC_STATICWAITWR2_OFFSET 0x0254 /* Static Memory Write Delay register 2 */
+#define LPC17_40_EMC_EMCSTATICWAITTURN2_OFFSET 0x0258 /* Static Memory Turn Round Delay register 2 */
+
+#define LPC17_40_EMC_STATICCONFIG3_OFFSET 0x0260 /* Static Memory Configuration register 3 */
+#define LPC17_40_EMC_STATICWAITWEN3_OFFSET 0x0264 /* Static Memory Write Enable Delay register 3 */
+#define LPC17_40_EMC_STATICWAITOEN3_OFFSET 0x0268 /* Static Memory Output Enable Delay register 3 */
+#define LPC17_40_EMC_STATICWAITRD3_OFFSET 0x026c /* Static Memory Read Delay register 3 */
+#define LPC17_40_EMC_STATICWAITPAGE3_OFFSET 0x0270 /* Static Memory Page Mode Read Delay register 4 */
+#define LPC17_40_EMC_STATICWAITWR3_OFFSET 0x0274 /* Static Memory Write Delay register 3 */
+#define LPC17_40_EMC_STATICWAITTURN3_OFFSET 0x0278 /* Static Memory Turn Round Delay register 3 */
+
+/* Register Addresses */
+
+#define LPC17_40_EMC_CONTROL (LPC17_40_EMC_BASE+LPC17_40_EMC_CONTROL_OFFSET)
+#define LPC17_40_EMC_STATUS (LPC17_40_EMC_BASE+LPC17_40_EMC_STATUS_OFFSET)
+#define LPC17_40_EMC_CONFIG (LPC17_40_EMC_BASE+LPC17_40_EMC_CONFIG_OFFSET)
+#define LPC17_40_EMC_DYNAMICCONTROL (LPC17_40_EMC_BASE+LPC17_40_EMC_DYNAMICCONTROL_OFFSET)
+#define LPC17_40_EMC_DYNAMICREFRESH (LPC17_40_EMC_BASE+LPC17_40_EMC_DYNAMICREFRESH_OFFSET)
+#define LPC17_40_EMC_DYNAMICREADCONFIG (LPC17_40_EMC_BASE+LPC17_40_EMC_DYNAMICREADCONFIG_OFFSET)
+#define LPC17_40_EMC_DYNAMICRP (LPC17_40_EMC_BASE+LPC17_40_EMC_DYNAMICRP_OFFSET)
+#define LPC17_40_EMC_DYNAMICRAS (LPC17_40_EMC_BASE+LPC17_40_EMC_DYNAMICRAS_OFFSET)
+#define LPC17_40_EMC_DYNAMICSREX (LPC17_40_EMC_BASE+LPC17_40_EMC_DYNAMICSREX_OFFSET)
+#define LPC17_40_EMC_DYNAMICAPR (LPC17_40_EMC_BASE+LPC17_40_EMC_DYNAMICAPR_OFFSET)
+#define LPC17_40_EMC_DYNAMICDAL (LPC17_40_EMC_BASE+LPC17_40_EMC_DYNAMICDAL_OFFSET)
+#define LPC17_40_EMC_DYNAMICWR (LPC17_40_EMC_BASE+LPC17_40_EMC_DYNAMICWR_OFFSET)
+#define LPC17_40_EMC_DYNAMICRC (LPC17_40_EMC_BASE+LPC17_40_EMC_DYNAMICRC_OFFSET)
+#define LPC17_40_EMC_DYNAMICRFC (LPC17_40_EMC_BASE+LPC17_40_EMC_DYNAMICRFC_OFFSET)
+#define LPC17_40_EMC_DYNAMICXSR (LPC17_40_EMC_BASE+LPC17_40_EMC_DYNAMICXSR_OFFSET)
+#define LPC17_40_EMC_DYNAMICRRD (LPC17_40_EMC_BASE+LPC17_40_EMC_DYNAMICRRD_OFFSET)
+#define LPC17_40_EMC_DYNAMICMRD (LPC17_40_EMC_BASE+LPC17_40_EMC_DYNAMICMRD_OFFSET)
+#define LPC17_40_EMC_STATICEXTENDEDWAIT (LPC17_40_EMC_BASE+LPC17_40_EMC_STATICEXTENDEDWAIT_OFFSET)
+
+#define LPC17_40_EMC_DYNAMICCONFIG0 (LPC17_40_EMC_BASE+LPC17_40_EMC_DYNAMICCONFIG0_OFFSET)
+#define LPC17_40_EMC_DYNAMICRASCAS0 (LPC17_40_EMC_BASE+LPC17_40_EMC_DYNAMICRASCAS0_OFFSET)
+
+#define LPC17_40_EMC_DYNAMICCONFIG1 (LPC17_40_EMC_BASE+LPC17_40_EMC_DYNAMICCONFIG1_OFFSET)
+#define LPC17_40_EMC_DYNAMICRASCAS1 (LPC17_40_EMC_BASE+LPC17_40_EMC_DYNAMICRASCAS1_OFFSET)
+
+#define LPC17_40_EMC_DYNAMICCONFIG2 (LPC17_40_EMC_BASE+LPC17_40_EMC_DYNAMICCONFIG2_OFFSET)
+#define LPC17_40_EMC_DYNAMICRASCAS2 (LPC17_40_EMC_BASE+LPC17_40_EMC_DYNAMICRASCAS2_OFFSET)
+
+#define LPC17_40_EMC_DYNAMICCONFIG3 (LPC17_40_EMC_BASE+LPC17_40_EMC_DYNAMICCONFIG3_OFFSET)
+#define LPC17_40_EMC_DYNAMICRASCAS3 (LPC17_40_EMC_BASE+LPC17_40_EMC_DYNAMICRASCAS3_OFFSET)
+
+#define LPC17_40_EMC_STATICCONFIG0 (LPC17_40_EMC_BASE+LPC17_40_EMC_STATICCONFIG0_OFFSET)
+#define LPC17_40_EMC_STATICWAITWEN0 (LPC17_40_EMC_BASE+LPC17_40_EMC_STATICWAITWEN0_OFFSET)
+#define LPC17_40_EMC_STATICWAITOEN0 (LPC17_40_EMC_BASE+LPC17_40_EMC_STATICWAITOEN0_OFFSET)
+#define LPC17_40_EMC_STATICWAITRD0 (LPC17_40_EMC_BASE+LPC17_40_EMC_STATICWAITRD0_OFFSET)
+#define LPC17_40_EMC_STATICWAITPAGE0 (LPC17_40_EMC_BASE+LPC17_40_EMC_STATICWAITPAGE0_OFFSET)
+#define LPC17_40_EMC_STATICWAITWR0 (LPC17_40_EMC_BASE+LPC17_40_EMC_STATICWAITWR0_OFFSET)
+#define LPC17_40_EMC_STATICWAITTURN0 (LPC17_40_EMC_BASE+LPC17_40_EMC_STATICWAITTURN0_OFFSET)
+
+#define LPC17_40_EMC_STATICCONFIG1 (LPC17_40_EMC_BASE+LPC17_40_EMC_STATICCONFIG1_OFFSET)
+#define LPC17_40_EMC_STATICWAITWEN1 (LPC17_40_EMC_BASE+LPC17_40_EMC_STATICWAITWEN1_OFFSET)
+#define LPC17_40_EMC_STATICWAITOEN1 (LPC17_40_EMC_BASE+LPC17_40_EMC_STATICWAITOEN1_OFFSET)
+#define LPC17_40_EMC_STATICWAITRD (LPC17_40_EMC_BASE+LPC17_40_EMC_STATICWAITRD1_OFFSET)
+#define LPC17_40_EMC_STATICWAITPAGE1 (LPC17_40_EMC_BASE+LPC17_40_EMC_STATICWAITPAGE1_OFFSET)
+#define LPC17_40_EMC_STATICWAITWR1 (LPC17_40_EMC_BASE+LPC17_40_EMC_STATICWAITWR1_OFFSET)
+#define LPC17_40_EMC_STATICWAITTURN1 (LPC17_40_EMC_BASE+LPC17_40_EMC_STATICWAITTURN1_OFFSET)
+
+#define LPC17_40_EMC_STATICCONFIG2 (LPC17_40_EMC_BASE+LPC17_40_EMC_STATICCONFIG2_OFFSET)
+#define LPC17_40_EMC_STATICWAITWEN2 (LPC17_40_EMC_BASE+LPC17_40_EMC_STATICWAITWEN2_OFFSET)
+#define LPC17_40_EMC_STATICWAITOEN2 (LPC17_40_EMC_BASE+LPC17_40_EMC_STATICWAITOEN2_OFFSET)
+#define LPC17_40_EMC_STATICWAITRD2 (LPC17_40_EMC_BASE+LPC17_40_EMC_STATICWAITRD2_OFFSET)
+#define LPC17_40_EMC_STATICWAITPAGE2 (LPC17_40_EMC_BASE+LPC17_40_EMC_STATICWAITPAGE2_OFFSET)
+#define LPC17_40_EMC_STATICWAITWR2 (LPC17_40_EMC_BASE+LPC17_40_EMC_STATICWAITWR2_OFFSET)
+#define LPC17_40_EMC_EMCSTATICWAITTURN2 (LPC17_40_EMC_BASE+LPC17_40_EMC_EMCSTATICWAITTURN2_OFFSET)
+
+#define LPC17_40_EMC_STATICCONFIG3 (LPC17_40_EMC_BASE+LPC17_40_EMC_STATICCONFIG3_OFFSET)
+#define LPC17_40_EMC_STATICWAITWEN3 (LPC17_40_EMC_BASE+LPC17_40_EMC_STATICWAITWEN3_OFFSET)
+#define LPC17_40_EMC_STATICWAITOEN3 (LPC17_40_EMC_BASE+LPC17_40_EMC_STATICWAITOEN3_OFFSET)
+#define LPC17_40_EMC_STATICWAITRD3 (LPC17_40_EMC_BASE+LPC17_40_EMC_STATICWAITRD3_OFFSET)
+#define LPC17_40_EMC_STATICWAITPAGE3 (LPC17_40_EMC_BASE+LPC17_40_EMC_STATICWAITPAGE3_OFFSET)
+#define LPC17_40_EMC_STATICWAITWR3 (LPC17_40_EMC_BASE+LPC17_40_EMC_STATICWAITWR3_OFFSET)
+#define LPC17_40_EMC_STATICWAITTURN3 (LPC17_40_EMC_BASE+LPC17_40_EMC_STATICWAITTURN3_OFFSET)
+
+/* Register Bitfield Definitions */
+
+/* EMC Control register */
+
+#define EMC_CONTROL_E (1 << 0) /* Bit 0: EMC Enable */
+#define EMC_CONTROL_M (1 << 1) /* Bit 1: Address mirror */
+#define EMC_CONTROL_L (1 << 2) /* Bit 2: Low-power mode */
+
+/* EMC Status register */
+
+#define EMC_STATUS_B (1 << 0) /* Bit 0: Busy */
+#define EMC_STATUS_S (1 << 1) /* Bit 1: Write buffer status */
+#define EMC_STATUS_SA (1 << 2) /* Bit 2: Self-refresh acknowledge */
+
+/* EMC Configuration register */
+
+#define EMC_CONFIG_EM (1 << 0) /* Bit 0: Endian mode */
+#define EMC_CONFIG_CLKR (1 << 8) /* Bit 8: CCLK:CLKOUT ratio */
+
+/* Dynamic Memory Control register */
+
+#define EMC_DYNAMICCONTROL_CE (1 << 0) /* Bit 0: Dynamic memory clock enable */
+#define EMC_DYNAMICCONTROL_CS (1 << 1) /* Bit 1: Dynamic memory clock control */
+#define EMC_DYNAMICCONTROL_SR (1 << 2) /* Bit 2: Self-refresh request */
+#define EMC_DYNAMICCONTROL_MMC (1 << 5) /* Bit 5: Memory clock control */
+#define EMC_DYNAMICCONTROL_I_SHIFT (7) /* Bits 7-8: SDRAM initialization */
+#define EMC_DYNAMICCONTROL_I_MASK (3 << EMC_DYNAMICCONTROL_I_SHIFT)
+# define EMC_DYNAMICCONTROL_I_NORMAL (0 << EMC_DYNAMICCONTROL_I_SHIFT) /* SDRAM NORMAL operation command */
+# define EMC_DYNAMICCONTROL_I_MODE (1 << EMC_DYNAMICCONTROL_I_SHIFT) /* SDRAM MODE command */
+# define EMC_DYNAMICCONTROL_I_PALL (2 << EMC_DYNAMICCONTROL_I_SHIFT) /* SDRAM PALL (precharge all) command */
+# define EMC_DYNAMICCONTROL_I_NOP (3 << EMC_DYNAMICCONTROL_I_SHIFT) /* SDRAM NOP (no operation) command) */
+
+/* Dynamic Memory Refresh Timer register */
+
+#define EMC_DYNAMICREFRESH_MASK (0x000007ff) /* Bits 0-10: REFRESH Refresh timer */
+
+/* Dynamic Memory Read Configuration register */
+
+#define EMC_DYNAMICREADCONFIG_RD_SHIFT (0) /* Bits 0-1: Read data strategy */
+#define EMC_DYNAMICREADCONFIG_RD_MASK (3 << EMC_DYNAMICREADCONFIG_RD_SHIFT)
+# define EMC_DYNAMICREADCONFIG_RD_CLKOUT (0 << EMC_DYNAMICREADCONFIG_RD_SHIFT) /* Clock out delayed strategy */
+# define EMC_DYNAMICREADCONFIG_RD_CMD (1 << EMC_DYNAMICREADCONFIG_RD_SHIFT) /* Command delayed strategy */
+# define EMC_DYNAMICREADCONFIG_RD_CMD1 (2 << EMC_DYNAMICREADCONFIG_RD_SHIFT) /* Command delayed strategy + 1 cycle */
+# define EMC_DYNAMICREADCONFIG_RD_CMD2 (3 << EMC_DYNAMICREADCONFIG_RD_SHIFT) /* Command delayed strategy + 2 cycles */
+
+/* Dynamic Memory Precharge Command Period register */
+
+#define EMC_DYNAMICRP_TRP_MASK (0x0000000f) /* Bits 0-3: Precharge command period */
+
+/* Dynamic Memory Active to Precharge Command Period register */
+
+#define EMC_DYNAMICRAS_TRAS_MASK (0x0000000f) /* Bits 0-3: Active to precharge command period */
+
+/* Dynamic Memory Self-refresh Exit Time register */
+
+#define EMC_DYNAMICSREX_TSREX_MASK (0x0000000f) /* Bits 0-3: Self-refresh exit time */
+
+/* Dynamic Memory Last Data Out to Active Time register */
+
+#define EMC_DYNAMICAPR_TAPR_MASK (0x0000000f) /* Bits 0-3: Last-data-out to active command time */
+
+/* Dynamic Memory Data-in to Active Command Time register */
+
+#define EMC_DYNAMICDAL_TDAL_MASK (0x0000000f) /* Bits 0-3: Data-in to active command */
+
+/* Dynamic Memory Write Recovery Time register */
+
+#define EMC_DYNAMICWR_TWR_MASK (0x0000000f) /* Bits 0-3: Write recovery time */
+
+/* Dynamic Memory Active to Active Command Period register */
+
+#define EMC_DYNAMICRC_TRC_MASK (0x0000001f) /* Bits 0-4: Active to active command period */
+
+/* Dynamic Memory Auto-refresh Period register */
+
+#define EMC_DYNAMICRFC_TRFC_MASK (0x0000001f) /* Bits 0-4: Auto-refresh period and auto-refresh to active command period */
+
+/* Dynamic Memory Exit Self-refresh register */
+
+#define EMC_DYNAMICXSR_TXSR_MASK (0x0000001f) /* Bits 0-4: Exit self-refresh to active command time */
+
+/* Dynamic Memory Active Bank A to Active Bank B Time register */
+
+#define EMC_DYNAMICRRD_TRRD_MASK (0x0000000f) /* Bits 0-3: Active bank A to active bank B latency */
+
+/* Dynamic Memory Load Mode register to Active Command Time */
+
+#define EMC_DYNAMICMRD_TMRD_MASK (0x0000000f) /* Bits 0-3: Load mode register to active command time */
+
+/* Static Memory Extended Wait register */
+
+#define EMC_STATICEXTENDEDWAIT_MASK (0x000003ff) /* Bits 0-9: Extended wait time out */
+
+/* Dynamic Memory Configuration registers (0-3) */
+
+#define EMC_DYNAMICCONFIG_MD_SHIFT (3) /* Bits 3-4: Memory device */
+#define EMC_DYNAMICCONFIG_MD_MASK (3 << EMC_DYNAMICCONFIG_MD_SHIFT)
+# define EMC_DYNAMICCONFIG_MD_SDRAM (0 << EMC_DYNAMICCONFIG_MD_SHIFT) /* SDRAM */
+# define EMC_DYNAMICCONFIG_MD_LOWPOWER (1 << EMC_DYNAMICCONFIG_MD_SHIFT) /* Low-power SDRAM */
+#define EMC_DYNAMICCONFIG_AM0_SHIFT (7) /* Bits 7-12: */
+#define EMC_DYNAMICCONFIG_AM0_MASK (63 << EMC_DYNAMICCONFIG_AM0_SHIFT)
+# define EMC_DYNAMICCONFIG_AM0(n) ((n) << EMC_DYNAMICCONFIG_AM0_SHIFT)
+#define EMC_DYNAMICCONFIG_AM1 (1 << 14) /* Bit 14: */
+#define EMC_DYNAMICCONFIG_B (1 << 19) /* Bit 19: Buffer enable */
+#define EMC_DYNAMICCONFIG_P (1 << 20) /* Bit 20: Write protect */
+
+/* Dynamic Memory RAS & CAS Delay registers (0-3) */
+
+#define EMC_DYNAMICRASCAS_RAS_SHIFT (0) /* Bits 0-1: RAS latency (active to read/write delay) */
+#define EMC_DYNAMICRASCAS_RAS_MASK (3 << EMC_DYNAMICRASCAS_RAS_SHIFT)
+# define EMC_DYNAMICRASCAS_RAS_1CCLK (1 << EMC_DYNAMICRASCAS_RAS_SHIFT) /* One CCLK cycle */
+# define EMC_DYNAMICRASCAS_RAS_2CCLK (2 << EMC_DYNAMICRASCAS_RAS_SHIFT) /* Two CCLK cycles */
+# define EMC_DYNAMICRASCAS_RAS_3CCLK (3 << EMC_DYNAMICRASCAS_RAS_SHIFT) /* Three CCLK cycles */
+#define EMC_DYNAMICRASCAS_CAS_SHIFT (8) /* Bits 8-9: CAS latency */
+#define EMC_DYNAMICRASCAS_CAS_MASK (3 << EMC_DYNAMICRASCAS_CAS_SHIFT)
+# define EMC_DYNAMICRASCAS_CAS_1CCLK (1 << EMC_DYNAMICRASCAS_CAS_SHIFT) /* One CCLK cycle */
+# define EMC_DYNAMICRASCAS_CAS_2CCLK (2 << EMC_DYNAMICRASCAS_CAS_SHIFT) /* Two CCLK cycles */
+# define EMC_DYNAMICRASCAS_CAS_3CCLK (3 << EMC_DYNAMICRASCAS_CAS_SHIFT) /* Three CCLK cycles */
+
+/* Static Memory Configuration registers (0-3) */
+
+#define EMC_STATICCONFIG_MW_SHIFT (0) /* Bits 0-1: Memory width */
+#define EMC_STATICCONFIG_MW_MASK (3 << EMC_STATICCONFIG_MW_SHIFT)
+# define EMC_STATICCONFIG_MW_8BIT (0 << EMC_STATICCONFIG_MW_SHIFT)
+# define EMC_STATICCONFIG_MW_16BIT (1 << EMC_STATICCONFIG_MW_SHIFT)
+# define EMC_STATICCONFIG_MW_32BIT (2 << EMC_STATICCONFIG_MW_SHIFT)
+#define EMC_STATICCONFIG_PM (1 << 3) /* Bit 3: Page mode */
+#define EMC_STATICCONFIG_PC (1 << 6) /* Bit 6: Chip select polarity */
+#define EMC_STATICCONFIG_PB (1 << 7) /* Bit 7: Byte lane state */
+#define EMC_STATICCONFIG_EW (1 << 8) /* Bit 8: Extended wait */
+#define EMC_STATICCONFIG_B (1 << 19) /* Bit 19: Buffer enable */
+#define EMC_STATICCONFIG_P (1 << 20) /* Bit 20: Write protect */
+
+/* Static Memory Write Enable Delay registers (0-3) */
+
+#define EMC_STATICWAITWEN_MASK (0x0000000f) /* Bits 0-3: Wait write enable */
+
+/* Static Memory Output Enable Delay registers (0-3) */
+
+#define EMC_STATICWAITOEN_MASK (0x0000000f) /* Bits 0-3: Wait output enable */
+
+/* Static Memory Read Delay registers (0-3) */
+
+#define EMC_STATICWAITRD_MASK (0x0000001f) /* Bits 0-4: Exit self-refresh to active command time */
+
+/* Static Memory Page Mode Read Delay registers (0-3) */
+
+#define EMC_STATICWAITPAGE_MASK (0x0000001f) /* Bits 0-4: Asynchronous page mode read after the first read wait states */
+
+/* Static Memory Write Delay registers (0-3) */
+
+#define EMC_STATICWAITWR_MASK (0x0000001f) /* Bits 0-4: Write wait states */
+
+/* Static Memory Turn Round Delay registers (0-3) */
+
+#define EMC_STATICWAITTURN_MASK (0x0000000f) /* Bits 0-3: Bus turn-around cycles */
+
+/****************************************************************************************************
+ * Public Types
+ ****************************************************************************************************/
+
+/****************************************************************************************************
+ * Public Data
+ ****************************************************************************************************/
+
+/****************************************************************************************************
+ * Public Functions
+ ****************************************************************************************************/
+
+#endif /* __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC17_40_EMC_H */
diff --git a/arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_ethernet.h b/arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_ethernet.h
new file mode 100644
index 00000000000..ce77c66603b
--- /dev/null
+++ b/arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_ethernet.h
@@ -0,0 +1,597 @@
+/************************************************************************************
+ * arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_ethernet.h
+ *
+ * Copyright (C) 2010, 2013 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ * 3. Neither the name NuttX 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 THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#ifndef __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC17_40_ETHERNET_H
+#define __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC17_40_ETHERNET_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include
+
+#include "chip.h"
+#include "hardware/lpc17_40_memorymap.h"
+
+/************************************************************************************
+ * Pre-processor Definitions
+ ************************************************************************************/
+
+/* Register offsets *****************************************************************/
+/* MAC registers */
+
+#define LPC17_40_ETH_MAC1_OFFSET 0x0000 /* MAC configuration register 1 */
+#define LPC17_40_ETH_MAC2_OFFSET 0x0004 /* MAC configuration register 2 */
+#define LPC17_40_ETH_IPGT_OFFSET 0x0008 /* Back-to-Back Inter-Packet-Gap register */
+#define LPC17_40_ETH_IPGR_OFFSET 0x000c /* Non Back-to-Back Inter-Packet-Gap register */
+#define LPC17_40_ETH_CLRT_OFFSET 0x0010 /* Collision window / Retry register */
+#define LPC17_40_ETH_MAXF_OFFSET 0x0014 /* Maximum Frame register */
+#define LPC17_40_ETH_SUPP_OFFSET 0x0018 /* PHY Support register */
+#define LPC17_40_ETH_TEST_OFFSET 0x001c /* Test register */
+#define LPC17_40_ETH_MCFG_OFFSET 0x0020 /* MII Mgmt Configuration register */
+#define LPC17_40_ETH_MCMD_OFFSET 0x0024 /* MII Mgmt Command register */
+#define LPC17_40_ETH_MADR_OFFSET 0x0028 /* MII Mgmt Address register */
+#define LPC17_40_ETH_MWTD_OFFSET 0x002c /* MII Mgmt Write Data register */
+#define LPC17_40_ETH_MRDD_OFFSET 0x0030 /* MII Mgmt Read Data register */
+#define LPC17_40_ETH_MIND_OFFSET 0x0034 /* MII Mgmt Indicators register */
+#define LPC17_40_ETH_SA0_OFFSET 0x0040 /* Station Address 0 register */
+#define LPC17_40_ETH_SA1_OFFSET 0x0044 /* Station Address 1 register */
+#define LPC17_40_ETH_SA2_OFFSET 0x0048 /* Station Address 2 register */
+
+/* Control registers */
+
+#define LPC17_40_ETH_CMD_OFFSET 0x0100 /* Command register */
+#define LPC17_40_ETH_STAT_OFFSET 0x0104 /* Status register */
+#define LPC17_40_ETH_RXDESC_OFFSET 0x0108 /* Receive descriptor base address register */
+#define LPC17_40_ETH_RXSTAT_OFFSET 0x010c /* Receive status base address register */
+#define LPC17_40_ETH_RXDESCNO_OFFSET 0x0110 /* Receive number of descriptors register */
+#define LPC17_40_ETH_RXPRODIDX_OFFSET 0x0114 /* Receive produce index register */
+#define LPC17_40_ETH_RXCONSIDX_OFFSET 0x0118 /* Receive consume index register */
+#define LPC17_40_ETH_TXDESC_OFFSET 0x011c /* Transmit descriptor base address register */
+#define LPC17_40_ETH_TXSTAT_OFFSET 0x0120 /* Transmit status base address register */
+#define LPC17_40_ETH_TXDESCRNO_OFFSET 0x0124 /* Transmit number of descriptors register */
+#define LPC17_40_ETH_TXPRODIDX_OFFSET 0x0128 /* Transmit produce index register */
+#define LPC17_40_ETH_TXCONSIDX_OFFSET 0x012c /* Transmit consume index register */
+#define LPC17_40_ETH_TSV0_OFFSET 0x0158 /* Transmit status vector 0 register */
+#define LPC17_40_ETH_TSV1_OFFSET 0x015c /* Transmit status vector 1 register */
+#define LPC17_40_ETH_RSV_OFFSET 0x0160 /* Receive status vector register */
+#define LPC17_40_ETH_FCCNTR_OFFSET 0x0170 /* Flow control counter register */
+#define LPC17_40_ETH_FCSTAT_OFFSET 0x0174 /* Flow control status register */
+
+/* Rx filter registers */
+
+#define LPC17_40_ETH_RXFLCTRL_OFFSET 0x0200 /* Receive filter control register */
+#define LPC17_40_ETH_RXFLWOLST_OFFSET 0x0204 /* Receive filter WoL status register */
+#define LPC17_40_ETH_RXFLWOLCLR_OFFSET 0x0208 /* Receive filter WoL clear register */
+#define LPC17_40_ETH_HASHFLL_OFFSET 0x0210 /* Hash filter table LSBs register */
+#define LPC17_40_ETH_HASHFLH_OFFSET 0x0214 /* Hash filter table MSBs register */
+
+/* Module control registers */
+
+#define LPC17_40_ETH_INTST_OFFSET 0x0fe0 /* Interrupt status register */
+#define LPC17_40_ETH_INTEN_OFFSET 0x0fe4 /* Interrupt enable register */
+#define LPC17_40_ETH_INTCLR_OFFSET 0x0fe8 /* Interrupt clear register */
+#define LPC17_40_ETH_INTSET_OFFSET 0x0fec /* Interrupt set register */
+#define LPC17_40_ETH_PWRDOWN_OFFSET 0x0ff4 /* Power-down register */
+
+/* Register addresses ***************************************************************/
+/* MAC registers */
+
+#define LPC17_40_ETH_MAC1 (LPC17_40_ETH_BASE+LPC17_40_ETH_MAC1_OFFSET)
+#define LPC17_40_ETH_MAC2 (LPC17_40_ETH_BASE+LPC17_40_ETH_MAC2_OFFSET)
+#define LPC17_40_ETH_IPGT (LPC17_40_ETH_BASE+LPC17_40_ETH_IPGT_OFFSET)
+#define LPC17_40_ETH_IPGR (LPC17_40_ETH_BASE+LPC17_40_ETH_IPGR_OFFSET)
+#define LPC17_40_ETH_CLRT (LPC17_40_ETH_BASE+LPC17_40_ETH_CLRT_OFFSET)
+#define LPC17_40_ETH_MAXF (LPC17_40_ETH_BASE+LPC17_40_ETH_MAXF_OFFSET)
+#define LPC17_40_ETH_SUPP (LPC17_40_ETH_BASE+LPC17_40_ETH_SUPP_OFFSET)
+#define LPC17_40_ETH_TEST (LPC17_40_ETH_BASE+LPC17_40_ETH_TEST_OFFSET)
+#define LPC17_40_ETH_MCFG (LPC17_40_ETH_BASE+LPC17_40_ETH_MCFG_OFFSET)
+#define LPC17_40_ETH_MCMD (LPC17_40_ETH_BASE+LPC17_40_ETH_MCMD_OFFSET)
+#define LPC17_40_ETH_MADR (LPC17_40_ETH_BASE+LPC17_40_ETH_MADR_OFFSET)
+#define LPC17_40_ETH_MWTD (LPC17_40_ETH_BASE+LPC17_40_ETH_MWTD_OFFSET)
+#define LPC17_40_ETH_MRDD (LPC17_40_ETH_BASE+LPC17_40_ETH_MRDD_OFFSET)
+#define LPC17_40_ETH_MIND (LPC17_40_ETH_BASE+LPC17_40_ETH_MIND_OFFSET)
+#define LPC17_40_ETH_SA0 (LPC17_40_ETH_BASE+LPC17_40_ETH_SA0_OFFSET)
+#define LPC17_40_ETH_SA1 (LPC17_40_ETH_BASE+LPC17_40_ETH_SA1_OFFSET)
+#define LPC17_40_ETH_SA2 (LPC17_40_ETH_BASE+LPC17_40_ETH_SA2_OFFSET)
+
+/* Control registers */
+
+#define LPC17_40_ETH_CMD (LPC17_40_ETH_BASE+LPC17_40_ETH_CMD_OFFSET)
+#define LPC17_40_ETH_STAT (LPC17_40_ETH_BASE+LPC17_40_ETH_STAT_OFFSET)
+#define LPC17_40_ETH_RXDESC (LPC17_40_ETH_BASE+LPC17_40_ETH_RXDESC_OFFSET)
+#define LPC17_40_ETH_RXSTAT (LPC17_40_ETH_BASE+LPC17_40_ETH_RXSTAT_OFFSET)
+#define LPC17_40_ETH_RXDESCNO (LPC17_40_ETH_BASE+LPC17_40_ETH_RXDESCNO_OFFSET)
+#define LPC17_40_ETH_RXPRODIDX (LPC17_40_ETH_BASE+LPC17_40_ETH_RXPRODIDX_OFFSET)
+#define LPC17_40_ETH_RXCONSIDX (LPC17_40_ETH_BASE+LPC17_40_ETH_RXCONSIDX_OFFSET)
+#define LPC17_40_ETH_TXDESC (LPC17_40_ETH_BASE+LPC17_40_ETH_TXDESC_OFFSET)
+#define LPC17_40_ETH_TXSTAT (LPC17_40_ETH_BASE+LPC17_40_ETH_TXSTAT_OFFSET)
+#define LPC17_40_ETH_TXDESCRNO (LPC17_40_ETH_BASE+LPC17_40_ETH_TXDESCRNO_OFFSET)
+#define LPC17_40_ETH_TXPRODIDX (LPC17_40_ETH_BASE+LPC17_40_ETH_TXPRODIDX_OFFSET)
+#define LPC17_40_ETH_TXCONSIDX (LPC17_40_ETH_BASE+LPC17_40_ETH_TXCONSIDX_OFFSET)
+#define LPC17_40_ETH_TSV0 (LPC17_40_ETH_BASE+LPC17_40_ETH_TSV0_OFFSET)
+#define LPC17_40_ETH_TSV1 (LPC17_40_ETH_BASE+LPC17_40_ETH_TSV1_OFFSET)
+#define LPC17_40_ETH_RSV (LPC17_40_ETH_BASE+LPC17_40_ETH_RSV_OFFSET)
+#define LPC17_40_ETH_FCCNTR (LPC17_40_ETH_BASE+LPC17_40_ETH_FCCNTR_OFFSET)
+#define LPC17_40_ETH_FCSTAT (LPC17_40_ETH_BASE+LPC17_40_ETH_FCSTAT_OFFSET)
+
+/* Rx filter registers */
+
+#define LPC17_40_ETH_RXFLCTRL (LPC17_40_ETH_BASE+LPC17_40_ETH_RXFLCTRL_OFFSET)
+#define LPC17_40_ETH_RXFLWOLST (LPC17_40_ETH_BASE+LPC17_40_ETH_RXFLWOLST_OFFSET)
+#define LPC17_40_ETH_RXFLWOLCLR (LPC17_40_ETH_BASE+LPC17_40_ETH_RXFLWOLCLR_OFFSET)
+#define LPC17_40_ETH_HASHFLL (LPC17_40_ETH_BASE+LPC17_40_ETH_HASHFLL_OFFSET)
+#define LPC17_40_ETH_HASHFLH (LPC17_40_ETH_BASE+LPC17_40_ETH_HASHFLH_OFFSET)
+
+/* Module control registers */
+
+#define LPC17_40_ETH_INTST (LPC17_40_ETH_BASE+LPC17_40_ETH_INTST_OFFSET)
+#define LPC17_40_ETH_INTEN (LPC17_40_ETH_BASE+LPC17_40_ETH_INTEN_OFFSET)
+#define LPC17_40_ETH_INTCLR (LPC17_40_ETH_BASE+LPC17_40_ETH_INTCLR_OFFSET)
+#define LPC17_40_ETH_INTSET (LPC17_40_ETH_BASE+LPC17_40_ETH_INTSET_OFFSET)
+#define LPC17_40_ETH_PWRDOWN (LPC17_40_ETH_BASE+LPC17_40_ETH_PWRDOWN_OFFSET)
+
+/* Register bit definitions *********************************************************/
+/* MAC registers */
+/* MAC configuration register 1 (MAC1) */
+
+#define ETH_MAC1_RE (1 << 0) /* Bit 0: Receive enable */
+#define ETH_MAC1_PARF (1 << 1) /* Bit 1: Passall all receive frames */
+#define ETH_MAC1_RFC (1 << 2) /* Bit 2: RX flow control */
+#define ETH_MAC1_TFC (1 << 3) /* Bit 3: TX flow control */
+#define ETH_MAC1_LPBK (1 << 4) /* Bit 4: Loopback */
+ /* Bits 5-7: Reserved */
+#define ETH_MAC1_TXRST (1 << 8) /* Bit 8: Reset TX */
+#define ETH_MAC1_MCSTXRST (1 << 9) /* Bit 9: Reset MCS/TX */
+#define ETH_MAC1_RXRST (1 << 10) /* Bit 10: Reset RX */
+#define ETH_MAC1_MCSRXRST (1 << 11) /* Bit 11: Reset MCS/RX */
+ /* Bits 12-13: Reserved */
+#define ETH_MAC1_SIMRST (1 << 14) /* Bit 14: Simulation reset */
+#define ETH_MAC1_SOFTRST (1 << 15) /* Bit 15: Soft reset */
+ /* Bits 16-31: Reserved */
+/* MAC configuration register 2 (MAC2) */
+
+#define ETH_MAC2_FD (1 << 0) /* Bit 0: Full duplex */
+#define ETH_MAC2_FLC (1 << 1) /* Bit 1: Frame length checking */
+#define ETH_MAC2_HFE (1 << 2) /* Bit 2: Huge frame enable */
+#define ETH_MAC2_DCRC (1 << 3) /* Bit 3: Delayed CRC */
+#define ETH_MAC2_CRCEN (1 << 4) /* Bit 4: CRC enable */
+#define ETH_MAC2_PADCRCEN (1 << 5) /* Bit 5: Pad/CRC enable */
+#define ETH_MAC2_VLANPADEN (1 << 6) /* Bit 6: VLAN pad enable */
+#define ETH_MAC2_AUTOPADEN (1 << 7) /* Bit 7: Auto detect pad enable */
+#define ETH_MAC2_PPE (1 << 8) /* Bit 8: Pure preamble enforcement */
+#define ETH_MAC2_LPE (1 << 9) /* Bit 9: Long preamble enforcement */
+ /* Bits 10-11: Reserved */
+#define ETH_MAC2_NBKOFF (1 << 12) /* Bit 12: No backoff */
+#define ETH_MAC2_BPNBKOFF (1 << 13) /* Bit 13: Back pressure/no backoff */
+#define ETH_MAC2_EXDEF (1 << 14) /* Bit 14: Excess defer */
+ /* Bits 15-31: Reserved */
+/* Back-to-Back Inter-Packet-Gap register (IPGT) */
+
+#define ETH_IPGT_SHIFT (0) /* Bits 0-6 */
+#define ETH_IPGT_MASK (0x7f << ETH_IPGT_SHIFT)
+ /* Bits 7-31: Reserved */
+/* Non Back-to-Back Inter-Packet-Gap register (IPGR) */
+
+#define ETH_IPGR_GAP2_SHIFT (0) /* Bits 0-6: Gap part 2 */
+#define ETH_IPGR_GAP2_MASK (0x7f << ETH_IPGR_GAP2_SHIFT)
+ /* Bit 7: Reserved */
+#define ETH_IPGR_GAP1_SHIFT (8) /* Bits 8-18: Gap part 1 */
+#define ETH_IPGR_GAP1_MASK (0x7f << ETH_IPGR_GAP2_SHIFT)
+ /* Bits 15-31: Reserved */
+/* Collision window / Retry register (CLRT) */
+
+#define ETH_CLRT_RMAX_SHIFT (0) /* Bits 0-3: Retransmission maximum */
+#define ETH_CLRT_RMAX_MASK (15 << ETH_CLRT_RMAX_SHIFT)
+ /* Bits 4-7: Reserved */
+#define ETH_CLRT_COLWIN_SHIFT (8) /* Bits 8-13: Collision window */
+#define ETH_CLRT_COLWIN_MASK (0x3f << ETH_CLRT_COLWIN_SHIFT)
+ /* Bits 14-31: Reserved */
+/* Maximum Frame register (MAXF) */
+
+#define ETH_MAXF_SHIFT (0) /* Bits 0-15 */
+#define ETH_MAXF_MASK (0xffff << ETH_MAXF_SHIFT)
+ /* Bits 16-31: Reserved */
+/* PHY Support register (SUPP) */
+ /* Bits 0-7: Reserved */
+#define ETH_SUPP_SPEED (1 << 8) /* Bit 8: 0=10Bps 1=100Bps */
+ /* Bits 9-31: Reserved */
+/* Test register (TEST) */
+
+#define ETH_TEST_SPQ (1 << 0) /* Bit 0: Shortcut pause quanta */
+#define ETH_TEST_TP (1 << 1) /* Bit 1: Test pause */
+#define ETH_TEST_TBP (1 << 2) /* Bit 2: Test packpressure */
+ /* Bits 3-31: Reserved */
+/* MII Mgmt Configuration register (MCFG) */
+
+#define ETH_MCFG_SCANINC (1 << 0) /* Bit 0: Scan increment */
+#define ETH_MCFG_SUPPRE (1 << 1) /* Bit 1: Suppress preamble */
+#define ETH_MCFG_CLKSEL_SHIFT (2) /* Bits 2-5: Clock select */
+#define ETH_MCFG_CLKSEL_MASK (15 << ETH_MCFG_CLKSEL_SHIFT)
+# define ETH_MCFG_CLKSEL_DIV4 (0 << ETH_MCFG_CLKSEL_SHIFT)
+# define ETH_MCFG_CLKSEL_DIV6 (2 << ETH_MCFG_CLKSEL_SHIFT)
+# define ETH_MCFG_CLKSEL_DIV8 (3 << ETH_MCFG_CLKSEL_SHIFT)
+# define ETH_MCFG_CLKSEL_DIV10 (4 << ETH_MCFG_CLKSEL_SHIFT)
+# define ETH_MCFG_CLKSEL_DIV14 (5 << ETH_MCFG_CLKSEL_SHIFT)
+# define ETH_MCFG_CLKSEL_DIV20 (6 << ETH_MCFG_CLKSEL_SHIFT)
+# define ETH_MCFG_CLKSEL_DIV28 (7 << ETH_MCFG_CLKSEL_SHIFT)
+# define ETH_MCFG_CLKSEL_DIV36 (8 << ETH_MCFG_CLKSEL_SHIFT)
+# define ETH_MCFG_CLKSEL_DIV40 (9 << ETH_MCFG_CLKSEL_SHIFT)
+# define ETH_MCFG_CLKSEL_DIV44 (10 << ETH_MCFG_CLKSEL_SHIFT)
+# define ETH_MCFG_CLKSEL_DIV48 (11 << ETH_MCFG_CLKSEL_SHIFT)
+# define ETH_MCFG_CLKSEL_DIV52 (12 << ETH_MCFG_CLKSEL_SHIFT)
+# define ETH_MCFG_CLKSEL_DIV56 (13 << ETH_MCFG_CLKSEL_SHIFT)
+# define ETH_MCFG_CLKSEL_DIV60 (14 << ETH_MCFG_CLKSEL_SHIFT)
+# define ETH_MCFG_CLKSEL_DIV64 (15 << ETH_MCFG_CLKSEL_SHIFT)
+ /* Bits 6-14: Reserved */
+#define ETH_MCFG_MIIRST (1 << 15) /* Bit 15: Reset MII mgmt */
+ /* Bits 16-31: Reserved */
+/* MII Mgmt Command register (MCMD) */
+
+#define ETH_MCMD_READ (1 << 0) /* Bit 0: Single read cycle */
+#define ETH_MCMD_SCAN (1 << 1) /* Bit 1: Continuous read cycles */
+ /* Bits 2-31: Reserved */
+#define ETH_MCMD_WRITE (0)
+
+/* MII Mgmt Address register (MADR) */
+
+#define ETH_MADR_REGADDR_SHIFT (0) /* Bits 0-4: Register address */
+#define ETH_MADR_REGADDR_MASK (31 << ETH_MADR_REGADDR_SHIFT)
+ /* Bits 7-5: Reserved */
+#define ETH_MADR_PHYADDR_SHIFT (8) /* Bits 8-12: PHY address */
+#define ETH_MADR_PHYADDR_MASK (31 << ETH_MADR_PHYADDR_SHIFT)
+ /* Bits 13-31: Reserved */
+/* MII Mgmt Write Data register (MWTD) */
+
+#define ETH_MWTD_SHIFT (0) /* Bits 0-15 */
+#define ETH_MWTD_MASK (0xffff << ETH_MWTD_SHIFT)
+ /* Bits 16-31: Reserved */
+/* MII Mgmt Read Data register (MRDD) */
+
+#define ETH_MRDD_SHIFT (0) /* Bits 0-15 */
+#define ETH_MRDD_MASK (0xffff << ETH_MRDD_SHIFT)
+ /* Bits 16-31: Reserved */
+/* MII Mgmt Indicators register (MIND) */
+
+#define ETH_MIND_BUSY (1 << 0) /* Bit 0: Busy */
+#define ETH_MIND_SCANNING (1 << 1) /* Bit 1: Scanning */
+#define ETH_MIND_NVALID (1 << 2) /* Bit 2: Not valid */
+#define ETH_MIND_MIIFAIL (1 << 3) /* Bit 3: MII link fail */
+ /* Bits 4-31: Reserved */
+/* Station Address 0 register (SA0) */
+
+#define ETH_SA0_OCTET2_SHIFT (0) /* Bits 0-7: Station address 2nd octet */
+#define ETH_SA0_OCTET2_MASK (0xff << ETH_SA0_OCTET2_SHIFT)
+#define ETH_SA0_OCTET1_SHIFT (8) /* Bits 8-15: Station address 1st octet */
+#define ETH_SA0_OCTET1_MASK (0xff << ETH_SA0_OCTET1_SHIFT)
+ /* Bits 16-31: Reserved */
+/* Station Address 1 register (SA1) */
+
+#define ETH_SA1_OCTET4_SHIFT (0) /* Bits 0-7: Station address 4th octet */
+#define ETH_SA1_OCTET4_MASK (0xff << ETH_SA0_OCTET4_SHIFT)
+#define ETH_SA1_OCTET3_SHIFT (8) /* Bits 8-15: Station address 3rd octet */
+#define ETH_SA1_OCTET3_MASK (0xff << ETH_SA0_OCTET3_SHIFT)
+ /* Bits 16-31: Reserved */
+/* Station Address 2 register (SA2) */
+
+#define ETH_SA2_OCTET6_SHIFT (0) /* Bits 0-7: Station address 5th octet */
+#define ETH_SA2_OCTET6_MASK (0xff << ETH_SA0_OCTET6_SHIFT)
+#define ETH_SA2_OCTET5_SHIFT (8) /* Bits 8-15: Station address 6th octet */
+#define ETH_SA2_OCTET5_MASK (0xff << ETH_SA0_OCTET5_SHIFT)
+ /* Bits 16-31: Reserved */
+/* Control registers */
+/* Command register (CMD) */
+
+#define ETH_CMD_RXEN (1 << 0) /* Bit 0: Receive enable */
+#define ETH_CMD_TXEN (1 << 1) /* Bit 1: Transmit enable */
+ /* Bit 2: Reserved */
+#define ETH_CMD_REGRST (1 << 3) /* Bit 3: Reset host registers */
+#define ETH_CMD_TXRST (1 << 4) /* Bit 4: Reset transmit datapath */
+#define ETH_CMD_RXRST (1 << 5) /* Bit 5: Reset receive datapath */
+#define ETH_CMD_PRFRAME (1 << 6) /* Bit 6: Pass run frame */
+#define ETH_CMD_PRFILTER (1 << 7) /* Bit 7: Pass RX filter */
+#define ETH_CMD_TXFC (1 << 8) /* Bit 8: TX flow control */
+#define ETH_CMD_RMII (1 << 9) /* Bit 9: RMII mode */
+#define ETH_CMD_FD (1 << 10) /* Bit 10: Full duplex */
+ /* Bits 11-31: Reserved */
+/* Status register */
+
+#define ETH_STAT_RX (1 << 0) /* Bit 0: RX status */
+#define ETH_STAT_TX (1 << 1) /* Bit 1: TX status */
+ /* Bits 2-31: Reserved */
+/* Receive descriptor base address register (RXDESC)
+ *
+ * The receive descriptor base address is a byte address aligned to a word
+ * boundary i.e. LSB 1:0 are fixed to 00. The register contains the lowest
+ * address in the array of descriptors.
+ */
+
+/* Receive status base address register (RXSTAT)
+ *
+ * The receive status base address is a byte address aligned to a double word
+ * boundary i.e. LSB 2:0 are fixed to 000.
+ */
+
+/* Receive number of descriptors register (RXDESCNO) */
+
+#define ETH_RXDESCNO_SHIFT (0) /* Bits 0-15 */
+#define ETH_RXDESCNO_MASK (0xffff << ETH_RXDESCNO_SHIFT)
+ /* Bits 16-31: Reserved */
+/* Receive produce index register (RXPRODIDX) */
+
+#define ETH_RXPRODIDX_SHIFT (0) /* Bits 0-15 */
+#define ETH_RXPRODIDX_MASK (0xffff << ETH_RXPRODIDX_SHIFT)
+ /* Bits 16-31: Reserved */
+/* Receive consume index register (RXCONSIDX) */
+
+#define ETH_RXCONSIDX_SHIFT (0) /* Bits 0-15 */
+#define ETH_RXCONSIDX_MASK (0xffff << ETH_RXPRODIDX_SHIFT)
+ /* Bits 16-31: Reserved */
+/* Transmit descriptor base address register (TXDESC)
+ *
+ * The transmit descriptor base address is a byte address aligned to a word
+ * boundary i.e. LSB 1:0 are fixed to 00. The register contains the lowest
+ * address in the array of descriptors.
+ */
+
+/* Transmit status base address register (TXSTAT)
+ *
+ * The transmit status base address is a byte address aligned to a word
+ * boundary i.e. LSB1:0 are fixed to 00. The register contains the lowest
+ * address in the array of statuses.
+ */
+
+/* Transmit number of descriptors register (TXDESCRNO) */
+
+#define ETH_TXDESCRNO_SHIFT (0) /* Bits 0-15 */
+#define ETH_TXDESCRNO_MASK (0xffff << ETH_TXDESCRNO_SHIFT)
+ /* Bits 16-31: Reserved */
+/* Transmit produce index register (TXPRODIDX) */
+
+#define ETH_TXPRODIDX_SHIFT (0) /* Bits 0-15 */
+#define ETH_TXPRODIDX_MASK (0xffff << ETH_TXPRODIDX_SHIFT)
+ /* Bits 16-31: Reserved */
+/* Transmit consume index register (TXCONSIDX) */
+
+#define ETH_TXCONSIDX_SHIFT (0) /* Bits 0-15 */
+#define ETH_TXCONSIDX_MASK (0xffff << ETH_TXPRODIDX_SHIFT)
+ /* Bits 16-31: Reserved */
+/* Transmit status vector 0 register (TSV0) */
+
+#define ETH_TSV0_CRCERR (1 << 0) /* Bit 0: CRC error */
+#define ETH_TSV0_LENCHKERR (1 << 1) /* Bit 1: Length check error */
+#define ETH_TSV0_LENOOR (1 << 2) /* Bit 2: Length out of range */
+#define ETH_TSV0_DONE (1 << 3) /* Bit 3: Done */
+#define ETH_TSV0_MCAST (1 << 4) /* Bit 4: Multicast */
+#define ETH_TSV0_BCAST (1 << 5) /* Bit 5: Broadcast */
+#define ETH_TSV0_PKTDEFER (1 << 6) /* Bit 6: Packet Defer */
+#define ETH_TSV0_EXCDEFER (1 << 7) /* Bit 7: Excessive Defer */
+#define ETH_TSV0_EXCCOL (1 << 8) /* Bit 8: Excessive Collision */
+#define ETH_TSV0_LATECOL (1 << 9) /* Bit 9: Late Collision */
+#define ETH_TSV0_GIANT (1 << 10) /* Bit 10: Giant */
+#define ETH_TSV0_UNDRUN (1 << 11) /* Bit 11: Underrun */
+#define ETH_TSV0_TOTBYTES_SHIFT (12) /* Bits 12-27:Total bytes */
+#define ETH_TSV0_TOTBYTES_MASK (0xffff << ETH_TSV0_TOTBYTES_SHIFT)
+#define ETH_TSV0_CTLFRAME (1 << 28) /* Bit 28: Control frame */
+#define ETH_TSV0_PAUSE (1 << 29) /* Bit 29: Pause */
+#define ETH_TSV0_BP (1 << 30) /* Bit 30: Backpressure */
+#define ETH_TSV0_VLAN (1 << 31) /* Bit 31: VLAN */
+
+/* Transmit status vector 1 register (TSV1) */
+
+#define ETH_TSV1_TXCNT_SHIFT (0) /* Bits 0-15: Transmit byte count */
+#define ETH_TSV1_TXCNT_MASK (0xffff << ETH_TSV1_TXCNT_SHIFT)
+#define ETH_TSV1_COLCNT_SHIFT (16) /* Bits 16-19: Transmit collision count */
+#define ETH_TSV1_COLCNT_MASK (15 << ETH_TSV1_COLCNT_SHIFT)
+ /* Bits 20-31: Reserved */
+/* Receive status vector register (RSV) */
+
+#define ETH_RSV_RXCNT_SHIFT (0) /* Bits 0-15: Received byte count */
+#define ETH_RSV_RXCNT_MASK (0xffff << ETH_RSV_RXCNT_SHIFT)
+#define ETH_RSV_PKTPI (1 << 16) /* Bit 16: Packet previously ignored */
+#define ETH_RSV_RXEPS (1 << 17) /* Bit 17: RXDV event previously seen */
+#define ETH_RSV_CEPS (1 << 18) /* Bit 18: Carrier event previously seen */
+#define ETH_RSV_RXCV (1 << 19) /* Bit 19: Receive code violation */
+#define ETH_RSV_CRCERR (1 << 20) /* Bit 20: CRC error */
+#define ETH_RSV_LENCHKERR (1 << 21) /* Bit 21: Length check error */
+#define ETH_RSV_LENOOR (1 << 22) /* Bit 22: Length out of range */
+#define ETH_RSV_RXOK (1 << 23) /* Bit 23: Receive OK */
+#define ETH_RSV_MCAST (1 << 24) /* Bit 24: Multicast */
+#define ETH_RSV_BCAST (1 << 25) /* Bit 25: Broadcast */
+#define ETH_RSV_DRIBNIB (1 << 26) /* Bit 26: Dribble Nibble */
+#define ETH_RSV_CTLFRAME (1 << 27) /* Bit 27: Control frame */
+#define ETH_RSV_PAUSE (1 << 28) /* Bit 28: Pause */
+#define ETH_RSV_UNSUPOP (1 << 29) /* Bit 29: Unsupported Opcode */
+#define ETH_RSV_VLAN (1 << 30) /* Bit 30: VLAN */
+ /* Bit 31: Reserved */
+/* Flow control counter register (FCCNTR) */
+
+#define ETH_FCCNTR_MCOUNT_SHIFT (0) /* Bits 0-15: Mirror count */
+#define ETH_FCCNTR_MCOUNT_MASK (0xffff << ETH_FCCNTR_MCOUNT_SHIFT)
+#define ETH_FCCNTR_PTMR_SHIFT (16) /* Bits 16-31: Pause timer */
+#define ETH_FCCNTR_PTMR_MASK (0xffff << ETH_FCCNTR_PTMR_SHIFT)
+
+/* Flow control status register (FCSTAT) */
+
+#define ETH_FCSTAT_MCOUNT_SHIFT (0) /* Bits 0-15: Current mirror count */
+#define ETH_FCSTAT_MCOUNT_MASK (0xffff << ETH_FCSTAT_MCOUNT_SHIFT)
+ /* Bits 16-31: Reserved */
+/* Rx filter registers */
+/* Receive filter control register (RXFLCTRL) */
+
+#define ETH_RXFLCTRL_UCASTEN (1 << 0) /* Bit 0: Accept all unicast frames */
+#define ETH_RXFLCTRL_BCASTEN (1 << 1) /* Bit 1: Accept all broadcast frames */
+#define ETH_RXFLCTRL_MCASTEN (1 << 2) /* Bit 2: Accept all multicast frames */
+#define ETH_RXFLCTRL_UCASTHASHEN (1 << 3) /* Bit 3: Accept hashed unicast */
+#define ETH_RXFLCTRL_MCASTHASHEN (1 << 4) /* Bit 4: Accect hashed multicast */
+#define ETH_RXFLCTRL_PERFEN (1 << 5) /* Bit 5: Accept perfect dest match */
+ /* Bits 6-11: Reserved */
+#define ETH_RXFLCTRL_MPKTEN (1 << 12) /* Bit 12: Magic pkt filter WoL int */
+#define ETH_RXFLCTRL_RXFILEN (1 << 13) /* Bit 13: Perfect match WoL interrupt */
+ /* Bits 14-31: Reserved */
+/* Receive filter WoL status register (RXFLWOLST) AND
+ * Receive filter WoL clear register (RXFLWOLCLR)
+ */
+
+#define ETH_RXFLWOL_UCAST (1 << 0) /* Bit 0: Unicast frame WoL */
+#define ETH_RXFLWOL_BCAST (1 << 1) /* Bit 1: Broadcast frame WoL */
+#define ETH_RXFLWOL_MCAST (1 << 2) /* Bit 2: Multicast frame WoL */
+#define ETH_RXFLWOL_UCASTHASH (1 << 3) /* Bit 3: Unicast hash filter WoL */
+#define ETH_RXFLWOL_MCASTHASH (1 << 4) /* Bit 4: Multiicast hash filter WoL */
+#define ETH_RXFLWOL_PERF (1 << 5) /* Bit 5: Perfect addr match WoL */
+ /* Bit 6: Reserved */
+#define ETH_RXFLWOL_RXFIL (1 << 7) /* Bit 7: Receive filter WoL */
+#define ETH_RXFLWOL_MPKT (1 << 8) /* Bit 8: Magic pkt filter WoL */
+ /* Bits 9-31: Reserved */
+/* Hash filter table LSBs register (HASHFLL) AND Hash filter table MSBs register
+* (HASHFLH) Are registers containing a 32-bit value with no bitfield.
+ */
+
+/* Module control registers */
+/* Interrupt status register (INTST), Interrupt enable register (INTEN), Interrupt
+ * clear register (INTCLR), and Interrupt set register (INTSET) common bit field
+ * definition:
+ */
+
+#define ETH_INT_RXOVR (1 << 0) /* Bit 0: RX overrun interrupt */
+#define ETH_INT_RXERR (1 << 1) /* Bit 1: RX error interrupt */
+#define ETH_INT_RXFIN (1 << 2) /* Bit 2: RX finished interrupt */
+#define ETH_INT_RXDONE (1 << 3) /* Bit 3: RX done interrupt */
+#define ETH_INT_TXUNR (1 << 4) /* Bit 4: TX underrun interrupt */
+#define ETH_INT_TXERR (1 << 5) /* Bit 5: TX error interrupt */
+#define ETH_INT_TXFIN (1 << 6) /* Bit 6: TX finished interrupt */
+#define ETH_INT_TXDONE (1 << 7) /* Bit 7: TX done interrupt */
+ /* Bits 8-11: Reserved */
+#define ETH_INT_SOFT (1 << 12) /* Bit 12: Soft interrupt */
+#define ETH_INT_WKUP (1 << 13) /* Bit 13: Wakeup interrupt */
+ /* Bits 14-31: Reserved */
+/* Power-down register */
+ /* Bits 0-30: Reserved */
+#define ETH_PWRDOWN_MACAHB (1 << 31) /* Power down MAC/AHB */
+
+/* Descriptors Offsets **************************************************************/
+
+/* Tx descriptor offsets */
+
+#define LPC17_40_TXDESC_PACKET 0x00 /* Base address of the Tx data buffer */
+#define LPC17_40_TXDESC_CONTROL 0x04 /* Control Information */
+#define LPC17_40_TXDESC_SIZE 0x08 /* Size in bytes of one Tx descriptor */
+
+/* Tx status offsets */
+
+#define LPC17_40_TXSTAT_INFO 0x00 /* Transmit status return flags */
+#define LPC17_40_TXSTAT_SIZE 0x04 /* Size in bytes of one Tx status */
+
+/* Rx descriptor offsets */
+
+#define LPC17_40_RXDESC_PACKET 0x00 /* Base address of the Rx data buffer */
+#define LPC17_40_RXDESC_CONTROL 0x04 /* Control Information */
+#define LPC17_40_RXDESC_SIZE 0x08 /* Size in bytes of one Rx descriptor */
+
+/* Rx status offsets */
+
+#define LPC17_40_RXSTAT_INFO 0x00 /* Receive status return flags */
+#define LPC17_40_RXSTAT_HASHCRC 0x04 /* Dest and source hash CRC */
+#define LPC17_40_RXSTAT_SIZE 0x08 /* Size in bytes of one Rx status */
+
+/* Descriptor Bit Definitions *******************************************************/
+
+/* Tx descriptor bit definitions */
+
+#define TXDESC_CONTROL_SIZE_SHIFT (0) /* Bits 0-10: Size of data buffer */
+#define TXDESC_CONTROL_SIZE_MASK (0x7ff << RXDESC_CONTROL_SIZE_SHIFT)
+
+#define TXDESC_CONTROL_OVERRIDE (1 << 26 /* Bit 26: Per-frame override */
+#define TXDESC_CONTROL_HUGE (1 << 27) /* Bit 27: Enable huge frame size */
+#define TXDESC_CONTROL_PAD (1 << 28) /* Bit 28: Pad short frames */
+#define TXDESC_CONTROL_CRC (1 << 29) /* Bit 29: Append CRC */
+#define TXDESC_CONTROL_LAST (1 << 30) /* Bit 30: Last descriptor of a fragment */
+#define TXDESC_CONTROL_INT (1 << 31) /* Bit 31: Generate TxDone interrupt */
+
+/* Tx status bit definitions */
+
+#define TXSTAT_INFO_COLCNT_SHIFT (21) /* Bits 21-24: Number of collisions */
+#define TXSTAT_INFO_COLCNT_MASK (15 << TXSTAT_INFO_COLCNT_SHIFT)
+#define TXSTAT_INFO_DEFER (1 << 25) /* Bit 25: Packet deffered */
+#define TXSTAT_INFO_EXCESSDEFER (1 << 26) /* Bit 26: Excessive packet defferals */
+#define TXSTAT_INFO_EXCESSCOL (1 << 27) /* Bit 27: Excessive packet collisions */
+#define TXSTAT_INFO_LATECOL (1 << 28) /* Bit 28: Out of window collision */
+#define TXSTAT_INFO_UNDERRUN (1 << 29) /* Bit 29: Tx underrun */
+#define TXSTAT_INFO_NODESC (1 << 30) /* Bit 29: No Tx descriptor available */
+#define TXSTAT_INFO_ERROR (1 << 31) /* Bit 31: OR of other error conditions */
+
+/* Rx descriptor bit definitions */
+
+#define RXDESC_CONTROL_SIZE_SHIFT (0) /* Bits 0-10: Size of data buffer */
+#define RXDESC_CONTROL_SIZE_MASK (0x7ff << RXDESC_CONTROL_SIZE_SHIFT)
+#define RXDESC_CONTROL_INT (1 << 31) /* Bit 31: Generate RxDone interrupt */
+
+/* Rx status bit definitions */
+
+#define RXSTAT_SAHASHCRC_SHIFT (0) /* Bits 0-8: Hash CRC calculated from the source address */
+#define RXSTAT_SAHASHCRC_MASK (0x1ff << RXSTAT_SAHASHCRC_SHIFT)
+#define RXSTAT_DAHASHCRC_SHIFT (16) /* Bits 16-24: Hash CRC calculated from the dest address */
+#define RXSTAT_DAHASHCRC_MASK (0x1ff << RXSTAT_DAHASHCRC_SHIFT)
+
+#define RXSTAT_INFO_RXSIZE_SHIFT (0) /* Bits 0-10: Size of actual data transferred */
+#define RXSTAT_INFO_RXSIZE_MASK (0x7ff << RXSTAT_INFO_RXSIZE_SHIFT)
+#define RXSTAT_INFO_CONTROL (1 << 18) /* Bit 18: This is a control frame */
+#define RXSTAT_INFO_VLAN (1 << 19) /* Bit 19: This is a VLAN frame */
+#define RXSTAT_INFO_FAILFILTER (1 << 20) /* Bit 20: Frame failed Rx filter */
+#define RXSTAT_INFO_MULTICAST (1 << 21) /* Bit 21: This is a multicast frame */
+#define RXSTAT_INFO_BROADCAST (1 << 22) /* Bit 22: This is a broadcast frame */
+#define RXSTAT_INFO_CRCERROR (1 << 23) /* Bit 23: Received frame had a CRC error */
+#define RXSTAT_INFO_SYMBOLERROR (1 << 24) /* Bit 24: PHY reported bit error */
+#define RXSTAT_INFO_LENGTHERROR (1 << 25) /* Bit 25: Invalid frame length */
+#define RXSTAT_INFO_RANGEERROR (1 << 26) /* Bit 26: Exceeds maximum packet size */
+#define RXSTAT_INFO_ALIGNERROR (1 << 27) /* Bit 27: Alignment error */
+#define RXSTAT_INFO_OVERRUN (1 << 28) /* Bit 28: Receive overrun error */
+#define RXSTAT_INFO_NODESC (1 << 29) /* Bit 29: No Rx descriptor available */
+#define RXSTAT_INFO_LASTFLAG (1 << 30) /* Bit 30: Last fragment of a frame */
+#define RXSTAT_INFO_ERROR (1 << 31) /* Bit 31: OR of other error conditions */
+
+/************************************************************************************
+ * Public Types
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Data
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+#endif /* __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC17_40_ETHERNET_H */
diff --git a/arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_gpdma.h b/arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_gpdma.h
new file mode 100644
index 00000000000..43ab92d7e9c
--- /dev/null
+++ b/arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_gpdma.h
@@ -0,0 +1,597 @@
+/************************************************************************************
+ * arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_gpdma.h
+ *
+ * Copyright (C) 2010, 2013 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ * 3. Neither the name NuttX 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 THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#ifndef __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC17_40_GPDMA_H
+#define __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC17_40_GPDMA_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include
+
+#include "chip.h"
+#include "hardware/lpc17_40_memorymap.h"
+
+/************************************************************************************
+ * Pre-processor Definitions
+ ************************************************************************************/
+/* Register offsets *****************************************************************/
+
+/* General registers (see also LPC17_40_SYSCON_DMAREQSEL_OFFSET in lpc17_40_syscon.h) */
+
+#define LPC17_40_DMA_INTST_OFFSET 0x0000 /* DMA Interrupt Status Register */
+#define LPC17_40_DMA_INTTCST_OFFSET 0x0004 /* DMA Interrupt Terminal Count Request Status Register */
+#define LPC17_40_DMA_INTTCCLR_OFFSET 0x0008 /* DMA Interrupt Terminal Count Request Clear Register */
+#define LPC17_40_DMA_INTERRST_OFFSET 0x000c /* DMA Interrupt Error Status Register */
+#define LPC17_40_DMA_INTERRCLR_OFFSET 0x0010 /* DMA Interrupt Error Clear Register */
+#define LPC17_40_DMA_RAWINTTCST_OFFSET 0x0014 /* DMA Raw Interrupt Terminal Count Status Register */
+#define LPC17_40_DMA_RAWINTERRST_OFFSET 0x0018 /* DMA Raw Error Interrupt Status Register */
+#define LPC17_40_DMA_ENBLDCHNS_OFFSET 0x001c /* DMA Enabled Channel Register */
+#define LPC17_40_DMA_SOFTBREQ_OFFSET 0x0020 /* DMA Software Burst Request Register */
+#define LPC17_40_DMA_SOFTSREQ_OFFSET 0x0024 /* DMA Software Single Request Register */
+#define LPC17_40_DMA_SOFTLBREQ_OFFSET 0x0028 /* DMA Software Last Burst Request Register */
+#define LPC17_40_DMA_SOFTLSREQ_OFFSET 0x002c /* DMA Software Last Single Request Register */
+#define LPC17_40_DMA_CONFIG_OFFSET 0x0030 /* DMA Configuration Register */
+#define LPC17_40_DMA_SYNC_OFFSET 0x0034 /* DMA Synchronization Register */
+
+/* Channel Registers */
+
+#define LPC17_40_NDMACH 8 /* Eight DMA channels */
+#define LPC17_40_DMA_CHAN_OFFSET(n) (0x0100 + ((n) << 5)) /* n=0,1,...,(LPC17_40_NDMACH-1) */
+
+#define LPC17_40_DMACH_SRCADDR_OFFSET 0x0000 /* DMA Channel Source Address Register */
+#define LPC17_40_DMACH_DESTADDR_OFFSET 0x0004 /* DMA Channel Destination Address Register */
+#define LPC17_40_DMACH_LLI_OFFSET 0x0008 /* DMA Channel Linked List Item Register */
+#define LPC17_40_DMACH_CONTROL_OFFSET 0x000c /* DMA Channel Control Register */
+#define LPC17_40_DMACH_CONFIG_OFFSET 0x0010 /* DMA Channel Configuration Register */
+
+#define LPC17_40_DMACH0_SRCADDR_OFFSET (0x100+LPC17_40_DMACH_SRCADDR_OFFSET)
+#define LPC17_40_DMACH0_DESTADDR_OFFSET (0x100+LPC17_40_DMACH_DESTADDR_OFFSET)
+#define LPC17_40_DMACH0_LLI_OFFSET (0x100+LPC17_40_DMACH_LLI_OFFSET)
+#define LPC17_40_DMACH0_CONTROL_OFFSET (0x100+LPC17_40_DMACH_CONTROL_OFFSET)
+#define LPC17_40_DMACH0_CONFIG_OFFSET (0x100+LPC17_40_DMACH_CONFIG_OFFSET)
+
+#define LPC17_40_DMACH1_SRCADDR_OFFSET (0x120+LPC17_40_DMACH_SRCADDR_OFFSET)
+#define LPC17_40_DMACH1_DESTADDR_OFFSET (0x120+LPC17_40_DMACH_DESTADDR_OFFSET)
+#define LPC17_40_DMACH1_LLI_OFFSET (0x120+LPC17_40_DMACH_LLI_OFFSET)
+#define LPC17_40_DMACH1_CONTROL_OFFSET (0x120+LPC17_40_DMACH_CONTROL_OFFSET)
+#define LPC17_40_DMACH1_CONFIG_OFFSET (0x120+LPC17_40_DMACH_CONFIG_OFFSET)
+
+#define LPC17_40_DMACH2_SRCADDR_OFFSET (0x140+LPC17_40_DMACH_SRCADDR_OFFSET)
+#define LPC17_40_DMACH2_DESTADDR_OFFSET (0x140+LPC17_40_DMACH_DESTADDR_OFFSET)
+#define LPC17_40_DMACH2_LLI_OFFSET (0x140+LPC17_40_DMACH_LLI_OFFSET)
+#define LPC17_40_DMACH2_CONTROL_OFFSET (0x140+LPC17_40_DMACH_CONTROL_OFFSET)
+#define LPC17_40_DMACH2_CONFIG_OFFSET (0x140+LPC17_40_DMACH_CONFIG_OFFSET)
+
+#define LPC17_40_DMACH3_SRCADDR_OFFSET (0x160+LPC17_40_DMACH_SRCADDR_OFFSET)
+#define LPC17_40_DMACH3_DESTADDR_OFFSET (0x160+LPC17_40_DMACH_DESTADDR_OFFSET)
+#define LPC17_40_DMACH3_LLI_OFFSET (0x160+LPC17_40_DMACH_LLI_OFFSET)
+#define LPC17_40_DMACH3_CONTROL_OFFSET (0x160+LPC17_40_DMACH_CONTROL_OFFSET)
+#define LPC17_40_DMACH3_CONFIG_OFFSET (0x160+LPC17_40_DMACH_CONFIG_OFFSET)
+
+#define LPC17_40_DMACH4_SRCADDR_OFFSET (0x180+LPC17_40_DMACH_SRCADDR_OFFSET)
+#define LPC17_40_DMACH4_DESTADDR_OFFSET (0x180+LPC17_40_DMACH_DESTADDR_OFFSET)
+#define LPC17_40_DMACH4_LLI_OFFSET (0x180+LPC17_40_DMACH_LLI_OFFSET)
+#define LPC17_40_DMACH4_CONTROL_OFFSET (0x180+LPC17_40_DMACH_CONTROL_OFFSET)
+#define LPC17_40_DMACH4_CONFIG_OFFSET (0x180+LPC17_40_DMACH_CONFIG_OFFSET)
+
+#define LPC17_40_DMACH5_SRCADDR_OFFSET (0x1a0+LPC17_40_DMACH_SRCADDR_OFFSET)
+#define LPC17_40_DMACH5_DESTADDR_OFFSET (0x1a0+LPC17_40_DMACH_DESTADDR_OFFSET)
+#define LPC17_40_DMACH5_LLI_OFFSET (0x1a0+LPC17_40_DMACH_LLI_OFFSET)
+#define LPC17_40_DMACH5_CONTROL_OFFSET (0x1a0+LPC17_40_DMACH_CONTROL_OFFSET)
+#define LPC17_40_DMACH5_CONFIG_OFFSET (0x1a0+LPC17_40_DMACH_CONFIG_OFFSET)
+
+#define LPC17_40_DMACH6_SRCADDR_OFFSET (0x1c0+LPC17_40_DMACH_SRCADDR_OFFSET)
+#define LPC17_40_DMACH6_DESTADDR_OFFSET (0x1c0+LPC17_40_DMACH_DESTADDR_OFFSET)
+#define LPC17_40_DMACH6_LLI_OFFSET (0x1c0+LPC17_40_DMACH_LLI_OFFSET)
+#define LPC17_40_DMACH6_CONTROL_OFFSET (0x1c0+LPC17_40_DMACH_CONTROL_OFFSET)
+#define LPC17_40_DMACH6_CONFIG_OFFSET (0x1c0+LPC17_40_DMACH_CONFIG_OFFSET)
+
+#define LPC17_40_DMACH7_SRCADDR_OFFSET (0x1e0+LPC17_40_DMACH_SRCADDR_OFFSET)
+#define LPC17_40_DMACH7_DESTADDR_OFFSET (0x1e0+LPC17_40_DMACH_DESTADDR_OFFSET)
+#define LPC17_40_DMACH7_LLI_OFFSET (0x1e0+LPC17_40_DMACH_LLI_OFFSET)
+#define LPC17_40_DMACH7_CONTROL_OFFSET (0x1e0+LPC17_40_DMACH_CONTROL_OFFSET)
+#define LPC17_40_DMACH7_CONFIG_OFFSET (0x1e0+LPC17_40_DMACH_CONFIG_OFFSET)
+
+/* Register addresses ***************************************************************/
+/* General registers (see also LPC17_40_SYSCON_DMAREQSEL in lpc17_40_syscon.h) */
+
+#define LPC17_40_DMA_INTST (LPC17_40_GPDMA_BASE+LPC17_40_DMA_INTST_OFFSET)
+#define LPC17_40_DMA_INTTCST (LPC17_40_GPDMA_BASE+LPC17_40_DMA_INTTCST_OFFSET)
+#define LPC17_40_DMA_INTTCCLR (LPC17_40_GPDMA_BASE+LPC17_40_DMA_INTTCCLR_OFFSET)
+#define LPC17_40_DMA_INTERRST (LPC17_40_GPDMA_BASE+LPC17_40_DMA_INTERRST_OFFSET)
+#define LPC17_40_DMA_INTERRCLR (LPC17_40_GPDMA_BASE+LPC17_40_DMA_INTERRCLR_OFFSET)
+#define LPC17_40_DMA_RAWINTTCST (LPC17_40_GPDMA_BASE+LPC17_40_DMA_RAWINTTCST_OFFSET)
+#define LPC17_40_DMA_RAWINTERRST (LPC17_40_GPDMA_BASE+LPC17_40_DMA_RAWINTERRST_OFFSET)
+#define LPC17_40_DMA_ENBLDCHNS (LPC17_40_GPDMA_BASE+LPC17_40_DMA_ENBLDCHNS_OFFSET)
+#define LPC17_40_DMA_SOFTBREQ (LPC17_40_GPDMA_BASE+LPC17_40_DMA_SOFTBREQ_OFFSET)
+#define LPC17_40_DMA_SOFTSREQ (LPC17_40_GPDMA_BASE+LPC17_40_DMA_SOFTSREQ_OFFSET)
+#define LPC17_40_DMA_SOFTLBREQ (LPC17_40_GPDMA_BASE+LPC17_40_DMA_SOFTLBREQ_OFFSET)
+#define LPC17_40_DMA_SOFTLSREQ (LPC17_40_GPDMA_BASE+LPC17_40_DMA_SOFTLSREQ_OFFSET)
+#define LPC17_40_DMA_CONFIG (LPC17_40_GPDMA_BASE+LPC17_40_DMA_CONFIG_OFFSET)
+#define LPC17_40_DMA_SYNC (LPC17_40_GPDMA_BASE+LPC17_40_DMA_SYNC_OFFSET)
+
+/* Channel Registers */
+
+#define LPC17_40_DMACH_BASE(n) (LPC17_40_GPDMA_BASE+LPC17_40_DMA_CHAN_OFFSET(n))
+
+#define LPC17_40_DMACH_SRCADDR(n) (LPC17_40_DMACH_BASE(n)+LPC17_40_DMACH_SRCADDR_OFFSET)
+#define LPC17_40_DMACH_DESTADDR(n) (LPC17_40_DMACH_BASE(n)+LPC17_40_DMACH_DESTADDR_OFFSET)
+#define LPC17_40_DMACH_LLI(n) (LPC17_40_DMACH_BASE(n)+LPC17_40_DMACH_LLI_OFFSET)
+#define LPC17_40_DMACH_CONTROL(n) (LPC17_40_DMACH_BASE(n)+LPC17_40_DMACH_CONTROL_OFFSET)
+#define LPC17_40_DMACH_CONFIG(n) (LPC17_40_DMACH_BASE(n)+LPC17_40_DMACH_CONFIG_OFFSET)
+
+#define LPC17_40_DMACH0_SRCADDR (LPC17_40_GPDMA_BASE+LPC17_40_DMACH0_SRCADDR_OFFSET)
+#define LPC17_40_DMACH0_DESTADDR (LPC17_40_GPDMA_BASE+LPC17_40_DMACH0_DESTADDR_OFFSET)
+#define LPC17_40_DMACH0_LLI (LPC17_40_GPDMA_BASE+LPC17_40_DMACH0_LLI_OFFSET)
+#define LPC17_40_DMACH0_CONTROL (LPC17_40_GPDMA_BASE+LPC17_40_DMACH0_CONTROL_OFFSET)
+#define LPC17_40_DMACH0_CONFIG (LPC17_40_GPDMA_BASE+LPC17_40_DMACH0_CONFIG_OFFSET)
+
+#define LPC17_40_DMACH1_SRCADDR (LPC17_40_GPDMA_BASE+LPC17_40_DMACH1_SRCADDR_OFFSET)
+#define LPC17_40_DMACH1_DESTADDR (LPC17_40_GPDMA_BASE+LPC17_40_DMACH1_DESTADDR_OFFSET)
+#define LPC17_40_DMACH1_LLI (LPC17_40_GPDMA_BASE+LPC17_40_DMACH1_LLI_OFFSET)
+#define LPC17_40_DMACH1_CONTROL (LPC17_40_GPDMA_BASE+LPC17_40_DMACH1_CONTROL_OFFSET)
+#define LPC17_40_DMACH1_CONFIG (LPC17_40_GPDMA_BASE+LPC17_40_DMACH1_CONFIG_OFFSET)
+
+#define LPC17_40_DMACH2_SRCADDR (LPC17_40_GPDMA_BASE+LPC17_40_DMACH2_SRCADDR_OFFSET)
+#define LPC17_40_DMACH2_DESTADDR (LPC17_40_GPDMA_BASE+LPC17_40_DMACH2_DESTADDR_OFFSET)
+#define LPC17_40_DMACH2_LLI (LPC17_40_GPDMA_BASE+LPC17_40_DMACH2_LLI_OFFSET)
+#define LPC17_40_DMACH2_CONTROL (LPC17_40_GPDMA_BASE+LPC17_40_DMACH2_CONTROL_OFFSET)
+#define LPC17_40_DMACH2_CONFIG (LPC17_40_GPDMA_BASE+LPC17_40_DMACH2_CONFIG_OFFSET)
+
+#define LPC17_40_DMACH3_SRCADDR (LPC17_40_GPDMA_BASE+LPC17_40_DMACH3_SRCADDR_OFFSET)
+#define LPC17_40_DMACH3_DESTADDR (LPC17_40_GPDMA_BASE+LPC17_40_DMACH3_DESTADDR_OFFSET)
+#define LPC17_40_DMACH3_LLI (LPC17_40_GPDMA_BASE+LPC17_40_DMACH3_LLI_OFFSET)
+#define LPC17_40_DMACH3_CONTROL (LPC17_40_GPDMA_BASE+LPC17_40_DMACH3_CONTROL_OFFSET)
+#define LPC17_40_DMACH3_CONFIG (LPC17_40_GPDMA_BASE+LPC17_40_DMACH3_CONFIG_OFFSET)
+
+#define LPC17_40_DMACH4_SRCADDR (LPC17_40_GPDMA_BASE+LPC17_40_DMACH4_SRCADDR_OFFSET)
+#define LPC17_40_DMACH4_DESTADDR (LPC17_40_GPDMA_BASE+LPC17_40_DMACH4_DESTADDR_OFFSET)
+#define LPC17_40_DMACH4_LLI (LPC17_40_GPDMA_BASE+LPC17_40_DMACH4_LLI_OFFSET)
+#define LPC17_40_DMACH4_CONTROL (LPC17_40_GPDMA_BASE+LPC17_40_DMACH4_CONTROL_OFFSET)
+#define LPC17_40_DMACH4_CONFIG (LPC17_40_GPDMA_BASE+LPC17_40_DMACH4_CONFIG_OFFSET)
+
+#define LPC17_40_DMACH5_SRCADDR (LPC17_40_GPDMA_BASE+LPC17_40_DMACH5_SRCADDR_OFFSET)
+#define LPC17_40_DMACH5_DESTADDR (LPC17_40_GPDMA_BASE+LPC17_40_DMACH5_DESTADDR_OFFSET)
+#define LPC17_40_DMACH5_LLI (LPC17_40_GPDMA_BASE+LPC17_40_DMACH5_LLI_OFFSET)
+#define LPC17_40_DMACH5_CONTROL (LPC17_40_GPDMA_BASE+LPC17_40_DMACH5_CONTROL_OFFSET)
+#define LPC17_40_DMACH5_CONFIG (LPC17_40_GPDMA_BASE+LPC17_40_DMACH5_CONFIG_OFFSET)
+
+#define LPC17_40_DMACH6_SRCADDR (LPC17_40_GPDMA_BASE+LPC17_40_DMACH6_SRCADDR_OFFSET)
+#define LPC17_40_DMACH6_DESTADDR (LPC17_40_GPDMA_BASE+LPC17_40_DMACH6_DESTADDR_OFFSET)
+#define LPC17_40_DMACH6_LLI (LPC17_40_GPDMA_BASE+LPC17_40_DMACH6_LLI_OFFSET)
+#define LPC17_40_DMACH6_CONTROL (LPC17_40_GPDMA_BASE+LPC17_40_DMACH6_CONTROL_OFFSET)
+#define LPC17_40_DMACH6_CONFIG (LPC17_40_GPDMA_BASE+LPC17_40_DMACH6_CONFIG_OFFSET)
+
+#define LPC17_40_DMACH7_SRCADDR (LPC17_40_GPDMA_BASE+LPC17_40_DMACH7_SRCADDR_OFFSET)
+#define LPC17_40_DMACH7_DESTADDR (LPC17_40_GPDMA_BASE+LPC17_40_DMACH7_DESTADDR_OFFSET)
+#define LPC17_40_DMACH7_LLI (LPC17_40_GPDMA_BASE+LPC17_40_DMACH7_LLI_OFFSET)
+#define LPC17_40_DMACH7_CONTROL (LPC17_40_GPDMA_BASE+LPC17_40_DMACH7_CONTROL_OFFSET)
+#define LPC17_40_DMACH7_CONFIG (LPC17_40_GPDMA_BASE+LPC17_40_DMACH7_CONFIG_OFFSET)
+
+/* Register bit definitions *********************************************************/
+/* DMA Request Connections **********************************************************/
+
+#define LPC17_40_NDMAREQ (16) /* The number of DMA requests */
+#if defined(LPC176x)
+/* Request Numbers */
+
+# define DMA_REQ_SSP0TX (0)
+# define DMA_REQ_SSP0RX (1)
+# define DMA_REQ_SSP1TX (2)
+# define DMA_REQ_SSP1RX (3)
+
+# define DMA_REQ_ADC (4)
+
+# define DMA_REQ_I2SCH0 (5)
+# define DMA_REQ_I2SCH1 (6)
+
+# define DMA_REQ_DAC (7)
+
+# define DMA_REQ_UART0TX (8) /* DMASEL08=0*/
+# define DMA_REQ_UART0RX (9) /* DMASEL09=0*/
+# define DMA_REQ_UART1TX (10) /* DMASEL010=0*/
+# define DMA_REQ_UART1RX (11) /* DMASEL011=0*/
+# define DMA_REQ_UART2TX (12) /* DMASEL012=0*/
+# define DMA_REQ_UART2RX (13) /* DMASEL013=0*/
+# define DMA_REQ_UART3TX (14) /* DMASEL014=0*/
+# define DMA_REQ_UART3RX (15) /* DMASEL015=0*/
+
+# define DMA_REQ_MAT0p0 (8) /* DMASEL08=1 */
+# define DMA_REQ_MAT0p1 (9) /* DMASEL09=1 */
+# define DMA_REQ_MAT1p0 (10) /* DMASEL010=1 */
+# define DMA_REQ_MAT1p1 (11) /* DMASEL011=1 */
+# define DMA_REQ_MAT2p0 (12) /* DMASEL012=1 */
+# define DMA_REQ_MAT2p1 (13) /* DMASEL013=1 */
+# define DMA_REQ_MAT3p0 (14) /* DMASEL014=1 */
+# define DMA_REQ_MAT3p1 (15) /* DMASEL015=1 */
+
+/* DMASEL values. For the LPC176x family, only request numbers 8-15 have
+ * DMASEL bits.
+ */
+
+# define DMA_DMASEL_SSP0TX (0) /* Not applicable */
+# define DMA_DMASEL_SSP0RX (0) /* Not applicable */
+# define DMA_DMASEL_SSP1TX (0) /* Not applicable */
+# define DMA_DMASEL_SSP1RX (0) /* Not applicable */
+
+# define DMA_DMASEL_ADC (0) /* Not applicable */
+
+# define DMA_DMASEL_I2SCH0 (0) /* Not applicable */
+# define DMA_DMASEL_I2SCH1 (0) /* Not applicable */
+
+# define DMA_DMASEL_DAC (0) /* Not applicable */
+
+# define DMA_DMASEL_UART0TX (0)
+# define DMA_DMASEL_UART0RX (0)
+# define DMA_DMASEL_UART1TX (0)
+# define DMA_DMASEL_UART1RX (0)
+# define DMA_DMASEL_UART2TX (0)
+# define DMA_DMASEL_UART2RX (0)
+# define DMA_DMASEL_UART3TX (0)
+# define DMA_DMASEL_UART3RX (0)
+
+# define DMA_DMASEL_MAT0p0 (1)
+# define DMA_DMASEL_MAT0p1 (1)
+# define DMA_DMASEL_MAT1p0 (1)
+# define DMA_DMASEL_MAT1p1 (1)
+# define DMA_DMASEL_MAT2p0 (1)
+# define DMA_DMASEL_MAT2p1 (1)
+# define DMA_DMASEL_MAT3p0 (1)
+# define DMA_DMASEL_MAT3p1 (1)
+
+#elif defined(LPC178x_40xx)
+/* Request Numbers */
+
+# define DMA_REQ_SDCARD (1) /* DMASEL01=0 */
+
+# define DMA_REQ_SSP0TX (2) /* DMASEL02=0 */
+# define DMA_REQ_SSP0RX (3) /* DMASEL03=0 */
+# define DMA_REQ_SSP1TX (4) /* DMASEL04=0 */
+# define DMA_REQ_SSP1RX (5) /* DMASEL05=0 */
+# define DMA_REQ_SSP2TX (6) /* DMASEL06=0 */
+# define DMA_REQ_SSP2RX (7) /* DMASEL07=0 */
+
+# define DMA_REQ_MAT0p0 (0) /* DMASEL00=1 */
+# define DMA_REQ_MAT0p1 (1) /* DMASEL01=1 */
+# define DMA_REQ_MAT1p0 (2) /* DMASEL02=1 */
+# define DMA_REQ_MAT1p1 (3) /* DMASEL03=1 */
+# define DMA_REQ_MAT2p0 (4) /* DMASEL04=1 */
+# define DMA_REQ_MAT2p1 (5) /* DMASEL05=1 */
+# define DMA_REQ_MAT3p0 (14) /* DMASEL14=1 */
+# define DMA_REQ_MAT3p1 (15) /* DMASEL15=1 */
+
+# define DMA_REQ_I2SCH0 (6) /* DMASEL06=1 */
+# define DMA_REQ_I2SCH1 (7) /* DMASEL07=1 */
+
+# define DMA_REQ_ADC (8) /* Not applicable */
+# define DMA_REQ_DAC (9) /* Not applicable */
+
+# define DMA_REQ_UART0TX (10) /* DMASEL10=0 */
+# define DMA_REQ_UART0RX (11) /* DMASEL11=0 */
+# define DMA_REQ_UART1TX (12) /* DMASEL12=0 */
+# define DMA_REQ_UART1RX (13) /* DMASEL13=0 */
+# define DMA_REQ_UART2TX (14) /* DMASEL14=0 */
+# define DMA_REQ_UART2RX (15) /* DMASEL15=0 */
+# define DMA_REQ_UART3TX (10) /* DMASEL10=1 */
+# define DMA_REQ_UART3RX (11) /* DMASEL11=1 */
+# define DMA_REQ_UART4TX (12) /* DMASEL12=1 */
+# define DMA_REQ_UART4RX (13) /* DMASEL13=1 */
+
+/* DMASEL values */
+
+# define DMA_DMASEL_SDCARD (0)
+
+# define DMA_DMASEL_SSP0TX (0)
+# define DMA_DMASEL_SSP0RX (0)
+# define DMA_DMASEL_SSP1TX (0)
+# define DMA_DMASEL_SSP1RX (0)
+# define DMA_DMASEL_SSP2TX (0)
+# define DMA_DMASEL_SSP2RX (0)
+
+# define DMA_DMASEL_MAT0p0 (1)
+# define DMA_DMASEL_MAT0p1 (1)
+# define DMA_DMASEL_MAT1p0 (1)
+# define DMA_DMASEL_MAT1p1 (1)
+# define DMA_DMASEL_MAT2p0 (1)
+# define DMA_DMASEL_MAT2p1 (1)
+# define DMA_DMASEL_MAT3p0 (1)
+# define DMA_DMASEL_MAT3p1 (1)
+
+# define DMA_DMASEL_I2SCH0 (1)
+# define DMA_DMASEL_I2SCH1 (1)
+
+# define DMA_DMASEL_ADC (0) /* Not applicable */
+# define DMA_DMASEL_DAC (0) /* Not applicable */
+
+# define DMA_DMASEL_UART0TX (0)
+# define DMA_DMASEL_UART0RX (0)
+# define DMA_DMASEL_UART1TX (0)
+# define DMA_DMASEL_UART1RX (0)
+# define DMA_DMASEL_UART2TX (0)
+# define DMA_DMASEL_UART2RX (0)
+# define DMA_DMASEL_UART3TX (1)
+# define DMA_DMASEL_UART3RX (1)
+# define DMA_DMASEL_UART4TX (1)
+# define DMA_DMASEL_UART4RX (1)
+#endif
+
+/* General registers (see also LPC17_40_SYSCON_DMAREQSEL in lpc17_40_syscon.h) */
+/* Fach of the following registers, bits 0-7 controls DMA channels 9-7,
+ * respectively. Bits 8-31 are reserved.
+ *
+ * DMA Interrupt Status Register
+ * DMA Interrupt Terminal Count Request Status Register
+ * DMA Interrupt Terminal Count Request Clear Register
+ * DMA Interrupt Error Status Register
+ * DMA Interrupt Error Clear Register
+ * DMA Raw Interrupt Terminal Count Status Register
+ * DMA Raw Error Interrupt Status Register
+ * DMA Enabled Channel Register
+ */
+
+#define DMACH(n) (1 << (n)) /* n=0,1,...7 */
+#define DMACH_ALL (0xff)
+
+/* For each of the following registers, bits 0-15 represent a set of encoded
+ * DMA sources. Bits 16-31 are reserved in each case.
+ *
+ * DMA Software Burst Request Register
+ * DMA Software Single Request Register
+ * DMA Software Last Burst Request Register
+ * DMA Software Last Single Request Register
+ * DMA Synchronization Register
+ */
+
+#if defined(LPC176x)
+# define DMA_REQ_SSP0TX_BIT (1 << DMA_REQ_SSP0TX)
+# define DMA_REQ_SSP0RX_BIT (1 << DMA_REQ_SSP0RX)
+# define DMA_REQ_SSP1TX_BIT (1 << DMA_REQ_SSP1TX)
+# define DMA_REQ_SSP1RX_BIT (1 << DMA_REQ_SSP0RX)
+# define DMA_REQ_ADC_BIT (1 << DMA_REQ_ADC)
+# define DMA_REQ_I2SCH0_BIT (1 << DMA_REQ_I2SCH0)
+# define DMA_REQ_I2SCH1_BIT (1 << DMA_REQ_I2SCH1)
+# define DMA_REQ_DAC_BIT (1 << DMA_REQ_DAC)
+
+# define DMA_REQ_UART0TX_BIT (1 << DMA_REQ_UART0TX)
+# define DMA_REQ_UART0RX_BIT (1 << DMA_REQ_UART0RX)
+# define DMA_REQ_UART1TX_BIT (1 << DMA_REQ_UART1TX)
+# define DMA_REQ_UART1RX_BIT (1 << DMA_REQ_UART1RX)
+# define DMA_REQ_UART2TX_BIT (1 << DMA_REQ_UART2TX)
+# define DMA_REQ_UART2RX_BIT (1 << DMA_REQ_UART2RX)
+# define DMA_REQ_UART3TX_BIT (1 << DMA_REQ_UART3TX)
+# define DMA_REQ_UART3RX_BIT (1 << DMA_REQ_UART3RX)
+
+# define DMA_REQ_MAT0p0_BIT (1 << DMA_REQ_MAT0p0)
+# define DMA_REQ_MAT0p1_BIT (1 << DMA_REQ_MAT0p1)
+# define DMA_REQ_MAT1p0_BIT (1 << DMA_REQ_MAT1p0)
+# define DMA_REQ_MAT1p1_BIT (1 << DMA_REQ_MAT1p1)
+# define DMA_REQ_MAT2p0_BIT (1 << DMA_REQ_MAT2p0)
+# define DMA_REQ_MAT2p1_BIT (1 << DMA_REQ_MAT2p1)
+# define DMA_REQ_MAT3p0_BIT (1 << DMA_REQ_MAT3p0)
+# define DMA_REQ_MAT3p1_BIT (1 << DMA_REQ_MAT3p1)
+#elif defined(LPC178x_40xx)
+# define DMA_REQ_SDCARD_BIT (1 << DMA_REQ_SDCARD)
+
+# define DMA_REQ_SSP0TX_BIT (1 << DMA_REQ_SSP0TX)
+# define DMA_REQ_SSP0RX_BIT (1 << DMA_REQ_SSP0RX)
+# define DMA_REQ_SSP1TX_BIT (1 << DMA_REQ_SSP1TX)
+# define DMA_REQ_SSP1RX_BIT (1 << DMA_REQ_SSP1RX)
+# define DMA_REQ_SSP2TX_BIT (1 << DMA_REQ_SSP2TX)
+# define DMA_REQ_SSP2RX_BIT (1 << DMA_REQ_SSP2RX)
+
+# define DMA_REQ_MAT0p0_BIT (1 << DMA_REQ_MAT0p0)
+# define DMA_REQ_MAT0p1_BIT (1 << DMA_REQ_MAT0p1)
+# define DMA_REQ_MAT1p0_BIT (1 << DMA_REQ_MAT1p0)
+# define DMA_REQ_MAT1p1_BIT (1 << DMA_REQ_MAT1p1)
+# define DMA_REQ_MAT2p0_BIT (1 << DMA_REQ_MAT2p0)
+# define DMA_REQ_MAT2p1_BIT (1 << DMA_REQ_MAT2p1)
+# define DMA_REQ_MAT3p0_BIT (1 << DMA_REQ_MAT3p0)
+# define DMA_REQ_MAT3p1_BIT (1 << DMA_REQ_MAT3p1)
+
+# define DMA_REQ_I2SCH0_BIT (1 << DMA_REQ_I2SCH0)
+# define DMA_REQ_I2SCH1_BIT (1 << DMA_REQ_I2SCH1)
+
+# define DMA_REQ_ADC_BIT (1 << DMA_REQ_ADC)
+# define DMA_REQ_DAC_BIT (1 << DMA_REQ_DAC)
+
+# define DMA_REQ_UART0TX_BIT (1 << DMA_REQ_UART0TX)
+# define DMA_REQ_UART0RX_BIT (1 << DMA_REQ_UART0RX)
+# define DMA_REQ_UART1TX_BIT (1 << DMA_REQ_UART1TX)
+# define DMA_REQ_UART1RX_BIT (1 << DMA_REQ_UART1RX)
+# define DMA_REQ_UART2TX_BIT (1 << DMA_REQ_UART2TX)
+# define DMA_REQ_UART2RX_BIT (1 << DMA_REQ_UART2RX)
+# define DMA_REQ_UART3TX_BIT (1 << DMA_REQ_UART3TX)
+# define DMA_REQ_UART3RX_BIT (1 << DMA_REQ_UART3RX)
+# define DMA_REQ_UART4TX_BIT (1 << DMA_REQ_UART4TX)
+# define DMA_REQ_UART4RX_BIT (1 << DMA_REQ_UART4RX)
+#endif
+
+/* DMA Configuration Register */
+
+#define DMA_CONFIG_E (1 << 0) /* Bit 0: DMA Controller enable */
+#define DMA_CONFIG_M (1 << 1) /* Bit 1: AHB Master endianness configuration */
+ /* Bits 2-31: Reserved */
+/* Channel Registers */
+
+/* DMA Channel Source Address Register (Bits 0-31: Source Address) */
+/* DMA Channel Destination Address Register Bits 0-31: Destination Address) */
+/* DMA Channel Linked List Item Register (Bits 0-31: Address of next link list
+ * item. Bits 0-1 must be zero.
+ */
+
+/* DMA Channel Control Register */
+
+#define DMACH_CONTROL_XFRSIZE_SHIFT (0) /* Bits 0-11: Transfer size */
+#define DMACH_CONTROL_XFRSIZE_MASK (0x0fff << DMACH_CONTROL_XFRSIZE_SHIFT)
+# define DMACH_CONTROL_XFRSIZE(n) ((n) << DMACH_CONTROL_XFRSIZE_SHIFT)
+#define DMACH_CONTROL_SBSIZE_SHIFT (12) /* Bits 12-14: Source burst size */
+#define DMACH_CONTROL_SBSIZE_MASK (7 << DMACH_CONTROL_SBSIZE_SHIFT)
+# define DMACH_CONTROL_SBSIZE_1 (0 << DMACH_CONTROL_SBSIZE_SHIFT)
+# define DMACH_CONTROL_SBSIZE_4 (1 << DMACH_CONTROL_SBSIZE_SHIFT)
+# define DMACH_CONTROL_SBSIZE_8 (2 << DMACH_CONTROL_SBSIZE_SHIFT)
+# define DMACH_CONTROL_SBSIZE_16 (3 << DMACH_CONTROL_SBSIZE_SHIFT)
+# define DMACH_CONTROL_SBSIZE_32 (4 << DMACH_CONTROL_SBSIZE_SHIFT)
+# define DMACH_CONTROL_SBSIZE_64 (5 << DMACH_CONTROL_SBSIZE_SHIFT)
+# define DMACH_CONTROL_SBSIZE_128 (6 << DMACH_CONTROL_SBSIZE_SHIFT)
+# define DMACH_CONTROL_SBSIZE_256 (7 << DMACH_CONTROL_SBSIZE_SHIFT)
+#define DMACH_CONTROL_DBSIZE_SHIFT (15) /* Bits 15-17: Destination burst size */
+#define DMACH_CONTROL_DBSIZE_MASK (7 << DMACH_CONTROL_DBSIZE_SHIFT)
+# define DMACH_CONTROL_DBSIZE_1 (0 << DMACH_CONTROL_DBSIZE_SHIFT)
+# define DMACH_CONTROL_DBSIZE_4 (1 << DMACH_CONTROL_DBSIZE_SHIFT)
+# define DMACH_CONTROL_DBSIZE_8 (2 << DMACH_CONTROL_DBSIZE_SHIFT)
+# define DMACH_CONTROL_DBSIZE_16 (3 << DMACH_CONTROL_DBSIZE_SHIFT)
+# define DMACH_CONTROL_DBSIZE_32 (4 << DMACH_CONTROL_DBSIZE_SHIFT)
+# define DMACH_CONTROL_DBSIZE_64 (5 << DMACH_CONTROL_DBSIZE_SHIFT)
+# define DMACH_CONTROL_DBSIZE_128 (6 << DMACH_CONTROL_DBSIZE_SHIFT)
+# define DMACH_CONTROL_DBSIZE_256 (7 << DMACH_CONTROL_DBSIZE_SHIFT)
+#define DMACH_CONTROL_SWIDTH_SHIFT (18) /* Bits 18-20: Source transfer width */
+#define DMACH_CONTROL_SWIDTH_MASK (7 << DMACH_CONTROL_SWIDTH_SHIFT)
+# define DMACH_CONTROL_SWIDTH_8BIT (0 << DMACH_CONTROL_SWIDTH_SHIFT) /* Byte (8-bit) */
+# define DMACH_CONTROL_SWIDTH_16BIT (1 << DMACH_CONTROL_SWIDTH_SHIFT) /* Halfword (16-bit) */
+# define DMACH_CONTROL_SWIDTH_32BIT (2 << DMACH_CONTROL_SWIDTH_SHIFT) /* Word (32-bit) */
+#define DMACH_CONTROL_DWIDTH_SHIFT (21) /* Bits 21-23: Destination transfer width */
+#define DMACH_CONTROL_DWIDTH_MASK (7 << DMACH_CONTROL_DWIDTH_SHIFT)
+# define DMACH_CONTROL_DWIDTH_8BIT (0 << DMACH_CONTROL_DWIDTH_SHIFT) /* Byte (8-bit) */
+# define DMACH_CONTROL_DWIDTH_16BIT (1 << DMACH_CONTROL_DWIDTH_SHIFT) /* Halfword (16-bit) */
+# define DMACH_CONTROL_DWIDTH_32BIT (2 << DMACH_CONTROL_DWIDTH_SHIFT) /* Word (32-bit) */
+#define DMACH_CONTROL_SI (1 << 26) /* Bit 26: Source increment */
+#define DMACH_CONTROL_DI (1 << 27) /* Bit 27: Destination increment */
+#define DMACH_CONTROL_PROT1 (1 << 28) /* Bit 28: User/priviledged mode */
+#define DMACH_CONTROL_PROT2 (1 << 29) /* Bit 29: Bufferable */
+#define DMACH_CONTROL_PROT3 (1 << 30) /* Bit 30: Cacheable */
+#define DMACH_CONTROL_I (1 << 31) /* Bit 31: Terminal count interrupt enable */
+
+/* DMA Channel Configuration Register */
+
+#define DMACH_CONFIG_E (1 << 0) /* Bit 0: Channel enable */
+#define DMACH_CONFIG_SRCPER_SHIFT (1) /* Bits 1-5: Source peripheral */
+#define DMACH_CONFIG_SRCPER_MASK (31 << DMACH_CONFIG_SRCPER_SHIFT)
+# define DMACH_CONFIG_SRCPER_SDCARD (DMA_REQ_SDCARD << DMACH_CONFIG_SRCPER_SHIFT)
+# define DMACH_CONFIG_SRCPER_SSP0TX (DMA_REQ_SSP0TX << DMACH_CONFIG_SRCPER_SHIFT)
+# define DMACH_CONFIG_SRCPER_SSP0RX (DMA_REQ_SSP0RX << DMACH_CONFIG_SRCPER_SHIFT)
+# define DMACH_CONFIG_SRCPER_SSP1TX (DMA_REQ_SSP1TX << DMACH_CONFIG_SRCPER_SHIFT)
+# define DMACH_CONFIG_SRCPER_SSP1RX (DMA_REQ_SSP1RX << DMACH_CONFIG_SRCPER_SHIFT)
+# define DMACH_CONFIG_SRCPER_SSP2TX (DMA_REQ_SSP2TX << DMACH_CONFIG_SRCPER_SHIFT)
+# define DMACH_CONFIG_SRCPER_SSP2RX (DMA_REQ_SSP2RX << DMACH_CONFIG_SRCPER_SHIFT)
+# define DMACH_CONFIG_SRCPER_I2SCH0 (DMA_REQ_I2SCH0 << DMACH_CONFIG_SRCPER_SHIFT)
+# define DMACH_CONFIG_SRCPER_I2SCH1 (DMA_REQ_I2SCH1 << DMACH_CONFIG_SRCPER_SHIFT)
+# define DMACH_CONFIG_SRCPER_ADC (DMA_REQ_ADC << DMACH_CONFIG_SRCPER_SHIFT)
+# define DMACH_CONFIG_SRCPER_DAC (DMA_REQ_DAC << DMACH_CONFIG_SRCPER_SHIFT)
+# define DMACH_CONFIG_SRCPER_UART0TX (DMA_REQ_UART0TX << DMACH_CONFIG_SRCPER_SHIFT)
+# define DMACH_CONFIG_SRCPER_UART0RX (DMA_REQ_UART0RX << DMACH_CONFIG_SRCPER_SHIFT)
+# define DMACH_CONFIG_SRCPER_UART1TX (DMA_REQ_UART1TX << DMACH_CONFIG_SRCPER_SHIFT)
+# define DMACH_CONFIG_SRCPER_UART1RX (DMA_REQ_UART1RX << DMACH_CONFIG_SRCPER_SHIFT)
+# define DMACH_CONFIG_SRCPER_UART2TX (DMA_REQ_UART2TX << DMACH_CONFIG_SRCPER_SHIFT)
+# define DMACH_CONFIG_SRCPER_UART2RX (DMA_REQ_UART2RX << DMACH_CONFIG_SRCPER_SHIFT)
+# define DMACH_CONFIG_SRCPER_UART3TX (DMA_REQ_UART3TX << DMACH_CONFIG_SRCPER_SHIFT)
+# define DMACH_CONFIG_SRCPER_UART3RX (DMA_REQ_UART3RX << DMACH_CONFIG_SRCPER_SHIFT)
+# define DMACH_CONFIG_SRCPER_UART4TX (DMA_REQ_UART4TX << DMACH_CONFIG_SRCPER_SHIFT)
+# define DMACH_CONFIG_SRCPER_UART4RX (DMA_REQ_UART4RX << DMACH_CONFIG_SRCPER_SHIFT)
+# define DMACH_CONFIG_SRCPER_MAT0p0 (DMA_REQ_MAT0p0 << DMACH_CONFIG_SRCPER_SHIFT)
+# define DMACH_CONFIG_SRCPER_MAT0p1 (DMA_REQ_MAT0p1 << DMACH_CONFIG_SRCPER_SHIFT)
+# define DMACH_CONFIG_SRCPER_MAT1p0 (DMA_REQ_MAT1p0 << DMACH_CONFIG_SRCPER_SHIFT)
+# define DMACH_CONFIG_SRCPER_MAT1p1 (DMA_REQ_MAT1p1 << DMACH_CONFIG_SRCPER_SHIFT)
+# define DMACH_CONFIG_SRCPER_MAT2p0 (DMA_REQ_MAT2p0 << DMACH_CONFIG_SRCPER_SHIFT)
+# define DMACH_CONFIG_SRCPER_MAT2p1 (DMA_REQ_MAT2p1 << DMACH_CONFIG_SRCPER_SHIFT)
+# define DMACH_CONFIG_SRCPER_MAT3p0 (DMA_REQ_MAT3p0 << DMACH_CONFIG_SRCPER_SHIFT)
+# define DMACH_CONFIG_SRCPER_MAT3p1 (DMA_REQ_MAT3p1 << DMACH_CONFIG_SRCPER_SHIFT)
+#define DMACH_CONFIG_DSTPER_SHIFT (6) /* Bits 6-10: Destination peripheral */
+#define DMACH_CONFIG_DSTPER_MASK (31 << DMACH_CONFIG_DSTPER_SHIFT)
+# define DMACH_CONFIG_DSTPER_SDCARD (DMA_REQ_SDCARD << DMACH_CONFIG_DSTPER_SHIFT)
+# define DMACH_CONFIG_DSTPER_SSP0TX (DMA_REQ_SSP0TX << DMACH_CONFIG_DSTPER_SHIFT)
+# define DMACH_CONFIG_DSTPER_SSP0RX (DMA_REQ_SSP0RX << DMACH_CONFIG_DSTPER_SHIFT)
+# define DMACH_CONFIG_DSTPER_SSP1TX (DMA_REQ_SSP1TX << DMACH_CONFIG_DSTPER_SHIFT)
+# define DMACH_CONFIG_DSTPER_SSP1RX (DMA_REQ_SSP1RX << DMACH_CONFIG_DSTPER_SHIFT)
+# define DMACH_CONFIG_DSTPER_SSP2TX (DMA_REQ_SSP2TX << DMACH_CONFIG_DSTPER_SHIFT)
+# define DMACH_CONFIG_DSTPER_SSP2RX (DMA_REQ_SSP2RX << DMACH_CONFIG_DSTPER_SHIFT)
+# define DMACH_CONFIG_DSTPER_I2SCH0 (DMA_REQ_I2SCH0 << DMACH_CONFIG_DSTPER_SHIFT)
+# define DMACH_CONFIG_DSTPER_I2SCH1 (DMA_REQ_I2SCH1 << DMACH_CONFIG_DSTPER_SHIFT)
+# define DMACH_CONFIG_DSTPER_ADC (DMA_REQ_ADC << DMACH_CONFIG_DSTPER_SHIFT)
+# define DMACH_CONFIG_DSTPER_DAC (DMA_REQ_DAC << DMACH_CONFIG_DSTPER_SHIFT)
+# define DMACH_CONFIG_DSTPER_UART0TX (DMA_REQ_UART0TX << DMACH_CONFIG_DSTPER_SHIFT)
+# define DMACH_CONFIG_DSTPER_UART0RX (DMA_REQ_UART0RX << DMACH_CONFIG_DSTPER_SHIFT)
+# define DMACH_CONFIG_DSTPER_UART1TX (DMA_REQ_UART1TX << DMACH_CONFIG_DSTPER_SHIFT)
+# define DMACH_CONFIG_DSTPER_UART1RX (DMA_REQ_UART1RX << DMACH_CONFIG_DSTPER_SHIFT)
+# define DMACH_CONFIG_DSTPER_UART2TX (DMA_REQ_UART2TX << DMACH_CONFIG_DSTPER_SHIFT)
+# define DMACH_CONFIG_DSTPER_UART2RX (DMA_REQ_UART2RX << DMACH_CONFIG_DSTPER_SHIFT)
+# define DMACH_CONFIG_DSTPER_UART3TX (DMA_REQ_UART3TX << DMACH_CONFIG_DSTPER_SHIFT)
+# define DMACH_CONFIG_DSTPER_UART3RX (DMA_REQ_UART3RX << DMACH_CONFIG_DSTPER_SHIFT)
+# define DMACH_CONFIG_DSTPER_UART4TX (DMA_REQ_UART4TX << DMACH_CONFIG_DSTPER_SHIFT)
+# define DMACH_CONFIG_DSTPER_UART4RX (DMA_REQ_UART4RX << DMACH_CONFIG_DSTPER_SHIFT)
+# define DMACH_CONFIG_DSTPER_MAT0p0 (DMA_REQ_MAT0p0 << DMACH_CONFIG_DSTPER_SHIFT)
+# define DMACH_CONFIG_DSTPER_MAT0p1 (DMA_REQ_MAT0p1 << DMACH_CONFIG_DSTPER_SHIFT)
+# define DMACH_CONFIG_DSTPER_MAT1p0 (DMA_REQ_MAT1p0 << DMACH_CONFIG_DSTPER_SHIFT)
+# define DMACH_CONFIG_DSTPER_MAT1p1 (DMA_REQ_MAT1p1 << DMACH_CONFIG_DSTPER_SHIFT)
+# define DMACH_CONFIG_DSTPER_MAT2p0 (DMA_REQ_MAT2p0 << DMACH_CONFIG_DSTPER_SHIFT)
+# define DMACH_CONFIG_DSTPER_MAT2p1 (DMA_REQ_MAT2p1 << DMACH_CONFIG_DSTPER_SHIFT)
+# define DMACH_CONFIG_DSTPER_MAT3p0 (DMA_REQ_MAT3p0 << DMACH_CONFIG_DSTPER_SHIFT)
+# define DMACH_CONFIG_DSTPER_MAT3p1 (DMA_REQ_MAT3p1 << DMACH_CONFIG_DSTPER_SHIFT)
+#define DMACH_CONFIG_XFRTYPE_SHIFT (11) /* Bits 11-13: Type of transfer */
+#define DMACH_CONFIG_XFRTYPE_MASK (7 << DMACH_CONFIG_XFRTYPE_SHIFT)
+ /* Flow controller = DMA controller */
+# define DMACH_CONFIG_XFRTYPE_M2M (0 << DMACH_CONFIG_XFRTYPE_SHIFT) /* Memory to memory */
+# define DMACH_CONFIG_XFRTYPE_M2P (1 << DMACH_CONFIG_XFRTYPE_SHIFT) /* Memory to peripheral */
+# define DMACH_CONFIG_XFRTYPE_P2M (2 << DMACH_CONFIG_XFRTYPE_SHIFT) /* Peripheral to memory */
+# define DMACH_CONFIG_XFRTYPE_P2P (3 << DMACH_CONFIG_XFRTYPE_SHIFT) /* Peripheral to peripheral */
+#ifdef LPC178x_40xx
+ /* Flow controller = Dest peripheral */
+# define DMACH_CONFIG_XFRTYPE_M2M_DC (4 << DMACH_CONFIG_XFRTYPE_SHIFT) /* Memory to memory */
+# define DMACH_CONFIG_XFRTYPE_M2P_DC (5 << DMACH_CONFIG_XFRTYPE_SHIFT) /* Memory to peripheral */
+ /* Flow controller = Source peripheral */
+# define DMACH_CONFIG_XFRTYPE_P2M_SC (6 << DMACH_CONFIG_XFRTYPE_SHIFT) /* Peripheral to memory */
+# define DMACH_CONFIG_XFRTYPE_P2P_SC (7 << DMACH_CONFIG_XFRTYPE_SHIFT) /* Peripheral to peripheral */
+#endif
+#define DMACH_CONFIG_IE (1 << 14) /* Bit 14: Interrupt error mask */
+#define DMACH_CONFIG_ITC (1 << 15) /* Bit 15: Terminal count interrupt mask */
+#define DMACH_CONFIG_L (1 << 16) /* Bit 16: Lock */
+#define DMACH_CONFIG_A (1 << 17) /* Bit 17: Active */
+#define DMACH_CONFIG_H (1 << 18) /* Bit 18: Halt */
+ /* Bits 19-31: Reserved */
+
+/************************************************************************************
+ * Public Types
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Data
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+#endif /* __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC17_40_GPDMA_H */
diff --git a/arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_gpio.h b/arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_gpio.h
new file mode 100644
index 00000000000..b18e7075447
--- /dev/null
+++ b/arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_gpio.h
@@ -0,0 +1,210 @@
+/************************************************************************************
+ * arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_gpio.h
+ *
+ * Copyright (C) 2010, 2013 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ * 3. Neither the name NuttX 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 THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#ifndef __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC17_40_CHIP_GPIO_H
+#define __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC17_40_CHIP_GPIO_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include
+
+#include "chip.h"
+#include "hardware/lpc17_40_memorymap.h"
+
+/************************************************************************************
+ * Pre-processor Definitions
+ ************************************************************************************/
+
+/* Register offsets *****************************************************************/
+/* GPIO block register offsets ******************************************************/
+
+#define LPC17_40_FIO0_OFFSET 0x0000
+#define LPC17_40_FIO1_OFFSET 0x0020
+#define LPC17_40_FIO2_OFFSET 0x0040
+#define LPC17_40_FIO3_OFFSET 0x0060
+#define LPC17_40_FIO4_OFFSET 0x0080
+#ifdef LPC178x_40xx
+# define LPC17_40_FIO5_OFFSET 0x00a0
+#endif
+
+#define LPC17_40_FIO_DIR_OFFSET 0x0000 /* Fast GPIO Port Direction control */
+#define LPC17_40_FIO_MASK_OFFSET 0x0010 /* Fast Mask register for ports */
+#define LPC17_40_FIO_PIN_OFFSET 0x0014 /* Fast Port Pin value registers */
+#define LPC17_40_FIO_SET_OFFSET 0x0018 /* Fast Port Output Set registers */
+#define LPC17_40_FIO_CLR_OFFSET 0x001c /* Fast Port Output Clear register */
+
+/* GPIO interrupt block register offsets ********************************************/
+
+#define LPC17_40_GPIOINT_OFFSET(n) (0x10*(n) + 0x80)
+#define LPC17_40_GPIOINT0_OFFSET 0x0080
+#define LPC17_40_GPIOINT2_OFFSET 0x00a0
+
+#define LPC17_40_GPIOINT_IOINTSTATUS_OFFSET 0x0000 /* GPIO overall Interrupt Status */
+#define LPC17_40_GPIOINT_INTSTATR_OFFSET 0x0004 /* GPIO Interrupt Status Rising edge */
+#define LPC17_40_GPIOINT_INTSTATF_OFFSET 0x0008 /* GPIO Interrupt Status Falling edge */
+#define LPC17_40_GPIOINT_INTCLR_OFFSET 0x000c /* GPIO Interrupt Clear */
+#define LPC17_40_GPIOINT_INTENR_OFFSET 0x0010 /* GPIO Interrupt Enable Rising edge */
+#define LPC17_40_GPIOINT_INTENF_OFFSET 0x0014 /* GPIO Interrupt Enable Falling edge */
+
+/* Register addresses ***************************************************************/
+/* GPIO block register addresses ****************************************************/
+
+#define LPC17_40_FIO_BASE(n) (LPC17_40_GPIO_BASE+LPC17_40_GPIOINT_OFFSET(n))
+#define LPC17_40_FIO0_BASE (LPC17_40_GPIO_BASE+LPC17_40_FIO0_OFFSET)
+#define LPC17_40_FIO1_BASE (LPC17_40_GPIO_BASE+LPC17_40_FIO1_OFFSET)
+#define LPC17_40_FIO2_BASE (LPC17_40_GPIO_BASE+LPC17_40_FIO2_OFFSET)
+#define LPC17_40_FIO3_BASE (LPC17_40_GPIO_BASE+LPC17_40_FIO3_OFFSET)
+#define LPC17_40_FIO4_BASE (LPC17_40_GPIO_BASE+LPC17_40_FIO4_OFFSET)
+#ifdef LPC178x_40xx
+# define LPC17_40_FIO5_BASE (LPC17_40_GPIO_BASE+LPC17_40_FIO5_OFFSET)
+#endif
+
+#define LPC17_40_FIO_DIR(n) (LPC17_40_FIO_BASE(n)+LPC17_40_FIO_DIR_OFFSET)
+#define LPC17_40_FIO_MASK(n) (LPC17_40_FIO_BASE(n)+LPC17_40_FIO_MASK_OFFSET)
+#define LPC17_40_FIO_PIN(n) (LPC17_40_FIO_BASE(n)+LPC17_40_FIO_PIN_OFFSET)
+#define LPC17_40_FIO_SET(n) (LPC17_40_FIO_BASE(n)+LPC17_40_FIO_SET_OFFSET)
+#define LPC17_40_FIO_CLR(n) (LPC17_40_FIO_BASE(n)+LPC17_40_FIO_CLR_OFFSET)
+
+#define LPC17_40_FIO0_DIR (LPC17_40_FIO0_BASE+LPC17_40_FIO_DIR_OFFSET)
+#define LPC17_40_FIO0_MASK (LPC17_40_FIO0_BASE+LPC17_40_FIO_MASK_OFFSET)
+#define LPC17_40_FIO0_PIN (LPC17_40_FIO0_BASE+LPC17_40_FIO_PIN_OFFSET)
+#define LPC17_40_FIO0_SET (LPC17_40_FIO0_BASE+LPC17_40_FIO_SET_OFFSET)
+#define LPC17_40_FIO0_CLR (LPC17_40_FIO0_BASE+LPC17_40_FIO_CLR_OFFSET)
+
+#define LPC17_40_FIO1_DIR (LPC17_40_FIO1_BASE+LPC17_40_FIO_DIR_OFFSET)
+#define LPC17_40_FIO1_MASK (LPC17_40_FIO1_BASE+LPC17_40_FIO_MASK_OFFSET)
+#define LPC17_40_FIO1_PIN (LPC17_40_FIO1_BASE+LPC17_40_FIO_PIN_OFFSET)
+#define LPC17_40_FIO1_SET (LPC17_40_FIO1_BASE+LPC17_40_FIO_SET_OFFSET)
+#define LPC17_40_FIO1_CLR (LPC17_40_FIO1_BASE+LPC17_40_FIO_CLR_OFFSET)
+
+#define LPC17_40_FIO2_DIR (LPC17_40_FIO2_BASE+LPC17_40_FIO_DIR_OFFSET)
+#define LPC17_40_FIO2_MASK (LPC17_40_FIO2_BASE+LPC17_40_FIO_MASK_OFFSET)
+#define LPC17_40_FIO2_PIN (LPC17_40_FIO2_BASE+LPC17_40_FIO_PIN_OFFSET)
+#define LPC17_40_FIO2_SET (LPC17_40_FIO2_BASE+LPC17_40_FIO_SET_OFFSET)
+#define LPC17_40_FIO2_CLR (LPC17_40_FIO2_BASE+LPC17_40_FIO_CLR_OFFSET)
+
+#define LPC17_40_FIO3_DIR (LPC17_40_FIO3_BASE+LPC17_40_FIO_DIR_OFFSET)
+#define LPC17_40_FIO3_MASK (LPC17_40_FIO3_BASE+LPC17_40_FIO_MASK_OFFSET)
+#define LPC17_40_FIO3_PIN (LPC17_40_FIO3_BASE+LPC17_40_FIO_PIN_OFFSET)
+#define LPC17_40_FIO3_SET (LPC17_40_FIO3_BASE+LPC17_40_FIO_SET_OFFSET)
+#define LPC17_40_FIO3_CLR (LPC17_40_FIO3_BASE+LPC17_40_FIO_CLR_OFFSET)
+
+#define LPC17_40_FIO4_DIR (LPC17_40_FIO4_BASE+LPC17_40_FIO_DIR_OFFSET)
+#define LPC17_40_FIO4_MASK (LPC17_40_FIO4_BASE+LPC17_40_FIO_MASK_OFFSET)
+#define LPC17_40_FIO4_PIN (LPC17_40_FIO4_BASE+LPC17_40_FIO_PIN_OFFSET)
+#define LPC17_40_FIO4_SET (LPC17_40_FIO4_BASE+LPC17_40_FIO_SET_OFFSET)
+#define LPC17_40_FIO4_CLR (LPC17_40_FIO4_BASE+LPC17_40_FIO_CLR_OFFSET)
+
+#ifdef LPC178x_40xx
+# define LPC17_40_FIO5_DIR (LPC17_40_FIO5_BASE+LPC17_40_FIO_DIR_OFFSET)
+# define LPC17_40_FIO5_MASK (LPC17_40_FIO5_BASE+LPC17_40_FIO_MASK_OFFSET)
+# define LPC17_40_FIO5_PIN (LPC17_40_FIO5_BASE+LPC17_40_FIO_PIN_OFFSET)
+# define LPC17_40_FIO5_SET (LPC17_40_FIO5_BASE+LPC17_40_FIO_SET_OFFSET)
+# define LPC17_40_FIO5_CLR (LPC17_40_FIO5_BASE+LPC17_40_FIO_CLR_OFFSET)
+#endif
+
+/* GPIO interrupt block register addresses ******************************************/
+
+#define LPC17_40_GPIOINTn_BASE(n) (LPC17_40_GPIOINT_BASE+LPC17_40_GPIOINT_OFFSET(n))
+#define LPC17_40_GPIOINT0_BASE (LPC17_40_GPIOINT_BASE+LPC17_40_GPIOINT0_OFFSET)
+#define LPC17_40_GPIOINT2_BASE (LPC17_40_GPIOINT_BASE+LPC17_40_GPIOINT2_OFFSET)
+
+#define LPC17_40_GPIOINT_IOINTSTATUS (LPC17_40_GPIOINT0_BASE+LPC17_40_GPIOINT_IOINTSTATUS_OFFSET)
+
+#define LPC17_40_GPIOINT_INTSTATR(n) (LPC17_40_GPIOINTn_BASE(n)+LPC17_40_GPIOINT_INTSTATR_OFFSET)
+#define LPC17_40_GPIOINT_INTSTATF(n) (LPC17_40_GPIOINTn_BASE(n)+LPC17_40_GPIOINT_INTSTATF_OFFSET)
+#define LPC17_40_GPIOINT_INTCLR(n) (LPC17_40_GPIOINTn_BASE(n)+LPC17_40_GPIOINT_INTCLR_OFFSET)
+#define LPC17_40_GPIOINT_INTENR(n) (LPC17_40_GPIOINTn_BASE(n)+LPC17_40_GPIOINT_INTENR_OFFSET)
+#define LPC17_40_GPIOINT_INTENF(n) (LPC17_40_GPIOINTn_BASE(n)+LPC17_40_GPIOINT_INTENF_OFFSET)
+
+/* Pins P0.0-31 */
+
+#define LPC17_40_GPIOINT0_INTSTATR (LPC17_40_GPIOINT0_BASE+LPC17_40_GPIOINT_INTSTATR_OFFSET)
+#define LPC17_40_GPIOINT0_INTSTATF (LPC17_40_GPIOINT0_BASE+LPC17_40_GPIOINT_INTSTATF_OFFSET)
+#define LPC17_40_GPIOINT0_INTCLR (LPC17_40_GPIOINT0_BASE+LPC17_40_GPIOINT_INTCLR_OFFSET)
+#define LPC17_40_GPIOINT0_INTENR (LPC17_40_GPIOINT0_BASE+LPC17_40_GPIOINT_INTENR_OFFSET)
+#define LPC17_40_GPIOINT0_INTENF (LPC17_40_GPIOINT0_BASE+LPC17_40_GPIOINT_INTENF_OFFSET)
+
+/* Pins P2.0-31 */
+
+#define LPC17_40_GPIOINT2_INTSTATR (LPC17_40_GPIOINT2_BASE+LPC17_40_GPIOINT_INTSTATR_OFFSET)
+#define LPC17_40_GPIOINT2_INTSTATF (LPC17_40_GPIOINT2_BASE+LPC17_40_GPIOINT_INTSTATF_OFFSET)
+#define LPC17_40_GPIOINT2_INTCLR (LPC17_40_GPIOINT2_BASE+LPC17_40_GPIOINT_INTCLR_OFFSET)
+#define LPC17_40_GPIOINT2_INTENR (LPC17_40_GPIOINT2_BASE+LPC17_40_GPIOINT_INTENR_OFFSET)
+#define LPC17_40_GPIOINT2_INTENF (LPC17_40_GPIOINT2_BASE+LPC17_40_GPIOINT_INTENF_OFFSET)
+
+/* Register bit definitions *********************************************************/
+/* GPIO block register bit definitions **********************************************/
+
+/* Fast GPIO Port Direction control registers (FIODIR) */
+/* Fast Mask register for ports (FIOMASK) */
+/* Fast Port Pin value registers using FIOMASK (FIOPIN) */
+/* Fast Port Output Set registers using FIOMASK (FIOSET) */
+/* Fast Port Output Clear register using FIOMASK (FIOCLR) */
+
+#define FIO(n) (1 << (n)) /* n=0,1,..31 */
+
+/* GPIO interrupt block register bit definitions ************************************/
+
+/* GPIO overall Interrupt Status (IOINTSTATUS) */
+#define GPIOINT_IOINTSTATUS_P0INT (1 << 0) /* Bit 0: Port 0 GPIO interrupt pending */
+ /* Bit 1: Reserved */
+#define GPIOINT_IOINTSTATUS_P2INT (1 << 2) /* Bit 2: Port 2 GPIO interrupt pending */
+ /* Bits 3-31: Reserved */
+
+/* GPIO Interrupt Status for Rising edge (INTSTATR)
+ * GPIO Interrupt Status for Falling edge (INTSTATF)
+ * GPIO Interrupt Clear (INTCLR)
+ * GPIO Interrupt Enable for Rising edge (INTENR)
+ * GPIO Interrupt Enable for Falling edge (INTENF)
+ */
+
+#define GPIOINT(n) (1 << (n)) /* n=0,1,..31 */
+
+/************************************************************************************
+ * Public Types
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Data
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+#endif /* __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC17_40_CHIP_GPIO_H */
diff --git a/arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_i2c.h b/arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_i2c.h
new file mode 100644
index 00000000000..c542b0c4b86
--- /dev/null
+++ b/arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_i2c.h
@@ -0,0 +1,208 @@
+/************************************************************************************
+ * arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_i2c.h
+ *
+ * Copyright (C) 2010, 2013 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ * 3. Neither the name NuttX 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 THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#ifndef __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC17_40_I2C_H
+#define __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC17_40_I2C_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include
+
+#include "chip.h"
+#include "hardware/lpc17_40_memorymap.h"
+
+/************************************************************************************
+ * Pre-processor Definitions
+ ************************************************************************************/
+
+/* Register offsets *****************************************************************/
+
+#define LPC17_40_I2C_CONSET_OFFSET 0x0000 /* I2C Control Set Register */
+#define LPC17_40_I2C_STAT_OFFSET 0x0004 /* I2C Status Register */
+#define LPC17_40_I2C_DAT_OFFSET 0x0008 /* I2C Data Register */
+#define LPC17_40_I2C_ADR0_OFFSET 0x000c /* I2C Slave Address Register 0 */
+#define LPC17_40_I2C_SCLH_OFFSET 0x0010 /* SCH Duty Cycle Register High Half Word */
+#define LPC17_40_I2C_SCLL_OFFSET 0x0014 /* SCL Duty Cycle Register Low Half Word */
+#define LPC17_40_I2C_CONCLR_OFFSET 0x0018 /* I2C Control Clear Register */
+#define LPC17_40_I2C_MMCTRL_OFFSET 0x001c /* Monitor mode control register */
+#define LPC17_40_I2C_ADR1_OFFSET 0x0020 /* I2C Slave Address Register 1 */
+#define LPC17_40_I2C_ADR2_OFFSET 0x0024 /* I2C Slave Address Register 2 */
+#define LPC17_40_I2C_ADR3_OFFSET 0x0028 /* I2C Slave Address Register 3 */
+#define LPC17_40_I2C_BUFR_OFFSET 0x002c /* Data buffer register */
+#define LPC17_40_I2C_MASK0_OFFSET 0x0030 /* I2C Slave address mask register 0 */
+#define LPC17_40_I2C_MASK1_OFFSET 0x0034 /* I2C Slave address mask register 1 */
+#define LPC17_40_I2C_MASK2_OFFSET 0x0038 /* I2C Slave address mask register 2 */
+#define LPC17_40_I2C_MASK3_OFFSET 0x003c /* I2C Slave address mask register */
+
+/* Register addresses ***************************************************************/
+
+#define LPC17_40_I2C0_CONSET (LPC17_40_I2C0_BASE+LPC17_40_I2C_CONSET_OFFSET)
+#define LPC17_40_I2C0_STAT (LPC17_40_I2C0_BASE+LPC17_40_I2C_STAT_OFFSET)
+#define LPC17_40_I2C0_DAT (LPC17_40_I2C0_BASE+LPC17_40_I2C_DAT_OFFSET)
+#define LPC17_40_I2C0_ADR0 (LPC17_40_I2C0_BASE+LPC17_40_I2C_ADR0_OFFSET)
+#define LPC17_40_I2C0_SCLH (LPC17_40_I2C0_BASE+LPC17_40_I2C_SCLH_OFFSET)
+#define LPC17_40_I2C0_SCLL (LPC17_40_I2C0_BASE+LPC17_40_I2C_SCLL_OFFSET)
+#define LPC17_40_I2C0_CONCLR (LPC17_40_I2C0_BASE+LPC17_40_I2C_CONCLR_OFFSET)
+#define LPC17_40_I2C0_MMCTRL (LPC17_40_I2C0_BASE+LPC17_40_I2C_MMCTRL_OFFSET)
+#define LPC17_40_I2C0_ADR1 (LPC17_40_I2C0_BASE+LPC17_40_I2C_ADR1_OFFSET)
+#define LPC17_40_I2C0_ADR2 (LPC17_40_I2C0_BASE+LPC17_40_I2C_ADR2_OFFSET)
+#define LPC17_40_I2C0_ADR3 (LPC17_40_I2C0_BASE+LPC17_40_I2C_ADR3_OFFSET)
+#define LPC17_40_I2C0_BUFR (LPC17_40_I2C0_BASE+LPC17_40_I2C_BUFR_OFFSET)
+#define LPC17_40_I2C0_MASK0 (LPC17_40_I2C0_BASE+LPC17_40_I2C_MASK0_OFFSET)
+#define LPC17_40_I2C0_MASK1 (LPC17_40_I2C0_BASE+LPC17_40_I2C_MASK1_OFFSET)
+#define LPC17_40_I2C0_MASK2 (LPC17_40_I2C0_BASE+LPC17_40_I2C_MASK2_OFFSET)
+#define LPC17_40_I2C0_MASK3 (LPC17_40_I2C0_BASE+LPC17_40_I2C_MASK3_OFFSET)
+
+#define LPC17_40_I2C1_CONSET (LPC17_40_I2C1_BASE+LPC17_40_I2C_CONSET_OFFSET)
+#define LPC17_40_I2C1_STAT (LPC17_40_I2C1_BASE+LPC17_40_I2C_STAT_OFFSET)
+#define LPC17_40_I2C1_DAT (LPC17_40_I2C1_BASE+LPC17_40_I2C_DAT_OFFSET)
+#define LPC17_40_I2C1_ADR0 (LPC17_40_I2C1_BASE+LPC17_40_I2C_ADR0_OFFSET)
+#define LPC17_40_I2C1_SCLH (LPC17_40_I2C1_BASE+LPC17_40_I2C_SCLH_OFFSET)
+#define LPC17_40_I2C1_SCLL (LPC17_40_I2C1_BASE+LPC17_40_I2C_SCLL_OFFSET)
+#define LPC17_40_I2C1_CONCLR (LPC17_40_I2C1_BASE+LPC17_40_I2C_CONCLR_OFFSET)
+#define LPC17_40_I2C1_MMCTRL (LPC17_40_I2C1_BASE+LPC17_40_I2C_MMCTRL_OFFSET)
+#define LPC17_40_I2C1_ADR1 (LPC17_40_I2C1_BASE+LPC17_40_I2C_ADR1_OFFSET)
+#define LPC17_40_I2C1_ADR2 (LPC17_40_I2C1_BASE+LPC17_40_I2C_ADR2_OFFSET)
+#define LPC17_40_I2C1_ADR3 (LPC17_40_I2C1_BASE+LPC17_40_I2C_ADR3_OFFSET)
+#define LPC17_40_I2C1_BUFR (LPC17_40_I2C1_BASE+LPC17_40_I2C_BUFR_OFFSET)
+#define LPC17_40_I2C1_MASK0 (LPC17_40_I2C1_BASE+LPC17_40_I2C_MASK0_OFFSET)
+#define LPC17_40_I2C1_MASK1 (LPC17_40_I2C1_BASE+LPC17_40_I2C_MASK1_OFFSET)
+#define LPC17_40_I2C1_MASK2 (LPC17_40_I2C1_BASE+LPC17_40_I2C_MASK2_OFFSET)
+#define LPC17_40_I2C1_MASK3 (LPC17_40_I2C1_BASE+LPC17_40_I2C_MASK3_OFFSET)
+
+#define LPC17_40_I2C2_CONSET (LPC17_40_I2C2_BASE+LPC17_40_I2C_CONSET_OFFSET)
+#define LPC17_40_I2C2_STAT (LPC17_40_I2C2_BASE+LPC17_40_I2C_STAT_OFFSET)
+#define LPC17_40_I2C2_DAT (LPC17_40_I2C2_BASE+LPC17_40_I2C_DAT_OFFSET)
+#define LPC17_40_I2C2_ADR0 (LPC17_40_I2C2_BASE+LPC17_40_I2C_ADR0_OFFSET)
+#define LPC17_40_I2C2_SCLH (LPC17_40_I2C2_BASE+LPC17_40_I2C_SCLH_OFFSET)
+#define LPC17_40_I2C2_SCLL (LPC17_40_I2C2_BASE+LPC17_40_I2C_SCLL_OFFSET)
+#define LPC17_40_I2C2_CONCLR (LPC17_40_I2C2_BASE+LPC17_40_I2C_CONCLR_OFFSET)
+#define LPC17_40_I2C2_MMCTRL (LPC17_40_I2C2_BASE+LPC17_40_I2C_MMCTRL_OFFSET)
+#define LPC17_40_I2C2_ADR1 (LPC17_40_I2C2_BASE+LPC17_40_I2C_ADR1_OFFSET)
+#define LPC17_40_I2C2_ADR2 (LPC17_40_I2C2_BASE+LPC17_40_I2C_ADR2_OFFSET)
+#define LPC17_40_I2C2_ADR3 (LPC17_40_I2C2_BASE+LPC17_40_I2C_ADR3_OFFSET)
+#define LPC17_40_I2C2_BUFR (LPC17_40_I2C2_BASE+LPC17_40_I2C_BUFR_OFFSET)
+#define LPC17_40_I2C2_MASK0 (LPC17_40_I2C2_BASE+LPC17_40_I2C_MASK0_OFFSET)
+#define LPC17_40_I2C2_MASK1 (LPC17_40_I2C2_BASE+LPC17_40_I2C_MASK1_OFFSET)
+#define LPC17_40_I2C2_MASK2 (LPC17_40_I2C2_BASE+LPC17_40_I2C_MASK2_OFFSET)
+#define LPC17_40_I2C2_MASK3 (LPC17_40_I2C2_BASE+LPC17_40_I2C_MASK3_OFFSET)
+
+/* Register bit definitions *********************************************************/
+/* I2C Control Set Register */
+ /* Bits 0-1: Reserved */
+#define I2C_CONSET_AA (1 << 2) /* Bit 2: Assert acknowledge flag */
+#define I2C_CONSET_SI (1 << 3) /* Bit 3: I2C interrupt flag */
+#define I2C_CONSET_STO (1 << 4) /* Bit 4: STOP flag */
+#define I2C_CONSET_STA (1 << 5) /* Bit 5: START flag */
+#define I2C_CONSET_I2EN (1 << 6) /* Bit 6: I2C interface enable */
+ /* Bits 7-31: Reserved */
+/* I2C Control Clear Register */
+ /* Bits 0-1: Reserved */
+#define I2C_CONCLR_AAC (1 << 2) /* Bit 2: Assert acknowledge Clear bit */
+#define I2C_CONCLR_SIC (1 << 3) /* Bit 3: I2C interrupt Clear bit */
+ /* Bit 4: Reserved */
+#define I2C_CONCLR_STAC (1 << 5) /* Bit 5: START flag Clear bit */
+#define I2C_CONCLRT_I2ENC (1 << 6) /* Bit 6: I2C interface Disable bit */
+ /* Bits 7-31: Reserved */
+/* I2C Status Register
+ *
+ * See tables 399-402 in the "LPC17xx User Manual" (UM10360), Rev. 01, 4 January
+ * 2010, NXP for definitions of status codes.
+ */
+
+#define I2C_STAT_MASK (0xff) /* Bits 0-7: I2C interface status
+ * Bits 0-1 always zero */
+ /* Bits 8-31: Reserved */
+/* I2C Data Register */
+
+#define I2C_DAT_MASK (0xff) /* Bits 0-7: I2C data */
+ /* Bits 8-31: Reserved */
+/* Monitor mode control register */
+
+#define I2C_MMCTRL_MMENA (1 << 0) /* Bit 0: Monitor mode enable */
+#define I2C_MMCTRL_ENASCL (1 << 1) /* Bit 1: SCL output enable */
+#define I2C_MMCTRL_MATCHALL (1 << 2) /* Bit 2: Select interrupt register match */
+ /* Bits 3-31: Reserved */
+/* Data buffer register */
+
+#define I2C_BUFR_MASK (0xff) /* Bits 0-7: 8 MSBs of the I2DAT shift register */
+ /* Bits 8-31: Reserved */
+/* I2C Slave address registers:
+ *
+ * I2C Slave Address Register 0
+ * I2C Slave Address Register 1
+ * I2C Slave Address Register 2
+ * I2C Slave Address Register 3
+ */
+
+#define I2C_ADR_GC (1 << 0) /* Bit 0: GC General Call enable bit */
+#define I2C_ADR_ADDR_SHIFT (1) /* Bits 1-7: I2C slave address */
+#define I2C_ADR_ADDR_MASK (0x7f << I2C_ADR_ADDR_SHIFT)
+ /* Bits 8-31: Reserved */
+/* I2C Slave address mask registers:
+ *
+ * I2C Slave address mask register 0
+ * I2C Slave address mask register 1
+ * I2C Slave address mask register 2
+ * I2C Slave address mask register 3
+ */
+ /* Bit 0: Reserved */
+#define I2C_MASK_SHIFT (1) /* Bits 1-7: I2C mask bits */
+#define I2C_MASK_MASK (0x7f << I2C_ADR_ADDR_SHIFT)
+ /* Bits 8-31: Reserved */
+/* SCH Duty Cycle Register High Half Word */
+
+#define I2C_SCLH_MASK (0xffff) /* Bit 0-15: Count for SCL HIGH time period selection */
+ /* Bits 16-31: Reserved */
+/* SCL Duty Cycle Register Low Half Word */
+
+#define I2C_SCLL_MASK (0xffff) /* Bit 0-15: Count for SCL LOW time period selection */
+ /* Bits 16-31: Reserved */
+
+/************************************************************************************
+ * Public Types
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Data
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+#endif /* __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC17_40_I2C_H */
diff --git a/arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_i2s.h b/arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_i2s.h
new file mode 100644
index 00000000000..0cd43c24dee
--- /dev/null
+++ b/arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_i2s.h
@@ -0,0 +1,190 @@
+/************************************************************************************
+ * arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_i2s
+ *
+ * Copyright (C) 2010, 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ * 3. Neither the name NuttX 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 THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#ifndef __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC17_40_I2S_H
+#define __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC17_40_I2S_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include
+
+#include "chip.h"
+#include "hardware/lpc17_40_memorymap.h"
+
+/************************************************************************************
+ * Pre-processor Definitions
+ ************************************************************************************/
+
+/* Register offsets *****************************************************************/
+
+#define LPC17_40_I2S_DAO_OFFSET 0x0000 /* Digital Audio Output Register */
+#define LPC17_40_I2S_DAI_OFFSET 0x0004 /* Digital Audio Input Register */
+#define LPC17_40_I2S_TXFIFO_OFFSET 0x0008 /* Transmit FIFO */
+#define LPC17_40_I2S_RXFIFO_OFFSET 0x000c /* Receive FIFO */
+#define LPC17_40_I2S_STATE_OFFSET 0x0010 /* Status Feedback Register */
+#define LPC17_40_I2S_DMA1_OFFSET 0x0014 /* DMA Configuration Register 1 */
+#define LPC17_40_I2S_DMA2_OFFSET 0x0018 /* DMA Configuration Register 2 */
+#define LPC17_40_I2S_IRQ_OFFSET 0x001c /* Interrupt Request Control Register */
+#define LPC17_40_I2S_TXRATE_OFFSET 0x0020 /* Transmit MCLK divider */
+#define LPC17_40_I2S_RXRATE_OFFSET 0x0024 /* Receive MCLK divider */
+#define LPC17_40_I2S_TXBITRATE_OFFSET 0x0028 /* Transmit bit rate divider */
+#define LPC17_40_I2S_RXBITRATE_OFFSET 0x002c /* Receive bit rate divider */
+#define LPC17_40_I2S_TXMODE_OFFSET 0x0030 /* Transmit mode control */
+#define LPC17_40_I2S_RXMODE_OFFSET 0x0034 /* Receive mode control */
+
+/* Register addresses ***************************************************************/
+
+#define LPC17_40_I2S_DAO (LPC17_40_I2S_BASE+LPC17_40_I2S_DAO_OFFSET)
+#define LPC17_40_I2S_DAI (LPC17_40_I2S_BASE+LPC17_40_I2S_DAI_OFFSET)
+#define LPC17_40_I2S_TXFIFO (LPC17_40_I2S_BASE+LPC17_40_I2S_TXFIFO_OFFSET)
+#define LPC17_40_I2S_RXFIFO (LPC17_40_I2S_BASE+LPC17_40_I2S_RXFIFO_OFFSET)
+#define LPC17_40_I2S_STATE (LPC17_40_I2S_BASE+LPC17_40_I2S_STATE_OFFSET)
+#define LPC17_40_I2S_DMA1 (LPC17_40_I2S_BASE+LPC17_40_I2S_DMA1_OFFSET)
+#define LPC17_40_I2S_DMA2 (LPC17_40_I2S_BASE+LPC17_40_I2S_DMA2_OFFSET)
+#define LPC17_40_I2S_IRQ (LPC17_40_I2S_BASE+LPC17_40_I2S_IRQ_OFFSET)
+#define LPC17_40_I2S_TXRATE (LPC17_40_I2S_BASE+LPC17_40_I2S_TXRATE_OFFSET)
+#define LPC17_40_I2S_RXRATE (LPC17_40_I2S_BASE+LPC17_40_I2S_RXRATE_OFFSET)
+#define LPC17_40_I2S_TXBITRATE (LPC17_40_I2S_BASE+LPC17_40_I2S_TXBITRATE_OFFSET)
+#define LPC17_40_I2S_RXBITRATE (LPC17_40_I2S_BASE+LPC17_40_I2S_RXBITRATE_OFFSET)
+#define LPC17_40_I2S_TXMODE (LPC17_40_I2S_BASE+LPC17_40_I2S_TXMODE_OFFSET)
+#define LPC17_40_I2S_RXMODE (LPC17_40_I2S_BASE+LPC17_40_I2S_RXMODE_OFFSET)
+
+/* Register bit definitions *********************************************************/
+
+/* Digital Audio Output Register */
+
+#define I2S_DAO_WDWID_SHIFT (0) /* Bits 0-1: Selects the number of bytes in data */
+#define I2S_DAO_WDWID_MASK (3 << I2S_DAO_WDWID_SHIFT)
+# define I2S_DAO_WDWID_8BITS (0 << I2S_DAO_WDWID_SHIFT)
+# define I2S_DAO_WDWID_16BITS (1 << I2S_DAO_WDWID_SHIFT)
+# define I2S_DAO_WDWID_32BITS (3 << I2S_DAO_WDWID_SHIFT)
+#define I2S_DAO_MONO (1 << 2) /* Bit 2: Mono format */
+#define I2S_DAO_STOP (1 << 3) /* Bit 3: Disable FIFOs / mute mode */
+#define I2S_DAO_RESET (1 << 4) /* Bit 4: Reset TX channel and FIFO */
+#define I2S_DAO_WSSEL (1 << 5) /* Bit 5: Slave mode select */
+#define I2S_DAO_WSHALFPER_SHIFT (6) /* Bits 6-14: Word select half period minus 1 */
+#define I2S_DAO_WSHALFPER_MASK (0x01ff << I2S_DAO_WSHALFPER_SHIFT)
+#define I2S_DAO_MUTE (1 << 15) /* Bit 15: Send only zeros on channel */
+ /* Bits 16-31: Reserved */
+/* Digital Audio Input Register */
+
+#define I2S_DAI_WDWID_SHIFT (0) /* Bits 0-1: Selects the number of bytes in data */
+#define I2S_DAI_WDWID_MASK (3 << I2S_DAI_WDWID_SHIFT)
+# define I2S_DAI_WDWID_8BITS (0 << I2S_DAI_WDWID_SHIFT)
+# define I2S_DAI_WDWID_16BITS (1 << I2S_DAI_WDWID_SHIFT)
+# define I2S_DAI_WDWID_32BITS (3 << I2S_DAI_WDWID_SHIFT)
+#define I2S_DAI_MONO (1 << 2) /* Bit 2: Mono format */
+#define I2S_DAI_STOP (1 << 3) /* Bit 3: Disable FIFOs / mute mode */
+#define I2S_DAI_RESET (1 << 4) /* Bit 4: Reset TX channel and FIFO */
+#define I2S_DAI_WSSEL (1 << 5) /* Bit 5: Slave mode select */
+#define I2S_DAI_WSHALFPER_SHIFT (6) /* Bits 6-14: Word select half period minus 1 */
+#define I2S_DAI_WSHALFPER_MASK (0x01ff << I2S_DAI_WSHALFPER_SHIFT)
+ /* Bits 15-31: Reserved */
+/* Transmit FIFO: 8 � 32-bit transmit FIFO */
+/* Receive FIFO: 8 � 32-bit receive FIFO */
+
+/* Status Feedback Register */
+
+#define I2S_STATE_IRQ (1 << 0) /* Bit 0: Receive Transmit Interrupt */
+#define I2S_STATE_DMAREQ1 (1 << 1) /* Bit 1: Receive or Transmit DMA Request 1 */
+#define I2S_STATE_DMAREQ2 (1 << 2) /* Bit 2: Receive or Transmit DMA Request 2 */
+ /* Bits 3-7: Reserved */
+#define I2S_STATE_RXLEVEL_SHIFT (8) /* Bits 8-11: Current level of the Receive FIFO */
+#define I2S_STATE_RXLEVEL_MASK (15 << I2S_STATE_RXLEVEL_SHIFT)
+ /* Bits 12-15: Reserved */
+#define I2S_STATE_TXLEVEL_SHIFT (16) /* Bits 16-19: Current level of the Transmit FIFO */
+#define I2S_STATE_TXLEVEL_MASK (15 << I2S_STATE_TXLEVEL_SHIFT)
+ /* Bits 20-31: Reserved */
+/* DMA Configuration Register 1 and 2 */
+
+#define I2S_DMA_RXDMAEN (1 << 0) /* Bit 0: Enable DMA1 for I2S receive */
+#define I2S_DMA_TXDMAEN (1 << 1) /* Bit 1: Enable DMA1 for I2S transmit */
+ /* Bits 2-7: Reserved */
+#define I2S_DMA_RXDEPTH_SHIFT (8) /* Bits 8-11: FIFO level that triggers RX request on DMA1 */
+#define I2S_DMA_RXDEPTH_MASK (15 << I2S_DMA_RXDEPTH_SHIFT)
+ /* Bits 12-15: Reserved */
+#define I2S_DMA_TXDEPTH_SHIFT (16) /* Bits 16-19: FIFO level that triggers a TX request on DMA1 */
+#define I2S_DMA_TXDEPTH_MASK (15 << I2S_DMA_TXDEPTH_SHIFT)
+ /* Bits 20-31: Reserved */
+/* Interrupt Request Control Register */
+
+#define I2S_IRQ_RXEN (1 << 0) /* Bit 0: Enable I2S receive interrupt */
+#define I2S_IRQ_TXEN (1 << 1) /* Bit 1: Enable I2S transmit interrupt */
+ /* Bits 2-7: Reserved */
+#define I2S_IRQ_RXDEPTH_SHIFT (8) /* Bits 8-11: Set FIFO level for irq request */
+#define I2S_IRQ_RXDEPTH_MASK (15 << I2S_IRQ_RXDEPTH_SHIFT)
+ /* Bits 12-15: Reserved */
+#define I2S_IRQ_TXDEPTH_SHIFT (16) /* Bits 16-19: Set FIFO level for irq request */
+#define I2S_IRQ_TXDEPTH_MASK (15 << I2S_IRQ_TXDEPTH_SHIFT)
+ /* Bits 20-31: Reserved */
+/* Transmit and Receive MCLK divider */
+
+#define I2S_RATE_YDIV_SHIFT (0) /* Bits 0-7: I2S transmit MCLK rate denominator */
+#define I2S_RATE_YDIV_MASK (0xff << I2S_RATE_YDIV_SHIFT)
+#define I2S_RATE_XDIV_SHIFT (8) /* Bits 8-15: I2S transmit MCLK rate numerator */
+#define I2S_RATE_XDIV_MASK (0xff << I2S_RATE_XDIV_SHIFT)
+ /* Bits 16-31: Reserved */
+
+/* Transmit and received bit rate divider */
+
+#define I2S_BITRATE_SHIFT (0) /* Bits 0-5: I2S transmit bit rate */
+#define I2S_BITRATE_MASK (0x3f << I2S_BITRATE_SHIFT)
+ /* Bits 6-31: Reserved */
+/* Transmit and Receive mode control */
+
+#define I2S_MODE_CLKSEL_SHIFT (0) /* Bits 0-1: Clock source for bit clock divider */
+#define I2S_MODE_CLKSEL_MASK (3 << I2S_MODE_CLKSEL_SHIFT)
+# define I2S_MODE_CLKSEL_FRACDIV (0 << I2S_MODE_CLKSEL_SHIFT) /* TX/RX fractional rate divider */
+# define I2S_MODE_CLKSEL_RXMCLK (2 << I2S_MODE_CLKSEL_SHIFT) /* RX_CLCK for TX_MCLK source */
+# define I2S_MODE_CLKSEL_TXMCLK (2 << I2S_MODE_CLKSEL_SHIFT) /* TX_CLCK for RX_MCLK source */
+#define I2S_MODE_4PIN (1 << 2) /* Bit 2: Transmit/Receive 4-pin mode selection */
+#define I2S_MODE_MCENA (1 << 3) /* Bit 3: Enable for the TX/RX_MCLK output */
+ /* Bits 4-31: Reserved */
+
+/************************************************************************************
+ * Public Types
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Data
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+#endif /* __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC17_40_I2S_H */
diff --git a/arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_lcd.h b/arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_lcd.h
new file mode 100644
index 00000000000..9b895fc59ce
--- /dev/null
+++ b/arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_lcd.h
@@ -0,0 +1,346 @@
+/************************************************************************************************
+ * arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_lcd.h
+ *
+ * Copyright (C) 2013 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ * 3. Neither the name NuttX 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 THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************************/
+
+#ifndef __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC17_40_LCD_H
+#define __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC17_40_LCD_H
+
+/************************************************************************************************
+ * Included Files
+ ************************************************************************************************/
+
+#include
+
+#include "chip.h"
+#include "hardware/lpc17_40_memorymap.h"
+
+/************************************************************************************************
+ * Pre-processor Definitions
+ ************************************************************************************************/
+
+/* Register offsets *****************************************************************************/
+
+#define LPC17_40_LCD_TIMH_OFFSET (0x0000) /* Horizontal Timing Control register */
+#define LPC17_40_LCD_TIMV_OFFSET (0x0004) /* Vertical Timing Control register */
+#define LPC17_40_LCD_POL_OFFSET (0x0008) /* Clock & Signal Polarity Control register */
+#define LPC17_40_LCD_LE_OFFSET (0x000c) /* Line End Control register */
+#define LPC17_40_LCD_UPBASE_OFFSET (0x0010) /* Upper Panel Frame Base Address register */
+#define LPC17_40_LCD_LPBASE_OFFSET (0x0014) /* Lower Panel Frame Base Address register */
+#define LPC17_40_LCD_CTRL_OFFSET (0x0018) /* LCD Control register */
+#define LPC17_40_LCD_INTMSK_OFFSET (0x001c) /* Interrupt Mask register */
+#define LPC17_40_LCD_INTRAW_OFFSET (0x0020) /* Raw Interrupt Status register */
+#define LPC17_40_LCD_INTSTAT_OFFSET (0x0024) /* Masked Interrupt Status register */
+#define LPC17_40_LCD_INTCLR_OFFSET (0x0028) /* Interrupt Clear register */
+#define LPC17_40_LCD_UPCURR_OFFSET (0x002c) /* Upper Panel Current Address Value register */
+#define LPC17_40_LCD_LPCURR_OFFSET (0x0030) /* Lower Panel Current Address Value register */
+
+/* 256x16-bit Color Palette registers, n=0-127 */
+
+#define LPC17_40_LCD_PAL_OFFSET(n) (0x0200 + ((n) << 2))
+
+/* Cursor Image registers, n=0-255 */
+
+#define LPC17_40_LCD_CRSR_IMG_OFFSET(n) (0x0800 + ((n) << 2))
+
+#define LPC17_40_LCD_CRSR_CRTL_OFFSET (0x0c00) /* Cursor Control register */
+#define LPC17_40_LCD_CRSR_CFG_OFFSET (0x0c04) /* Cursor Configuration register */
+#define LPC17_40_LCD_CRSR_PAL0_OFFSET (0x0c08) /* Cursor Palette register 0 */
+#define LPC17_40_LCD_CRSR_PAL1_OFFSET (0x0c0c) /* Cursor Palette register 1 */
+#define LPC17_40_LCD_CRSR_XY_OFFSET (0x0c10) /* Cursor XY Position register */
+#define LPC17_40_LCD_CRSR_CLIP_OFFSET (0x0c14) /* Cursor Clip Position register */
+#define LPC17_40_LCD_CRSR_INTMSK_OFFSET (0x0c20) /* Cursor Interrupt Mask regsiter */
+#define LPC17_40_LCD_CRSR_INTCLR_OFFSET (0x0c24) /* Cursor Interrupt Clear register */
+#define LPC17_40_LCD_CRSR_INTRAW_OFFSET (0x0c28) /* Cursor Raw Interrupt Status register */
+#define LPC17_40_LCD_CRSR_INTSTAT_OFFSET (0x0c2c) /* Cursor Masked Interrupt Status register */
+
+/* Register Addresses ***************************************************************************/
+
+#define LPC17_40_LCD_TIMH (LPC17_40_LCD_BASE+LPC17_40_LCD_TIMH_OFFSET)
+#define LPC17_40_LCD_TIMV (LPC17_40_LCD_BASE+LPC17_40_LCD_TIMV_OFFSET)
+#define LPC17_40_LCD_POL (LPC17_40_LCD_BASE+LPC17_40_LCD_POL_OFFSET)
+#define LPC17_40_LCD_LE (LPC17_40_LCD_BASE+LPC17_40_LCD_LE_OFFSET)
+#define LPC17_40_LCD_UPBASE (LPC17_40_LCD_BASE+LPC17_40_LCD_UPBASE_OFFSET)
+#define LPC17_40_LCD_LPBASE (LPC17_40_LCD_BASE+LPC17_40_LCD_LPBASE_OFFSET)
+#define LPC17_40_LCD_CTRL (LPC17_40_LCD_BASE+LPC17_40_LCD_CTRL_OFFSET)
+#define LPC17_40_LCD_INTMSK (LPC17_40_LCD_BASE+LPC17_40_LCD_INTMSK_OFFSET)
+#define LPC17_40_LCD_INTRAW (LPC17_40_LCD_BASE+LPC17_40_LCD_INTRAW_OFFSET)
+#define LPC17_40_LCD_INTSTAT (LPC17_40_LCD_BASE+LPC17_40_LCD_INTSTAT_OFFSET)
+#define LPC17_40_LCD_INTCLR (LPC17_40_LCD_BASE+ LPC17_40_LCD_INTCLR_OFFSET)
+#define LPC17_40_LCD_UPCURR (LPC17_40_LCD_BASE+LPC17_40_LCD_UPCURR_OFFSET)
+#define LPC17_40_LCD_LPCURR (LPC17_40_LCD_BASE+LPC17_40_LCD_LPCURR_OFFSET)
+
+#define LPC17_40_LCD_PAL(n) (LPC17_40_LCD_BASE+LPC17_40_LCD_PAL_OFFSET(n))
+#define LPC17_40_LCD_CRSR_IMG(n) (LPC17_40_LCD_BASE+LPC17_40_LCD_CRSR_IMG_OFFSET(n))
+
+#define LPC17_40_LCD_CRSR_CRTL (LPC17_40_LCD_BASE+LPC17_40_LCD_CRSR_CRTL_OFFSET)
+#define LPC17_40_LCD_CRSR_CFG (LPC17_40_LCD_BASE+LPC17_40_LCD_CRSR_CFG_OFFSET)
+#define LPC17_40_LCD_CRSR_PAL0 (LPC17_40_LCD_BASE+LPC17_40_LCD_CRSR_PAL0_OFFSET)
+#define LPC17_40_LCD_CRSR_PAL1 (LPC17_40_LCD_BASE+LPC17_40_LCD_CRSR_PAL1_OFFSET)
+#define LPC17_40_LCD_CRSR_XY (LPC17_40_LCD_BASE+LPC17_40_LCD_CRSR_XY_OFFSET)
+#define LPC17_40_LCD_CRSR_CLIP (LPC17_40_LCD_BASE+LPC17_40_LCD_CRSR_CLIP_OFFSET)
+#define LPC17_40_LCD_CRSR_INTMSK (LPC17_40_LCD_BASE+LPC17_40_LCD_CRSR_INTMSK_OFFSET)
+#define LPC17_40_LCD_CRSR_INTCLR (LPC17_40_LCD_BASE+LPC17_40_LCD_CRSR_INTCLR_OFFSET)
+#define LPC17_40_LCD_CRSR_INTRAW (LPC17_40_LCD_BASE+LPC17_40_LCD_CRSR_INTRAW_OFFSET)
+#define LPC17_40_LCD_CRSR_INTSTAT (LPC17_40_LCD_BASE+LPC17_40_LCD_CRSR_INTSTAT_OFFSET)
+
+/* Register Bitfield Definitions ****************************************************************/
+
+/* LCD_TIMH - Horizontal Timing Register */
+ /* Bits 0-1: Reserved */
+#define LCD_TIMH_PPL_SHIFT (2) /* Bits 2-7: Pixels Per Line - 16-1024ppl */
+#define LCD_TIMH_PPL_MASK (0x3f << LCD_TIMH_PPL_SHIFT)
+#define LCD_TIMH_HSW_SHIFT (8) /* Bits 8-15: Horizontal Sync Pulse Width */
+#define LCD_TIMH_HWS_MASK (0xff << LCD_TIMH_HSW_SHIFT)
+#define LCD_TIMH_HFP_SHIFT (16) /* Bits 16-23: Horizontal Front Porch */
+#define LCD_TIMH_HFP_MASK (0xff << LCD_TIMH_HFP_SHIFT)
+#define LCD_TIMH_HBP_SHIFT (24) /* Bits 24-31: Horizontal Back Porch */
+#define LCD_TIMH_HBP_MASK (0xff << LCD_TIMH_HBP_SHIFT)
+
+/* LCD_TIMV - Vertical Timing Register */
+
+#define LCD_TIMV_LPP_SHIFT (0) /* Bits 0-9: Lines Per Panel 1-1024 lpp*/
+#define LCD_TIMV_LPP_MASK (0x3ff << LCD_TIMV_LPP_SHIFT)
+#define LCD_TIMV_VSW_SHIFT (10) /* Bits 10-15: Vertical Synch Pulse Width */
+#define LCD_TIMV_VSW_MASK (0x3f << LCD_TIMV_VSW_SHIFT)
+#define LCD_TIMV_VFP_SHIFT (16) /* Bits 16-23: Vertical Front Porch */
+#define LCD_TIMV_VFP_MASK (0xff << LCD_TIMV_VFP_SHIFT)
+#define LCD_TIMV_VBP_SHIFT (24) /* Bits 24-31: Vertical Back Porch */
+#define LCD_TIMV_VBP_MASK (0xff << LCD_TIMV_VBP_SHIFT)
+
+/* LCD_POL - Clock and Signal Polarity Register */
+
+#define LCD_POL_PCDLO_SHIFT (0) /* Bits 0-4: Lower 5 bits of panel clock divisor */
+#define LCD_POL_PCDLO_MASK (0x1f << LCD_POL_PCDLO_SHIFT)
+#define LCD_POL_CLKSEL (1 << 5) /* Bit 5: Clock select- 0=PCLK, 1=LCD_CLKIN */
+#define LCD_POL_ACB_SHIFT (6) /* Bits 6-10: AC bias pin frequency */
+#define LCD_POL_ACB_MASK (0x1f << LCD_POL_ACB_SHIFT)
+#define LCD_POL_IVS (1 << 11) /* Bit 11: Invert vertical sync */
+#define LCD_POL_IHS (1 << 12) /* Bit 12: Invert horizontal sync */
+#define LCD_POL_IPC (1 << 13) /* Bit 13: Invert panel clock */
+#define LCD_POL_IOE (1 << 14) /* Bit 14: Invert output enable */
+ /* Bit 15: Reserved */
+#define LCD_POL_CPL_SHIFT (16) /* Bit 16-25: Clocks per line */
+#define LCD_POL_CPL_MASK (0x3ff << LCD_POL_CPL_SHIFT)
+#define LCD_POL_BCD (1 << 26) /* Bit 26: Bypass pixel clock divider */
+#define LCD_POL_PCDHI_SHIFT (27) /* Bits 27-31: Upper 5 bits of panel clock divisor */
+#define LCD_POL_PCDHI_MASK (0x1f << LCD_POL_PCDHI_SHIFT)
+
+/* LCD_LE - Line End Control Register */
+
+#define LCD_LE_LED_SHIFT (0) /* Bits 0-6: Line End delay */
+#define LCD_LE_LED_MASK (0x7f << LCD_LE_LED_SHIFT)
+ /* Bits 7-15: Reserved */
+#define LCD_LE_LEE (1 << 16) /* Bit 16: LCD line end enable */
+ /* Bit 17-31: Reserved */
+/* LCD_UPBASE - Upper Panel Frame Base Address Register */
+ /* Bits 0-2: Reserved */
+#define LCD_UPBASE_LCDUPBASE_SHIFT (3) /* Bits 3-31: LCD upper panel base address */
+#define LCD_UPBASE_LCDUPBASE_MASK (0x1FFFFFFF << LCD_UPBASE_LCDUPBASE_SHIFT)
+
+/* LCD_UPBASE - Lower Panel Frame Base Address Register */
+ /* Bits 0-2: Reserved */
+#define LCD_UPBASE_LCDLPBASE_SHIFT (3) /* Bits 3-31: LCD lower panel base address */
+#define LCD_UPBASE_LCDLPBASE_MASK (0x1FFFFFFF << LCD_UPBASE_LCDUPBASE_SHIFT)
+
+/* LCD_CTRL - Controle Register */
+
+#define LCD_CTRL_LCDEN (1 << 0) /* Bit 0: LCD enable control bit */
+#define LCD_CTRL_LCDBPP_SHIFT (1) /* Bits 1-3: LCD bits per pixel */
+#define LCD_CTRL_LCDBPP_MASK (7 << LCD_CTRL_LCDBPP_SHIFT)
+# define LCD_CTRL_LCDBPP_1 (0 << LCD_CTRL_LCDBPP_SHIFT) /* 1 bpp */
+# define LCD_CTRL_LCDBPP_2 (1 << LCD_CTRL_LCDBPP_SHIFT) /* 2 bpp */
+# define LCD_CTRL_LCDBPP_4 (2 << LCD_CTRL_LCDBPP_SHIFT) /* 4 bpp */
+# define LCD_CTRL_LCDBPP_8 (3 << LCD_CTRL_LCDBPP_SHIFT) /* 8 bpp */
+# define LCD_CTRL_LCDBPP_16 (4 << LCD_CTRL_LCDBPP_SHIFT) /* 16 bpp */
+# define LCD_CTRL_LCDBPP_24 (5 << LCD_CTRL_LCDBPP_SHIFT) /* 24 bpp (TFT panel only) */
+# define LCD_CTRL_LCDBPP_565 (6 << LCD_CTRL_LCDBPP_SHIFT) /* 16 bpp, 5:6:5 mode */
+# define LCD_CTRL_LCDBPP_444 (7 << LCD_CTRL_LCDBPP_SHIFT) /* 12 bpp, 4:4:4 mode */
+#define LCD_CTRL_LCDBW (1 << 4) /* Bit 4: STN LCD monochrome/color selection */
+#define LCD_CTRL_LCDTFT (1 << 5) /* Bit 5: LCD TFT type selection */
+#define LCD_CTRL_LCDMONO8 (1 << 6) /* Bit 6: Monochrome LCD interface bit */
+#define LCD_CTRL_LCDDUAL (1 << 7) /* Bit 7: Single or Dual LCD panel selection */
+#define LCD_CTRL_BGR (1 << 8) /* Bit 8: Color format */
+#define LCD_CTRL_BEBO (1 << 9) /* Bit 9: Big-Endian Byte Order */
+#define LCD_CTRL_BEPO (1 << 10) /* Bit 10: Big-Endian Pixel Ordering */
+#define LCD_CTRL_LCDPWR (1 << 11) /* Bit 11: LCD Power enable */
+#define LCD_CTRL_LCDVCOMP_SHIFT (12) /* Bits 12-13: LCD Vertical compare interrupt */
+#define LCD_CTRL_LCDVCOMP_MASK (3 << LCD_CTRL_LCDVCOMP_SHIFT)
+ /* Bits 14-15: Reserved */
+#define LCD_CTRL_WATERMARK (1 << 16) /* Bit 16: LCD DMA FIFO watermark level */
+ /* Bits 17-31: Reserved */
+/* LCD_INTMSK - Interrupt Mask Register */
+ /* Bits 0: Reserved */
+#define LCD_INTMSK_FUFIM (1 << 1) /* Bit 1: FIFO underflow interrupt enable */
+#define LCD_INTMSK_LNBUIM (1 << 2) /* Bit 2: LCD next base address interrupt enable */
+#define LCD_INTMSK_VCOMPIM (1 << 3) /* Bit 3: Vertical compare interrupt enable */
+#define LCD_INTMSK_BERIM (1 << 4) /* Bit 4: AHB Master error interrupt enable */
+ /* Bits 5-31: Reserved */
+#define LCD_INTMSK_ALL (0x1e)
+
+/* LCD_INTRAW - Raw Interrupt Status Register */
+ /* Bits 0: Reserved */
+#define LCD_INTRAW_FUFRIS (1 << 1) /* Bit 1: FIFO Undeflow raw interrupt status */
+#define LCD_INTRAW_LNBURIS (1 << 2) /* Bit 2: LCD Next address base update intterupt */
+#define LCD_INTRAW_VCOMPRIS (1 << 3) /* Bit 3: Vertical compare interrupt status */
+#define LCD_INTRAW_BERRAW (1 << 4) /* Bit 4: AHB Master bus error interrupt status */
+ /* Bits 5-31: Reserved */
+#define LCD_INTRAW_ALL (0x1e)
+
+/* LCD_INTSTAT - Masked Interrupt Status Register */
+ /* Bits 0: Reserved */
+#define LCD_INTSTAT_FUFMIS (1 << 1) /* Bit 1: FIFO Undeflow raw interrupt status */
+#define LCD_INTSTAT_LNBUMIS (1 << 2) /* Bit 2: LCD Next address base update intterupt */
+#define LCD_INTSTAT_VCOMPMIS (1 << 3) /* Bit 3: Vertical compare interrupt status */
+#define LCD_INTSTAT_BERMIS (1 << 4) /* Bit 4: AHB Master bus error interrupt status */
+ /* Bits 15-31: Reserved */
+#define LCD_INTSTAT_ALL (0x1e)
+
+/* LCD_INTCLR - Interrupt Clear Register */
+ /* Bits 0: Reserved */
+#define LCD_INTCLR_FUFIC (1 << 1) /* Bit 1: FIFO Undeflow raw interrupt clear */
+#define LCD_INTCLR_LNBUIC (1 << 2) /* Bit 2: LCD Next address base update intterupt */
+#define LCD_INTCLR_VCOMPIC (1 << 3) /* Bit 3: Vertical compare interrupt clear */
+#define LCD_INTCLR_BERIC (1 << 4) /* Bit 4: AHB Master bus error interrupt clear */
+ /* Bits 15-31: Reserved */
+#define LCD_INTCLR_ALL (0x1e)
+
+/* Upper and Lower Panel Address register has no bitfields */
+/*
+ * Upper Panel Current Address register (LCDUPCURR)
+ * Lower Panel Current Address register (LCDLPCURR)
+ */
+
+/* LCD_PAL - Color Palette Registers */
+
+#define LCD_PAL_R0_SHIFT (0) /* Bits 0-4: Red palette data */
+#define LCD_PAL_R0_MASK (0x1f << LCD_PAL_R0_SHIFT)
+#define LCD_PAL_G0_SHIFT (5) /* Bits 5-9: Green palette data */
+#define LCD_PAL_G0_MASK (0x1f << LCD_PAL_G0_SHIFT)
+#define LCD_PAL_B0_SHIFT (10) /* Bits 10-14: Blue paletted data */
+#define LCD_PAL_B0_MASK (0x1f << LCD_PAL_B0_SHIFT)
+#define LCD_PAL_I0 (1 << 15) /* Bit 15: Intensity/Unused bit */
+#define LCD_PAL_R1_SHIFT (16) /* Bits 16-20: Red palette data */
+#define LCD_PAL_R1_MASK (0x1f << LCD_PAL_R1_SHIFT)
+#define LCD_PAL_G1_SHIFT (21) /* Bits 21-25: Green palette data */
+#define LCD_PAL_G1_MASK (0x1f << LCD_PAL_G1_SHIFT)
+#define LCD_PAL_B1_SHIFT (26) /* Bits 26-30: Blue palette data */
+#define LCD_PAL_B1_MASK (0x1f << LCD_PAL_B1_SHIFT)
+#define LCD_PAL_I1 (1 << 31) /* Bit 31: Intensity/Unused bit */
+
+/* LCD_CRSR_IMG - Cursor Image Register - has no bitfields */
+/* The 256 words of the cursor image register defines the appearance
+ * of either one 64x64 cursor, or 4 32x32 cursors.
+ */
+
+/* LCD CRSR_CTRL - Cursor Control Register */
+
+#define LCD_CRSR_CTRL_CRSON (1 << 0) /* Bit 0: Cursor enable */
+ /* Bits 1-3: Reserved */
+#define LCD_CRSR_CTRL_CRSRNUM_SHIFT (4) /* Bits 4-5: Cursor image number */
+#define LCD_CRSR_CTRL_CRSRNUM_MASK (3 << LCD_CRSR_CTRL_CRSRNUM1_0_SHIFT)
+ /* Bits 6-31: Reserved */
+/* If the selected cursor is 32x32 */
+
+#define LCD_CURSOR0 (0)
+#define LCD_CURSOR1 (1)
+#define LCD_CURSOR2 (2)
+#define LCD_CURSOR3 (3)
+
+/* LCD CRSR_CFG - Cursor Configuration Register */
+
+#define LCD_CRSR_CFG_CRSRSIZE (1 << 0) /* Bit 0: Cursor size selection */
+#define LCD_CRSR_CFG_FRAMESYNC (1 << 1) /* Bit 1: Cursor frame sync type */
+ /* Bits 2-31: Reserved */
+
+#define LCD_CURSOR_SIZE32 (0) /* 32x32 */
+#define LCD_CURSOR_SIZE64 (1) /* 64x64 */
+#define LCD_CURSOR_FRAMEASYNC (0) /* Cursor coordinates are asynchronous */
+#define LCD_CURSOR_FRAMESYNC (1) /* coordinates are synchronize to framesync pulse */
+
+/* LCD CRSR_PAL0/1 - Cursor Palette Registers */
+
+#define LCD_CRSR_PAL_RED_SHIFT (0) /* Bits 0-7: Red color componnent */
+#define LCD_CRSR_PAL_RED_MASK (0xff << LCD_CRSR_PAL0_RED_SHIFT)
+#define LCD_CRSR_PAL_GREEN_SHIFT (8) /* Bits 8-15: Green color component */
+#define LCD_CRSR_PAL_GREEN_MASK (0xff << LCD_CRSR_PAL0_GREEN_SHIFT)
+#define LCD_CRSR_PAL_BLUE_SHIFT (16) /* Bits 16-23: Blue color component */
+#define LCD_CRSR_PAL_BLUE_MASK (0xff << LCD_CRSR_PAL0_BLUE_SHIFT)
+ /* Bits 24-31: Reserved */
+/* LCD CRSR_XY - Cursor XY Position Register */
+
+#define LCD_CRSR_CRSRX_SHIFT (0) /* Bits 0-9: X ordinate */
+#define LCD_CRSR_CRSRX_MASK (0x3ff << LCD_CRSR_CRSRX_SHIFT)
+ /* Bits 10-15: Reserved */
+#define LCD_CRSR_CRSRY_SHIFT (16) /* Bits 16-25: Y ordinate */
+#define LCD_CRSR_CRSRY_MASK (0x3ff << LCD_CRSR_CRSRY_SHIFT)
+ /* Bits 26-31: Reserved */
+/* LCD CRSR_CLIP - Cursor Clip Position Register */
+
+#define LCD_CRSR_CRSRCLIPX_SHIFT (0) /* Bits 0-5: X clip position */
+#define LCD_CRSR_CRSRCLIPX_MASK (0x3f << LCD_CRSR_CRSRCLIPX_SHIFT)
+ /* Bits 6-7: Reserved */
+#define LCD_CRSR_CRSRCLIPY_SHIFT (8) /* Bits 8-13: Reserved */
+#define LCD_CRSR_CRSRCLIPY_MASK (0x3f << LCD_CRSR_CRSRCLIPY_SHIFT)
+ /* Bits 14-31: Reserved */
+/* LCD CRSR_INTMSK - Cursor Interrrupt Mask Register */
+
+#define LCD_CRSR_INTMSK_CRSRIM (1 << 0) /* Bit 0: Cursor interrupt mask */
+ /* Bits 1-31: Reserved */
+/* LCD CRSR_INTCLR - Cursor Interrrupt Clear Register */
+
+#define LCD_CRSR_INTCLR_CRSRIC (1 << 0) /* Bit 0: Cursor interrupt clear */
+ /* Bits 1-31: Reserved */
+
+/* LCD CRSR_INTRAW - Cursor Raw Interrrupt Status Register */
+
+#define LCD_CRSR_INTRAW_CRSRRIS (1 << 0) /* Bit 0: Cursor raw interrupt status */
+ /* Bits 1-31: Reserved */
+/* LCD CRSR_INTSTAT - Mask Interrrupt Status Register */
+
+#define LCD_CRSR_INTSTAT_CRSRMIS (1 << 0) /* Bit 0: Cursor mask interrupt status */
+ /* Bits 1-31: Reserved */
+
+/************************************************************************************************
+ * Public Types
+ ************************************************************************************************/
+
+/************************************************************************************************
+ * Public Data
+ ************************************************************************************************/
+
+/************************************************************************************************
+ * Public Functions
+ ************************************************************************************************/
+
+#endif /* __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC17_40_LCD_H */
diff --git a/arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_mcpwm.h b/arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_mcpwm.h
new file mode 100644
index 00000000000..2d6646d1491
--- /dev/null
+++ b/arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_mcpwm.h
@@ -0,0 +1,280 @@
+/************************************************************************************
+ * arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_mcpwm.h
+ *
+ * Copyright (C) 2010, 2013 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ * 3. Neither the name NuttX 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 THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#ifndef __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC17_40_MCPWM_H
+#define __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC17_40_MCPWM_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include
+
+#include "chip.h"
+#include "hardware/lpc17_40_memorymap.h"
+
+/************************************************************************************
+ * Pre-processor Definitions
+ ************************************************************************************/
+
+/* Register offsets *****************************************************************/
+
+#define LPC17_40_MCPWM_CON_OFFSET 0x0000 /* PWM Control read address */
+#define LPC17_40_MCPWM_CONSET_OFFSET 0x0004 /* PWM Control set address */
+#define LPC17_40_MCPWM_CONCLR_OFFSET 0x0008 /* PWM Control clear address */
+#define LPC17_40_MCPWM_CAPCON_OFFSET 0x000c /* Capture Control read address */
+#define LPC17_40_MCPWM_CAPCONSET_OFFSET 0x0010 /* Capture Control set address */
+#define LPC17_40_MCPWM_CAPCONCLR_OFFSET 0x0014 /* Event Control clear address */
+#define LPC17_40_MCPWM_TC0_OFFSET 0x0018 /* Timer Counter register, channel 0 */
+#define LPC17_40_MCPWM_TC1_OFFSET 0x001c /* Timer Counter register, channel 1 */
+#define LPC17_40_MCPWM_TC2_OFFSET 0x0020 /* Timer Counter register, channel 2 */
+#define LPC17_40_MCPWM_LIM0_OFFSET 0x0024 /* Limit register, channel 0 */
+#define LPC17_40_MCPWM_LIM1_OFFSET 0x0028 /* Limit register, channel 1 */
+#define LPC17_40_MCPWM_LIM2_OFFSET 0x002c /* Limit register, channel 2 */
+#define LPC17_40_MCPWM_MAT0_OFFSET 0x0030 /* Match register, channel 0 */
+#define LPC17_40_MCPWM_MAT1_OFFSET 0x0034 /* Match register, channel 1 */
+#define LPC17_40_MCPWM_MAT2_OFFSET 0x0038 /* Match register, channel 2 */
+#define LPC17_40_MCPWM_DT_OFFSET 0x003c /* Dead time register */
+#define LPC17_40_MCPWM_CP_OFFSET 0x0040 /* Commutation Pattern register */
+#define LPC17_40_MCPWM_CAP0_OFFSET 0x0044 /* Capture register, channel 0 */
+#define LPC17_40_MCPWM_CAP1_OFFSET 0x0048 /* Capture register, channel 1 */
+#define LPC17_40_MCPWM_CAP2_OFFSET 0x004c /* Capture register, channel 2 */
+#define LPC17_40_MCPWM_INTEN_OFFSET 0x0050 /* Interrupt Enable read address */
+#define LPC17_40_MCPWM_INTENSET_OFFSET 0x0054 /* Interrupt Enable set address */
+#define LPC17_40_MCPWM_INTENCLR_OFFSET 0x0058 /* Interrupt Enable clear address */
+#define LPC17_40_MCPWM_CNTCON_OFFSET 0x005c /* Count Control read address */
+#define LPC17_40_MCPWM_CNTCONSET_OFFSET 0x0060 /* Count Control set address */
+#define LPC17_40_MCPWM_CNTCONCLR_OFFSET 0x0064 /* Count Control clear address */
+#define LPC17_40_MCPWM_INTF_OFFSET 0x0068 /* Interrupt flags read address */
+#define LPC17_40_MCPWM_INTFSET_OFFSET 0x006c /* Interrupt flags set address */
+#define LPC17_40_MCPWM_INTFCLR_OFFSET 0x0070 /* Interrupt flags clear address */
+#define LPC17_40_MCPWM_CAPCLR_OFFSET 0x0074 /* Capture clear address */
+
+/* Register addresses ***************************************************************/
+
+#define LPC17_40_MCPWM_CON (LPC17_40_MCPWM_BASE+LPC17_40_MCPWM_CON_OFFSET)
+#define LPC17_40_MCPWM_CONSET (LPC17_40_MCPWM_BASE+LPC17_40_MCPWM_CONSET_OFFSET)
+#define LPC17_40_MCPWM_CONCLR (LPC17_40_MCPWM_BASE+LPC17_40_MCPWM_CONCLR_OFFSET)
+#define LPC17_40_MCPWM_CAPCON (LPC17_40_MCPWM_BASE+LPC17_40_MCPWM_CAPCON_OFFSET)
+#define LPC17_40_MCPWM_CAPCONSET (LPC17_40_MCPWM_BASE+LPC17_40_MCPWM_CAPCONSET_OFFSET)
+#define LPC17_40_MCPWM_CAPCONCLR (LPC17_40_MCPWM_BASE+LPC17_40_MCPWM_CAPCONCLR_OFFSET)
+#define LPC17_40_MCPWM_TC0 (LPC17_40_MCPWM_BASE+LPC17_40_MCPWM_TC0_OFFSET)
+#define LPC17_40_MCPWM_TC1 (LPC17_40_MCPWM_BASE+LPC17_40_MCPWM_TC1_OFFSET)
+#define LPC17_40_MCPWM_TC2 (LPC17_40_MCPWM_BASE+LPC17_40_MCPWM_TC2_OFFSET)
+#define LPC17_40_MCPWM_LIM0 (LPC17_40_MCPWM_BASE+LPC17_40_MCPWM_LIM0_OFFSET)
+#define LPC17_40_MCPWM_LIM1 (LPC17_40_MCPWM_BASE+LPC17_40_MCPWM_LIM1_OFFSET)
+#define LPC17_40_MCPWM_LIM2 (LPC17_40_MCPWM_BASE+LPC17_40_MCPWM_LIM2_OFFSET)
+#define LPC17_40_MCPWM_MAT0 (LPC17_40_MCPWM_BASE+LPC17_40_MCPWM_MAT0_OFFSET)
+#define LPC17_40_MCPWM_MAT1 (LPC17_40_MCPWM_BASE+LPC17_40_MCPWM_MAT1_OFFSET)
+#define LPC17_40_MCPWM_MAT2 (LPC17_40_MCPWM_BASE+LPC17_40_MCPWM_MAT2_OFFSET)
+#define LPC17_40_MCPWM_DT (LPC17_40_MCPWM_BASE+LPC17_40_MCPWM_DT_OFFSET)
+#define LPC17_40_MCPWM_CP (LPC17_40_MCPWM_BASE+LPC17_40_MCPWM_CP_OFFSET)
+#define LPC17_40_MCPWM_CAP0 (LPC17_40_MCPWM_BASE+LPC17_40_MCPWM_CAP0_OFFSET)
+#define LPC17_40_MCPWM_CAP1 (LPC17_40_MCPWM_BASE+LPC17_40_MCPWM_CAP1_OFFSET)
+#define LPC17_40_MCPWM_CAP2 (LPC17_40_MCPWM_BASE+LPC17_40_MCPWM_CAP2_OFFSET)
+#define LPC17_40_MCPWM_INTEN (LPC17_40_MCPWM_BASE+LPC17_40_MCPWM_INTEN_OFFSET)
+#define LPC17_40_MCPWM_INTENSET (LPC17_40_MCPWM_BASE+LPC17_40_MCPWM_INTENSET_OFFSET)
+#define LPC17_40_MCPWM_INTENCLR (LPC17_40_MCPWM_BASE+LPC17_40_MCPWM_INTENCLR_OFFSET)
+#define LPC17_40_MCPWM_CNTCON (LPC17_40_MCPWM_BASE+LPC17_40_MCPWM_CNTCON_OFFSET)
+#define LPC17_40_MCPWM_CNTCONSET (LPC17_40_MCPWM_BASE+LPC17_40_MCPWM_CNTCONSET_OFFSET)
+#define LPC17_40_MCPWM_CNTCONCLR (LPC17_40_MCPWM_BASE+LPC17_40_MCPWM_CNTCONCLR_OFFSET)
+#define LPC17_40_MCPWM_INTF (LPC17_40_MCPWM_BASE+LPC17_40_MCPWM_INTF_OFFSET)
+#define LPC17_40_MCPWM_INTFSET (LPC17_40_MCPWM_BASE+LPC17_40_MCPWM_INTFSET_OFFSET)
+#define LPC17_40_MCPWM_INTFCLR (LPC17_40_MCPWM_BASE+LPC17_40_MCPWM_INTFCLR_OFFSET)
+#define LPC17_40_MCPWM_CAPCLR (LPC17_40_MCPWM_BASE+LPC17_40_MCPWM_CAPCLR_OFFSET)
+
+/* Register bit definitions *********************************************************/
+/* There are no bit field definitions for the following registers because they support
+ * 32-bit values:
+ *
+ * - Timer Counter register, channel 0 (TC0), Timer Counter register, channel 1 (TC1),
+ * and Timer Counter register, channel 2 (TC2): 32-bit Timer/Counter values for
+ * channels 0, 1, 2 (no bit field definitions)
+ *
+ * - Limit register, channel 0 (LIM0), Limit register, channel 1 (LIM1), and Limit
+ * register, channel 2 (LIM2): 32-bit Limit values for TC0, 1, 2 (no bit field
+ * definitions)
+ *
+ * - Match register, channel 0 MAT0), Match register, channel 1 (MAT1), and Match
+ * register, channel 2 (MAT2): 32-bit Match values for TC0, 1, 2 (no bit field
+ * definitions).
+ *
+ * - Capture register, channel 0 (CAP0), Capture register, channel 1 (CAP1), and
+ * Capture register, channel 2 (CAP2): 32-bit TC value at a capture event for
+ * channels 0, 1, 2 (no bit field definitions)
+ */
+
+/* PWM Control read address (CON), PWM Control set address (CONSET), and PWM Control
+ * clear address (CONCLR) common regiser bit definitions.
+ */
+
+#define MCPWM_CON_RUN0 (1 << 0) /* Bit 0: Stops/starts timer channel 0 */
+#define MCPWM_CON_CENTER0 (1 << 1) /* Bit 1: Chan 0 edge/center aligned operation */
+#define MCPWM_CON_POLA0 (1 << 2) /* Bit 2: Polarity of MCOA0 and MCOB0 */
+#define MCPWM_CON_DTE0 (1 << 3) /* Bit 3: Dead time feature control */
+#define MCPWM_CON_DISUP0 (1 << 4) /* Bit 4: Enable/disable register updates */
+ /* Bits 5-7: Reserved */
+#define MCPWM_CON_RUN1 (1 << 8) /* Bit 8: Stops/starts timer channel 1 */
+#define MCPWM_CON_CENTER1 (1 << 9) /* Bit 9: Chan 1 edge/center aligned operation */
+#define MCPWM_CON_POLA1 (1 << 10) /* Bit 10: Polarity of MCOA1 and MCOB1 */
+#define MCPWM_CON_DTE1 (1 << 11) /* Bit 11: Dead time feature control */
+#define MCPWM_CON_DISUP1 (1 << 12) /* Bit 12: Enable/disable register updates */
+ /* Bits 13-15: Reserved */
+#define MCPWM_CON_RUN2 (1 << 16) /* Bit 16: Stops/starts timer channel 2 */
+#define MCPWM_CON_CENTER2 (1 << 17) /* Bit 17: Chan 2 edge/center aligned operation */
+#define MCPWM_CON_POLA2 (1 << 18) /* Bit 18: Polarity of MCOA1 and MCOB1 */
+#define MCPWM_CON_DTE2 (1 << 19) /* Bit 19: Dead time feature control */
+#define MCPWM_CON_DISUP2 (1 << 20) /* Bit 20: Enable/disable register updates */
+ /* Bits 21-28: Reserved */
+#define MCPWM_CON_INVBDC (1 << 29) /* Bit 29: Polarity of MCOB outputs (all channels) */
+#define MCPWM_CON_ACMODE (1 << 30) /* Bit 30: 3-phase AC mode select */
+#define MCPWM_CON_DCMODE (1 << 31) /* Bit 31: 3-phase DC mode select */
+
+/* Capture Control read address (CAPCON), Capture Control set address (CAPCONSET),
+ * and Event Control clear address (CAPCONCLR) common register bit defintions
+ */
+
+#define MCPWM_CAPCON_CAP0MCI0RE (1 << 0) /* Bit 0: Enable chan0 rising edge capture MCI0 */
+#define MCPWM_CAPCON_CAP0MCI0FE (1 << 1) /* Bit 1: Enable chan 0 falling edge capture MCI0 */
+#define MCPWM_CAPCON_CAP0MCI1RE (1 << 2) /* Bit 2: Enable chan 0 rising edge capture MCI1 */
+#define MCPWM_CAPCON_CAP0MCI1FE (1 << 3) /* Bit 3: Enable chan 0 falling edge capture MCI1 */
+#define MCPWM_CAPCON_CAP0MCI2RE (1 << 4) /* Bit 4: Enable chan 0 rising edge capture MCI2 */
+#define MCPWM_CAPCON_CAP0MCI2FE (1 << 5) /* Bit 5: Enable chan 0 falling edge capture MCI2 */
+#define MCPWM_CAPCON_CAP1MCI0RE (1 << 6) /* Bit 6: Enable chan 1 rising edge capture MCI0 */
+#define MCPWM_CAPCON_CAP1MCI0FE (1 << 7) /* Bit 7: Enable chan 1 falling edge capture MCI0 */
+#define MCPWM_CAPCON_CAP1MCI1RE (1 << 8) /* Bit 8: Enable chan 1 rising edge capture MCI1 */
+#define MCPWM_CAPCON_CAP1MCI1FE (1 << 9) /* Bit 9: Enable chan 1 falling edge capture MCI1 */
+#define MCPWM_CAPCON_CAP1MCI2RE (1 << 10) /* Bit 10: Enable chan 1 rising edge capture MCI2 */
+#define MCPWM_CAPCON_CAP1MCI2FE (1 << 11) /* Bit 11: Enable chan 1 falling edge capture MCI2 */
+#define MCPWM_CAPCON_CAP2MCI0RE (1 << 12) /* Bit 12: Enable chan 2 rising edge capture MCI0 */
+#define MCPWM_CAPCON_CAP2MCI0FE (1 << 13) /* Bit 13: Enable chan 2 falling edge capture MCI0 */
+#define MCPWM_CAPCON_CAP2MCI1RE (1 << 14) /* Bit 14: Enable chan 2 rising edge capture MCI1 */
+#define MCPWM_CAPCON_CAP2MCI1FE (1 << 15) /* Bit 15: Enable chan 2 falling edge capture MCI1 */
+#define MCPWM_CAPCON_CAP2MCI2RE (1 << 16) /* Bit 16: Enable chan 2 rising edge capture MCI2 */
+#define MCPWM_CAPCON_CAP2MCI2FE (1 << 17) /* Bit 17: Enable chan 2 falling edge capture MCI2 */
+#define MCPWM_CAPCON_RT0 (1 << 18) /* Bit 18: TC0 reset by chan 0 capture event */
+#define MCPWM_CAPCON_RT1 (1 << 19) /* Bit 19: TC1 reset by chan 1 capture event */
+#define MCPWM_CAPCON_RT2 (1 << 20) /* Bit 20: TC2 reset by chan 2 capture event */
+#define MCPWM_CAPCON_HNFCAP0 (1 << 21) /* Bit 21: Hardware noise filter */
+#define MCPWM_CAPCON_HNFCAP1 (1 << 22) /* Bit 22: Hardware noise filter */
+#define MCPWM_CAPCON_HNFCAP2 (1 << 23) /* Bit 23: Hardware noise filter */
+ /* Bits 24-31: Reserved */
+/* Dead time register */
+
+#define MCPWM_DT_DT0_SHIFT (0) /* Bits 0-9: Dead time for channel 0 */
+#define MCPWM_DT_DT0_MASK (0x03ff << MCPWM_DT_DT0_SHIFT)
+#define MCPWM_DT_DT1_SHIFT (10) /* Bits 10-19: Dead time for channel 1 */
+#define MCPWM_DT_DT1_MASK (0x03ff << MCPWM_DT_DT1_SHIFT)
+#define MCPWM_DT_DT2_SHIFT (20) /* Bits 20-29: Dead time for channel 2 */
+#define MCPWM_DT_DT2_MASK (0x03ff << MCPWM_DT_DT2_SHIFT)
+ /* Bits 30-31: reserved */
+/* Commutation Pattern register */
+
+#define MCPWM_CP_CCPA0 (1 << 0) /* Bit 0: Iinternal MCOA0 */
+#define MCPWM_CP_CCPB0 (1 << 1) /* Bit 1: MCOB0 tracks internal MCOA0 */
+#define MCPWM_CP_CCPA1 (1 << 2) /* Bit 2: MCOA1 tracks internal MCOA0 */
+#define MCPWM_CP_CCPB1 (1 << 3) /* Bit 3: MCOB1 tracks internal MCOA0 */
+#define MCPWM_CP_CCPA2 (1 << 4) /* Bit 4: MCOA2 tracks internal MCOA0 */
+#define MCPWM_CP_CCPB2 (1 << 5) /* Bit 5: MCOB2 tracks internal MCOA0 */
+ /* Bits 6-31: reserved */
+
+/* Interrupt Enable read address (INTEN), Interrupt Enable set address (INTENSET),
+ * Interrupt Enable clear address (INTENCLR), Interrupt flags read address (INTF),
+ * Interrupt flags set address (INTFSET), and Interrupt flags clear address (INTFCLR)
+ * common bit field definitions
+ */
+
+#define MCPWM_INT_ILIM0 (1 << 0) /* Bit 0: Limit interrupts for channel 0 */
+#define MCPWM_INT_IMAT0 (1 << 1) /* Bit 1: Match interrupts for channel 0 */
+#define MCPWM_INT_ICAP0 (1 << 2) /* Bit 2: Capture interrupts for channel 0 */
+ /* Bit 3: Reserved */
+#define MCPWM_INT_ILIM1 (1 << 4) /* Bit 4: Limit interrupts for channel 1 */
+#define MCPWM_INT_IMAT1 (1 << 5) /* Bit 5: Match interrupts for channel 1 */
+#define MCPWM_INT_ICAP1 (1 << 6) /* Bit 6: Capture interrupts for channel 1 */
+ /* Bit 7: Reserved */
+#define MCPWM_INT_ILIM2 (1 << 8) /* Bit 8: Limit interrupts for channel 2 */
+#define MCPWM_INT_IMAT2 (1 << 9) /* Bit 9: Match interrupts for channel 2 */
+#define MCPWM_INT_ICAP2 (1 << 10) /* Bit 10: Capture interrupts for channel 2 */
+ /* Bits 11-14: Reserved */
+#define MCPWM_INT_ABORT (1 << 15) /* Bit 15: Fast abort interrupt */
+ /* Bits 16-31: Reserved */
+
+/* Count Control read address (CNTCON), Count Control set address (CNTCONSET), and
+ * Count Control clear address (CNTCONCLR) common register bit definitions.
+ */
+
+#define MCPWM_CNTCON_TC0MCI0RE (1 << 0) /* Bit 0: Counter 0 incr on rising edge MCI0 */
+#define MCPWM_CNTCON_TC0MCI0FE (1 << 1) /* Bit 1: Counter 0 incr onfalling edge MCI0 */
+#define MCPWM_CNTCON_TC0MCI1RE (1 << 2) /* Bit 2: Counter 0 incr onrising edge MCI1 */
+#define MCPWM_CNTCON_TC0MCI1FE (1 << 3) /* Bit 3: Counter 0 incr onfalling edge MCI1 */
+#define MCPWM_CNTCON_TC0MCI2RE (1 << 4) /* Bit 4: Counter 0 incr onrising edge MCI2 */
+#define MCPWM_CNTCON_TC0MCI2FE (1 << 5) /* Bit 5: Counter 0 incr onfalling edge MCI2 */
+#define MCPWM_CNTCON_TC1MCI0RE (1 << 6) /* Bit 6: Counter 1 incr onrising edge MCI0 */
+#define MCPWM_CNTCON_TC1MCI0FE (1 << 7) /* Bit 7: Counter 1 incr onfalling edge MCI0 */
+#define MCPWM_CNTCON_TC1MCI1RE (1 << 8) /* Bit 8: Counter 1 incr onrising edge MCI1 */
+#define MCPWM_CNTCON_TC1MCI1FE (1 << 9) /* Bit 9: Counter 1 incr onfalling edge MCI1 */
+#define MCPWM_CNTCON_TC1MCI2RE (1 << 10) /* Bit 10: Counter 1 incr onrising edge MCI2 */
+#define MCPWM_CNTCON_TC1MCI2FE (1 << 11) /* Bit 11: Counter 1 incr onfalling edge MCI2 */
+#define MCPWM_CNTCON_TC2MCI0RE (1 << 12) /* Bit 12: Counter 2 incr onrising edge MCI0 */
+#define MCPWM_CNTCON_TC2MCI0FE (1 << 13) /* Bit 13: Counter 2 incr onfalling edge MCI0 */
+#define MCPWM_CNTCON_TC2MCI1RE (1 << 14) /* Bit 14: Counter 2 incr onrising edge MCI1 */
+#define MCPWM_CNTCON_TC2MCI1FE (1 << 15) /* Bit 15: Counter 2 incr onfalling edge MCI1 */
+#define MCPWM_CNTCON_TC2MCI2RE (1 << 16) /* Bit 16: Counter 2 incr onrising edge MCI2 */
+#define MCPWM_CNTCON_TC2MCI2FE (1 << 17) /* Bit 17: Counter 2 incr onfalling edge MCI2 */
+ /* Bits 28-28: Reserved */
+#define MCPWM_CNTCON_CNTR0 (1 << 29) /* Bit 29: Channel 0 counter mode */
+#define MCPWM_CNTCON_CNTR1 (1 << 30) /* Bit 30: Channel 1 counter mode */
+#define MCPWM_CNTCON_CNTR2 (1 << 31) /* Bit 31: Channel 2 counter mode */
+
+/* Capture clear address */
+
+#define MCPWM_CAPCLR_MCCLR0 (1 << 0) /* Bit 0: Clear MCCAP0 register */
+#define MCPWM_CAPCLR_MCCLR1 (1 << 1) /* Bit 1: Clear MCCAP1 register */
+#define MCPWM_CAPCLR_MCCLR2 (1 << 2) /* Bit 2: Clear MCCAP2 register */
+ /* Bits 2-31: Reserved */
+
+/************************************************************************************
+ * Public Types
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Data
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+#endif /* __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC17_40_MCPWM_H */
diff --git a/arch/arm/src/lpc17xx/hardware/lpc17_memorymap.h b/arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_memorymap.h
similarity index 86%
rename from arch/arm/src/lpc17xx/hardware/lpc17_memorymap.h
rename to arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_memorymap.h
index 54dcc06b75e..cb90225d74b 100644
--- a/arch/arm/src/lpc17xx/hardware/lpc17_memorymap.h
+++ b/arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_memorymap.h
@@ -1,5 +1,5 @@
/************************************************************************************
- * arch/arm/src/lpc17xx/hardware/lpc17_memorymap.h
+ * arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_memorymap.h
*
* Copyright (C) 2009-2011, 2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt
@@ -33,8 +33,8 @@
*
************************************************************************************/
-#ifndef __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC17_MEMORYMAP_H
-#define __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC17_MEMORYMAP_H
+#ifndef __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC17_40_MEMORYMAP_H
+#define __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC17_40_MEMORYMAP_H
/************************************************************************************
* Included Files
@@ -43,17 +43,17 @@
#include
/* This file is only a thin shell that includes the correct memory map definitions
- * for the selected LPC17xx family.
+ * for the selected LPC17xx/LPC40xx family.
*/
-#include
+#include
#if defined(LPC176x)
# include "hardware/lpc176x_memorymap.h"
-#elif defined(LPC178x)
-# include "hardware/lpc178x_memorymap.h"
+#elif defined(LPC178x_40xx)
+# include "hardware/lpc178x_40xx_memorymap.h"
#else
-# error "Unrecognized LPC17xx family"
+# error "Unrecognized LPC17xx/LPC40xx family"
#endif
/************************************************************************************
@@ -72,4 +72,4 @@
* Public Function Prototypes
************************************************************************************/
-#endif /* __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC17_MEMORYMAP_H */
+#endif /* __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC17_40_MEMORYMAP_H */
diff --git a/arch/arm/src/lpc17xx/hardware/lpc17_pinconfig.h b/arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_pinconfig.h
similarity index 86%
rename from arch/arm/src/lpc17xx/hardware/lpc17_pinconfig.h
rename to arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_pinconfig.h
index 39a9fe09082..cf530596684 100644
--- a/arch/arm/src/lpc17xx/hardware/lpc17_pinconfig.h
+++ b/arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_pinconfig.h
@@ -1,5 +1,5 @@
/************************************************************************************
- * arch/arm/src/lpc17xx/hardware/lpc17_pinconfig.h
+ * arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_pinconfig.h
*
* Copyright (C) 2009-2011, 2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt
@@ -33,8 +33,8 @@
*
************************************************************************************/
-#ifndef __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC17_PINCONFIG_H
-#define __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC17_PINCONFIG_H
+#ifndef __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC17_40_PINCONFIG_H
+#define __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC17_40_PINCONFIG_H
/************************************************************************************
* Included Files
@@ -43,17 +43,17 @@
#include
/* This file is only a thin shell that includes the correct pin configuration
- * definitions for the selected LPC17xx family.
+ * definitions for the selected LPC17xx/LPC40xx family.
*/
-#include
+#include
#if defined(LPC176x)
# include "hardware/lpc176x_pinconfig.h"
-#elif defined(LPC178x)
-# include "hardware/lpc178x_pinconfig.h"
+#elif defined(LPC178x_40xx)
+# include "hardware/lpc178x_40xx_pinconfig.h"
#else
-# error "Unrecognized LPC17xx family"
+# error "Unrecognized LPC17xx/LPC40xx family"
#endif
/************************************************************************************
@@ -72,4 +72,4 @@
* Public Function Prototypes
************************************************************************************/
-#endif /* __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC17_PINCONFIG_H */
+#endif /* __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC17_40_PINCONFIG_H */
diff --git a/arch/arm/src/lpc17xx/hardware/lpc17_pinconn.h b/arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_pinconn.h
similarity index 86%
rename from arch/arm/src/lpc17xx/hardware/lpc17_pinconn.h
rename to arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_pinconn.h
index f9f46dfb5f4..a36c3b60d0d 100644
--- a/arch/arm/src/lpc17xx/hardware/lpc17_pinconn.h
+++ b/arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_pinconn.h
@@ -1,5 +1,5 @@
/************************************************************************************
- * arch/arm/src/lpc17xx/hardware/lpc17_pinconn.h
+ * arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_pinconn.h
*
* Copyright (C) 2010, 2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt
@@ -33,8 +33,8 @@
*
************************************************************************************/
-#ifndef __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC17_PINCONN_H
-#define __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC17_PINCONN_H
+#ifndef __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC17_40_PINCONN_H
+#define __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC17_40_PINCONN_H
/************************************************************************************
* Included Files
@@ -43,17 +43,17 @@
#include
/* This file is only a thin shell that includes the correct pin configuration
- * register definitions for the selected LPC17xx family.
+ * register definitions for the selected LPC17xx/LPC40xx family.
*/
-#include
+#include
#if defined(LPC176x)
# include "hardware/lpc176x_pinconn.h"
-#elif defined(LPC178x)
-# include "hardware/lpc178x_iocon.h"
+#elif defined(LPC178x_40xx)
+# include "hardware/lpc178x_40xx_iocon.h"
#else
-# error "Unrecognized LPC17xx family"
+# error "Unrecognized LPC17xx/LPC40xx family"
#endif
/************************************************************************************
@@ -72,4 +72,4 @@
* Public Functions
************************************************************************************/
-#endif /* __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC17_PINCONN_H */
+#endif /* __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC17_40_PINCONN_H */
diff --git a/arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_pwm.h b/arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_pwm.h
new file mode 100644
index 00000000000..14e59cf3f66
--- /dev/null
+++ b/arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_pwm.h
@@ -0,0 +1,223 @@
+/************************************************************************************
+ * arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_pwm.h
+ *
+ * Copyright (C) 2010 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ * 3. Neither the name NuttX 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 THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#ifndef __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC17_40_PWM_H
+#define __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC17_40_PWM_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include
+
+#include "chip.h"
+#include "hardware/lpc17_40_memorymap.h"
+
+/************************************************************************************
+ * Pre-processor Definitions
+ ************************************************************************************/
+
+/* Register offsets *****************************************************************/
+
+#define LPC17_40_PWM_IR_OFFSET 0x0000 /* Interrupt Register */
+#define LPC17_40_PWM_TCR_OFFSET 0x0004 /* Timer Control Register */
+#define LPC17_40_PWM_TC_OFFSET 0x0008 /* Timer Counter */
+#define LPC17_40_PWM_PR_OFFSET 0x000c /* Prescale Register */
+#define LPC17_40_PWM_PC_OFFSET 0x0010 /* Prescale Counter */
+#define LPC17_40_PWM_MCR_OFFSET 0x0014 /* Match Control Register */
+#define LPC17_40_PWM_MR0_OFFSET 0x0018 /* Match Register 0 */
+#define LPC17_40_PWM_MR1_OFFSET 0x001c /* Match Register 1 */
+#define LPC17_40_PWM_MR2_OFFSET 0x0020 /* Match Register 2 */
+#define LPC17_40_PWM_MR3_OFFSET 0x0024 /* Match Register 3 */
+#define LPC17_40_PWM_CCR_OFFSET 0x0028 /* Capture Control Register */
+#define LPC17_40_PWM_CR0_OFFSET 0x002c /* Capture Register 0 */
+#define LPC17_40_PWM_CR1_OFFSET 0x0030 /* Capture Register 1 */
+#define LPC17_40_PWM_CR2_OFFSET 0x0034 /* Capture Register 2 */
+#define LPC17_40_PWM_CR3_OFFSET 0x0038 /* Capture Register 3 */
+#define LPC17_40_PWM_MR4_OFFSET 0x0040 /* Match Register 4 */
+#define LPC17_40_PWM_MR5_OFFSET 0x0044 /* Match Register 5 */
+#define LPC17_40_PWM_MR6_OFFSET 0x0048 /* Match Register 6 */
+#define LPC17_40_PWM_PCR_OFFSET 0x004c /* PWM Control Register */
+#define LPC17_40_PWM_LER_OFFSET 0x0050 /* Load Enable Register */
+#define LPC17_40_PWM_CTCR_OFFSET 0x0070 /* Counter/Timer Control Register */
+
+/* Register addresses ***************************************************************/
+
+#define LPC17_40_PWM1_IR (LPC17_40_PWM1_BASE+LPC17_40_PWM_IR_OFFSET)
+#define LPC17_40_PWM1_TCR (LPC17_40_PWM1_BASE+LPC17_40_PWM_TCR_OFFSET)
+#define LPC17_40_PWM1_TC (LPC17_40_PWM1_BASE+LPC17_40_PWM_TC_OFFSET)
+#define LPC17_40_PWM1_PR (LPC17_40_PWM1_BASE+LPC17_40_PWM_PR_OFFSET)
+#define LPC17_40_PWM1_PC (LPC17_40_PWM1_BASE+LPC17_40_PWM_PC_OFFSET)
+#define LPC17_40_PWM1_MCR (LPC17_40_PWM1_BASE+LPC17_40_PWM_MCR_OFFSET)
+#define LPC17_40_PWM1_MR0 (LPC17_40_PWM1_BASE+LPC17_40_PWM_MR0_OFFSET)
+#define LPC17_40_PWM1_MR1 (LPC17_40_PWM1_BASE+LPC17_40_PWM_MR1_OFFSET)
+#define LPC17_40_PWM1_MR2 (LPC17_40_PWM1_BASE+LPC17_40_PWM_MR2_OFFSET)
+#define LPC17_40_PWM1_MR3 (LPC17_40_PWM1_BASE+LPC17_40_PWM_MR3_OFFSET)
+#define LPC17_40_PWM1_MR4 (LPC17_40_PWM1_BASE+LPC17_40_PWM_MR4_OFFSET)
+#define LPC17_40_PWM1_MR5 (LPC17_40_PWM1_BASE+LPC17_40_PWM_MR5_OFFSET)
+#define LPC17_40_PWM1_MR6 (LPC17_40_PWM1_BASE+LPC17_40_PWM_MR6_OFFSET)
+#define LPC17_40_PWM1_CCR (LPC17_40_PWM1_BASE+LPC17_40_PWM_CCR_OFFSET)
+#define LPC17_40_PWM1_CR0 (LPC17_40_PWM1_BASE+LPC17_40_PWM_CR0_OFFSET)
+#define LPC17_40_PWM1_CR1 (LPC17_40_PWM1_BASE+LPC17_40_PWM_CR1_OFFSET)
+#define LPC17_40_PWM1_CR2 (LPC17_40_PWM1_BASE+LPC17_40_PWM_CR2_OFFSET)
+#define LPC17_40_PWM1_CR3 (LPC17_40_PWM1_BASE+LPC17_40_PWM_CR3_OFFSET)
+#define LPC17_40_PWM1_PCR (LPC17_40_PWM1_BASE+LPC17_40_PWM_PCR_OFFSET)
+#define LPC17_40_PWM1_LER (LPC17_40_PWM1_BASE+LPC17_40_PWM_LER_OFFSET)
+#define LPC17_40_PWM1_CTCR (LPC17_40_PWM1_BASE+LPC17_40_PWM_CTCR_OFFSET)
+
+/* Register bit definitions *********************************************************/
+/* Registers holding 32-bit numeric values (no bit field definitions):
+ *
+ * Timer Counter (TC)
+ * Prescale Register (PR)
+ * Prescale Counter (PC)
+ * Match Register 0 (MR0)
+ * Match Register 1 (MR1)
+ * Match Register 2 (MR2)
+ * Match Register 3 (MR3)
+ * Match Register 4 (MR3)
+ * Match Register 5 (MR3)
+ * Match Register 6 (MR3)
+ * Capture Register 0 (CR0)
+ * Capture Register 1 (CR1)
+ * Capture Register 1 (CR2)
+ * Capture Register 1 (CR3)
+ */
+
+/* Interrupt Register */
+
+#define PWM_IR_MR0 (1 << 0) /* Bit 0: PWM match channel 0 interrupt */
+#define PWM_IR_MR1 (1 << 1) /* Bit 1: PWM match channel 1 interrupt */
+#define PWM_IR_MR2 (1 << 2) /* Bit 2: PWM match channel 2 interrupt */
+#define PWM_IR_MR3 (1 << 3) /* Bit 3: PWM match channel 3 interrupt */
+#define PWM_IR_CAP0 (1 << 4) /* Bit 4: Capture input 0 interrupt */
+#define PWM_IR_CAP1 (1 << 5) /* Bit 5: Capture input 1 interrupt */
+ /* Bits 6-7: Reserved */
+#define PWM_IR_MR4 (1 << 8) /* Bit 8: PWM match channel 4 interrupt */
+#define PWM_IR_MR5 (1 << 9) /* Bit 9: PWM match channel 5 interrupt */
+#define PWM_IR_MR6 (1 << 10) /* Bit 10: PWM match channel 6 interrupt */
+ /* Bits 11-31: Reserved */
+/* Timer Control Register */
+
+#define PWM_TCR_CNTREN (1 << 0) /* Bit 0: Counter Enable */
+#define PWM_TCR_CNTRRST (1 << 1) /* Bit 1: Counter Reset */
+ /* Bit 2: Reserved */
+#define PWM_TCR_PWMEN (1 << 3) /* Bit 3: PWM Enable */
+ /* Bits 4-31: Reserved */
+/* Match Control Register */
+
+#define PWM_MCR_MR0I (1 << 0) /* Bit 0: Interrupt on MR0 */
+#define PWM_MCR_MR0R (1 << 1) /* Bit 1: Reset on MR0 */
+#define PWM_MCR_MR0S (1 << 2) /* Bit 2: Stop on MR0 */
+#define PWM_MCR_MR1I (1 << 3) /* Bit 3: Interrupt on MR1 */
+#define PWM_MCR_MR1R (1 << 4) /* Bit 4: Reset on MR1 */
+#define PWM_MCR_MR1S (1 << 5) /* Bit 5: Stop on MR1 */
+#define PWM_MCR_MR2I (1 << 6) /* Bit 6: Interrupt on MR2 */
+#define PWM_MCR_MR2R (1 << 7) /* Bit 7: Reset on MR2 */
+#define PWM_MCR_MR2S (1 << 8) /* Bit 8: Stop on MR2 */
+#define PWM_MCR_MR3I (1 << 9) /* Bit 9: Interrupt on MR3 */
+#define PWM_MCR_MR3R (1 << 10) /* Bit 10: Reset on MR3 */
+#define PWM_MCR_MR3S (1 << 11) /* Bit 11: Stop on MR3 */
+#define PWM_MCR_MR4I (1 << 12) /* Bit 12: Interrupt on MR4 */
+#define PWM_MCR_MR4R (1 << 13) /* Bit 13: Reset on MR4 */
+#define PWM_MCR_MR4S (1 << 14) /* Bit 14: Stop on MR4 */
+#define PWM_MCR_MR5I (1 << 15) /* Bit 15: Interrupt on MR5 */
+#define PWM_MCR_MR5R (1 << 16) /* Bit 16: Reset on MR5*/
+#define PWM_MCR_MR5S (1 << 17) /* Bit 17: Stop on MR5 */
+#define PWM_MCR_MR6I (1 << 18) /* Bit 18: Interrupt on MR6 */
+#define PWM_MCR_MR6R (1 << 19) /* Bit 19: Reset on MR6 */
+#define PWM_MCR_MR6S (1 << 20) /* Bit 20: Stop on MR6 */
+ /* Bits 21-31: Reserved */
+/* Capture Control Register (Where are CAP2 and 3?) */
+
+#define PWM_CCR_CAP0RE (1 << 0) /* Bit 0: Capture on CAPn.0 rising edge */
+#define PWM_CCR_CAP0FE (1 << 1) /* Bit 1: Capture on CAPn.0 falling edg */
+#define PWM_CCR_CAP0I (1 << 2) /* Bit 2: Interrupt on CAPn.0 */
+#define PWM_CCR_CAP1RE (1 << 3) /* Bit 3: Capture on CAPn.1 rising edge */
+#define PWM_CCR_CAP1FE (1 << 4) /* Bit 4: Capture on CAPn.1 falling edg */
+#define PWM_CCR_CAP1I (1 << 5) /* Bit 5: Interrupt on CAPn.1 */
+ /* Bits 6-31: Reserved */
+/* PWM Control Register */
+ /* Bits 0-1: Reserved */
+#define PWM_PCR_SEL2 (1 << 2) /* Bit 2: PWM2 single edge controlled mode */
+#define PWM_PCR_SEL3 (1 << 3) /* Bit 3: PWM3 single edge controlled mode */
+#define PWM_PCR_SEL4 (1 << 4) /* Bit 4: PWM4 single edge controlled mode */
+#define PWM_PCR_SEL5 (1 << 5) /* Bit 5: PWM5 single edge controlled mode */
+#define PWM_PCR_SEL6 (1 << 6) /* Bit 6: PWM6 single edge controlled mode */
+ /* Bits 7-8: Reserved */
+#define PWM_PCR_ENA1 (1 << 9) /* Bit 9: Enable PWM1 output */
+#define PWM_PCR_ENA2 (1 << 10) /* Bit 10: Enable PWM2 output */
+#define PWM_PCR_ENA3 (1 << 11) /* Bit 11: Enable PWM3 output */
+#define PWM_PCR_ENA4 (1 << 12) /* Bit 12: Enable PWM4 output */
+#define PWM_PCR_ENA5 (1 << 13) /* Bit 13: Enable PWM5 output */
+#define PWM_PCR_ENA6 (1 << 14) /* Bit 14: Enable PWM6 output */
+ /* Bits 15-31: Reserved */
+/* Load Enable Register */
+
+#define PWM_LER_M0EN (1 << 0) /* Bit 0: Enable PWM Match 0 Latch */
+#define PWM_LER_M1EN (1 << 1) /* Bit 1: Enable PWM Match 1 Latch */
+#define PWM_LER_M2EN (1 << 2) /* Bit 2: Enable PWM Match 2 Latch */
+#define PWM_LER_M3EN (1 << 3) /* Bit 3: Enable PWM Match 3 Latch */
+#define PWM_LER_M4EN (1 << 4) /* Bit 4: Enable PWM Match 4 Latch */
+#define PWM_LER_M5EN (1 << 5) /* Bit 5: Enable PWM Match 5 Latch */
+#define PWM_LER_M6EN (1 << 6) /* Bit 6: Enable PWM Match 6 Latch */
+ /* Bits 7-31: Reserved */
+/* Counter/Timer Control Register */
+
+#define PWM_CTCR_MODE_SHIFT (0) /* Bits 0-1: Counter/Timer Mode */
+#define PWM_CTCR_MODE_MASK (3 << PWM_CTCR_MODE_SHIFT)
+# define PWM_CTCR_MODE_TIMER (0 << PWM_CTCR_MODE_SHIFT) /* Timer Mode, prescal match */
+# define PWM_CTCR_MODE_CNTRRE (1 << PWM_CTCR_MODE_SHIFT) /* Counter Mode, CAP rising edge */
+# define PWM_CTCR_MODE_CNTRFE (2 << PWM_CTCR_MODE_SHIFT) /* Counter Mode, CAP falling edge */
+# define PWM_CTCR_MODE_CNTRBE (3 << PWM_CTCR_MODE_SHIFT) /* Counter Mode, CAP both edges */
+#define PWM_CTCR_INPSEL_SHIFT (2) /* Bits 2-3: Count Input Select */
+#define PWM_CTCR_INPSEL_MASK (3 << PWM_CTCR_INPSEL_SHIFT)
+# define PWM_CTCR_INPSEL_CAPNp0 (0 << PWM_CTCR_INPSEL_SHIFT) /* CAPn.0 for TIMERn */
+# define PWM_CTCR_INPSEL_CAPNp1 (1 << PWM_CTCR_INPSEL_SHIFT) /* CAPn.0 for TIMERn */
+ /* Bits 4-31: Reserved */
+
+/************************************************************************************
+ * Public Types
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Data
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+#endif /* __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC17_40_PWM_H */
diff --git a/arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_qei.h b/arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_qei.h
new file mode 100644
index 00000000000..7f2db27b036
--- /dev/null
+++ b/arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_qei.h
@@ -0,0 +1,214 @@
+/********************************************************************************************
+ * arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_qei.h
+ *
+ * Copyright (C) 2010, 2013 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ * 3. Neither the name NuttX 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 THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ********************************************************************************************/
+
+#ifndef __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC17_40_QEI_H
+#define __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC17_40_QEI_H
+
+/********************************************************************************************
+ * Included Files
+ ********************************************************************************************/
+
+#include
+
+#include "chip.h"
+#include "hardware/lpc17_40_memorymap.h"
+
+/********************************************************************************************
+ * Pre-processor Definitions
+ ********************************************************************************************/
+
+/* Register offsets *************************************************************************/
+/* Control registers */
+
+#define LPC17_40_QEI_CON_OFFSET 0x0000 /* Control register */
+#define LPC17_40_QEI_STAT_OFFSET 0x0004 /* Encoder status register */
+#define LPC17_40_QEI_CONF_OFFSET 0x0008 /* Configuration register */
+
+/* Position, index, and timer registers */
+
+#define LPC17_40_QEI_POS_OFFSET 0x000c /* Position register */
+#define LPC17_40_QEI_MAXPOS_OFFSET 0x0010 /* Maximum position register */
+#define LPC17_40_QEI_CMPOS0_OFFSET 0x0014 /* Position compare register */
+#define LPC17_40_QEI_CMPOS1_OFFSET 0x0018 /* Position compare register */
+#define LPC17_40_QEI_CMPOS2_OFFSET 0x001c /* Position compare register */
+#define LPC17_40_QEI_INXCNT_OFFSET 0x0020 /* Index count register */
+#define LPC17_40_QEI_INXCMP_OFFSET 0x0024 /* Index compare register */
+#define LPC17_40_QEI_LOAD_OFFSET 0x0028 /* Velocity timer reload register */
+#define LPC17_40_QEI_TIME_OFFSET 0x002c /* Velocity timer register */
+#define LPC17_40_QEI_VEL_OFFSET 0x0030 /* Velocity counter register */
+#define LPC17_40_QEI_CAP_OFFSET 0x0034 /* Velocity capture register */
+#define LPC17_40_QEI_VELCOMP_OFFSET 0x0038 /* Velocity compare register */
+#define LPC17_40_QEI_FILTER_OFFSET 0x003c /* Digital filter register */
+
+#ifdef LPC178
+# define LPC17_40_QEI_INXCMP0_OFFSET 0x0024 /* Index compare0 register */
+# define LPC17_40_QEI_INXCMP1_OFFSET 0x004c /* Index compare1 register */
+# define LPC17_40_QEI_INXCMP2_OFFSET 0x0050 /* Index compare2 register */
+# define LPC17_40_QEI_FILTER_PHA_OFFSET 0x003c /* Digital filter register */
+# define LPC17_40_QEI_FILTER_PHB_OFFSET 0x0040 /* Digital filter register */
+# define LPC17_40_QEI_FILTER_INX_OFFSET 0x0044 /* Digital filter register */
+# define LPC17_40_QEI_WINDOW_OFFSET 0x0048 /* Index acceptance register */
+#endif
+
+/* Interrupt registers */
+
+#define LPC17_40_QEI_IEC_OFFSET 0x0fd8 /* Interrupt enable clear register */
+#define LPC17_40_QEI_IES_OFFSET 0x0fdc /* Interrupt enable set register */
+#define LPC17_40_QEI_INTSTAT_OFFSET 0x0fe0 /* Interrupt status register */
+#define LPC17_40_QEI_IE_OFFSET 0x0fe4 /* Interrupt enable register */
+#define LPC17_40_QEI_CLR_OFFSET 0x0fe8 /* Interrupt status clear register */
+#define LPC17_40_QEI_SET_OFFSET 0x0fec /* Interrupt status set register */
+
+/* Register addresses ***********************************************************************/
+/* Control registers */
+
+#define LPC17_40_QEI_CON (LPC17_40_QEI_BASE+LPC17_40_QEI_CON_OFFSET)
+#define LPC17_40_QEI_STAT (LPC17_40_QEI_BASE+LPC17_40_QEI_STAT_OFFSET)
+#define LPC17_40_QEI_CONF (LPC17_40_QEI_BASE+LPC17_40_QEI_CONF_OFFSET)
+
+/* Position, index, and timer registers */
+
+#define LPC17_40_QEI_POS (LPC17_40_QEI_BASE+LPC17_40_QEI_POS_OFFSET)
+#define LPC17_40_QEI_MAXPOS (LPC17_40_QEI_BASE+LPC17_40_QEI_MAXPOS_OFFSET)
+#define LPC17_40_QEI_CMPOS0 (LPC17_40_QEI_BASE+LPC17_40_QEI_CMPOS0_OFFSET)
+#define LPC17_40_QEI_CMPOS1 (LPC17_40_QEI_BASE+LPC17_40_QEI_CMPOS1_OFFSET)
+#define LPC17_40_QEI_CMPOS2 (LPC17_40_QEI_BASE+LPC17_40_QEI_CMPOS2_OFFSET)
+#define LPC17_40_QEI_INXCNT (LPC17_40_QEI_BASE+LPC17_40_QEI_INXCNT_OFFSET)
+#define LPC17_40_QEI_INXCMP (LPC17_40_QEI_BASE+LPC17_40_QEI_INXCMP_OFFSET)
+#define LPC17_40_QEI_LOAD (LPC17_40_QEI_BASE+LPC17_40_QEI_LOAD_OFFSET)
+#define LPC17_40_QEI_TIME (LPC17_40_QEI_BASE+LPC17_40_QEI_TIME_OFFSET)
+#define LPC17_40_QEI_VEL (LPC17_40_QEI_BASE+LPC17_40_QEI_VEL_OFFSET)
+#define LPC17_40_QEI_CAP (LPC17_40_QEI_BASE+LPC17_40_QEI_CAP_OFFSET)
+#define LPC17_40_QEI_VELCOMP (LPC17_40_QEI_BASE+LPC17_40_QEI_VELCOMP_OFFSET)
+#define LPC17_40_QEI_FILTER (LPC17_40_QEI_BASE+LPC17_40_QEI_FILTER_OFFSET)
+
+/* Interrupt registers */
+
+#define LPC17_40_QEI_IEC (LPC17_40_QEI_BASE+LPC17_40_QEI_IEC_OFFSET)
+#define LPC17_40_QEI_IES (LPC17_40_QEI_BASE+LPC17_40_QEI_IES_OFFSET)
+#define LPC17_40_QEI_INTSTAT (LPC17_40_QEI_BASE+LPC17_40_QEI_INTSTAT_OFFSET)
+#define LPC17_40_QEI_IE (LPC17_40_QEI_BASE+LPC17_40_QEI_IE_OFFSET)
+#define LPC17_40_QEI_CLR (LPC17_40_QEI_BASE+LPC17_40_QEI_CLR_OFFSET)
+#define LPC17_40_QEI_SET (LPC17_40_QEI_BASE+LPC17_40_QEI_SET_OFFSET)
+
+/* Register bit definitions *****************************************************************/
+/* The following registers hold 32-bit integer values and have no bit fields defined
+ * in this section:
+ *
+ * Position register (POS)
+ * Maximum position register (MAXPOS)
+ * Position compare register 0 (CMPOS0)
+ * Position compare register 1 (CMPOS)
+ * Position compare register 2 (CMPOS2)
+ * Index count register (INXCNT)
+ * Index compare register (INXCMP)
+ * Velocity timer reload register (LOAD)
+ * Velocity timer register (TIME)
+ * Velocity counter register (VEL)
+ * Velocity capture register (CAP)
+ * Velocity compare register (VELCOMP)
+ * Digital filter register (FILTER)
+ */
+
+/* Control registers */
+/* Control register */
+
+#define QEI_CON_RESP (1 << 0) /* Bit 0: Reset position counter */
+#define QEI_CON_RESPI (1 << 1) /* Bit 1: Reset position counter on index */
+#define QEI_CON_RESV (1 << 2) /* Bit 2: Reset velocity */
+#define QEI_CON_RESI (1 << 3) /* Bit 3: Reset index counter */
+ /* Bits 4-31: reserved */
+/* Encoder status register */
+
+#define QEI_STAT_DIR (1 << 0) /* Bit 0: Direction bit */
+ /* Bits 1-31: reserved */
+/* Configuration register */
+
+#define QEI_CONF_DIRINV (1 << 0) /* Bit 0: Direction invert */
+#define QEI_CONF_SIGMODE (1 << 1) /* Bit 1: Signal Mode */
+#define QEI_CONF_CAPMODE (1 << 2) /* Bit 2: Capture Mode */
+#define QEI_CONF_INVINX (1 << 3) /* Bit 3: Invert Index */
+
+#ifdef LPC178x_40xx
+# define QEI_CONF_CRESPI (1 << 4) /* Bit 4: Continuous Index reset */
+ /* Bits 5-15: reserved */
+# define QEI_CONF_INXGATE_SHIFT (16) /* Bit 16:19 Index Gating */
+# define QEI_CONF_INXGATE_MASK (15 << QEI_CONF_INXGATE_SHIFT)
+#endif
+ /* Bits 20-31: reserved */
+
+/* Position, index, and timer registers (all 32-bit integer values with not bit fields */
+
+/* Interrupt registers */
+/* Interrupt enable clear register (IEC), Interrupt enable set register (IES),
+ * Interrupt status register (INTSTAT), Interrupt enable register (IE), Interrupt
+ * status clear register (CLR), and Interrupt status set register (SET) common
+ * bit definitions.
+ */
+
+#define QEI_INT_INX (1 << 0) /* Bit 0: Index pulse detected */
+#define QEI_INT_TIM (1 << 1) /* Bit 1: Velocity timer overflow occurred */
+#define QEI_INT_VELC (1 << 2) /* Bit 2: Captured velocity less than compare velocity */
+#define QEI_INT_DIR (1 << 3) /* Bit 3: Change of direction detected */
+#define QEI_INT_ERR (1 << 4) /* Bit 4: Encoder phase error detected */
+#define QEI_INT_ENCLK (1 << 5) /* Bit 5: Eencoder clock pulse detected */
+#define QEI_INT_POS0 (1 << 6) /* Bit 6: Position 0 compare equal to current position */
+#define QEI_INT_POS1 (1 << 7) /* Bit 7: Position 1 compare equal to current position */
+#define QEI_INT_POS2 (1 << 8) /* Bit 8: Position 2 compare equal to current position */
+#define QEI_INT_REV (1 << 9) /* Bit 9: Index compare value equal to current index count */
+#define QEI_INT_POS0REV (1 << 10) /* Bit 10: Combined position 0 and revolution count interrupt */
+#define QEI_INT_POS1REV (1 << 11) /* Bit 11: Position 1 and revolution count interrupt */
+#define QEI_INT_POS2REV (1 << 12) /* Bit 12: Position 2 and revolution count interrupt */
+
+#ifdef LPC178x_40xx
+# define QEI_INT_REV1 (1 << 13) /* Bit 13: Index compare1 value to current index interrupt */
+# define QEI_INT_REV2 (1 << 14) /* Bit 14: Index compare2 value to current index interrupt */
+# define QEI_INT_MAXPOS (1 << 15) /* Bit 15: Current position count interrupt */
+#endif
+ /* Bits 16-31: reserved */
+
+/********************************************************************************************
+ * Public Types
+ ********************************************************************************************/
+
+/********************************************************************************************
+ * Public Data
+ ********************************************************************************************/
+
+/********************************************************************************************
+ * Public Functions
+ ********************************************************************************************/
+
+#endif /* __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC17_40_QEI_H */
diff --git a/arch/arm/src/lpc17xx/hardware/lpc17_rit.h b/arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_rit.h
similarity index 72%
rename from arch/arm/src/lpc17xx/hardware/lpc17_rit.h
rename to arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_rit.h
index 7ddf129e922..3b8e5249038 100644
--- a/arch/arm/src/lpc17xx/hardware/lpc17_rit.h
+++ b/arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_rit.h
@@ -1,5 +1,5 @@
/************************************************************************************
- * arch/arm/src/lpc17xx/hardware/lpc17_rit.h
+ * arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_rit.h
*
* Copyright (C) 2010, 2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt
@@ -33,8 +33,8 @@
*
************************************************************************************/
-#ifndef __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC17_RIT_H
-#define __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC17_RIT_H
+#ifndef __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC17_40_RIT_H
+#define __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC17_40_RIT_H
/************************************************************************************
* Included Files
@@ -43,7 +43,7 @@
#include
#include "chip.h"
-#include "hardware/lpc17_memorymap.h"
+#include "hardware/lpc17_40_memorymap.h"
/************************************************************************************
* Pre-processor Definitions
@@ -51,17 +51,17 @@
/* Register offsets *****************************************************************/
-#define LPC17_RIT_COMPVAL_OFFSET 0x0000 /* Compare register */
-#define LPC17_RIT_MASK_OFFSET 0x0004 /* Mask register */
-#define LPC17_RIT_CTRL_OFFSET 0x0008 /* Control register */
-#define LPC17_RIT_COUNTER_OFFSET 0x000c /* 32-bit counter */
+#define LPC17_40_RIT_COMPVAL_OFFSET 0x0000 /* Compare register */
+#define LPC17_40_RIT_MASK_OFFSET 0x0004 /* Mask register */
+#define LPC17_40_RIT_CTRL_OFFSET 0x0008 /* Control register */
+#define LPC17_40_RIT_COUNTER_OFFSET 0x000c /* 32-bit counter */
/* Register addresses ***************************************************************/
-#define LPC17_RIT_COMPVAL (LPC17_RIT_BASE+LPC17_RIT_COMPVAL_OFFSET)
-#define LPC17_RIT_MASK (LPC17_RIT_BASE+LPC17_RIT_MASK_OFFSET)
-#define LPC17_RIT_CTRL (LPC17_RIT_BASE+LPC17_RIT_CTRL_OFFSET)
-#define LPC17_RIT_COUNTER (LPC17_RIT_BASE+LPC17_RIT_COUNTER_OFFSET)
+#define LPC17_40_RIT_COMPVAL (LPC17_40_RIT_BASE+LPC17_40_RIT_COMPVAL_OFFSET)
+#define LPC17_40_RIT_MASK (LPC17_40_RIT_BASE+LPC17_40_RIT_MASK_OFFSET)
+#define LPC17_40_RIT_CTRL (LPC17_40_RIT_BASE+LPC17_40_RIT_CTRL_OFFSET)
+#define LPC17_40_RIT_COUNTER (LPC17_40_RIT_BASE+LPC17_40_RIT_COUNTER_OFFSET)
/* Register bit definitions *********************************************************/
/* Compare register (Bits 0-31: value compared to the counter) */
@@ -70,11 +70,11 @@
/* Control register */
-#define RIT_CTRL_INT (1 << 0) /* Bit 0: Interrupt flag */
-#define RIT_CTRL_ENCLR (1 << 1) /* Bit 1: Timer enable clear */
-#define RIT_CTRL_ENBR (1 << 2) /* Bit 2: Timer enable for debug */
-#define RIT_CTRL_EN (1 << 3) /* Bit 3: Timer enable */
- /* Bits 4-31: Reserved */
+#define RIT_CTRL_INT (1 << 0) /* Bit 0: Interrupt flag */
+#define RIT_CTRL_ENCLR (1 << 1) /* Bit 1: Timer enable clear */
+#define RIT_CTRL_ENBR (1 << 2) /* Bit 2: Timer enable for debug */
+#define RIT_CTRL_EN (1 << 3) /* Bit 3: Timer enable */
+ /* Bits 4-31: Reserved */
/* 32-bit counter (Bits 0-31: 32-bit up counter) */
/************************************************************************************
@@ -89,4 +89,4 @@
* Public Functions
************************************************************************************/
-#endif /* __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC17_RIT_H */
+#endif /* __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC17_40_RIT_H */
diff --git a/arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_rtc.h b/arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_rtc.h
new file mode 100644
index 00000000000..ce42c039b35
--- /dev/null
+++ b/arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_rtc.h
@@ -0,0 +1,277 @@
+/************************************************************************************
+ * arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_rtc.h
+ *
+ * Copyright (C) 2010, 2012-2013 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ * 3. Neither the name NuttX 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 THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#ifndef __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC17_40_RTC_H
+#define __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC17_40_RTC_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include
+
+#include "chip.h"
+#include "hardware/lpc17_40_memorymap.h"
+
+/************************************************************************************
+ * Pre-processor Definitions
+ ************************************************************************************/
+
+/* Register offsets *****************************************************************/
+/* Miscellaneous registers */
+
+#define LPC17_40_RTC_ILR_OFFSET 0x0000 /* Interrupt Location Register */
+#define LPC17_40_RTC_CCR_OFFSET 0x0008 /* Clock Control Register */
+#define LPC17_40_RTC_CIIR_OFFSET 0x000c /* Counter Increment Interrupt Register */
+#define LPC17_40_RTC_AMR_OFFSET 0x0010 /* Alarm Mask Register */
+#define LPC17_40_RTC_AUXEN_OFFSET 0x0058 /* RTC Auxiliary Enable register */
+#define LPC17_40_RTC_AUX_OFFSET 0x005c /* RTC Auxiliary control register */
+
+/* Consolidated time registers */
+
+#define LPC17_40_RTC_CTIME0_OFFSET 0x0014 /* Consolidated Time Register 0 */
+#define LPC17_40_RTC_CTIME1_OFFSET 0x0018 /* Consolidated Time Register 1 */
+#define LPC17_40_RTC_CTIME2_OFFSET 0x001c /* Consolidated Time Register 2 */
+
+/* Time counter registers */
+
+#define LPC17_40_RTC_SEC_OFFSET 0x0020 /* Seconds Counter */
+#define LPC17_40_RTC_MIN_OFFSET 0x0024 /* Minutes Register */
+#define LPC17_40_RTC_HOUR_OFFSET 0x0028 /* Hours Register */
+#define LPC17_40_RTC_DOM_OFFSET 0x002c /* Day of Month Register */
+#define LPC17_40_RTC_DOW_OFFSET 0x0030 /* Day of Week Register */
+#define LPC17_40_RTC_DOY_OFFSET 0x0034 /* Day of Year Register */
+#define LPC17_40_RTC_MONTH_OFFSET 0x0038 /* Months Register */
+#define LPC17_40_RTC_YEAR_OFFSET 0x003c /* Years Register */
+#define LPC17_40_RTC_CALIB_OFFSET 0x0040 /* Calibration Value Register */
+
+/* General purpose registers */
+
+#define LPC17_40_RTC_GPREG0_OFFSET 0x0044 /* General Purpose Register 0 */
+#define LPC17_40_RTC_GPREG1_OFFSET 0x0048 /* General Purpose Register 1 */
+#define LPC17_40_RTC_GPREG2_OFFSET 0x004c /* General Purpose Register 2 */
+#define LPC17_40_RTC_GPREG3_OFFSET 0x0050 /* General Purpose Register 3 */
+#define LPC17_40_RTC_GPREG4_OFFSET 0x0054 /* General Purpose Register 4 */
+
+/* Alarm register group */
+
+#define LPC17_40_RTC_ALSEC_OFFSET 0x0060 /* Alarm value for Seconds */
+#define LPC17_40_RTC_ALMIN_OFFSET 0x0064 /* Alarm value for Minutes */
+#define LPC17_40_RTC_ALHOUR_OFFSET 0x0068 /* Alarm value for Hours */
+#define LPC17_40_RTC_ALDOM_OFFSET 0x006c /* Alarm value for Day of Month */
+#define LPC17_40_RTC_ALDOW_OFFSET 0x0070 /* Alarm value for Day of Week */
+#define LPC17_40_RTC_ALDOY_OFFSET 0x0074 /* Alarm value for Day of Year */
+#define LPC17_40_RTC_ALMON_OFFSET 0x0078 /* Alarm value for Months */
+#define LPC17_40_RTC_ALYEAR_OFFSET 0x007c /* Alarm value for Year */
+
+/* Register addresses ***************************************************************/
+/* Miscellaneous registers */
+
+#define LPC17_40_RTC_ILR (LPC17_40_RTC_BASE+LPC17_40_RTC_ILR_OFFSET)
+#define LPC17_40_RTC_CCR (LPC17_40_RTC_BASE+LPC17_40_RTC_CCR_OFFSET)
+#define LPC17_40_RTC_CIIR (LPC17_40_RTC_BASE+LPC17_40_RTC_CIIR_OFFSET)
+#define LPC17_40_RTC_AMR (LPC17_40_RTC_BASE+LPC17_40_RTC_AMR_OFFSET)
+#define LPC17_40_RTC_AUXEN (LPC17_40_RTC_BASE+LPC17_40_RTC_AUXEN_OFFSET)
+#define LPC17_40_RTC_AUX (LPC17_40_RTC_BASE+LPC17_40_RTC_AUX_OFFSET)
+
+/* Consolidated time registers */
+
+#define LPC17_40_RTC_CTIME0 (LPC17_40_RTC_BASE+LPC17_40_RTC_CTIME0_OFFSET)
+#define LPC17_40_RTC_CTIME1 (LPC17_40_RTC_BASE+LPC17_40_RTC_CTIME1_OFFSET)
+#define LPC17_40_RTC_CTIME2 (LPC17_40_RTC_BASE+LPC17_40_RTC_CTIME2_OFFSET)
+
+/* Time counter registers */
+
+#define LPC17_40_RTC_SEC (LPC17_40_RTC_BASE+LPC17_40_RTC_SEC_OFFSET)
+#define LPC17_40_RTC_MIN (LPC17_40_RTC_BASE+LPC17_40_RTC_MIN_OFFSET)
+#define LPC17_40_RTC_HOUR (LPC17_40_RTC_BASE+LPC17_40_RTC_HOUR_OFFSET)
+#define LPC17_40_RTC_DOM (LPC17_40_RTC_BASE+LPC17_40_RTC_DOM_OFFSET)
+#define LPC17_40_RTC_DOW (LPC17_40_RTC_BASE+LPC17_40_RTC_DOW_OFFSET)
+#define LPC17_40_RTC_DOY (LPC17_40_RTC_BASE+LPC17_40_RTC_DOY_OFFSET)
+#define LPC17_40_RTC_MONTH (LPC17_40_RTC_BASE+LPC17_40_RTC_MONTH_OFFSET)
+#define LPC17_40_RTC_YEAR (LPC17_40_RTC_BASE+LPC17_40_RTC_YEAR_OFFSET)
+#define LPC17_40_RTC_CALIB (LPC17_40_RTC_BASE+LPC17_40_RTC_CALIB_OFFSET)
+
+/* General purpose registers */
+
+#define LPC17_40_RTC_GPREG0 (LPC17_40_RTC_BASE+LPC17_40_RTC_GPREG0_OFFSET)
+#define LPC17_40_RTC_GPREG1 (LPC17_40_RTC_BASE+LPC17_40_RTC_GPREG1_OFFSET)
+#define LPC17_40_RTC_GPREG2 (LPC17_40_RTC_BASE+LPC17_40_RTC_GPREG2_OFFSET)
+#define LPC17_40_RTC_GPREG3 (LPC17_40_RTC_BASE+LPC17_40_RTC_GPREG3_OFFSET)
+#define LPC17_40_RTC_GPREG4 (LPC17_40_RTC_BASE+LPC17_40_RTC_GPREG4_OFFSET)
+
+/* Alarm register group */
+
+#define LPC17_40_RTC_ALSEC (LPC17_40_RTC_BASE+LPC17_40_RTC_ALSEC_OFFSET)
+#define LPC17_40_RTC_ALMIN (LPC17_40_RTC_BASE+LPC17_40_RTC_ALMIN_OFFSET)
+#define LPC17_40_RTC_ALHOUR (LPC17_40_RTC_BASE+LPC17_40_RTC_ALHOUR_OFFSET)
+#define LPC17_40_RTC_ALDOM (LPC17_40_RTC_BASE+LPC17_40_RTC_ALDOM_OFFSET)
+#define LPC17_40_RTC_ALDOW (LPC17_40_RTC_BASE+LPC17_40_RTC_ALDOW_OFFSET)
+#define LPC17_40_RTC_ALDOY (LPC17_40_RTC_BASE+LPC17_40_RTC_ALDOY_OFFSET)
+#define LPC17_40_RTC_ALMON (LPC17_40_RTC_BASE+LPC17_40_RTC_ALMON_OFFSET)
+#define LPC17_40_RTC_ALYEAR (LPC17_40_RTC_BASE+LPC17_40_RTC_ALYEAR_OFFSET)
+
+/* Register bit definitions *********************************************************/
+/* The following registers hold 32-bit values and have no bit fields to be defined:
+ *
+ * General Purpose Register 0
+ * General Purpose Register 1
+ * General Purpose Register 2
+ * General Purpose Register 3
+ * General Purpose Register 4
+ */
+
+/* Miscellaneous registers */
+/* Interrupt Location Register */
+
+#define RTC_ILR_RTCCIF (1 << 0) /* Bit 0: Counter Increment Interrupt */
+#define RTC_ILR_RTCALF (1 << 1) /* Bit 1: Alarm interrupt */
+ /* Bits 2-31: Reserved */
+/* Clock Control Register */
+
+#define RTC_CCR_CLKEN (1 << 0) /* Bit 0: Clock Enable */
+#define RTC_CCR_CTCRST (1 << 1) /* Bit 1: CTC Reset */
+ /* Bits 2-3: Internal test mode controls */
+#define RTC_CCR_CCALEN (1 << 4) /* Bit 4: Calibration counter enable */
+ /* Bits 5-31: Reserved */
+/* Counter Increment Interrupt Register */
+
+#define RTC_CIIR_IMSEC (1 << 0) /* Bit 0: Second interrupt */
+#define RTC_CIIR_IMMIN (1 << 1) /* Bit 1: Minute interrupt */
+#define RTC_CIIR_IMHOUR (1 << 2) /* Bit 2: Hour interrupt */
+#define RTC_CIIR_IMDOM (1 << 3) /* Bit 3: Day of Month value interrupt */
+#define RTC_CIIR_IMDOW (1 << 4) /* Bit 4: Day of Week value interrupt */
+#define RTC_CIIR_IMDOY (1 << 5) /* Bit 5: Day of Year interrupt */
+#define RTC_CIIR_IMMON (1 << 6) /* Bit 6: Month interrupt */
+#define RTC_CIIR_IMYEAR (1 << 7) /* Bit 7: Yearinterrupt */
+ /* Bits 8-31: Reserved */
+/* Alarm Mask Register */
+
+#define RTC_AMR_SEC (1 << 0) /* Bit 0: Second not compared for alarm */
+#define RTC_AMR_MIN (1 << 1) /* Bit 1: Minutes not compared for alarm */
+#define RTC_AMR_HOUR (1 << 2) /* Bit 2: Hour not compared for alarm */
+#define RTC_AMR_DOM (1 << 3) /* Bit 3: Day of Monthnot compared for alarm */
+#define RTC_AMR_DOW (1 << 4) /* Bit 4: Day of Week not compared for alarm */
+#define RTC_AMR_DOY (1 << 5) /* Bit 5: Day of Year not compared for alarm */
+#define RTC_AMR_MON (1 << 6) /* Bit 6: Month not compared for alarm */
+#define RTC_AMR_YEAR (1 << 7) /* Bit 7: Year not compared for alarm */
+ /* Bits 8-31: Reserved */
+
+/* RTC Auxiliary Control Register */
+ /* Bits 0-3: Reserved */
+#define RTC_AUXEN_RTCOSCF (1 << 4) /* Bit 4: RTC Oscillator Fail detect flag */
+#ifdef LPC178x_40xx
+ /* Bit 5: Reserved */
+# define RTC_AUXEN_RTCPDOUT (1 << 6) /* Bit 6: RTC power down mode flag */
+ /* Bits 7-31: Reserved */
+#endif
+
+/* RTC Auxiliary Enable Register */
+ /* Bits 0-3: Reserved */
+#define RTC_AUX_OSCFEN (1 << 4) /* Bit 4: Oscillator Fail Detect interrupt enable */
+ /* Bits 5-31: Reserved */
+
+/* Consolidated Time Registers */
+/* Consolidated Time Register 0 */
+
+#define RTC_CTIME0_SEC_SHIFT (0) /* Bits 0-5: Seconds */
+#define RTC_CTIME0_SEC_MASK (63 << RTC_CTIME0_SEC_SHIFT)
+ /* Bits 6-7: Reserved */
+#define RTC_CTIME0_MIN_SHIFT (8) /* Bits 8-13: Minutes */
+#define RTC_CTIME0_MIN_MASK (63 << RTC_CTIME0_MIN_SHIFT)
+ /* Bits 14-15: Reserved */
+#define RTC_CTIME0_HOURS_SHIFT (16) /* Bits 16-20: Hours */
+#define RTC_CTIME0_HOURS_MASK (31 << RTC_CTIME0_HOURS_SHIFT)
+ /* Bits 21-23: Reserved */
+#define RTC_CTIME0_DOW_SHIFT (24) /* Bits 24-26: Day of Week */
+#define RTC_CTIME0_DOW_MASK (7 << RTC_CTIME0_DOW_SHIFT)
+ /* Bits 27-31: Reserved */
+/* Consolidated Time Register 1 */
+
+#define RTC_CTIME1_DOM_SHIFT (0) /* Bits 0-4: Day of Month */
+#define RTC_CTIME1_DOM_MASK (31 << RTC_CTIME1_DOM_SHIFT)
+ /* Bits 5-7: Reserved */
+#define RTC_CTIME1_MON_SHIFT (8) /* Bits 8-11: Month */
+#define RTC_CTIME1_MON_MASK (15 << RTC_CTIME1_MON_SHIFT)
+ /* Bits 12-15: Reserved */
+#define RTC_CTIME1_YEAR_SHIFT (16) /* Bits 16-27: Year */
+#define RTC_CTIME1_YEAR_MASK (0x0fff << RTC_CTIME1_YEAR_SHIFT)
+ /* Bits 28-31: Reserved */
+/* Consolidated Time Register 2 */
+
+#define RTC_CTIME2_DOY_SHIFT (0) /* Bits 0-11: Day of Year */
+#define RTC_CTIME2_DOY_MASK (0x0fff << RTC_CTIME2_DOY_SHIFT)
+ /* Bits 12-31: Reserved */
+/* Time counter registers */
+
+#define RTC_SEC_MASK (0x003f)
+#define RTC_MIN_MASK (0x003f)
+#define RTC_HOUR_MASK (0x001f)
+#define RTC_DOM_MASK (0x001f)
+#define RTC_DOW_MASK (0x0007)
+#define RTC_DOY_MASK (0x01ff)
+#define RTC_MONTH_MASK (0x000f)
+#define RTC_YEAR_MASK (0x0fff)
+
+/* Calibration Value Register */
+
+#define RTC_CALIB_CALVAL_SHIFT (0) /* Bits 0-16: calibration counter counts to this value */
+#define RTC_CALIB_CALVAL_MASK (0xffff << RTC_CALIB_CALVAL_SHIFT)
+#define RTC_CALIB_CALDIR (1 << 17) /* Bit 17: Calibration direction */
+ /* Bits 18-31: Reserved */
+/* Alarm register group */
+
+#define RTC_ALSEC_MASK (0x003f)
+#define RTC_ALMIN_MASK (0x003f)
+#define RTC_ALHOUR_MASK (0x001f)
+#define RTC_ALDOM_MASK (0x001f)
+#define RTC_ALDOW_MASK (0x0007)
+#define RTC_ALDOY_MASK (0x01ff)
+#define RTC_ALMON_MASK (0x000f)
+#define RTC_ALYEAR_MASK (0x0fff)
+
+/************************************************************************************
+ * Public Types
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Data
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+#endif /* __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC17_40_RTC_H */
diff --git a/arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_rtcevmr.h b/arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_rtcevmr.h
new file mode 100644
index 00000000000..6df87091a1c
--- /dev/null
+++ b/arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_rtcevmr.h
@@ -0,0 +1,143 @@
+/************************************************************************************
+ * arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_rtcevmr.h
+ *
+ * Copyright (C) 2013 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ * 3. Neither the name NuttX 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 THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#ifndef __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC17_40_RTCEVMR_H
+#define __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC17_40_RTCEVMR_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include
+
+#include "chip.h"
+#include "hardware/lpc17_40_memorymap.h"
+
+/************************************************************************************
+ * Pre-processor Definitions
+ ************************************************************************************/
+
+/* Register offsets *****************************************************************/
+
+#define LPC17_40_RTCEV_ERCONTROL_OFFSET 0x0084 /* Monitor/Recorder Control register */
+#define LPC17_40_RTCEV_ERSTATUS_OFFSET 0x0080 /* Status register */
+#define LPC17_40_RTCEV_ERCOUNTERS_OFFSET 0x0088 /* Counters register */
+#define LPC17_40_RTCEV_ERFIRSTSTAMP0_OFFSET 0x0090 /* Channel 0 first Stamp register */
+#define LPC17_40_RTCEV_ERFIRSTSTAMP1_OFFSET 0x0090 /* Channel 1 first Stamp register */
+#define LPC17_40_RTCEV_ERFIRSTSTAMP2_OFFSET 0x0090 /* Channel 2 first Stamp register */
+#define LPC17_40_RTCEV_ERLASTSTAMP0_OFFSET 0x0098 /* Channel 0 last stamp register */
+#define LPC17_40_RTCEV_ERLASTSTAMP1_OFFSET 0x00a0 /* Channel 1 last stamp register */
+#define LPC17_40_RTCEV_ERLASTSTAMP2_OFFSET 0x00a8 /* Channel 2 last stamp register */
+
+#define LPC17_40_RTCEV_ERCONTROL (LPC17_40_RTC_BASE+LPC17_40_RTCEV_ERCONTROL_OFFSET)
+#define LPC17_40_RTCEV_ERSTATUS (LPC17_40_RTC_BASE+LPC17_40_RTCEV_ERSTATUS_OFFSET)
+#define LPC17_40_RTCEV_ERCOUNTERS (LPC17_40_RTC_BASE+LPC17_40_RTCEV_ERCOUNTERS_OFFSET)
+#define LPC17_40_RTCEV_ERFIRSTSTAMP0 (LPC17_40_RTC_BASE+LPC17_40_RTCEV_ERFIRSTSTAMP0_OFFSET)
+#define LPC17_40_RTCEV_ERFIRSTSTAMP1 (LPC17_40_RTC_BASE+LPC17_40_RTCEV_ERFIRSTSTAMP1_OFFSET)
+#define LPC17_40_RTCEV_ERFIRSTSTAMP2 (LPC17_40_RTC_BASE+LPC17_40_RTCEV_ERFIRSTSTAMP2_OFFSET)
+#define LPC17_40_RTCEV_ERLASTSTAMP0 (LPC17_40_RTC_BASE+LPC17_40_RTCEV_ERLASTSTAMP0_OFFSET)
+#define LPC17_40_RTCEV_ERLASTSTAMP1 (LPC17_40_RTC_BASE+LPC17_40_RTCEV_ERLASTSTAMP1_OFFSET)
+#define LPC17_40_RTCEV_ERLASTSTAMP2 (LPC17_40_RTC_BASE+LPC17_40_RTCEV_ERLASTSTAMP2_OFFSET)
+
+/* RTCEV ERCONTROL Event Monitor/Recorder Control Register */
+
+#define RTCEV_ERCONTROL_INTWAKE_EN0 (1) /* Bit 0: Interrupt/wakeup enable channel 0 */
+#define RTCEV_ERCONTROL_GPCLEAR_EN0 (1 << 1) /* Bit 1: Automatic clearing of RTC - channel 0 */
+#define RTCEV_ERCONTROL_POL0 (1 << 2) /* Bit 2: Edge polarity on RTC_EV0 pins */
+#define RTCEV_ERCONTROL_EV0_INPUT_EN (1 << 3) /* Bit 3: Event enable for channel 0 */
+ /* Bits 4-9: Reserved */
+#define RTCEV_ERCONTROL_INTWAKE_EN1 (1 << 10) /* Bit 10: Interrupt/wakeup enable - channel 1 */
+#define RTCEV_ERCONTROL_GPCLEAR_EN1 (1 << 11) /* Bit 11: Automatic clearing of RTC - channel 1 */
+#define RTCEV_ERCONTROL_POL1 (1 << 12) /* Bit 12: Edge polarity on RTC_EV1 pins */
+#define RTCEV_ERCONTROL_EV1_INPUT_EN (1 << 13) /* Bit 13: Event enable for channel 1 */
+ /* Bits 14-19: Reserved */
+#define RTCEV_ERCONTROL_INTWAKE_EN2 (1 << 20) /* Bit 20: Interrupt/wakeup enable - channel 2 */
+#define RTCEV_ERCONTROL_GPCLEAR_EN2 (1 << 21) /* Bit 21: Automatic clearing of RTC - channel 2 */
+#define RTCEV_ERCONTROL_POL2 (1 << 22) /* Bit 22: Edge polarity on RTC_EV2 pins */
+#define RTCEV_ERCONTROL_EV2_INPUT_EN (1 << 23) /* Bit 23: Event enable for channel 1 */
+ /* Bits 24-29: Reserved */
+#define RTCEV_ERCONTROL_ERMODE_SHIFT (30) /* Bits 30-31: Event monitoring mode */
+#define RTCEV_ERCONTROL_ERMODE_MASK (3 << RTCEV_ERCONTROL_ERMODE_SHIFT)
+# define ERMODE0 (0) /* monitor/clocks disabled */
+# define ERMODE1 (1) /* 16Hz sample clock */
+# define ERMODE2 (2) /* 64Hz sample clock */
+# define ERMODE3 (3) /* 1000Hz sample clock */
+
+/* RTCEV ERSTATUS - Monitor/Recorder Status Register */
+
+#define RTCEV_ERSTATUS_EV0 (1) /* Bit 0: Event flag - channel 0 */
+#define RTCEV_ERSTATUS_EV1 (1 << 1) /* Bit 1: Event flag - channel 1 */
+#define RTCEV_ERSTATUS_EV2 (1 << 2) /* Bit 2: Event flag - channel 2 */
+#define RTCEV_ERSTATUS_EV2 (1 << 3) /* Bit 3: GPReg async clear flag */
+ /* Bits 4-30: Reserved */
+#define RTCEV_ERSTATUS_WAKEUP (1 << 31) /* Bit 31: Interrupt/Wakeup request flag */
+
+/* RTCEV ERCOUNTERS - Monitor/Recorder Counters Register */
+
+#define RTCEV_ERCOUNTER_COUNTER0_SHIFT (0) /* Bits 0-2: Value for event 0 */
+#define RTCEV_ERCOUNTER_COUNTER0_MASK (7 << RTCEV_ERCOUNTER_COUNTER0_SHIFT)
+ /* Bits 3-7: Reserved */
+#define RTCEV_ERCOUNTER_COUNTER1_SHIFT (8) i /* Bits 8-10: Value for event 1 */
+#define RTCEV_ERCOUNTER_COUNTER1_MASK (7 << RTCEV_ERCOUNTER_COUNTER1_SHIFT)
+ /* Bits 11-15: Reserved */
+#define RTCEV_ERCOUNTER_COUNTER2_SHIFT (16) /* Bits 16-18: Value for event 2 */
+#define RTCEV_ERCOUNTER_COUNTER2_MASK (7 << RTCEV_ERCOUNTER_COUNTER2_SHIFT)
+ /* Bits 19-31: Reserved */
+
+/* RTCEV ERFIRSTSTAMP[0-2] - Monitor/Recorder First Stamp Registers */
+/* RTCEV ERLASTSTAMP[0-2] - Monitor/Recorder Last Stamp Registers */
+
+#define RTCEV_TIMESTAMP_SEC_SHIFT (0) /* Bits 0-5: Seconds value 0-59 */
+#define RTCEV_TIMESTAMP_SEC_MASK (0x3f << RTCEV_TIMESTAMP_SEC_SHIFT)
+#define RTCEV_TIMESTAMP_MIN_SHIFT (6) /* Bits 6-11: Minutes value 0-59 */
+#define RTCEV_TIMESTAMP_MIN_MASK (0x3f << RTCEV_TIMESTAMP_MIN_SHIFT)
+#define RTCEV_TIMESTAMP_HOUR_SHIFT (12) /* Bits 12-16: Hours value 0-23 */
+#define RTCEV_TIMESTAMP_HOUR_MASK (0x1f << RTCEV_TIMESTAMP_HOUR_SHIFT)
+#define RTCEV_TIMESTAMP_DOY_SHIFT (17) /* Bits 17-25: Day of the year value 1-366 */
+#define RTCEV_TIMESTAMP_DOY_MASK (0x1ff << RTCEV_TIMESTAMP_DOY_SHIFT)
+
+/************************************************************************************
+ * Public Types
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Data
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+#endif /* __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC17_40_RTCEVMR_H */
diff --git a/arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_sdcard.h b/arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_sdcard.h
new file mode 100644
index 00000000000..cac8c1b7336
--- /dev/null
+++ b/arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_sdcard.h
@@ -0,0 +1,272 @@
+/************************************************************************************
+ * arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_sdcard.h
+ *
+ * Copyright (C) 2013 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ * 3. Neither the name NuttX 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 THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#ifndef __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC17_40_SDCARD_H
+#define __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC17_40_SDCARD_H
+
+/************************************************************************************
+ * Pre-processor Definitions
+ ************************************************************************************/
+
+/* Register Offsets *****************************************************************/
+
+#define LPC17_40_SDCARD_PWR_OFFSET 0x0000 /* SD card power control register */
+#define LPC17_40_SDCARD_CLOCK_OFFSET 0x0004 /* SD card clock control register */
+#define LPC17_40_SDCARD_ARG_OFFSET 0x0008 /* SD card argument register */
+#define LPC17_40_SDCARD_CMD_OFFSET 0x000c /* SD card command register */
+#define LPC17_40_SDCARD_RESPCMD_OFFSET 0x0010 /* SD card command response register */
+#define LPC17_40_SDCARD_RESP_OFFSET(n) (0x0010+4*(n))
+# define LPC17_40_SDCARD_RESP0_OFFSET 0x0014 /* SD card response 1 register */
+# define LPC17_40_SDCARD_RESP1_OFFSET 0x0018 /* SD card response 2 register */
+# define LPC17_40_SDCARD_RESP2_OFFSET 0x001c /* SD card response 3 register */
+# define LPC17_40_SDCARD_RESP3_OFFSET 0x0020 /* SD card response 4 register */
+#define LPC17_40_SDCARD_DTIMER_OFFSET 0x0024 /* SD card data timer register */
+#define LPC17_40_SDCARD_DLEN_OFFSET 0x0028 /* SD card data length register */
+#define LPC17_40_SDCARD_DCTRL_OFFSET 0x002c /* SD card data control register */
+#define LPC17_40_SDCARD_DCOUNT_OFFSET 0x0030 /* SD card data counter register */
+#define LPC17_40_SDCARD_STATUS_OFFSET 0x0034 /* SD card status register */
+#define LPC17_40_SDCARD_CLEAR_OFFSET 0x0038 /* SD card interrupt clear register */
+#define LPC17_40_SDCARD_MASK0_OFFSET 0x003c /* SD card mask register */
+#define LPC17_40_SDCARD_FIFOCNT_OFFSET 0x0048 /* SD card FIFO counter register */
+#define LPC17_40_SDCARD_FIFO_OFFSET 0x0080 /* SD card data FIFO register */
+
+/* Register Addresses ***************************************************************/
+
+#define LPC17_40_SDCARD_PWR (LPC17_40_MCI_BASE+LPC17_40_SDCARD_PWR_OFFSET)
+#define LPC17_40_SDCARD_CLOCK (LPC17_40_MCI_BASE+LPC17_40_SDCARD_CLOCK_OFFSET)
+#define LPC17_40_SDCARD_ARG (LPC17_40_MCI_BASE+LPC17_40_SDCARD_ARG_OFFSET)
+#define LPC17_40_SDCARD_CMD (LPC17_40_MCI_BASE+LPC17_40_SDCARD_CMD_OFFSET)
+#define LPC17_40_SDCARD_RESPCMD (LPC17_40_MCI_BASE+LPC17_40_SDCARD_RESPCMD_OFFSET)
+#define LPC17_40_SDCARD_RESP(n) (LPC17_40_MCI_BASE+LPC17_40_SDCARD_RESP_OFFSET(n))
+#define LPC17_40_SDCARD_RESP0 (LPC17_40_MCI_BASE+LPC17_40_SDCARD_RESP0_OFFSET)
+#define LPC17_40_SDCARD_RESP1 (LPC17_40_MCI_BASE+LPC17_40_SDCARD_RESP1_OFFSET)
+#define LPC17_40_SDCARD_RESP2 (LPC17_40_MCI_BASE+LPC17_40_SDCARD_RESP2_OFFSET)
+#define LPC17_40_SDCARD_RESP3 (LPC17_40_MCI_BASE+LPC17_40_SDCARD_RESP3_OFFSET)
+#define LPC17_40_SDCARD_DTIMER (LPC17_40_MCI_BASE+LPC17_40_SDCARD_DTIMER_OFFSET)
+#define LPC17_40_SDCARD_DLEN (LPC17_40_MCI_BASE+LPC17_40_SDCARD_DLEN_OFFSET)
+#define LPC17_40_SDCARD_DCTRL (LPC17_40_MCI_BASE+LPC17_40_SDCARD_DCTRL_OFFSET)
+#define LPC17_40_SDCARD_DCOUNT (LPC17_40_MCI_BASE+LPC17_40_SDCARD_DCOUNT_OFFSET)
+#define LPC17_40_SDCARD_STATUS (LPC17_40_MCI_BASE+LPC17_40_SDCARD_STATUS_OFFSET)
+#define LPC17_40_SDCARD_CLEAR (LPC17_40_MCI_BASE+LPC17_40_SDCARD_CLEAR_OFFSET)
+#define LPC17_40_SDCARD_MASK0 (LPC17_40_MCI_BASE+LPC17_40_SDCARD_MASK0_OFFSET)
+#define LPC17_40_SDCARD_FIFOCNT (LPC17_40_MCI_BASE+LPC17_40_SDCARD_FIFOCNT_OFFSET)
+#define LPC17_40_SDCARD_FIFO (LPC17_40_MCI_BASE+LPC17_40_SDCARD_FIFO_OFFSET)
+
+/* Register Bitfield Definitions ****************************************************/
+
+/* MCI Power Control Registers - PWR - 0x400c 0000*/
+
+#define SDCARD_PWR_CTRL_SHIFT (0) /* Bits 0-1: Power supply control bits */
+#define SDCARD_PWR_CTRL_MASK (3 << SDCARD_PWR_CTRL_SHIFT)
+# define SDCARD_PWR_CTRL_OFF (0 << SDCARD_PWR_CTRL_SHIFT) /* 00: Power-off: card clock stopped */
+# define SDCARD_PWR_CTRL_PWRUP (2 << SDCARD_PWR_CTRL_SHIFT) /* 10: Reserved power-up */
+# define SDCARD_PWR_CTRL_ON (3 << SDCARD_PWR_CTRL_SHIFT) /* 11: Power-on: card is clocked */
+ /* Bits 2-5 Reserved */
+#define SDCARD_PWR_OPENDRAIN (1 << 6) /* SD_CMD Output Control */
+#define SDCARD_PWR_ROD (1 << 7) /* Rod Control */
+ /* Bits 8-31: Reserved */
+#define SDCARD_PWR_RESET (0) /* Reset value */
+
+/* MCI Clock Control Register - CLOCK - 0x400c 0004 */
+
+#define SDCARD_CLOCK_CLKDIV_SHIFT (0) /* Bits 7-0: Clock divide factor */
+#define SDCARD_CLOCK_CLKDIV_MASK (0xff << SDCARD_CLOCK_CLKDIV_SHIFT)
+#define SDCARD_CLOCK_CLKEN (1 << 8) /* Bit 8: Clock enable bit */
+#define SDCARD_CLOCK_PWRSAV (1 << 9) /* Bit 9: Power saving configuration bit */
+#define SDCARD_CLOCK_BYPASS (1 << 10) /* Bit 10: Clock divider bypass enable bit */
+#define SDCARD_CLOCK_WIDBUS (1 << 11) /* Bit 11: Wide bus mode enable bit */
+# define SDCARD_CLOCK_WIDBUS_D1 (0) /* 0: Default (SDIO_D0) */
+# define SDCARD_CLOCK_WIDBUS_D4 (SDCARD_CLOCK_WIDBUS) /* 1: 4-wide (SDIO_D[3:0]) */
+ /* Bits 12-31: Reserved */
+
+#define SDCARD_CLOCK_RESET (0) /* Reset value */
+
+/* MCI Argument Register - ARGUMENT - 0x400c 0008 has no bitfields */
+
+#define SDCARD_ARG_RESET (0) /* Reset value */
+
+/* MCI Command Register - COMMAND - 0x400c 000c */
+
+#define SDCARD_CMD_INDEX_SHIFT (0) /* Bits 0-5: Command Index */
+#define SDCARD_CMD_INDEX_MASK (0x3f << SDCARD_CMD_INDEX_SHIFT)
+#define SDCARD_CMD_WAITRESP_SHIFT (6) /* Bits 7-6: Wait for response bits */
+#define SDCARD_CMD_WAITRESP_MASK (3 << SDCARD_CMD_WAITRESP_SHIFT)
+# define SDCARD_CMD_NORESPONSE (0 << SDCARD_CMD_WAITRESP_SHIFT) /* 00/01: No response */
+# define SDCARD_CMD_SHORTRESPONSE (1 << SDCARD_CMD_WAITRESP_SHIFT) /* 10: Short response */
+# define SDCARD_CMD_LONGRESPONSE (3 << SDCARD_CMD_WAITRESP_SHIFT) /* 11: Long response */
+#define SDCARD_CMD_WAITINT (1 << 8) /* Bit 8: CPSM waits for interrupt request */
+#define SDCARD_CMD_WAITPEND (1 << 9) /* Bit 9: CPSM Waits for ends of data transfer */
+#define SDCARD_CMD_CPSMEN (1 << 10) /* Bit 10: Command path state machine enable */
+ /* Bits 11-31: Reserved */
+
+#define SDCARD_CMD_RESET (0) /* Reset value */
+
+/* MCI Command Response Register - RESPCOMMAND - 0x400c 0010 */
+
+#define SDCARD_RESPCMD_SHIFT (0) /* Bits 0-5: Resopnse Command index */
+#define SDCARD_RESPCMD_MASK (0x3f << SDCARD_RESPCMD_SHIFT)
+ /* Bits 6-31: Reserved */
+
+/* MCI Response Registers RESPONSE0-3 - 0x400c 0014, 0x400c 0018,
+ No bitfields 0x400c 001c, 0x400c 0020 */
+
+
+/* MCI - Data Timer Register DATATIMER - 0x400c 0024 */
+/* No bitfields */
+
+#define SDCARD_DTIMER_RESET (0) /* Reset value */
+
+/* MCI - Data Length Register DATALENGTH - 0x400C 0028 */
+
+#define SDCARD_DATALENGTH_SHIFT (0) /* Bits 0-15: Data length value */
+#define SDCARD_DATALENGTH_MASK (0xffff << SDCARD_DATALENGTH_SHIFT)
+ /* Bits 16-31: Reserved */
+
+#define SDCARD_DLEN_RESET (0) /* Reset value */
+
+/* MCI - Data Control Register - DATACTRL - 0x400c 002c */
+
+#define SDCARD_DCTRL_DTEN (1 << 0) /* Bit 0: Data transfer enabled bit */
+#define SDCARD_DCTRL_DTDIR (1 << 1) /* Bit 1: Data transfer direction */
+#define SDCARD_DCTRL_DTMODE (1 << 2) /* Bit 2: Data transfer mode */
+#define SDCARD_DCTRL_DMAEN (1 << 3) /* Bit 3: DMA enable bit */
+#define SDCARD_DCTRL_DBLOCKSIZE_SHIFT (4) /* Bits 4-7: Data block size */
+#define SDCARD_DCTRL_DBLOCKSIZE_MASK (15 << SDCARD_DCTRL_DBLOCKSIZE_SHIFT)
+# define SDCARD_DCTRL_1BYTE (0 << SDCARD_DCTRL_DBLOCKSIZE_SHIFT)
+# define SDCARD_DCTRL_2BYTES (1 << SDCARD_DCTRL_DBLOCKSIZE_SHIFT)
+# define SDCARD_DCTRL_4BYTES (2 << SDCARD_DCTRL_DBLOCKSIZE_SHIFT)
+# define SDCARD_DCTRL_8BYTES (3 << SDCARD_DCTRL_DBLOCKSIZE_SHIFT)
+# define SDCARD_DCTRL_16BYTES (4 << SDCARD_DCTRL_DBLOCKSIZE_SHIFT)
+# define SDCARD_DCTRL_32BYTES (5 << SDCARD_DCTRL_DBLOCKSIZE_SHIFT)
+# define SDCARD_DCTRL_64BYTES (6 << SDCARD_DCTRL_DBLOCKSIZE_SHIFT)
+# define SDCARD_DCTRL_128BYTES (7 << SDCARD_DCTRL_DBLOCKSIZE_SHIFT)
+# define SDCARD_DCTRL_256BYTES (8 << SDCARD_DCTRL_DBLOCKSIZE_SHIFT)
+# define SDCARD_DCTRL_512BYTES (9 << SDCARD_DCTRL_DBLOCKSIZE_SHIFT)
+# define SDCARD_DCTRL_1KBYTE (10 << SDCARD_DCTRL_DBLOCKSIZE_SHIFT)
+# define SDCARD_DCTRL_2KBYTES (11 << SDCARD_DCTRL_DBLOCKSIZE_SHIFT)
+ /* Bits 8-31: Reserved */
+
+#define SDCARD_DCTRL_RESET (0) /* Reset value */
+
+/* MCI - Data Length Register DATALENGTH - 0x400c 0028 */
+
+#define SDCARD_DATACOUNT_SHIFT (0) /* Bits 0-15: Remaining data */
+#define SDCARD_DATACOUNT_MASK (0xffff << SDCARD_DATACOUNT_SHIFT)
+ /* Bits 16-31: Reserved */
+
+/* MCI - Status Register -Status - 0x400c 0034 */
+
+#define SDCARD_STATUS_CCRCFAIL (1 << 0) /* Bit 0: Command response CRC fail */
+#define SDCARD_STATUS_DCRCFAIL (1 << 1) /* Bit 1: Data block CRC fail */
+#define SDCARD_STATUS_CTIMEOUT (1 << 2) /* Bit 2: Command response timeout */
+#define SDCARD_STATUS_DTIMEOUT (1 << 3) /* Bit 3: Data timeout */
+#define SDCARD_STATUS_TXUNDERR (1 << 4) /* Bit 4: Transmit FIFO underrun error */
+#define SDCARD_STATUS_RXOVERR (1 << 5) /* Bit 5: Received FIFO overrun error */
+#define SDCARD_STATUS_CMDREND (1 << 6) /* Bit 6: Command response received */
+#define SDCARD_STATUS_CMDSENT (1 << 7) /* Bit 7: Command sent */
+#define SDCARD_STATUS_DATAEND (1 << 8) /* Bit 8: Data end */
+#define SDCARD_STATUS_STBITERR (1 << 9) /* Bit 9: Start bit not detected */
+#define SDCARD_STATUS_DBCKEND (1 << 10) /* Bit 10: Data block sent/received */
+#define SDCARD_STATUS_CMDACT (1 << 11) /* Bit 11: Command transfer in progress */
+#define SDCARD_STATUS_TXACT (1 << 12) /* Bit 12: Data transmit in progress */
+#define SDCARD_STATUS_RXACT (1 << 13) /* Bit 13: Data receive in progress */
+#define SDCARD_STATUS_TXFIFOHE (1 << 14) /* Bit 14: Transmit FIFO half empty */
+#define SDCARD_STATUS_RXFIFOHF (1 << 15) /* Bit 15: Receive FIFO half full */
+#define SDCARD_STATUS_TXFIFOF (1 << 16) /* Bit 16: Transmit FIFO full */
+#define SDCARD_STATUS_RXFIFOF (1 << 17) /* Bit 17: Receive FIFO full */
+#define SDCARD_STATUS_TXFIFOE (1 << 18) /* Bit 18: Transmit FIFO empty */
+#define SDCARD_STATUS_RXFIFOE (1 << 19) /* Bit 19: Receive FIFO empty */
+#define SDCARD_STATUS_TXDAVL (1 << 20) /* Bit 20: Data available in transmit FIFO */
+#define SDCARD_STATUS_RXDAVL (1 << 21) /* Bit 21: Data available in receive FIFO */
+ /* Bits 22-31: Reserved */
+
+/* MCI - Clear Register CLEAR - 0x400c 0038 */
+
+#define SDCARD_CLEAR_CCRCFAILC (1 << 0) /* Bit 0: CCRCFAIL flag clear bit */
+#define SDCARD_CLEAR_DCRCFAILC (1 << 1) /* Bit 1: DCRCFAIL flag clear bit */
+#define SDCARD_CLEAR_CTIMEOUTC (1 << 2) /* Bit 2: CTIMEOUT flag clear bit */
+#define SDCARD_CLEAR_DTIMEOUTC (1 << 3) /* Bit 3: DTIMEOUT flag clear bit */
+#define SDCARD_CLEAR_TXUNDERRC (1 << 4) /* Bit 4: TXUNDERR flag clear bit */
+#define SDCARD_CLEAR_RXOVERRC (1 << 5) /* Bit 5: RXOVERR flag clear bit */
+#define SDCARD_CLEAR_CMDRENDC (1 << 6) /* Bit 6: CMDREND flag clear bit */
+#define SDCARD_CLEAR_CMDSENTC (1 << 7) /* Bit 7: CMDSENT flag clear bit */
+#define SDCARD_CLEAR_DATAENDC (1 << 8) /* Bit 8: DATAEND flag clear bit */
+#define SDCARD_CLEAR_STBITERRC (1 << 9) /* Bit 9: STBITERR flag clear bit */
+#define SDCARD_CLEAR_DBCKENDC (1 << 10) /* Bit 10: DBCKEND flag clear bit */
+ /* Bits 11-31: Reserved */
+
+#define SDCARD_CLEAR_RESET 0x000007ff
+#define SDCARD_CLEAR_STATICFLAGS 0x000005ff
+
+/* MCI - Interrupt Mask Registers - MASK0 - 0x400c 003c */
+
+#define SDCARD_MASK0_CCRCFAILIE (1 << 0) /* Bit 0: Command CRC fail interrupt enable */
+#define SDCARD_MASK0_DCRCFAILIE (1 << 1) /* Bit 1: Data CRC fail interrupt enable */
+#define SDCARD_MASK0_CTIMEOUTIE (1 << 2) /* Bit 2: Command timeout interrupt enable */
+#define SDCARD_MASK0_DTIMEOUTIE (1 << 3) /* Bit 3: Data timeout interrupt enable */
+#define SDCARD_MASK0_TXUNDERRIE (1 << 4) /* Bit 4: Tx FIFO underrun error interrupt enable */
+#define SDCARD_MASK0_RXOVERRIE (1 << 5) /* Bit 5: Rx FIFO overrun error interrupt enable */
+#define SDCARD_MASK0_CMDRENDIE (1 << 6) /* Bit 6: Command response received interrupt enable */
+#define SDCARD_MASK0_CMDSENTIE (1 << 7) /* Bit 7: Command sent interrupt enable */
+#define SDCARD_MASK0_DATAENDIE (1 << 8) /* Bit 8: Data end interrupt enable */
+#define SDCARD_MASK0_STBITERRIE (1 << 9) /* Bit 9: Start bit error interrupt enable */
+#define SDCARD_MASK0_DBCKENDIE (1 << 10) /* Bit 10: Data block end interrupt enable */
+#define SDCARD_MASK0_CMDACTIE (1 << 11) /* Bit 11: Command acting interrupt enable */
+#define SDCARD_MASK0_TXACTIE (1 << 12) /* Bit 12: Data transmit acting interrupt enable */
+#define SDCARD_MASK0_RXACTIE (1 << 13) /* Bit 13: Data receive acting interrupt enable */
+#define SDCARD_MASK0_TXFIFOHEIE (1 << 14) /* Bit 14: Tx FIFO half empty interrupt enable */
+#define SDCARD_MASK0_RXFIFOHFIE (1 << 15) /* Bit 15: Rx FIFO half full interrupt enable */
+#define SDCARD_MASK0_TXFIFOFIE (1 << 16) /* Bit 16: Tx FIFO full interrupt enable */
+#define SDCARD_MASK0_RXFIFOFIE (1 << 17) /* Bit 17: Rx FIFO full interrupt enable */
+#define SDCARD_MASK0_TXFIFOEIE (1 << 18) /* Bit 18: Tx FIFO empty interrupt enable */
+#define SDCARD_MASK0_RXFIFOEIE (1 << 19) /* Bit 19: Rx FIFO empty interrupt enable */
+#define SDCARD_MASK0_TXDAVLIE (1 << 20) /* Bit 20: Data available in Tx FIFO interrupt enable */
+#define SDCARD_MASK0_RXDAVLIE (1 << 21) /* Bit 21: Data available in Rx FIFO interrupt enable */
+ /* Bits 22-31: Reserved */
+#define SDCARD_MASK0_RESET (0)
+
+/* MCI - FIFO Counter Register (FIFOCNT - 0x400c 0048 */
+
+#define SDCARD_FIFOCNT_SHIFT (0) /* Bits 0-14: Remaining data */
+#define SDCARD_FIFOCNT_MASK (0x7fff << SDCARD_FIFOCNT_SHIFT)
+ /* Bits 15-31: Reserved */
+
+/* MCI - Data FIFO Register - FIFO - 0x400c 0080 to 0x400c 00bc */
+/* The receive and transmit FIFOs can be read or written as 32 bit wide registers.
+ * The FIFOs contain 16 entries on 16 sequential addresses.
+ */
+
+#endif /* __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC17_40_SDCARD_H */
+
diff --git a/arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_spi.h b/arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_spi.h
new file mode 100644
index 00000000000..fdd991ccc1f
--- /dev/null
+++ b/arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_spi.h
@@ -0,0 +1,141 @@
+/************************************************************************************
+ * arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_spi.h
+ *
+ * Copyright (C) 2010, 2013 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ * 3. Neither the name NuttX 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 THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#ifndef __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC17_40_SPI_H
+#define __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC17_40_SPI_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include
+
+#include "chip.h"
+#include "hardware/lpc17_40_memorymap.h"
+
+/************************************************************************************
+ * Pre-processor Definitions
+ ************************************************************************************/
+
+/* Register offsets *****************************************************************/
+
+#define LPC17_40_SPI_CR_OFFSET 0x0000 /* Control Register */
+#define LPC17_40_SPI_SR_OFFSET 0x0004 /* SPI Status Register */
+#define LPC17_40_SPI_DR_OFFSET 0x0008 /* SPI Data Register */
+#define LPC17_40_SPI_CCR_OFFSET 0x000c /* SPI Clock Counter Register */
+#define LPC17_40_SPI_TCR_OFFSET 0x0010 /* SPI Test Control Register */
+#define LPC17_40_SPI_TSR_OFFSET 0x0014 /* SPI Test Status Register */
+#define LPC17_40_SPI_INT_OFFSET 0x001c /* SPI Interrupt Register */
+
+/* Register addresses ***************************************************************/
+
+#define LPC17_40_SPI_CR (LPC17_40_SPI_BASE+LPC17_40_SPI_CR_OFFSET)
+#define LPC17_40_SPI_SR (LPC17_40_SPI_BASE+LPC17_40_SPI_SR_OFFSET)
+#define LPC17_40_SPI_DR (LPC17_40_SPI_BASE+LPC17_40_SPI_DR_OFFSET)
+#define LPC17_40_SPI_CCR (LPC17_40_SPI_BASE+LPC17_40_SPI_CCR_OFFSET)
+#define LPC17_40_TCR_CCR (LPC17_40_SPI_BASE+LPC17_40_SPI_TCR_OFFSET)
+#define LPC17_40_TSR_CCR (LPC17_40_SPI_BASE+LPC17_40_SPI_TSR_OFFSET)
+#define LPC17_40_SPI_INT (LPC17_40_SPI_BASE+LPC17_40_SPI_INT_OFFSET)
+
+/* Register bit definitions *********************************************************/
+
+/* Control Register */
+ /* Bits 0-1: Reserved */
+#define SPI_CR_BITENABLE (1 << 2) /* Bit 2: Enable word size selected by BITS */
+#define SPI_CR_CPHA (1 << 3) /* Bit 3: Clock phase control */
+#define SPI_CR_CPOL (1 << 4) /* Bit 4: Clock polarity control */
+#define SPI_CR_MSTR (1 << 5) /* Bit 5: Master mode select */
+#define SPI_CR_LSBF (1 << 6) /* Bit 6: SPI data is transferred LSB first */
+#define SPI_CR_SPIE (1 << 7) /* Bit 7: Serial peripheral interrupt enable */
+#define SPI_CR_BITS_SHIFT (8) /* Bits 8-11: Number of bits per word (BITENABLE==1) */
+#define SPI_CR_BITS_MASK (15 << SPI_CR_BITS_SHIFT)
+# define SPI_CR_BITS_8BITS (8 << SPI_CR_BITS_SHIFT) /* 8 bits per transfer */
+# define SPI_CR_BITS_9BITS (9 << SPI_CR_BITS_SHIFT) /* 9 bits per transfer */
+# define SPI_CR_BITS_10BITS (10 << SPI_CR_BITS_SHIFT) /* 10 bits per transfer */
+# define SPI_CR_BITS_11BITS (11 << SPI_CR_BITS_SHIFT) /* 11 bits per transfer */
+# define SPI_CR_BITS_12BITS (12 << SPI_CR_BITS_SHIFT) /* 12 bits per transfer */
+# define SPI_CR_BITS_13BITS (13 << SPI_CR_BITS_SHIFT) /* 13 bits per transfer */
+# define SPI_CR_BITS_14BITS (14 << SPI_CR_BITS_SHIFT) /* 14 bits per transfer */
+# define SPI_CR_BITS_15BITS (15 << SPI_CR_BITS_SHIFT) /* 15 bits per transfer */
+# define SPI_CR_BITS_16BITS (0 << SPI_CR_BITS_SHIFT) /* 16 bits per transfer */
+ /* Bits 12-31: Reserved */
+/* SPI Status Register */
+ /* Bits 0-2: Reserved */
+#define SPI_SR_ABRT (1 << 3) /* Bit 3: Slave abort */
+#define SPI_SR_MODF (1 << 4) /* Bit 4: Mode fault */
+#define SPI_SR_ROVR (1 << 5) /* Bit 5: Read overrun */
+#define SPI_SR_WCOL (1 << 6) /* Bit 6: Write collision */
+#define SPI_SR_SPIF (1 << 7) /* Bit 7: SPI transfer complete */
+ /* Bits 8-31: Reserved */
+/* SPI Data Register */
+
+#define SPI_DR_MASK (0xff) /* Bits 0-15: SPI Bi-directional data port */
+#define SPI_DR_MASKWIDE (0xffff) /* Bits 0-15: If SPI_CR_BITENABLE != 0 */
+ /* Bits 8-31: Reserved */
+/* SPI Clock Counter Register */
+
+#define SPI_CCR_MASK (0xff) /* Bits 0-7: SPI Clock counter setting */
+ /* Bits 8-31: Reserved */
+/* SPI Test Control Register */
+ /* Bit 0: Reserved */
+#define SPI_TCR_TEST_SHIFT (1) /* Bits 1-7: SPI test mode */
+#define SPI_TCR_TEST_MASK (0x7f << SPI_TCR_TEST_SHIFT)
+ /* Bits 8-31: Reserved */
+/* SPI Test Status Register */
+ /* Bits 0-2: Reserved */
+#define SPI_TSR_ABRT (1 << 3) /* Bit 3: Slave abort */
+#define SPI_TSR_MODF (1 << 4) /* Bit 4: Mode fault */
+#define SPI_TSR_ROVR (1 << 5) /* Bit 5: Read overrun */
+#define SPI_TSR_WCOL (1 << 6) /* Bit 6: Write collision */
+#define SPI_TSR_SPIF (1 << 7) /* Bit 7: SPI transfer complete */
+ /* Bits 8-31: Reserved */
+/* SPI Interrupt Register */
+
+#define SPI_INT_SPIF (1 << 0) /* SPI interrupt */
+ /* Bits 1-31: Reserved */
+
+/************************************************************************************
+ * Public Types
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Data
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+#endif /* __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC17_40_SPI_H */
diff --git a/arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_ssp.h b/arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_ssp.h
new file mode 100644
index 00000000000..21e74239fa8
--- /dev/null
+++ b/arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_ssp.h
@@ -0,0 +1,185 @@
+/************************************************************************************
+ * arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_ssp.h
+ *
+ * Copyright (C) 2010, 2012-2013 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ * 3. Neither the name NuttX 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 THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#ifndef __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC17_40_SSP_H
+#define __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC17_40_SSP_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include
+
+#include "chip.h"
+#include "hardware/lpc17_40_memorymap.h"
+
+/************************************************************************************
+ * Pre-processor Definitions
+ ************************************************************************************/
+/* 8 frame FIFOs for both transmit and receive */
+
+#define LPC17_40_SSP_FIFOSZ 8
+
+/* Register offsets *****************************************************************/
+
+#define LPC17_40_SSP_CR0_OFFSET 0x0000 /* Control Register 0 */
+#define LPC17_40_SSP_CR1_OFFSET 0x0004 /* Control Register 1 */
+#define LPC17_40_SSP_DR_OFFSET 0x0008 /* Data Register */
+#define LPC17_40_SSP_SR_OFFSET 0x000c /* Status Register */
+#define LPC17_40_SSP_CPSR_OFFSET 0x0010 /* Clock Prescale Register */
+#define LPC17_40_SSP_IMSC_OFFSET 0x0014 /* Interrupt Mask Set and Clear Register */
+#define LPC17_40_SSP_RIS_OFFSET 0x0018 /* Raw Interrupt Status Register */
+#define LPC17_40_SSP_MIS_OFFSET 0x001c /* Masked Interrupt Status Register */
+#define LPC17_40_SSP_ICR_OFFSET 0x0020 /* Interrupt Clear Register */
+#define LPC17_40_SSP_DMACR_OFFSET 0x0024 /* DMA Control Register */
+
+/* Register addresses ***************************************************************/
+
+#define LPC17_40_SSP0_CR0 (LPC17_40_SSP0_BASE+LPC17_40_SSP_CR0_OFFSET)
+#define LPC17_40_SSP0_CR1 (LPC17_40_SSP0_BASE+LPC17_40_SSP_CR1_OFFSET)
+#define LPC17_40_SSP0_DR (LPC17_40_SSP0_BASE+LPC17_40_SSP_DR_OFFSET)
+#define LPC17_40_SSP0_SR (LPC17_40_SSP0_BASE+LPC17_40_SSP_SR_OFFSET)
+#define LPC17_40_SSP0_CPSR (LPC17_40_SSP0_BASE+LPC17_40_SSP_CPSR_OFFSET)
+#define LPC17_40_SSP0_IMSC (LPC17_40_SSP0_BASE+LPC17_40_SSP_IMSC_OFFSET)
+#define LPC17_40_SSP0_RIS (LPC17_40_SSP0_BASE+LPC17_40_SSP_RIS_OFFSET)
+#define LPC17_40_SSP0_MIS (LPC17_40_SSP0_BASE+LPC17_40_SSP_MIS_OFFSET)
+#define LPC17_40_SSP0_ICR (LPC17_40_SSP0_BASE+LPC17_40_SSP_ICR_OFFSET)
+#define LPC17_40_SSP0_DMACR (LPC17_40_SSP0_BASE+LPC17_40_SSP_DMACR_OFFSET)
+
+#define LPC17_40_SSP1_CR0 (LPC17_40_SSP1_BASE+LPC17_40_SSP_CR0_OFFSET)
+#define LPC17_40_SSP1_CR1 (LPC17_40_SSP1_BASE+LPC17_40_SSP_CR1_OFFSET)
+#define LPC17_40_SSP1_DR (LPC17_40_SSP1_BASE+LPC17_40_SSP_DR_OFFSET)
+#define LPC17_40_SSP1_SR (LPC17_40_SSP1_BASE+LPC17_40_SSP_SR_OFFSET)
+#define LPC17_40_SSP1_CPSR (LPC17_40_SSP1_BASE+LPC17_40_SSP_CPSR_OFFSET)
+#define LPC17_40_SSP1_IMSC (LPC17_40_SSP1_BASE+LPC17_40_SSP_IMSC_OFFSET)
+#define LPC17_40_SSP1_RIS (LPC17_40_SSP1_BASE+LPC17_40_SSP_RIS_OFFSET)
+#define LPC17_40_SSP1_MIS (LPC17_40_SSP1_BASE+LPC17_40_SSP_MIS_OFFSET)
+#define LPC17_40_SSP1_ICR (LPC17_40_SSP1_BASE+LPC17_40_SSP_ICR_OFFSET)
+#define LPC17_40_SSP1_DMACR (LPC17_40_SSP1_BASE+LPC17_40_SSP_DMACR_OFFSET)
+
+#define LPC17_40_SSP2_CR0 (LPC17_40_SSP2_BASE+LPC17_40_SSP_CR0_OFFSET)
+#define LPC17_40_SSP2_CR1 (LPC17_40_SSP2_BASE+LPC17_40_SSP_CR1_OFFSET)
+#define LPC17_40_SSP2_DR (LPC17_40_SSP2_BASE+LPC17_40_SSP_DR_OFFSET)
+#define LPC17_40_SSP2_SR (LPC17_40_SSP2_BASE+LPC17_40_SSP_SR_OFFSET)
+#define LPC17_40_SSP2_CPSR (LPC17_40_SSP2_BASE+LPC17_40_SSP_CPSR_OFFSET)
+#define LPC17_40_SSP2_IMSC (LPC17_40_SSP2_BASE+LPC17_40_SSP_IMSC_OFFSET)
+#define LPC17_40_SSP2_RIS (LPC17_40_SSP2_BASE+LPC17_40_SSP_RIS_OFFSET)
+#define LPC17_40_SSP2_MIS (LPC17_40_SSP2_BASE+LPC17_40_SSP_MIS_OFFSET)
+#define LPC17_40_SSP2_ICR (LPC17_40_SSP2_BASE+LPC17_40_SSP_ICR_OFFSET)
+#define LPC17_40_SSP2_DMACR (LPC17_40_SSP2_BASE+LPC17_40_SSP_DMACR_OFFSET)
+
+/* Register bit definitions *********************************************************/
+/* Control Register 0 */
+
+#define SSP_CR0_DSS_SHIFT (0) /* Bits 0-3: DSS Data Size Select */
+#define SSP_CR0_DSS_MASK (15 << SSP_CR0_DSS_SHIFT)
+# define SSP_CR0_DSS_4BIT (3 << SSP_CR0_DSS_SHIFT)
+# define SSP_CR0_DSS_5BIT (4 << SSP_CR0_DSS_SHIFT)
+# define SSP_CR0_DSS_6BIT (5 << SSP_CR0_DSS_SHIFT)
+# define SSP_CR0_DSS_7BIT (6 << SSP_CR0_DSS_SHIFT)
+# define SSP_CR0_DSS_8BIT (7 << SSP_CR0_DSS_SHIFT)
+# define SSP_CR0_DSS_9BIT (8 << SSP_CR0_DSS_SHIFT)
+# define SSP_CR0_DSS_10BIT (9 << SSP_CR0_DSS_SHIFT)
+# define SSP_CR0_DSS_11BIT (10 << SSP_CR0_DSS_SHIFT)
+# define SSP_CR0_DSS_12BIT (11 << SSP_CR0_DSS_SHIFT)
+# define SSP_CR0_DSS_13BIT (12 << SSP_CR0_DSS_SHIFT)
+# define SSP_CR0_DSS_14BIT (13 << SSP_CR0_DSS_SHIFT)
+# define SSP_CR0_DSS_15BIT (14 << SSP_CR0_DSS_SHIFT)
+# define SSP_CR0_DSS_16BIT (15 << SSP_CR0_DSS_SHIFT)
+#define SSP_CR0_FRF_SHIFT (4) /* Bits 4-5: FRF Frame Format */
+#define SSP_CR0_FRF_MASK (3 << SSP_CR0_FRF_SHIFT)
+# define SSP_CR0_FRF_SPI (0 << SSP_CR0_FRF_SHIFT)
+# define SSP_CR0_FRF_TI (1 << SSP_CR0_FRF_SHIFT)
+# define SSP_CR0_FRF_UWIRE (2 << SSP_CR0_FRF_SHIFT)
+#define SSP_CR0_CPOL (1 << 6) /* Bit 6: Clock Out Polarity */
+#define SSP_CR0_CPHA (1 << 7) /* Bit 7: Clock Out Phase */
+#define SSP_CR0_SCR_SHIFT (8) /* Bits 8-15: Serial Clock Rate */
+#define SSP_CR0_SCR_MASK (0xff << SSP_CR0_SCR_SHIFT)
+ /* Bits 8-31: Reserved */
+/* Control Register 1 */
+
+#define SSP_CR1_LBM (1 << 0) /* Bit 0: Loop Back Mode */
+#define SSP_CR1_SSE (1 << 1) /* Bit 1: SSP Enable */
+#define SSP_CR1_MS (1 << 2) /* Bit 2: Master/Slave Mode */
+#define SSP_CR1_SOD (1 << 3) /* Bit 3: Slave Output Disable */
+ /* Bits 4-31: Reserved */
+/* Data Register */
+
+#define SSP_DR_MASK (0xffff) /* Bits 0-15: Data */
+ /* Bits 16-31: Reserved */
+/* Status Register */
+
+#define SSP_SR_TFE (1 << 0) /* Bit 0: Transmit FIFO Empty */
+#define SSP_SR_TNF (1 << 1) /* Bit 1: Transmit FIFO Not Full */
+#define SSP_SR_RNE (1 << 2) /* Bit 2: Receive FIFO Not Empty */
+#define SSP_SR_RFF (1 << 3) /* Bit 3: Receive FIFO Full */
+#define SSP_SR_BSY (1 << 4) /* Bit 4: Busy */
+ /* Bits 5-31: Reserved */
+/* Clock Prescale Register */
+
+#define SSP_CPSR_DVSR_MASK (0xff) /* Bits 0-7: clock = SSP_PCLK/DVSR */
+ /* Bits 8-31: Reserved */
+/* Common format for interrupt control registers:
+ *
+ * Interrupt Mask Set and Clear Register (IMSC)
+ * Raw Interrupt Status Register (RIS)
+ * Masked Interrupt Status Register (MIS)
+ * Interrupt Clear Register (ICR)
+ */
+
+#define SSP_INT_ROR (1 << 0) /* Bit 0: RX FIFO overrun */
+#define SSP_INT_RT (1 << 1) /* Bit 1: RX FIFO timeout */
+#define SSP_INT_RX (1 << 2) /* Bit 2: RX FIFO at least half full (not ICR) */
+#define SSP_INT_TX (1 << 3 ) /* Bit 3: TX FIFO at least half empy (not ICR) */
+ /* Bits 4-31: Reserved */
+/* DMA Control Register */
+
+#define SSP_DMACR_RXDMAE (1 << 0) /* Bit 0: Receive DMA Enable */
+#define SSP_DMACR_TXDMAE (1 << 1) /* Bit 1: Transmit DMA Enable */
+ /* Bits 2-31: Reserved */
+
+/************************************************************************************
+ * Public Types
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Data
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+#endif /* __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC17_40_SSP_H */
diff --git a/arch/arm/src/lpc17xx/hardware/lpc17_syscon.h b/arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_syscon.h
similarity index 86%
rename from arch/arm/src/lpc17xx/hardware/lpc17_syscon.h
rename to arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_syscon.h
index 29d4380f29f..61e6b1b69b4 100644
--- a/arch/arm/src/lpc17xx/hardware/lpc17_syscon.h
+++ b/arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_syscon.h
@@ -1,5 +1,5 @@
/************************************************************************************
- * arch/arm/src/lpc17xx/hardware/lpc17_syscon.h
+ * arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_syscon.h
*
* Copyright (C) 2010, 2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt
@@ -33,8 +33,8 @@
*
************************************************************************************/
-#ifndef __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC17_SYSCON_H
-#define __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC17_SYSCON_H
+#ifndef __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC17_40_SYSCON_H
+#define __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC17_40_SYSCON_H
/************************************************************************************
* Included Files
@@ -43,17 +43,17 @@
#include
/* This file is only a thin shell that includes the correct system controller
- * register definitions for the selected LPC17xx family.
+ * register definitions for the selected LPC17xx/LPC40xx family.
*/
-#include
+#include
#if defined(LPC176x)
# include "hardware/lpc176x_syscon.h"
-#elif defined(LPC178x)
-# include "hardware/lpc178x_syscon.h"
+#elif defined(LPC178x_40xx)
+# include "hardware/lpc178x_40xx_syscon.h"
#else
-# error "Unrecognized LPC17xx family"
+# error "Unrecognized LPC17xx/LPC40xx family"
#endif
/************************************************************************************
@@ -72,4 +72,4 @@
* Public Functions
************************************************************************************/
-#endif /* __ARCH_ARM_SRC_LPC17XX_HARDWARE_LPC17_SYSCON_H */
+#endif /* __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC17_40_SYSCON_H */
diff --git a/arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_timer.h b/arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_timer.h
new file mode 100644
index 00000000000..68aaeb3ef5c
--- /dev/null
+++ b/arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_timer.h
@@ -0,0 +1,250 @@
+/************************************************************************************
+ * arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_timer.h
+ *
+ * Copyright (C) 2010, 2012-2013 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ * 3. Neither the name NuttX 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 THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#ifndef __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC17_40_TIMER_H
+#define __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC17_40_TIMER_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include
+
+#include "chip.h"
+#include "hardware/lpc17_40_memorymap.h"
+
+/************************************************************************************
+ * Pre-processor Definitions
+ ************************************************************************************/
+
+/* Register offsets *****************************************************************/
+
+#define LPC17_40_TMR_IR_OFFSET 0x0000 /* Interrupt Register */
+#define LPC17_40_TMR_TCR_OFFSET 0x0004 /* Timer Control Register */
+#define LPC17_40_TMR_TC_OFFSET 0x0008 /* Timer Counter */
+#define LPC17_40_TMR_PR_OFFSET 0x000c /* Prescale Register */
+#define LPC17_40_TMR_PC_OFFSET 0x0010 /* Prescale Counter */
+#define LPC17_40_TMR_MCR_OFFSET 0x0014 /* Match Control Register */
+#define LPC17_40_TMR_MR0_OFFSET 0x0018 /* Match Register 0 */
+#define LPC17_40_TMR_MR1_OFFSET 0x001c /* Match Register 1 */
+#define LPC17_40_TMR_MR2_OFFSET 0x0020 /* Match Register 2 */
+#define LPC17_40_TMR_MR3_OFFSET 0x0024 /* Match Register 3 */
+#define LPC17_40_TMR_CCR_OFFSET 0x0028 /* Capture Control Register */
+#define LPC17_40_TMR_CR0_OFFSET 0x002c /* Capture Register 0 */
+#define LPC17_40_TMR_CR1_OFFSET 0x0030 /* Capture Register 1 */
+#define LPC17_40_TMR_EMR_OFFSET 0x003c /* External Match Register */
+#define LPC17_40_TMR_CTCR_OFFSET 0x0070 /* Count Control Register */
+
+/* Register addresses ***************************************************************/
+
+#define LPC17_40_TMR0_IR (LPC17_40_TMR0_BASE+LPC17_40_TMR_IR_OFFSET)
+#define LPC17_40_TMR0_TCR (LPC17_40_TMR0_BASE+LPC17_40_TMR_TCR_OFFSET)
+#define LPC17_40_TMR0_TC (LPC17_40_TMR0_BASE+LPC17_40_TMR_TC_OFFSET)
+#define LPC17_40_TMR0_PR (LPC17_40_TMR0_BASE+LPC17_40_TMR_PR_OFFSET)
+#define LPC17_40_TMR0_PC (LPC17_40_TMR0_BASE+LPC17_40_TMR_PC_OFFSET)
+#define LPC17_40_TMR0_MCR (LPC17_40_TMR0_BASE+LPC17_40_TMR_MCR_OFFSET)
+#define LPC17_40_TMR0_MR0 (LPC17_40_TMR0_BASE+LPC17_40_TMR_MR0_OFFSET)
+#define LPC17_40_TMR0_MR1 (LPC17_40_TMR0_BASE+LPC17_40_TMR_MR1_OFFSET)
+#define LPC17_40_TMR0_MR2 (LPC17_40_TMR0_BASE+LPC17_40_TMR_MR2_OFFSET)
+#define LPC17_40_TMR0_MR3 (LPC17_40_TMR0_BASE+LPC17_40_TMR_MR3_OFFSET)
+#define LPC17_40_TMR0_CCR (LPC17_40_TMR0_BASE+LPC17_40_TMR_CCR_OFFSET)
+#define LPC17_40_TMR0_CR0 (LPC17_40_TMR0_BASE+LPC17_40_TMR_CR0_OFFSET)
+#define LPC17_40_TMR0_CR1 (LPC17_40_TMR0_BASE+LPC17_40_TMR_CR1_OFFSET)
+#define LPC17_40_TMR0_EMR (LPC17_40_TMR0_BASE+LPC17_40_TMR_EMR_OFFSET)
+#define LPC17_40_TMR0_CTCR (LPC17_40_TMR0_BASE+LPC17_40_TMR_CTCR_OFFSET)
+
+#define LPC17_40_TMR1_IR (LPC17_40_TMR1_BASE+LPC17_40_TMR_IR_OFFSET)
+#define LPC17_40_TMR1_TCR (LPC17_40_TMR1_BASE+LPC17_40_TMR_TCR_OFFSET)
+#define LPC17_40_TMR1_TC (LPC17_40_TMR1_BASE+LPC17_40_TMR_TC_OFFSET)
+#define LPC17_40_TMR1_PR (LPC17_40_TMR1_BASE+LPC17_40_TMR_PR_OFFSET)
+#define LPC17_40_TMR1_PC (LPC17_40_TMR1_BASE+LPC17_40_TMR_PC_OFFSET)
+#define LPC17_40_TMR1_MCR (LPC17_40_TMR1_BASE+LPC17_40_TMR_MCR_OFFSET)
+#define LPC17_40_TMR1_MR0 (LPC17_40_TMR1_BASE+LPC17_40_TMR_MR0_OFFSET)
+#define LPC17_40_TMR1_MR1 (LPC17_40_TMR1_BASE+LPC17_40_TMR_MR1_OFFSET)
+#define LPC17_40_TMR1_MR2 (LPC17_40_TMR1_BASE+LPC17_40_TMR_MR2_OFFSET)
+#define LPC17_40_TMR1_MR3 (LPC17_40_TMR1_BASE+LPC17_40_TMR_MR3_OFFSET)
+#define LPC17_40_TMR1_CCR (LPC17_40_TMR1_BASE+LPC17_40_TMR_CCR_OFFSET)
+#define LPC17_40_TMR1_CR0 (LPC17_40_TMR1_BASE+LPC17_40_TMR_CR0_OFFSET)
+#define LPC17_40_TMR1_CR1 (LPC17_40_TMR1_BASE+LPC17_40_TMR_CR1_OFFSET)
+#define LPC17_40_TMR1_EMR (LPC17_40_TMR1_BASE+LPC17_40_TMR_EMR_OFFSET)
+#define LPC17_40_TMR1_CTCR (LPC17_40_TMR1_BASE+LPC17_40_TMR_CTCR_OFFSET)
+
+#define LPC17_40_TMR2_IR (LPC17_40_TMR2_BASE+LPC17_40_TMR_IR_OFFSET)
+#define LPC17_40_TMR2_TCR (LPC17_40_TMR2_BASE+LPC17_40_TMR_TCR_OFFSET)
+#define LPC17_40_TMR2_TC (LPC17_40_TMR2_BASE+LPC17_40_TMR_TC_OFFSET)
+#define LPC17_40_TMR2_PR (LPC17_40_TMR2_BASE+LPC17_40_TMR_PR_OFFSET)
+#define LPC17_40_TMR2_PC (LPC17_40_TMR2_BASE+LPC17_40_TMR_PC_OFFSET)
+#define LPC17_40_TMR2_MCR (LPC17_40_TMR2_BASE+LPC17_40_TMR_MCR_OFFSET)
+#define LPC17_40_TMR2_MR0 (LPC17_40_TMR2_BASE+LPC17_40_TMR_MR0_OFFSET)
+#define LPC17_40_TMR2_MR1 (LPC17_40_TMR2_BASE+LPC17_40_TMR_MR1_OFFSET)
+#define LPC17_40_TMR2_MR2 (LPC17_40_TMR2_BASE+LPC17_40_TMR_MR2_OFFSET)
+#define LPC17_40_TMR2_MR3 (LPC17_40_TMR2_BASE+LPC17_40_TMR_MR3_OFFSET)
+#define LPC17_40_TMR2_CCR (LPC17_40_TMR2_BASE+LPC17_40_TMR_CCR_OFFSET)
+#define LPC17_40_TMR2_CR0 (LPC17_40_TMR2_BASE+LPC17_40_TMR_CR0_OFFSET)
+#define LPC17_40_TMR2_CR1 (LPC17_40_TMR2_BASE+LPC17_40_TMR_CR1_OFFSET)
+#define LPC17_40_TMR2_EMR (LPC17_40_TMR2_BASE+LPC17_40_TMR_EMR_OFFSET)
+#define LPC17_40_TMR2_CTCR (LPC17_40_TMR2_BASE+LPC17_40_TMR_CTCR_OFFSET)
+
+#define LPC17_40_TMR3_IR (LPC17_40_TMR3_BASE+LPC17_40_TMR_IR_OFFSET)
+#define LPC17_40_TMR3_TCR (LPC17_40_TMR3_BASE+LPC17_40_TMR_TCR_OFFSET)
+#define LPC17_40_TMR3_TC (LPC17_40_TMR3_BASE+LPC17_40_TMR_TC_OFFSET)
+#define LPC17_40_TMR3_PR (LPC17_40_TMR3_BASE+LPC17_40_TMR_PR_OFFSET)
+#define LPC17_40_TMR3_PC (LPC17_40_TMR3_BASE+LPC17_40_TMR_PC_OFFSET)
+#define LPC17_40_TMR3_MCR (LPC17_40_TMR3_BASE+LPC17_40_TMR_MCR_OFFSET)
+#define LPC17_40_TMR3_MR0 (LPC17_40_TMR3_BASE+LPC17_40_TMR_MR0_OFFSET)
+#define LPC17_40_TMR3_MR1 (LPC17_40_TMR3_BASE+LPC17_40_TMR_MR1_OFFSET)
+#define LPC17_40_TMR3_MR2 (LPC17_40_TMR3_BASE+LPC17_40_TMR_MR2_OFFSET)
+#define LPC17_40_TMR3_MR3 (LPC17_40_TMR3_BASE+LPC17_40_TMR_MR3_OFFSET)
+#define LPC17_40_TMR3_CCR (LPC17_40_TMR3_BASE+LPC17_40_TMR_CCR_OFFSET)
+#define LPC17_40_TMR3_CR0 (LPC17_40_TMR3_BASE+LPC17_40_TMR_CR0_OFFSET)
+#define LPC17_40_TMR3_CR1 (LPC17_40_TMR3_BASE+LPC17_40_TMR_CR1_OFFSET)
+#define LPC17_40_TMR3_EMR (LPC17_40_TMR3_BASE+LPC17_40_TMR_EMR_OFFSET)
+#define LPC17_40_TMR3_CTCR (LPC17_40_TMR3_BASE+LPC17_40_TMR_CTCR_OFFSET)
+
+/* Register bit definitions *********************************************************/
+/* Registers holding 32-bit numeric values (no bit field definitions):
+ *
+ * Timer Counter (TC)
+ * Prescale Register (PR)
+ * Prescale Counter (PC)
+ * Match Register 0 (MR0)
+ * Match Register 1 (MR1)
+ * Match Register 2 (MR2)
+ * Match Register 3 (MR3)
+ * Capture Register 0 (CR0)
+ * Capture Register 1 (CR1)
+ */
+
+/* Interrupt Register */
+
+#define TMR_IR_MR0 (1 << 0) /* Bit 0: Match channel 0 interrupt */
+#define TMR_IR_MR1 (1 << 1) /* Bit 1: Match channel 1 interrupt */
+#define TMR_IR_MR2 (1 << 2) /* Bit 2: Match channel 2 interrupt */
+#define TMR_IR_MR3 (1 << 3) /* Bit 3: Match channel 3 interrupt */
+#define TMR_IR_CR0 (1 << 4) /* Bit 4: Capture channel 0 interrupt */
+#define TMR_IR_CR1 (1 << 5) /* Bit 5: Capture channel 1 interrupt */
+ /* Bits 6-31: Reserved */
+/* Timer Control Register */
+
+#define TMR_TCR_EN (1 << 0) /* Bit 0: Counter Enable */
+#define TMR_TCR_RESET (1 << 1) /* Bit 1: Counter Reset */
+ /* Bits 2-31: Reserved */
+/* Match Control Register */
+
+#define TMR_MCR_MR0I (1 << 0) /* Bit 0: Interrupt on MR0 */
+#define TMR_MCR_MR0R (1 << 1) /* Bit 1: Reset on MR0 */
+#define TMR_MCR_MR0S (1 << 2) /* Bit 2: Stop on MR0 */
+#define TMR_MCR_MR1I (1 << 3) /* Bit 3: Interrupt on MR1 */
+#define TMR_MCR_MR1R (1 << 4) /* Bit 4: Reset on MR1 */
+#define TMR_MCR_MR1S (1 << 5) /* Bit 5: Stop on MR1 */
+#define TMR_MCR_MR2I (1 << 6) /* Bit 6: Interrupt on MR2 */
+#define TMR_MCR_MR2R (1 << 7) /* Bit 7: Reset on MR2 */
+#define TMR_MCR_MR2S (1 << 8) /* Bit 8: Stop on MR2 */
+#define TMR_MCR_MR3I (1 << 9) /* Bit 9: Interrupt on MR3 */
+#define TMR_MCR_MR3R (1 << 10) /* Bit 10: Reset on MR3 */
+#define TMR_MCR_MR3S (1 << 11) /* Bit 11: Stop on MR3 */
+ /* Bits 12-31: Reserved */
+/* Capture Control Register */
+
+#define TMR_CCR_CAP0RE (1 << 0) /* Bit 0: Capture on CAPn.0 rising edge */
+#define TMR_CCR_CAP0FE (1 << 1) /* Bit 1: Capture on CAPn.0 falling edge */
+#define TMR_CCR_CAP0I (1 << 2) /* Bit 2: Interrupt on CAPn.0 */
+#define TMR_CCR_CAP1RE (1 << 3) /* Bit 3: Capture on CAPn.1 rising edge */
+#define TMR_CCR_CAP1FE (1 << 4) /* Bit 4: Capture on CAPn.1 falling edge */
+#define TMR_CCR_CAP1I (1 << 5) /* Bit 5: Interrupt on CAPn.1 */
+ /* Bits 6-31: Reserved */
+/* External Match Register */
+
+#define TMR_EMR_NOTHING (0) /* Do Nothing */
+#define TMR_EMR_CLEAR (1) /* Clear external match bit MATn.m */
+#define TMR_EMR_SET (2) /* Set external match bit MATn.m */
+#define TMR_EMR_TOGGLE (3) /* Toggle external match bit MATn.m */
+
+#define TMR_EMR_EM0 (1 << 0) /* Bit 0: External Match 0 */
+#define TMR_EMR_EM1 (1 << 1) /* Bit 1: External Match 1 */
+#define TMR_EMR_EM2 (1 << 2) /* Bit 2: External Match 2 */
+#define TMR_EMR_EM3 (1 << 3) /* Bit 3: External Match 3 */
+#define TMR_EMR_EMC0_SHIFT (4) /* Bits 4-5: External Match Control 0 */
+#define TMR_EMR_EMC0_MASK (3 << TMR_EMR_EMC0_SHIFTy)
+# define TMR_EMR_EMC0_NOTHING (TMR_EMR_NOTHING << TMR_EMR_EMC0_SHIFT)
+# define TMR_EMR_EMC0_CLEAR (TMR_EMR_CLEAR << TMR_EMR_EMC0_SHIFT)
+# define TMR_EMR_EMC0_SET (TMR_EMR_SET << TMR_EMR_EMC0_SHIFT)
+# define TMR_EMR_EMC0_TOGGLE (TMR_EMR_TOGGLE << TMR_EMR_EMC0_SHIFT)
+#define TMR_EMR_EMC1_SHIFT (6) /* Bits 6-7: External Match Control 1 */
+#define TMR_EMR_EMC1_MASK (3 << TMR_EMR_EMC1_SHIFT)
+# define TMR_EMR_EMC1_NOTHING (TMR_EMR_NOTHING << TMR_EMR_EMC1_SHIFT)
+# define TMR_EMR_EMC1_CLEAR (TMR_EMR_CLEAR << TMR_EMR_EMC1_SHIFT)
+# define TMR_EMR_EMC1_SET (TMR_EMR_SET << TMR_EMR_EMC1_SHIFT)
+# define TMR_EMR_EMC1_TOGGLE (TMR_EMR_TOGGLE << TMR_EMR_EMC1_SHIFT)
+#define TMR_EMR_EMC2_SHIFT (8) /* Bits 8-9: External Match Control 2 */
+#define TMR_EMR_EMC2_MASK (3 << TMR_EMR_EMC2_SHIFT)
+# define TMR_EMR_EMC2_NOTHING (TMR_EMR_NOTHING << TMR_EMR_EMC2_SHIFT)
+# define TMR_EMR_EMC2_CLEAR (TMR_EMR_CLEAR << TMR_EMR_EMC2_SHIFT)
+# define TMR_EMR_EMC2_SET (TMR_EMR_SET << TMR_EMR_EMC2_SHIFT)
+# define TMR_EMR_EMC2_TOGGLE (TMR_EMR_TOGGLE << TMR_EMR_EMC2_SHIFT)
+#define TMR_EMR_EMC3_SHIFT (10) /* Bits 10-11: External Match Control 3 */
+#define TMR_EMR_EMC3_MASK (3 << TMR_EMR_EMC3_SHIFT)
+# define TMR_EMR_EMC3_NOTHING (TMR_EMR_NOTHING << TMR_EMR_EMC3_SHIFT)
+# define TMR_EMR_EMC3_CLEAR (TMR_EMR_CLEAR << TMR_EMR_EMC3_SHIFT)
+# define TMR_EMR_EMC3_SET (TMR_EMR_SET << TMR_EMR_EMC3_SHIFT)
+# define TMR_EMR_EMC3_TOGGLE (TMR_EMR_TOGGLE << TMR_EMR_EMC3_SHIFT)
+ /* Bits 12-31: Reserved */
+/* Count Control Register */
+
+#define TMR_CTCR_MODE_SHIFT (0) /* Bits 0-1: Counter/Timer Mode */
+#define TMR_CTCR_MODE_MASK (3 << TMR_CTCR_MODE_SHIFT)
+# define TMR_CTCR_MODE_TIMER (0 << TMR_CTCR_MODE_SHIFT) /* Timer Mode, prescale match */
+# define TMR_CTCR_MODE_CNTRRE (1 << TMR_CTCR_MODE_SHIFT) /* Counter Mode, CAP rising edge */
+# define TMR_CTCR_MODE_CNTRFE (2 << TMR_CTCR_MODE_SHIFT) /* Counter Mode, CAP falling edge */
+# define TMR_CTCR_MODE_CNTRBE (3 << TMR_CTCR_MODE_SHIFT) /* Counter Mode, CAP both edges */
+#define TMR_CTCR_INPSEL_SHIFT (2) /* Bits 2-3: Count Input Select */
+#define TMR_CTCR_INPSEL_MASK (3 << TMR_CTCR_INPSEL_SHIFT)
+# define TMR_CTCR_INPSEL_CAPNp0 (0 << TMR_CTCR_INPSEL_SHIFT) /* CAPn.0 for TIMERn */
+# define TMR_CTCR_INPSEL_CAPNp1 (1 << TMR_CTCR_INPSEL_SHIFT) /* CAPn.1 for TIMERn */
+ /* Bits 4-31: Reserved */
+
+/************************************************************************************
+ * Public Types
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Data
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+#endif /* __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC17_40_TIMER_H */
diff --git a/arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_uart.h b/arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_uart.h
new file mode 100644
index 00000000000..44c781244f8
--- /dev/null
+++ b/arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_uart.h
@@ -0,0 +1,414 @@
+/************************************************************************************
+ * arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_uart.h
+ *
+ * Copyright (C) 2010, 2012-2013 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ * 3. Neither the name NuttX 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 THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#ifndef __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC17_40_UART_H
+#define __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC17_40_UART_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include
+
+#include "chip.h"
+#include "hardware/lpc17_40_memorymap.h"
+
+/************************************************************************************
+ * Pre-processor Definitions
+ ************************************************************************************/
+
+/* Register offsets *****************************************************************/
+
+#define LPC17_40_UART_RBR_OFFSET 0x0000 /* (DLAB =0) Receiver Buffer Register (all) */
+#define LPC17_40_UART_THR_OFFSET 0x0000 /* (DLAB =0) Transmit Holding Register (all) */
+#define LPC17_40_UART_DLL_OFFSET 0x0000 /* (DLAB =1) Divisor Latch LSB (all) */
+#define LPC17_40_UART_DLM_OFFSET 0x0004 /* (DLAB =1) Divisor Latch MSB (all) */
+#define LPC17_40_UART_IER_OFFSET 0x0004 /* (DLAB =0) Interrupt Enable Register (all) */
+#define LPC17_40_UART_IIR_OFFSET 0x0008 /* Interrupt ID Register (all) */
+#define LPC17_40_UART_FCR_OFFSET 0x0008 /* FIFO Control Register (all) */
+#define LPC17_40_UART_LCR_OFFSET 0x000c /* Line Control Register (all) */
+#define LPC17_40_UART_MCR_OFFSET 0x0010 /* Modem Control Register (UART1 only) */
+#define LPC17_40_UART_LSR_OFFSET 0x0014 /* Line Status Register (all) */
+#define LPC17_40_UART_MSR_OFFSET 0x0018 /* Modem Status Register (UART1 only) */
+#define LPC17_40_UART_SCR_OFFSET 0x001c /* Scratch Pad Register (all) */
+#define LPC17_40_UART_ACR_OFFSET 0x0020 /* Auto-baud Control Register (all) */
+#define LPC17_40_UART_ICR_OFFSET 0x0024 /* IrDA Control Register (UART0,2,3 only) */
+#define LPC17_40_UART_FDR_OFFSET 0x0028 /* Fractional Divider Register (all) */
+#define LPC17_40_UART_TER_OFFSET 0x0030 /* Transmit Enable Register (all) */
+#define LPC17_40_UART_RS485CTRL_OFFSET 0x004c /* RS-485/EIA-485 Control (UART1 only) */
+#define LPC17_40_UART_ADRMATCH_OFFSET 0x0050 /* RS-485/EIA-485 address match (UART1 only) */
+#define LPC17_40_UART_RS485DLY_OFFSET 0x0054 /* RS-485/EIA-485 direction control delay (UART1 only) */
+#define LPC17_40_UART_FIFOLVL_OFFSET 0x0058 /* FIFO Level register (all) */
+
+#ifdef LPC178x_40xx
+# define LPC17_40_UART_OSR_OFFSET 0x002c /* Oversampling Register (UART4 only) */
+# define LPC17_40_UART_SCICTRL_OFFSET 0x0048 /* Smart Card Interface Register (UART4 only) */
+# define LPC17_40_UART_SYNCCTRL_OFFSET 0x0058 /* Synchronous Mode Register (UART4 only) */
+#endif
+
+/* Register addresses ***************************************************************/
+
+#define LPC17_40_UART0_RBR (LPC17_40_UART0_BASE+LPC17_40_UART_RBR_OFFSET)
+#define LPC17_40_UART0_THR (LPC17_40_UART0_BASE+LPC17_40_UART_THR_OFFSET)
+#define LPC17_40_UART0_DLL (LPC17_40_UART0_BASE+LPC17_40_UART_DLL_OFFSET)
+#define LPC17_40_UART0_DLM (LPC17_40_UART0_BASE+LPC17_40_UART_DLM_OFFSET)
+#define LPC17_40_UART0_IER (LPC17_40_UART0_BASE+LPC17_40_UART_IER_OFFSET)
+#define LPC17_40_UART0_IIR (LPC17_40_UART0_BASE+LPC17_40_UART_IIR_OFFSET)
+#define LPC17_40_UART0_FCR (LPC17_40_UART0_BASE+LPC17_40_UART_FCR_OFFSET)
+#define LPC17_40_UART0_LCR (LPC17_40_UART0_BASE+LPC17_40_UART_LCR_OFFSET)
+#define LPC17_40_UART0_LSR (LPC17_40_UART0_BASE+LPC17_40_UART_LSR_OFFSET)
+#define LPC17_40_UART0_SCR (LPC17_40_UART0_BASE+LPC17_40_UART_SCR_OFFSET)
+#define LPC17_40_UART0_ACR (LPC17_40_UART0_BASE+LPC17_40_UART_ACR_OFFSET)
+#define LPC17_40_UART0_ICR (LPC17_40_UART0_BASE+LPC17_40_UART_ICR_OFFSET)
+#define LPC17_40_UART0_FDR (LPC17_40_UART0_BASE+LPC17_40_UART_FDR_OFFSET)
+#define LPC17_40_UART0_TER (LPC17_40_UART0_BASE+LPC17_40_UART_TER_OFFSET)
+
+#ifdef LPC178x_40xx
+# define LPC17_40_UART0_RS485CTRL (LPC17_40_UART0_BASE+LPC17_40_UART_RS485CTRL_OFFSET)
+# define LPC17_40_UART0_ADRMATCH (LPC17_40_UART0_BASE+LPC17_40_UART_ADRMATCH_OFFSET)
+# define LPC17_40_UART0_RS485DLY (LPC17_40_UART0_BASE+LPC17_40_UART_RS485DLY_OFFSET)
+#endif
+
+#define LPC17_40_UART0_FIFOLVL (LPC17_40_UART0_BASE+LPC17_40_UART_FIFOLVL_OFFSET)
+
+#define LPC17_40_UART1_RBR (LPC17_40_UART1_BASE+LPC17_40_UART_RBR_OFFSET)
+#define LPC17_40_UART1_THR (LPC17_40_UART1_BASE+LPC17_40_UART_THR_OFFSET)
+#define LPC17_40_UART1_DLL (LPC17_40_UART1_BASE+LPC17_40_UART_DLL_OFFSET)
+#define LPC17_40_UART1_DLM (LPC17_40_UART1_BASE+LPC17_40_UART_DLM_OFFSET)
+#define LPC17_40_UART1_IER (LPC17_40_UART1_BASE+LPC17_40_UART_IER_OFFSET)
+#define LPC17_40_UART1_IIR (LPC17_40_UART1_BASE+LPC17_40_UART_IIR_OFFSET)
+#define LPC17_40_UART1_FCR (LPC17_40_UART1_BASE+LPC17_40_UART_FCR_OFFSET)
+#define LPC17_40_UART1_LCR (LPC17_40_UART1_BASE+LPC17_40_UART_LCR_OFFSET)
+#define LPC17_40_UART1_MCR (LPC17_40_UART1_BASE+LPC17_40_UART_MCR_OFFSET)
+#define LPC17_40_UART1_LSR (LPC17_40_UART1_BASE+LPC17_40_UART_LSR_OFFSET)
+#define LPC17_40_UART1_MSR (LPC17_40_UART1_BASE+LPC17_40_UART_MSR_OFFSET)
+#define LPC17_40_UART1_SCR (LPC17_40_UART1_BASE+LPC17_40_UART_SCR_OFFSET)
+#define LPC17_40_UART1_ACR (LPC17_40_UART1_BASE+LPC17_40_UART_ACR_OFFSET)
+#define LPC17_40_UART1_FDR (LPC17_40_UART1_BASE+LPC17_40_UART_FDR_OFFSET)
+#define LPC17_40_UART1_TER (LPC17_40_UART1_BASE+LPC17_40_UART_TER_OFFSET)
+#define LPC17_40_UART1_RS485CTRL (LPC17_40_UART1_BASE+LPC17_40_UART_RS485CTRL_OFFSET)
+#define LPC17_40_UART1_ADRMATCH (LPC17_40_UART1_BASE+LPC17_40_UART_ADRMATCH_OFFSET)
+#define LPC17_40_UART1_RS485DLY (LPC17_40_UART1_BASE+LPC17_40_UART_RS485DLY_OFFSET)
+#define LPC17_40_UART1_FIFOLVL (LPC17_40_UART1_BASE+LPC17_40_UART_FIFOLVL_OFFSET)
+
+#define LPC17_40_UART2_RBR (LPC17_40_UART2_BASE+LPC17_40_UART_RBR_OFFSET)
+#define LPC17_40_UART2_THR (LPC17_40_UART2_BASE+LPC17_40_UART_THR_OFFSET)
+#define LPC17_40_UART2_DLL (LPC17_40_UART2_BASE+LPC17_40_UART_DLL_OFFSET)
+#define LPC17_40_UART2_DLM (LPC17_40_UART2_BASE+LPC17_40_UART_DLM_OFFSET)
+#define LPC17_40_UART2_IER (LPC17_40_UART2_BASE+LPC17_40_UART_IER_OFFSET)
+#define LPC17_40_UART2_IIR (LPC17_40_UART2_BASE+LPC17_40_UART_IIR_OFFSET)
+#define LPC17_40_UART2_FCR (LPC17_40_UART2_BASE+LPC17_40_UART_FCR_OFFSET)
+#define LPC17_40_UART2_LCR (LPC17_40_UART2_BASE+LPC17_40_UART_LCR_OFFSET)
+#define LPC17_40_UART2_LSR (LPC17_40_UART2_BASE+LPC17_40_UART_LSR_OFFSET)
+#define LPC17_40_UART2_SCR (LPC17_40_UART2_BASE+LPC17_40_UART_SCR_OFFSET)
+#define LPC17_40_UART2_ACR (LPC17_40_UART2_BASE+LPC17_40_UART_ACR_OFFSET)
+#define LPC17_40_UART2_ICR (LPC17_40_UART2_BASE+LPC17_40_UART_ICR_OFFSET)
+#define LPC17_40_UART2_FDR (LPC17_40_UART2_BASE+LPC17_40_UART_FDR_OFFSET)
+#define LPC17_40_UART2_TER (LPC17_40_UART2_BASE+LPC17_40_UART_TER_OFFSET)
+
+#ifdef LPC178x_40xx
+# define LPC17_40_UART2_RS485CTRL (LPC17_40_UART2_BASE+LPC17_40_UART_RS485CTRL_OFFSET)
+# define LPC17_40_UART2_ADRMATCH (LPC17_40_UART2_BASE+LPC17_40_UART_ADRMATCH_OFFSET)
+# define LPC17_40_UART2_RS485DLY (LPC17_40_UART2_BASE+LPC17_40_UART_RS485DLY_OFFSET)
+#endif
+
+#define LPC17_40_UART2_FIFOLVL (LPC17_40_UART2_BASE+LPC17_40_UART_FIFOLVL_OFFSET)
+
+#define LPC17_40_UART3_RBR (LPC17_40_UART3_BASE+LPC17_40_UART_RBR_OFFSET)
+#define LPC17_40_UART3_THR (LPC17_40_UART3_BASE+LPC17_40_UART_THR_OFFSET)
+#define LPC17_40_UART3_DLL (LPC17_40_UART3_BASE+LPC17_40_UART_DLL_OFFSET)
+#define LPC17_40_UART3_DLM (LPC17_40_UART3_BASE+LPC17_40_UART_DLM_OFFSET)
+#define LPC17_40_UART3_IER (LPC17_40_UART3_BASE+LPC17_40_UART_IER_OFFSET)
+#define LPC17_40_UART3_IIR (LPC17_40_UART3_BASE+LPC17_40_UART_IIR_OFFSET)
+#define LPC17_40_UART3_FCR (LPC17_40_UART3_BASE+LPC17_40_UART_FCR_OFFSET)
+#define LPC17_40_UART3_LCR (LPC17_40_UART3_BASE+LPC17_40_UART_LCR_OFFSET)
+#define LPC17_40_UART3_LSR (LPC17_40_UART3_BASE+LPC17_40_UART_LSR_OFFSET)
+#define LPC17_40_UART3_SCR (LPC17_40_UART3_BASE+LPC17_40_UART_SCR_OFFSET)
+#define LPC17_40_UART3_ACR (LPC17_40_UART3_BASE+LPC17_40_UART_ACR_OFFSET)
+#define LPC17_40_UART3_ICR (LPC17_40_UART3_BASE+LPC17_40_UART_ICR_OFFSET)
+#define LPC17_40_UART3_FDR (LPC17_40_UART3_BASE+LPC17_40_UART_FDR_OFFSET)
+#define LPC17_40_UART3_TER (LPC17_40_UART3_BASE+LPC17_40_UART_TER_OFFSET)
+
+#ifdef LPC178x_40xx
+# define LPC17_40_UART3_RS485CTRL (LPC17_40_UART3_BASE+LPC17_40_UART_RS485CTRL_OFFSET)
+# define LPC17_40_UART3_ADRMATCH (LPC17_40_UART3_BASE+LPC17_40_UART_ADRMATCH_OFFSET)
+# define LPC17_40_UART3_RS485DLY (LPC17_40_UART3_BASE+LPC17_40_UART_RS485DLY_OFFSET)
+#endif
+
+#define LPC17_40_UART3_FIFOLVL (LPC17_40_UART3_BASE+LPC17_40_UART_FIFOLVL_OFFSET)
+
+#ifdef LPC178x_40xx
+# define LPC17_40_UART4_RBR (LPC17_40_UART4_BASE+LPC17_40_UART_RBR_OFFSET)
+# define LPC17_40_UART4_THR (LPC17_40_UART4_BASE+LPC17_40_UART_THR_OFFSET)
+# define LPC17_40_UART4_DLL (LPC17_40_UART4_BASE+LPC17_40_UART_DLL_OFFSET)
+# define LPC17_40_UART4_DLM (LPC17_40_UART4_BASE+LPC17_40_UART_DLM_OFFSET)
+# define LPC17_40_UART4_IER (LPC17_40_UART4_BASE+LPC17_40_UART_IER_OFFSET)
+# define LPC17_40_UART4_IIR (LPC17_40_UART4_BASE+LPC17_40_UART_IIR_OFFSET)
+# define LPC17_40_UART4_FCR (LPC17_40_UART4_BASE+LPC17_40_UART_FCR_OFFSET)
+# define LPC17_40_UART4_LCR (LPC17_40_UART4_BASE+LPC17_40_UART_LCR_OFFSET)
+# define LPC17_40_UART4_LSR (LPC17_40_UART4_BASE+LPC17_40_UART_LSR_OFFSET)
+# define LPC17_40_UART4_SCR (LPC17_40_UART4_BASE+LPC17_40_UART_SCR_OFFSET)
+# define LPC17_40_UART4_ACR (LPC17_40_UART4_BASE+LPC17_40_UART_ACR_OFFSET)
+# define LPC17_40_UART4_ICR (LPC17_40_UART4_BASE+LPC17_40_UART_ICR_OFFSET)
+# define LPC17_40_UART4_FDR (LPC17_40_UART4_BASE+LPC17_40_UART_FDR_OFFSET)
+# define LPC17_40_UART4_TER (LPC17_40_UART4_BASE+LPC17_40_UART_TER_OFFSET)
+# define LPC17_40_UART4_RS485CTRL (LPC17_40_UART4_BASE+LPC17_40_UART_RS485CTRL_OFFSET)
+# define LPC17_40_UART4_ADRMATCH (LPC17_40_UART4_BASE+LPC17_40_UART_ADRMATCH_OFFSET)
+# define LPC17_40_UART4_RS485DLY (LPC17_40_UART4_BASE+LPC17_40_UART_RS485DLY_OFFSET)
+# define LPC17_40_UART4_FIFOLVL (LPC17_40_UART4_BASE+LPC17_40_UART_FIFOLVL_OFFSET)
+# define LPC17_40_UART4_OSR (LPC17_40_UART4_BASE+LPC17_40_UART4_OSR_OFFSET)
+# define LPC17_40_UART4_SCICTRL (LPC17_40_UART4_BASE+LPC17_40_UART4_SCICTRL_OFFSET)
+# define LPC17_40_UART4_SYNCCTRL (LPC17_40_UART4_BASE+LPC17_40_UART4_SYNCCTRL_OFFSET)
+#endif
+
+/* Register bit definitions *********************************************************/
+
+/* RBR (DLAB =0) Receiver Buffer Register (all) */
+
+#define UART_RBR_MASK (0xff) /* Bits 0-7: Oldest received byte in RX FIFO */
+ /* Bits 8-31: Reserved */
+
+/* THR (DLAB =0) Transmit Holding Register (all) */
+
+#define UART_THR_MASK (0xff) /* Bits 0-7: Adds byte to TX FIFO */
+ /* Bits 8-31: Reserved */
+
+/* DLL (DLAB =1) Divisor Latch LSB (all) */
+
+#define UART_DLL_MASK (0xff) /* Bits 0-7: DLL */
+ /* Bits 8-31: Reserved */
+
+/* DLM (DLAB =1) Divisor Latch MSB (all) */
+
+#define UART_DLM_MASK (0xff) /* Bits 0-7: DLM */
+ /* Bits 8-31: Reserved */
+
+/* IER (DLAB =0) Interrupt Enable Register (all) */
+
+#define UART_IER_RBRIE (1 << 0) /* Bit 0: RBR Interrupt Enable */
+#define UART_IER_THREIE (1 << 1) /* Bit 1: THRE Interrupt Enable */
+#define UART_IER_RLSIE (1 << 2) /* Bit 2: RX Line Status Interrupt Enable */
+#define UART_IER_MSIE (1 << 3) /* Bit 3: Modem Status Interrupt Enable (UART1 only) */
+ /* Bits 4-6: Reserved */
+#define UART_IER_CTSIE (1 << 7) /* Bit 7: CTS transition interrupt (UART1 only) */
+#define UART_IER_ABEOIE (1 << 8) /* Bit 8: Enables the end of auto-baud interrupt */
+#define UART_IER_ABTOIE (1 << 9) /* Bit 9: Enables the auto-baud time-out interrupt */
+ /* Bits 10-31: Reserved */
+#define UART_IER_ALLIE (0x038f)
+
+/* IIR Interrupt ID Register (all) */
+
+#define UART_IIR_INTSTATUS (1 << 0) /* Bit 0: Interrupt status (active low) */
+#define UART_IIR_INTID_SHIFT (1) /* Bits 1-3: Interrupt identification */
+#define UART_IIR_INTID_MASK (7 << UART_IIR_INTID_SHIFT)
+# define UART_IIR_INTID_MSI (0 << UART_IIR_INTID_SHIFT) /* Modem Status (UART1 only) */
+# define UART_IIR_INTID_THRE (1 << UART_IIR_INTID_SHIFT) /* THRE Interrupt */
+# define UART_IIR_INTID_RDA (2 << UART_IIR_INTID_SHIFT) /* 2a - Receive Data Available (RDA) */
+# define UART_IIR_INTID_RLS (3 << UART_IIR_INTID_SHIFT) /* 1 - Receive Line Status (RLS) */
+# define UART_IIR_INTID_CTI (6 << UART_IIR_INTID_SHIFT) /* 2b - Character Time-out Indicator (CTI) */
+ /* Bits 4-5: Reserved */
+#define UART_IIR_FIFOEN_SHIFT (6) /* Bits 6-7: Copies of FCR bit 0 */
+#define UART_IIR_FIFOEN_MASK (3 << UART_IIR_FIFOEN_SHIFT)
+#define UART_IIR_ABEOINT (1 << 8) /* Bit 8: End of auto-baud interrupt */
+#define UART_IIR_ABTOINT (1 << 9) /* Bit 9: Auto-baud time-out interrupt */
+ /* Bits 10-31: Reserved */
+/* FCR FIFO Control Register (all) */
+
+#define UART_FCR_FIFOEN (1 << 0) /* Bit 0: Enable FIFOs */
+#define UART_FCR_RXRST (1 << 1) /* Bit 1: RX FIFO Reset */
+#define UART_FCR_TXRST (1 << 2) /* Bit 2: TX FIFO Reset */
+#define UART_FCR_DMAMODE (1 << 3) /* Bit 3: DMA Mode Select */
+ /* Bits 4-5: Reserved */
+#define UART_FCR_RXTRIGGER_SHIFT (6) /* Bits 6-7: RX Trigger Level */
+#define UART_FCR_RXTRIGGER_MASK (3 << UART_FCR_RXTRIGGER_SHIFT)
+# define UART_FCR_RXTRIGGER_0 (0 << UART_FCR_RXTRIGGER_SHIFT) /* Trigger level 0 (1 character) */
+# define UART_FCR_RXTRIGGER_4 (1 << UART_FCR_RXTRIGGER_SHIFT) /* Trigger level 1 (4 characters) */
+# define UART_FCR_RXTRIGGER_8 (2 << UART_FCR_RXTRIGGER_SHIFT) /* Trigger level 2 (8 characters) */
+# define UART_FCR_RXTRIGGER_14 (3 << UART_FCR_RXTRIGGER_SHIFT) /* Trigger level 3 (14 characters) */
+ /* Bits 8-31: Reserved */
+/* LCR Line Control Register (all) */
+
+#define UART_LCR_WLS_SHIFT (0) /* Bit 0-1: Word Length Select */
+#define UART_LCR_WLS_MASK (3 << UART_LCR_WLS_SHIFT)
+# define UART_LCR_WLS_5BIT (0 << UART_LCR_WLS_SHIFT)
+# define UART_LCR_WLS_6BIT (1 << UART_LCR_WLS_SHIFT)
+# define UART_LCR_WLS_7BIT (2 << UART_LCR_WLS_SHIFT)
+# define UART_LCR_WLS_8BIT (3 << UART_LCR_WLS_SHIFT)
+#define UART_LCR_STOP (1 << 2) /* Bit 2: Stop Bit Select */
+#define UART_LCR_PE (1 << 3) /* Bit 3: Parity Enable */
+#define UART_LCR_PS_SHIFT (4) /* Bits 4-5: Parity Select */
+#define UART_LCR_PS_MASK (3 << UART_LCR_PS_SHIFT)
+# define UART_LCR_PS_ODD (0 << UART_LCR_PS_SHIFT) /* Odd parity */
+# define UART_LCR_PS_EVEN (1 << UART_LCR_PS_SHIFT) /* Even Parity */
+# define UART_LCR_PS_STICK1 (2 << UART_LCR_PS_SHIFT) /* Forced "1" stick parity */
+# define UART_LCR_PS_STICK0 (3 << UART_LCR_PS_SHIFT) /* Forced "0" stick parity */
+#define UART_LCR_BRK (1 << 6) /* Bit 6: Break Control */
+#define UART_LCR_DLAB (1 << 7) /* Bit 7: Divisor Latch Access Bit (DLAB) */
+ /* Bits 8-31: Reserved */
+/* MCR Modem Control Register (UART1 only) */
+
+#define UART_MCR_DTR (1 << 0) /* Bit 0: DTR Control Source for DTR output */
+#define UART_MCR_RTS (1 << 1) /* Bit 1: Control Source for RTS output */
+ /* Bits 2-3: Reserved */
+#define UART_MCR_LPBK (1 << 4) /* Bit 4: Loopback Mode Select */
+ /* Bit 5: Reserved */
+#define UART_MCR_RTSEN (1 << 6) /* Bit 6: Enable auto-rts flow control */
+#define UART_MCR_CTSEN (1 << 7) /* Bit 7: Enable auto-cts flow control */
+ /* Bits 8-31: Reserved */
+/* LSR Line Status Register (all) */
+
+#define UART_LSR_RDR (1 << 0) /* Bit 0: Receiver Data Ready */
+#define UART_LSR_OE (1 << 1) /* Bit 1: Overrun Error */
+#define UART_LSR_PE (1 << 2) /* Bit 2: Parity Error */
+#define UART_LSR_FE (1 << 3) /* Bit 3: Framing Error */
+#define UART_LSR_BI (1 << 4) /* Bit 4: Break Interrupt */
+#define UART_LSR_THRE (1 << 5) /* Bit 5: Transmitter Holding Register Empty */
+#define UART_LSR_TEMT (1 << 6) /* Bit 6: Transmitter Empty */
+#define UART_LSR_RXFE (1 << 7) /* Bit 7: Error in RX FIFO (RXFE) */
+ /* Bits 8-31: Reserved */
+/* MSR Modem Status Register (UART1 only) */
+
+#define UART_MSR_DELTACTS (1 << 0) /* Bit 0: CTS state change */
+#define UART_MSR_DELTADSR (1 << 1) /* Bit 1: DSR state change */
+#define UART_MSR_RIEDGE (1 << 2) /* Bit 2: RI ow to high transition */
+#define UART_MSR_DELTADCD (1 << 3) /* Bit 3: DCD state change */
+#define UART_MSR_CTS (1 << 4) /* Bit 4: CTS State */
+#define UART_MSR_DSR (1 << 5) /* Bit 5: DSR State */
+#define UART_MSR_RI (1 << 6) /* Bit 6: Ring Indicator State */
+#define UART_MSR_DCD (1 << 7) /* Bit 7: Data Carrier Detect State */
+ /* Bits 8-31: Reserved */
+/* SCR Scratch Pad Register (all) */
+
+#define UART_SCR_MASK (0xff) /* Bits 0-7: SCR data */
+ /* Bits 8-31: Reserved */
+/* ACR Auto-baud Control Register (all) */
+
+#define UART_ACR_START (1 << 0) /* Bit 0: Auto-baud start/running*/
+#define UART_ACR_MODE (1 << 1) /* Bit 1: Auto-baud mode select*/
+#define UART_ACR_AUTORESTART (1 << 2) /* Bit 2: Restart in case of time-out*/
+ /* Bits 3-7: Reserved */
+#define UART_ACR_ABEOINTCLR (1 << 8) /* Bit 8: End of auto-baud interrupt clear */
+#define UART_ACR_ABTOINTCLRT (1 << 9) /* Bit 9: Auto-baud time-out interrupt clear */
+ /* Bits 10-31: Reserved */
+/* ICA IrDA Control Register (UART0,2,3 only) */
+
+#define UART_ICR_IRDAEN (1 << 0) /* Bit 0: Enable IrDA mode */
+#define UART_ICR_IRDAINV (1 << 1) /* Bit 1: Invert serial input */
+#define UART_ICR_FIXPULSEEN (1 << 2) /* Bit 2: Enable IrDA fixed pulse width mode */
+#define UART_ICR_PULSEDIV_SHIFT (3) /* Bits 3-5: Configures the pulse when FixPulseEn = 1 */
+#define UART_ICR_PULSEDIV_MASK (7 << UART_ICR_PULSEDIV_SHIFT)
+# define UART_ICR_PULSEDIV_2TPCLK (0 << UART_ICR_PULSEDIV_SHIFT) /* 2 x TPCLK */
+# define UART_ICR_PULSEDIV_4TPCLK (1 << UART_ICR_PULSEDIV_SHIFT) /* 4 x TPCLK */
+# define UART_ICR_PULSEDIV_8TPCLK (2 << UART_ICR_PULSEDIV_SHIFT) /* 8 x TPCLK */
+# define UART_ICR_PULSEDIV_16TPCLK (3 << UART_ICR_PULSEDIV_SHIFT) /* 16 x TPCLK */
+# define UART_ICR_PULSEDIV_32TPCLK (4 << UART_ICR_PULSEDIV_SHIFT) /* 32 x TPCLK */
+# define UART_ICR_PULSEDIV_64TPCLK (5 << UART_ICR_PULSEDIV_SHIFT) /* 64 x TPCLK */
+# define UART_ICR_PULSEDIV_128TPCLK (6 << UART_ICR_PULSEDIV_SHIFT) /* 128 x TPCLK */
+# define UART_ICR_PULSEDIV_256TPCLK (7 << UART_ICR_PULSEDIV_SHIFT) /* 246 x TPCLK */
+ /* Bits 6-31: Reserved */
+/* FDR Fractional Divider Register (all) */
+
+#define UART_FDR_DIVADDVAL_SHIFT (0) /* Bits 0-3: Baud-rate generation pre-scaler divisor value */
+#define UART_FDR_DIVADDVAL_MASK (15 << UART_FDR_DIVADDVAL_SHIFT)
+#define UART_FDR_MULVAL_SHIFT (4) /* Bits 4-7 Baud-rate pre-scaler multiplier value */
+#define UART_FDR_MULVAL_MASK (15 << UART_FDR_MULVAL_SHIFT)
+ /* Bits 8-31: Reserved */
+/* TER Transmit Enable Register (all) */
+ /* Bits 0-6: Reserved */
+#define UART_TER_TXEN (1 << 7) /* Bit 7: TX Enable */
+ /* Bits 8-31: Reserved */
+/* RS-485/EIA-485 Control (UART1 only) */
+
+#define UART_RS485CTRL_NMMEN (1 << 0) /* Bit 0: RS-485/EIA-485 Normal Multidrop Mode (NMM) enabled */
+#define UART_RS485CTRL_RXDIS (1 << 1) /* Bit 1: Receiver is disabled */
+#define UART_RS485CTRL_AADEN (1 << 2) /* Bit 2: Auto Address Detect (AAD) is enabled */
+#define UART_RS485CTRL_SEL (1 << 3) /* Bit 3: RTS/DTR used for direction control (DCTRL=1) */
+#define UART_RS485CTRL_DCTRL (1 << 4) /* Bit 4: Enable Auto Direction Control */
+#define UART_RS485CTRL_OINV (1 << 5) /* Bit 5: Polarity of the direction control signal on RTS/DTR */
+ /* Bits 6-31: Reserved */
+/* RS-485/EIA-485 address match (UART1 only) */
+
+#define UART_ADRMATCH_MASK (0xff) /* Bits 0-7: Address match value */
+ /* Bits 8-31: Reserved */
+/* RS-485/EIA-485 direction control delay (UART1 only) */
+
+#define UART_RS485DLY_MASK (0xff) /* Bits 0-7: Direction control (RTS/DTR) delay */
+ /* Bits 8-31: Reserved */
+/* FIFOLVL FIFO Level register (all) */
+
+#define UART_FIFOLVL_RX_SHIFT (0) /* Bits 0-3: Current level of the UART RX FIFO */
+#define UART_FIFOLVL_RX_MASK (15 << UART_FIFOLVL_RX_SHIFT)
+ /* Bits 4-7: Reserved */
+#define UART_FIFOLVL_TX_SHIFT (8) /* Bits 8-11: Current level of the UART TX FIFO */
+#define UART_FIFOLVL_TX_MASK (15 << UART_FIFOLVL_TX_SHIFT)
+ /* Bits 12-31: Reserved */
+
+/* SCICTL Smart Card Interface (UART4 only) */
+
+#ifdef LPC178x_40xx
+# define UART_SCIEN (1 << 0) /* Bit 0: Smart Card Interface enable */
+# define UART_NACKDIS (1 << 1) /* Bit 1: NACK response disable.Applicable if PROTSEL=0 */
+# define UART_PROTSEL (1 << 2) /* Bit 2: Protocol Selection ISO7816-3 */
+# define UART_TXRETRY (7 << 5) /* Bits 5-7: Maximum number of Re-Transmission */
+# define UART_GUARDTIME_SHIFT (8) /* Bits 8-15: Extra guard time */
+# define UART_GUARDTIME_MASK (0xff << UART_GUARDTIME_SHIFT)
+ /* Bits 16-31: Reserved */
+#endif
+
+/* OSR Oversampling Register (UART4 only) */
+
+#ifdef LPC178x_40xx
+ /* Bit 0: Reserved */
+# define UART_OSFRAC (7 << 1) /* Bits 1-3: Fractional part of Oversampling Ratio */
+# define UART_OSINT_SHIFT (4) /* Bits 4-7: Integer part of (Oversampling Ratio -1) */
+# define UART_OSINT_MASK (0x0f << UART_OSINT_SHIFT)
+# define UART_FDINT_SHIFT (8) /* Bits 8-14: OSINT extension in Smart Card mode */
+# define UART_FDINT_MASK (0x7f << UART_FDINT_SHIFT)
+ /* Bits 15-31: Reserved */
+#endif
+
+/************************************************************************************
+ * Public Types
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Data
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+#endif /* __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC17_40_UART_H */
diff --git a/arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_usb.h b/arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_usb.h
new file mode 100644
index 00000000000..d0248b30590
--- /dev/null
+++ b/arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_usb.h
@@ -0,0 +1,778 @@
+/************************************************************************************
+ * arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_usb.h
+ *
+ * Copyright (C) 2010, 2013 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ * 3. Neither the name NuttX 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 THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#ifndef __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC17_40_USB_H
+#define __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC17_40_USB_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include
+#include
+
+#include "chip.h"
+#include "hardware/lpc17_40_memorymap.h"
+
+/************************************************************************************
+ * Pre-processor Definitions
+ ************************************************************************************/
+
+/* Register offsets *****************************************************************/
+/* USB Host Controller (OHCI) *******************************************************/
+/* See include/nuttx/usb/ohci.h */
+
+#define LPC17_40_USBHOST_MODID_OFFSET 0x00fc /* Module ID/Revision ID */
+
+/* USB OTG Controller ***************************************************************/
+/* OTG registers */
+
+#define LPC17_40_USBOTG_INTST_OFFSET 0x0100 /* OTG Interrupt Status */
+#define LPC17_40_USBOTG_INTEN_OFFSET 0x0104 /* OTG Interrupt Enable */
+#define LPC17_40_USBOTG_INTSET_OFFSET 0x0108 /* OTG Interrupt Set */
+#define LPC17_40_USBOTG_INTCLR_OFFSET 0x010c /* OTG Interrupt Clear */
+#define LPC17_40_USBOTG_STCTRL_OFFSET 0x0110 /* OTG Status and Control */
+#define LPC17_40_USBOTG_TMR_OFFSET 0x0114 /* OTG Timer */
+
+/* USB Device Controller ************************************************************/
+/* Device interrupt registers. See also SYSCON_USBINTST in lpc17_40_syscon.h */
+
+#define LPC17_40_USBDEV_INTST_OFFSET 0x0200 /* USB Device Interrupt Status */
+#define LPC17_40_USBDEV_INTEN_OFFSET 0x0204 /* USB Device Interrupt Enable */
+#define LPC17_40_USBDEV_INTCLR_OFFSET 0x0208 /* USB Device Interrupt Clear */
+#define LPC17_40_USBDEV_INTSET_OFFSET 0x020c /* USB Device Interrupt Set */
+
+/* SIE Command registers */
+
+#define LPC17_40_USBDEV_CMDCODE_OFFSET 0x0210 /* USB Command Code */
+#define LPC17_40_USBDEV_CMDDATA_OFFSET 0x0214 /* USB Command Data */
+
+/* USB transfer registers */
+
+#define LPC17_40_USBDEV_RXDATA_OFFSET 0x0218 /* USB Receive Data */
+#define LPC17_40_USBDEV_RXPLEN_OFFSET 0x0220 /* USB Receive Packet Length */
+#define LPC17_40_USBDEV_TXDATA_OFFSET 0x021c /* USB Transmit Data */
+#define LPC17_40_USBDEV_TXPLEN_OFFSET 0x0224 /* USB Transmit Packet Length */
+#define LPC17_40_USBDEV_CTRL_OFFSET 0x0228 /* USB Control */
+
+/* More Device interrupt registers */
+
+#define LPC17_40_USBDEV_INTPRI_OFFSET 0x022c /* USB Device Interrupt Priority */
+
+/* Endpoint interrupt registers */
+
+#define LPC17_40_USBDEV_EPINTST_OFFSET 0x0230 /* USB Endpoint Interrupt Status */
+#define LPC17_40_USBDEV_EPINTEN_OFFSET 0x0234 /* USB Endpoint Interrupt Enable */
+#define LPC17_40_USBDEV_EPINTCLR_OFFSET 0x0238 /* USB Endpoint Interrupt Clear */
+#define LPC17_40_USBDEV_EPINTSET_OFFSET 0x023c /* USB Endpoint Interrupt Set */
+#define LPC17_40_USBDEV_EPINTPRI_OFFSET 0x0240 /* USB Endpoint Priority */
+
+/* Endpoint realization registers */
+
+#define LPC17_40_USBDEV_REEP_OFFSET 0x0244 /* USB Realize Endpoint */
+#define LPC17_40_USBDEV_EPIND_OFFSET 0x0248 /* USB Endpoint Index */
+#define LPC17_40_USBDEV_MAXPSIZE_OFFSET 0x024c /* USB MaxPacketSize */
+
+/* DMA registers */
+
+#define LPC17_40_USBDEV_DMARST_OFFSET 0x0250 /* USB DMA Request Status */
+#define LPC17_40_USBDEV_DMARCLR_OFFSET 0x0254 /* USB DMA Request Clear */
+#define LPC17_40_USBDEV_DMARSET_OFFSET 0x0258 /* USB DMA Request Set */
+#define LPC17_40_USBDEV_UDCAH_OFFSET 0x0280 /* USB UDCA Head */
+#define LPC17_40_USBDEV_EPDMAST_OFFSET 0x0284 /* USB Endpoint DMA Status */
+#define LPC17_40_USBDEV_EPDMAEN_OFFSET 0x0288 /* USB Endpoint DMA Enable */
+#define LPC17_40_USBDEV_EPDMADIS_OFFSET 0x028c /* USB Endpoint DMA Disable */
+#define LPC17_40_USBDEV_DMAINTST_OFFSET 0x0290 /* USB DMA Interrupt Status */
+#define LPC17_40_USBDEV_DMAINTEN_OFFSET 0x0294 /* USB DMA Interrupt Enable */
+#define LPC17_40_USBDEV_EOTINTST_OFFSET 0x02a0 /* USB End of Transfer Interrupt Status */
+#define LPC17_40_USBDEV_EOTINTCLR_OFFSET 0x02a4 /* USB End of Transfer Interrupt Clear */
+#define LPC17_40_USBDEV_EOTINTSET_OFFSET 0x02a8 /* USB End of Transfer Interrupt Set */
+#define LPC17_40_USBDEV_NDDRINTST_OFFSET 0x02ac /* USB New DD Request Interrupt Status */
+#define LPC17_40_USBDEV_NDDRINTCLR_OFFSET 0x02b0 /* USB New DD Request Interrupt Clear */
+#define LPC17_40_USBDEV_NDDRINTSET_OFFSET 0x02b4 /* USB New DD Request Interrupt Set */
+#define LPC17_40_USBDEV_SYSERRINTST_OFFSET 0x02b8 /* USB System Error Interrupt Status */
+#define LPC17_40_USBDEV_SYSERRINTCLR_OFFSET 0x02bc /* USB System Error Interrupt Clear */
+#define LPC17_40_USBDEV_SYSERRINTSET_OFFSET 0x02c0 /* USB System Error Interrupt Set */
+
+/* OTG I2C registers ****************************************************************/
+
+#define LPC17_40_OTGI2C_RX_OFFSET 0x0300 /* I2C Receive */
+#define LPC17_40_OTGI2C_TX_OFFSET 0x0300 /* I2C Transmit */
+#define LPC17_40_OTGI2C_STS_OFFSET 0x0304 /* I2C Status */
+#define LPC17_40_OTGI2C_CTL_OFFSET 0x0308 /* I2C Control */
+#define LPC17_40_OTGI2C_CLKHI_OFFSET 0x030c /* I2C Clock High */
+#define LPC17_40_OTGI2C_CLKLO_OFFSET 0x0310 /* I2C Clock Low */
+
+/* Clock control registers ***********************************************************/
+
+#define LPC17_40_USBOTG_CLKCTRL_OFFSET 0x0ff4 /* OTG clock controller */
+#define LPC17_40_USBOTG_CLKST_OFFSET 0x0ff8 /* OTG clock status */
+
+#define LPC17_40_USBDEV_CLKCTRL_OFFSET 0x0ff4 /* USB Clock Control */
+#define LPC17_40_USBDEV_CLKST_OFFSET 0x0ff8 /* USB Clock Status */
+
+/* Register addresses ***************************************************************/
+/* USB Host Controller (OHCI) *******************************************************/
+/* Control and status registers (section 7.1) */
+
+#define LPC17_40_USBHOST_HCIREV (LPC17_40_USB_BASE+OHCI_HCIREV_OFFSET)
+#define LPC17_40_USBHOST_CTRL (LPC17_40_USB_BASE+OHCI_CTRL_OFFSET)
+#define LPC17_40_USBHOST_CMDST (LPC17_40_USB_BASE+OHCI_CMDST_OFFSET)
+#define LPC17_40_USBHOST_INTST (LPC17_40_USB_BASE+OHCI_INTST_OFFSET)
+#define LPC17_40_USBHOST_INTEN (LPC17_40_USB_BASE+OHCI_INTEN_OFFSET)
+#define LPC17_40_USBHOST_INTDIS (LPC17_40_USB_BASE+OHCI_INTDIS_OFFSET)
+
+/* Memory pointers (section 7.2) */
+
+#define LPC17_40_USBHOST_HCCA (LPC17_40_USB_BASE+OHCI_HCCA_OFFSET)
+#define LPC17_40_USBHOST_PERED (LPC17_40_USB_BASE+OHCI_PERED_OFFSET)
+#define LPC17_40_USBHOST_CTRLHEADED (LPC17_40_USB_BASE+OHCI_CTRLHEADED_OFFSET)
+#define LPC17_40_USBHOST_CTRLED (LPC17_40_USB_BASE+OHCI_CTRLED_OFFSET)
+#define LPC17_40_USBHOST_BULKHEADED (LPC17_40_USB_BASE+OHCI_BULKHEADED_OFFSET)
+#define LPC17_40_USBHOST_BULKED (LPC17_40_USB_BASE+OHCI_BULKED_OFFSET)
+#define LPC17_40_USBHOST_DONEHEAD (LPC17_40_USB_BASE+OHCI_DONEHEAD_OFFSET)
+
+/* Frame counters (section 7.3) */
+
+#define LPC17_40_USBHOST_FMINT (LPC17_40_USB_BASE+OHCI_FMINT_OFFSET)
+#define LPC17_40_USBHOST_FMREM (LPC17_40_USB_BASE+OHCI_FMREM_OFFSET)
+#define LPC17_40_USBHOST_FMNO (LPC17_40_USB_BASE+OHCI_FMNO_OFFSET)
+#define LPC17_40_USBHOST_PERSTART (LPC17_40_USB_BASE+OHCI_PERSTART_OFFSET)
+
+/* Root hub ports (section 7.4) */
+
+#define LPC17_40_USBHOST_LSTHRES (LPC17_40_USB_BASE+OHCI_LSTHRES_OFFSET)
+#define LPC17_40_USBHOST_RHDESCA (LPC17_40_USB_BASE+OHCI_RHDESCA_OFFSET)
+#define LPC17_40_USBHOST_RHDESCB (LPC17_40_USB_BASE+OHCI_RHDESCB_OFFSET)
+#define LPC17_40_USBHOST_RHSTATUS (LPC17_40_USB_BASE+OHCI_RHSTATUS_OFFSET)
+#define LPC17_40_USBHOST_RHPORTST1 (LPC17_40_USB_BASE+OHCI_RHPORTST1_OFFSET)
+#define LPC17_40_USBHOST_RHPORTST2 (LPC17_40_USB_BASE+OHCI_RHPORTST2_OFFSET)
+#define LPC17_40_USBHOST_MODID (LPC17_40_USB_BASE+LPC17_40_USBHOST_MODID_OFFSET)
+
+/* USB OTG Controller ***************************************************************/
+/* OTG registers */
+
+#define LPC17_40_USBOTG_INTST (LPC17_40_USB_BASE+LPC17_40_USBOTG_INTST_OFFSET)
+#define LPC17_40_USBOTG_INTEN (LPC17_40_USB_BASE+LPC17_40_USBOTG_INTEN_OFFSET)
+#define LPC17_40_USBOTG_INTSET (LPC17_40_USB_BASE+LPC17_40_USBOTG_INTSET_OFFSET)
+#define LPC17_40_USBOTG_INTCLR (LPC17_40_USB_BASE+LPC17_40_USBOTG_INTCLR_OFFSET)
+#define LPC17_40_USBOTG_STCTRL (LPC17_40_USB_BASE+LPC17_40_USBOTG_STCTRL_OFFSET)
+#define LPC17_40_USBOTG_TMR (LPC17_40_USB_BASE+LPC17_40_USBOTG_TMR_OFFSET)
+
+/* USB Device Controller ************************************************************/
+/* Device interrupt registers. See also SYSCON_USBINTST in lpc17_40_syscon.h */
+
+#define LPC17_40_USBDEV_INTST (LPC17_40_USB_BASE+LPC17_40_USBDEV_INTST_OFFSET)
+#define LPC17_40_USBDEV_INTEN (LPC17_40_USB_BASE+LPC17_40_USBDEV_INTEN_OFFSET)
+#define LPC17_40_USBDEV_INTCLR (LPC17_40_USB_BASE+LPC17_40_USBDEV_INTCLR_OFFSET)
+#define LPC17_40_USBDEV_INTSET (LPC17_40_USB_BASE+LPC17_40_USBDEV_INTSET_OFFSET)
+
+/* SIE Command registers */
+
+#define LPC17_40_USBDEV_CMDCODE (LPC17_40_USB_BASE+LPC17_40_USBDEV_CMDCODE_OFFSET)
+#define LPC17_40_USBDEV_CMDDATA (LPC17_40_USB_BASE+LPC17_40_USBDEV_CMDDATA_OFFSET)
+
+/* USB transfer registers */
+
+#define LPC17_40_USBDEV_RXDATA (LPC17_40_USB_BASE+LPC17_40_USBDEV_RXDATA_OFFSET)
+#define LPC17_40_USBDEV_RXPLEN (LPC17_40_USB_BASE+LPC17_40_USBDEV_RXPLEN_OFFSET)
+#define LPC17_40_USBDEV_TXDATA (LPC17_40_USB_BASE+LPC17_40_USBDEV_TXDATA_OFFSET)
+#define LPC17_40_USBDEV_TXPLEN (LPC17_40_USB_BASE+LPC17_40_USBDEV_TXPLEN_OFFSET)
+#define LPC17_40_USBDEV_CTRL (LPC17_40_USB_BASE+LPC17_40_USBDEV_CTRL_OFFSET)
+
+/* More Device interrupt registers */
+
+#define LPC17_40_USBDEV_INTPRI (LPC17_40_USB_BASE+LPC17_40_USBDEV_INTPRI_OFFSET)
+
+/* Endpoint interrupt registers */
+
+#define LPC17_40_USBDEV_EPINTST (LPC17_40_USB_BASE+LPC17_40_USBDEV_EPINTST_OFFSET)
+#define LPC17_40_USBDEV_EPINTEN (LPC17_40_USB_BASE+LPC17_40_USBDEV_EPINTEN_OFFSET)
+#define LPC17_40_USBDEV_EPINTCLR (LPC17_40_USB_BASE+LPC17_40_USBDEV_EPINTCLR_OFFSET)
+#define LPC17_40_USBDEV_EPINTSET (LPC17_40_USB_BASE+LPC17_40_USBDEV_EPINTSET_OFFSET)
+#define LPC17_40_USBDEV_EPINTPRI (LPC17_40_USB_BASE+LPC17_40_USBDEV_EPINTPRI_OFFSET)
+
+/* Endpoint realization registers */
+
+#define LPC17_40_USBDEV_REEP (LPC17_40_USB_BASE+LPC17_40_USBDEV_REEP_OFFSET)
+#define LPC17_40_USBDEV_EPIND (LPC17_40_USB_BASE+LPC17_40_USBDEV_EPIND_OFFSET)
+#define LPC17_40_USBDEV_MAXPSIZE (LPC17_40_USB_BASE+LPC17_40_USBDEV_MAXPSIZE_OFFSET)
+
+/* DMA registers */
+
+#define LPC17_40_USBDEV_DMARST (LPC17_40_USB_BASE+LPC17_40_USBDEV_DMARST_OFFSET)
+#define LPC17_40_USBDEV_DMARCLR (LPC17_40_USB_BASE+LPC17_40_USBDEV_DMARCLR_OFFSET)
+#define LPC17_40_USBDEV_DMARSET (LPC17_40_USB_BASE+LPC17_40_USBDEV_DMARSET_OFFSET)
+#define LPC17_40_USBDEV_UDCAH (LPC17_40_USB_BASE+LPC17_40_USBDEV_UDCAH_OFFSET)
+#define LPC17_40_USBDEV_EPDMAST (LPC17_40_USB_BASE+LPC17_40_USBDEV_EPDMAST_OFFSET)
+#define LPC17_40_USBDEV_EPDMAEN (LPC17_40_USB_BASE+LPC17_40_USBDEV_EPDMAEN_OFFSET)
+#define LPC17_40_USBDEV_EPDMADIS (LPC17_40_USB_BASE+LPC17_40_USBDEV_EPDMADIS_OFFSET)
+#define LPC17_40_USBDEV_DMAINTST (LPC17_40_USB_BASE+LPC17_40_USBDEV_DMAINTST_OFFSET)
+#define LPC17_40_USBDEV_DMAINTEN (LPC17_40_USB_BASE+LPC17_40_USBDEV_DMAINTEN_OFFSET)
+#define LPC17_40_USBDEV_EOTINTST (LPC17_40_USB_BASE+LPC17_40_USBDEV_EOTINTST_OFFSET)
+#define LPC17_40_USBDEV_EOTINTCLR (LPC17_40_USB_BASE+LPC17_40_USBDEV_EOTINTCLR_OFFSET)
+#define LPC17_40_USBDEV_EOTINTSET (LPC17_40_USB_BASE+LPC17_40_USBDEV_EOTINTSET_OFFSET)
+#define LPC17_40_USBDEV_NDDRINTST (LPC17_40_USB_BASE+LPC17_40_USBDEV_NDDRINTST_OFFSET)
+#define LPC17_40_USBDEV_NDDRINTCLR (LPC17_40_USB_BASE+LPC17_40_USBDEV_NDDRINTCLR_OFFSET)
+#define LPC17_40_USBDEV_NDDRINTSET (LPC17_40_USB_BASE+LPC17_40_USBDEV_NDDRINTSET_OFFSET)
+#define LPC17_40_USBDEV_SYSERRINTST (LPC17_40_USB_BASE+LPC17_40_USBDEV_SYSERRINTST_OFFSET)
+#define LPC17_40_USBDEV_SYSERRINTCLR (LPC17_40_USB_BASE+LPC17_40_USBDEV_SYSERRINTCLR_OFFSET)
+#define LPC17_40_USBDEV_SYSERRINTSET (LPC17_40_USB_BASE+LPC17_40_USBDEV_SYSERRINTSET_OFFSET)
+
+/* OTG I2C registers ****************************************************************/
+
+#define LPC17_40_OTGI2C_RX (LPC17_40_USB_BASE+LPC17_40_OTGI2C_RX_OFFSET)
+#define LPC17_40_OTGI2C_TX (LPC17_40_USB_BASE+LPC17_40_OTGI2C_TX_OFFSET)
+#define LPC17_40_OTGI2C_STS (LPC17_40_USB_BASE+LPC17_40_OTGI2C_STS_OFFSET)
+#define LPC17_40_OTGI2C_CTL (LPC17_40_USB_BASE+LPC17_40_OTGI2C_CTL_OFFSET)
+#define LPC17_40_OTGI2C_CLKHI (LPC17_40_USB_BASE+LPC17_40_OTGI2C_CLKHI_OFFSET)
+#define LPC17_40_OTGI2C_CLKLO (LPC17_40_USB_BASE+LPC17_40_OTGI2C_CLKLO_OFFSET)
+
+/* Clock control registers ***********************************************************/
+
+#define LPC17_40_USBOTG_CLKCTRL (LPC17_40_USB_BASE+LPC17_40_USBOTG_CLKCTRL_OFFSET)
+#define LPC17_40_USBOTG_CLKST (LPC17_40_USB_BASE+LPC17_40_USBOTG_CLKST_OFFSET)
+
+#define LPC17_40_USBDEV_CLKCTRL (LPC17_40_USB_BASE+LPC17_40_USBDEV_CLKCTRL_OFFSET)
+#define LPC17_40_USBDEV_CLKST (LPC17_40_USB_BASE+LPC17_40_USBDEV_CLKST_OFFSET)
+
+/* Register bit definitions *********************************************************/
+/* USB Host Controller (OHCI) *******************************************************/
+/* See include/nuttx/usb/ohci.h */
+
+/* Module ID/Revision ID */
+
+#define USBHOST_MODID_VER_SHIFT (0) /* Bits 0-7: Unique version number */
+#define USBHOST_MODID_VER_MASK (0xff << USBHOST_MODID_VER_SHIFT)
+#define USBHOST_MODID_REV_SHIFT (8) /* Bits 9-15: Unique revision number */
+#define USBHOST_MODID_REV_MASK (0xff << USBHOST_MODID_REV_SHIFT)
+#define USBHOST_MODID_3505_SHIFT (16) /* Bits 16-31: 0x3505 */
+#define USBHOST_MODID_3505_MASK (0xffff << USBHOST_MODID_3505_SHIFT)
+# define USBHOST_MODID_3505 (0x3505 << USBHOST_MODID_3505_SHIFT)
+
+/* USB OTG Controller ***************************************************************/
+/* OTG registers:
+ *
+ * OTG Interrupt Status, OTG Interrupt Enable, OTG Interrupt Set, AND OTG Interrupt
+ * Clear
+ */
+
+#define USBOTG_INT_TMR (1 << 0) /* Bit 0: Timer time-out */
+#define USBOTG_INT_REMOVE_PU (1 << 1) /* Bit 1: Remove pull-up */
+#define USBOTG_INT_HNP_FAILURE (1 << 2) /* Bit 2: HNP failed */
+#define USBOTG_INT_HNP_SUCCESS (1 << 3) /* Bit 3: HNP succeeded */
+ /* Bits 4-31: Reserved */
+/* OTG Status and Control */
+
+#define USBOTG_STCTRL_PORTFUNC_SHIFT (0) /* Bits 0-1: Controls port function */
+#define USBOTG_STCTRL_PORTFUNC_MASK (3 << USBOTG_STCTRL_PORTFUNC_SHIFT)
+# define USBOTG_STCTRL_PORTFUNC_HNPOK (1 << USBOTG_STCTRL_PORTFUNC_SHIFT) /* HNP suceeded */
+#define USBOTG_STCTRL_TMRSCALE_SHIFT (2) /* Bits 2-3: Timer scale selection */
+#define USBOTG_STCTRL_TMRSCALE_MASK (3 << USBOTG_STCTRL_TMR_SCALE_SHIFT)
+# define USBOTG_STCTRL_TMRSCALE_10US (0 << USBOTG_STCTRL_TMR_SCALE_SHIFT) /* 10uS (100 KHz) */
+# define USBOTG_STCTRL_TMRSCALE_100US (1 << USBOTG_STCTRL_TMR_SCALE_SHIFT) /* 100uS (10 KHz) */
+# define USBOTG_STCTRL_TMRSCALE_1000US (2 << USBOTG_STCTRL_TMR_SCALE_SHIFT) /* 1000uS (1 KHz) */
+#define USBOTG_STCTRL_TMRMODE (1 << 4) /* Bit 4: Timer mode selection */
+#define USBOTG_STCTRL_TMREN (1 << 5) /* Bit 5: Timer enable */
+#define USBOTG_STCTRL_TMRRST (1 << 6) /* Bit 6: TTimer reset */
+ /* Bit 7: Reserved */
+#define USBOTG_STCTRL_BHNPTRACK (1 << 8) /* Bit 8: Enable HNP tracking for B-device (peripheral) */
+#define USBOTG_STCTRL_AHNPTRACK (1 << 9) /* Bit 9: Enable HNP tracking for A-device (host) */
+#define USBOTG_STCTRL_PUREMOVED (1 << 10) /* Bit 10: Set when D+ pull-up removed */
+ /* Bits 11-15: Reserved */
+#define USBOTG_STCTRL_TMRCNT_SHIFT (0) /* Bits 16-313: Timer scale selection */
+#define USBOTG_STCTRL_TMRCNT_MASK (0ffff << USBOTG_STCTRL_TMR_CNT_SHIFT)
+
+/* OTG Timer */
+
+#define USBOTG_TMR_TIMEOUTCNT_SHIFT (0) /* Bits 0-15: Interrupt when CNT matches this */
+#define USBOTG_TMR_TIMEOUTCNT_MASK (0xffff << USBOTG_TMR_TIMEOUTCNT_SHIFT)
+ /* Bits 16-31: Reserved */
+
+/* USB Device Controller ************************************************************/
+/* Device interrupt registers. See also SYSCON_USBINTST in lpc17_40_syscon.h */
+/* USB Device Interrupt Status, USB Device Interrupt Enable, USB Device Interrupt
+ * Clear, USB Device Interrupt Set, and USB Device Interrupt Priority
+ */
+
+#define USBDEV_INT_FRAME (1 << 0) /* Bit 0: frame interrupt (every 1 ms) */
+#define USBDEV_INT_EPFAST (1 << 1) /* Bit 1: Fast endpoint interrupt */
+#define USBDEV_INT_EPSLOW (1 << 2) /* Bit 2: Slow endpoints interrupt */
+#define USBDEV_INT_DEVSTAT (1 << 3) /* Bit 3: Bus reset, suspend change or connect change */
+#define USBDEV_INT_CCEMPTY (1 << 4) /* Bit 4: Command code register empty */
+#define USBDEV_INT_CDFULL (1 << 5) /* Bit 5: Command data register full */
+#define USBDEV_INT_RXENDPKT (1 << 6) /* Bit 6: RX endpoint data transferred */
+#define USBDEV_INT_TXENDPKT (1 << 7) /* Bit 7: TX endpoint data tansferred */
+#define USBDEV_INT_EPRLZED (1 << 8) /* Bit 8: Endpoints realized */
+#define USBDEV_INT_ERRINT (1 << 9) /* Bit 9: Error Interrupt */
+ /* Bits 10-31: Reserved */
+/* SIE Command registers:
+ *
+ * USB Command Code
+ */
+ /* Bits 0-7: Reserved */
+#define USBDEV_CMDCODE_PHASE_SHIFT (8) /* Bits 8-15: Command phase */
+#define USBDEV_CMDCODE_PHASE_MASK (0xff << USBDEV_CMDCODE_PHASE_SHIFT)
+# define USBDEV_CMDCODE_PHASE_READ (1 << USBDEV_CMDCODE_PHASE_SHIFT)
+# define USBDEV_CMDCODE_PHASE_WRITE (2 << USBDEV_CMDCODE_PHASE_SHIFT)
+# define USBDEV_CMDCODE_PHASE_COMMAND (5 << USBDEV_CMDCODE_PHASE_SHIFT)
+#define USBDEV_CMDCODE_CMD_SHIFT (16) /* Bits 15-23: Command (READ/COMMAND phases) */
+#define USBDEV_CMDCODE_CMD_MASK (0xff << USBDEV_CMDCODE_CMD_SHIFT)
+#define USBDEV_CMDCODE_WDATA_SHIFT (16) /* Bits 15-23: Write dagta (WRITE phase) */
+#define USBDEV_CMDCODE_WDATA_MASK (0xff << USBDEV_CMDCODE_CMD_SHIFT)
+ /* Bits 24-31: Reserved */
+/* USB Command Data */
+
+#define USBDEV_CMDDATA_SHIFT (0) /* Bits 0-7: Command read data */
+#define USBDEV_CMDDATA_MASK (0xff << USBDEV_CMDDATA_SHIFT)
+ /* Bits 8-31: Reserved */
+/* USB transfer registers:
+ *
+ * USB Receive Data (Bits 0-31: Received data)
+ */
+
+/* USB Receive Packet Length */
+
+#define USBDEV_RXPLEN_SHIFT (0) /* Bits 0-9: Bytes remaining to be read */
+#define USBDEV_RXPLEN_MASK (0x3ff << USBDEV_RXPLEN_SHIFT)
+#define USBDEV_RXPLEN_DV (1 << 10) /* Bit 10: DV Data valid */
+#define USBDEV_RXPLEN_PKTRDY (1 << 11) /* Bit 11: Packet ready for reading */
+ /* Bits 12-31: Reserved */
+/* USB Transmit Data (Bits 0-31: Transmit data) */
+
+/* USB Transmit Packet Length */
+
+#define USBDEV_TXPLEN_SHIFT (0) /* Bits 0-9: Bytes remaining to be written */
+#define USBDEV_TXPLEN_MASK (0x3ff << USBDEV_TXPLEN_SHIFT)
+ /* Bits 10-31: Reserved */
+/* USB Control */
+
+#define USBDEV_CTRL_RDEN (1 << 0) /* Bit 0: Read mode control */
+#define USBDEV_CTRL_WREN (1 << 1) /* Bit 1: Write mode control */
+#define USBDEV_CTRL_LOGEP_SHIFT (2) /* Bits 2-5: Logical Endpoint number */
+#define USBDEV_CTRL_LOGEP_MASK (15 << USBDEV_CTRL_LOGEP_SHIFT)
+ /* Bits 6-31: Reserved */
+/* Endpoint interrupt registers:
+ *
+ * USB Endpoint Interrupt Status, USB Endpoint Interrupt Enable, USB Endpoint Interrupt
+ * Clear, USB Endpoint Interrupt Set, and USB Endpoint Priority. Bits correspond
+ * to on RX or TX value for any of 15 logical endpoints).
+ */
+
+#define USBDEV_LOGEPRX(n) (1 << ((n) << 1))
+#define USBDEV_LOGEPTX(n) ((1 << ((n) << 1)) + 1)
+#define USBDEV_LOGEPRX0 (1 << 0)
+#define USBDEV_LOGEPTX0 (1 << 1)
+#define USBDEV_LOGEPRX1 (1 << 2)
+#define USBDEV_LOGEPTX1 (1 << 3)
+#define USBDEV_LOGEPRX2 (1 << 4)
+#define USBDEV_LOGEPTX2 (1 << 5)
+#define USBDEV_LOGEPRX3 (1 << 6)
+#define USBDEV_LOGEPTX3 (1 << 7)
+#define USBDEV_LOGEPRX4 (1 << 8)
+#define USBDEV_LOGEPTX4 (1 << 9)
+#define USBDEV_LOGEPRX5 (1 << 10)
+#define USBDEV_LOGEPTX5 (1 << 11)
+#define USBDEV_LOGEPRX6 (1 << 12)
+#define USBDEV_LOGEPTX6 (1 << 13)
+#define USBDEV_LOGEPRX7 (1 << 14)
+#define USBDEV_LOGEPTX7 (1 << 15)
+#define USBDEV_LOGEPRX8 (1 << 16)
+#define USBDEV_LOGEPTX8 (1 << 17)
+#define USBDEV_LOGEPRX9 (1 << 18)
+#define USBDEV_LOGEPTX9 (1 << 19)
+#define USBDEV_LOGEPRX10 (1 << 20)
+#define USBDEV_LOGEPTX10 (1 << 21)
+#define USBDEV_LOGEPRX11 (1 << 22)
+#define USBDEV_LOGEPTX11 (1 << 23)
+#define USBDEV_LOGEPRX12 (1 << 24)
+#define USBDEV_LOGEPTX12 (1 << 25)
+#define USBDEV_LOGEPRX13 (1 << 26)
+#define USBDEV_LOGEPTX13 (1 << 27)
+#define USBDEV_LOGEPRX14 (1 << 28)
+#define USBDEV_LOGEPTX14 (1 << 29)
+#define USBDEV_LOGEPRX15 (1 << 30)
+#define USBDEV_LOGEPTX15 (1 << 31)
+
+/* Endpoint realization registers:
+ *
+ * USB Realize Endpoint (Bits correspond to 1 of 32 physical endpoints)
+ */
+
+#define USBDEV_PHYEP(n) (1 << (n))
+#define USBDEV_PHYEP0 (1 << 0)
+#define USBDEV_PHYEP1 (1 << 1)
+#define USBDEV_PHYEP2 (1 << 2)
+#define USBDEV_PHYEP3 (1 << 3)
+#define USBDEV_PHYEP4 (1 << 4)
+#define USBDEV_PHYEP5 (1 << 5)
+#define USBDEV_PHYEP6 (1 << 6)
+#define USBDEV_PHYEP7 (1 << 7)
+#define USBDEV_PHYEP8 (1 << 8)
+#define USBDEV_PHYEP9 (1 << 9)
+#define USBDEV_PHYEP10 (1 << 10)
+#define USBDEV_PHYEP11 (1 << 11)
+#define USBDEV_PHYEP12 (1 << 12)
+#define USBDEV_PHYEP13 (1 << 13)
+#define USBDEV_PHYEP14 (1 << 14)
+#define USBDEV_PHYEP15 (1 << 15)
+#define USBDEV_PHYEP16 (1 << 16)
+#define USBDEV_PHYEP17 (1 << 17)
+#define USBDEV_PHYEP18 (1 << 18)
+#define USBDEV_PHYEP19 (1 << 19)
+#define USBDEV_PHYEP20 (1 << 20)
+#define USBDEV_PHYEP21 (1 << 21)
+#define USBDEV_PHYEP22 (1 << 22)
+#define USBDEV_PHYEP23 (1 << 23)
+#define USBDEV_PHYEP24 (1 << 24)
+#define USBDEV_PHYEP25 (1 << 25)
+#define USBDEV_PHYEP26 (1 << 26)
+#define USBDEV_PHYEP27 (1 << 27)
+#define USBDEV_PHYEP28 (1 << 28)
+#define USBDEV_PHYEP29 (1 << 29)
+#define USBDEV_PHYEP30 (1 << 30)
+#define USBDEV_PHYEP31 (1 << 31)
+
+/* USB Endpoint Index */
+
+#define USBDEV_EPIND_SHIFT (0) /* Bits 0-4: Physical endpoint number (0-31) */
+#define USBDEV_EPIND_MASK (31 << USBDEV_EPIND_SHIFT)
+ /* Bits 5-31: Reserved */
+/* USB MaxPacketSize */
+
+#define USBDEV_MAXPSIZE_SHIFT (0) /* Bits 0-9: Maximum packet size value */
+#define USBDEV_MAXPSIZE_MASK (0x3ff << USBDEV_MAXPSIZE_SHIFT)
+ /* Bits 10-31: Reserved */
+/* DMA registers:
+ *
+ * USB DMA Request Status, USB DMA Request Clear, and USB DMA Request Set. Registers
+ * contain bits for each of 32 physical endpoints. Use the USBDEV_PHYEP* definitions
+ * above. PHYEP0-1 (bits 0-1) must be zero.
+ */
+
+/* USB UDCA Head */
+ /* Bits 0-6: Reserved */
+#define USBDEV_UDCAH_SHIFT (7) /* Bits 7-31: UDCA start address */
+#define USBDEV_UDCAH_MASK (0x01ffffff << USBDEV_UDCAH_SHIFT)
+
+/* USB Endpoint DMA Status, USB Endpoint DMA Enable, and USB Endpoint DMA Disable.
+ * Registers contain bits for physical endpoints 2-31. Use the USBDEV_PHYEP*
+ * definitions above. PHYEP0-1 (bits 0-1) must be zero.
+ */
+
+/* USB DMA Interrupt Status and USB DMA Interrupt Enable */
+
+#define USBDEV_DMAINT_EOT (1 << 0) /* Bit 0: End of Transfer Interrupt */
+#define USBDEV_DMAINT_NDDR (1 << 1) /* Bit 1: New DD Request Interrupt */
+#define USBDEV_DMAINT_ERR (1 << 2) /* Bit 2: System Error Interrupt */
+ /* Bits 3-31: Reserved */
+/* USB End of Transfer Interrupt Status, USB End of Transfer Interrupt Clear, and USB
+ * End of Transfer Interrupt Set. Registers contain bits for physical endpoints 2-31.
+ * Use the USBDEV_PHYEP* definitions above. PHYEP0-1 (bits 0-1) must be zero.
+ */
+
+/* USB New DD Request Interrupt Status, USB New DD Request Interrupt Clear, and USB
+ * New DD Request Interrupt Set. Registers contain bits for physical endpoints 2-31.
+ * Use the USBDEV_PHYEP* definitions above. PHYEP0-1 (bits 0-1) must be zero.
+ */
+
+/* USB System Error Interrupt Status, USB System Error Interrupt Clear, USB System
+ * Error Interrupt Set. Registers contain bits for physical endpoints 2-31. Use
+ * the USBDEV_PHYEP* definitions above. PHYEP0-1 (bits 0-1) must be zero.
+ */
+
+/* OTG I2C registers ****************************************************************/
+
+/* I2C Receive */
+
+#define OTGI2C_RX_DATA_SHIFT (0) /* Bits 0-7: RX data */
+#define OTGI2C_RX_DATA_MASK (0xff << OTGI2C_RX_SHIFT)
+ /* Bits 8-31: Reserved */
+/* I2C Transmit */
+
+#define OTGI2C_TX_DATA_SHIFT (0) /* Bits 0-7: TX data */
+#define OTGI2C_TX_DATA_MASK (0xff << OTGI2C_TX_DATA_SHIFT)
+#define OTGI2C_TX_DATA_START (1 << 8) /* Bit 8: Issue START before transmit */
+#define OTGI2C_TX_DATA_STOP (1 << 9) /* Bit 9: Issue STOP before transmit */
+ /* Bits 3-31: Reserved */
+/* I2C Status */
+
+#define OTGI2C_STS_TDI (1 << 0) /* Bit 0: Transaction Done Interrupt */
+#define OTGI2C_STS_AFI (1 << 1) /* Bit 1: Arbitration Failure Interrupt */
+#define OTGI2C_STS_NAI (1 << 2) /* Bit 2: No Acknowledge Interrupt */
+#define OTGI2C_STS_DRMI (1 << 3) /* Bit 3: Master Data Request Interrupt */
+#define OTGI2C_STS_DRSI (1 << 4) /* Bit 4: Slave Data Request Interrupt */
+#define OTGI2C_STS_ACTIVE (1 << 5) /* Bit 5: Indicates whether the bus is busy */
+#define OTGI2C_STS_SCL (1 << 6) /* Bit 6: The current value of the SCL signal */
+#define OTGI2C_STS_SDA (1 << 7) /* Bit 7: The current value of the SDA signal */
+#define OTGI2C_STS_RFF (1 << 8) /* Bit 8: Receive FIFO Full (RFF) */
+#define OTGI2C_STS_RFE (1 << 9) /* Bit 9: Receive FIFO Empty */
+#define OTGI2C_STS_TFF (1 << 10) /* Bit 10: Transmit FIFO Full */
+#define OTGI2C_STS_TFE (1 << 11) /* Bit 11: Transmit FIFO Empty */
+ /* Bits 12-31: Reserved */
+/* I2C Control */
+
+#define OTGI2C_CTL_TDIE (1 << 0) /* Bit 0: Transmit Done Interrupt Enable */
+#define OTGI2C_CTL_AFIE (1 << 1) /* Bit 1: Transmitter Arbitration Failure Interrupt Enable */
+#define OTGI2C_CTL_NAIE (1 << 2) /* Bit 2: Transmitter No Acknowledge Interrupt Enable */
+#define OTGI2C_CTL_DRMIE (1 << 3) /* Bit 3: Master Transmitter Data Request Interrupt Enable */
+#define OTGI2C_CTL_DRSIE (1 << 4) /* Bit 4: Slave Transmitter Data Request Interrupt Enable */
+#define OTGI2C_CTL_REFIE (1 << 5) /* Bit 5: Receive FIFO Full Interrupt Enable */
+#define OTGI2C_CTL_RFDAIE (1 << 6) /* Bit 6: Receive Data Available Interrupt Enable */
+#define OTGI2C_CTL_TFFIE (1 << 7) /* Bit 7: Transmit FIFO Not Full Interrupt Enable */
+#define OTGI2C_CTL_SRST (1 << 8) /* Bit 8: Soft reset */
+ /* Bits 9-31: Reserved */
+/* I2C Clock High */
+
+#define OTGI2C_CLKHI_SHIFT (0) /* Bits 0-7: Clock divisor high */
+#define OTGI2C_CLKHI_MASK (0xff << OTGI2C_CLKHI_SHIFT)
+ /* Bits 8-31: Reserved */
+/* I2C Clock Low */
+
+#define OTGI2C_CLKLO_SHIFT (0) /* Bits 0-7: Clock divisor high */
+#define OTGI2C_CLLO_MASK (0xff << OTGI2C_CLKLO_SHIFT)
+ /* Bits 8-31: Reserved */
+/* Clock control registers ***********************************************************/
+
+/* USB Clock Control (OTG clock controller) and USB Clock Status (OTG clock status) */
+
+#define USBDEV_CLK_HOSTCLK (1 << 0) /* Bit 1: Host clock (OTG only) */
+#define USBDEV_CLK_DEVCLK (1 << 1) /* Bit 1: Device clock */
+#define USBDEV_CLK_I2CCLK (1 << 2) /* Bit 2: I2C clock (OTG only) */
+#define USBDEV_CLK_PORTSELCLK (1 << 3) /* Bit 3: Port select register clock (device only) */
+#define USBDEV_CLK_OTGCLK (1 << 3) /* Bit 3: OTG clock (OTG only) */
+#define USBDEV_CLK_AHBCLK (1 << 4) /* Bit 4: AHB clock */
+ /* Bits 5-31: Reserved */
+/* Alternate naming */
+
+#define USBOTG_CLK_HOSTCLK USBDEV_CLK_HOSTCLK
+#define USBOTG_CLK_DEVCLK USBDEV_CLK_DEVCLK
+#define USBOTG_CLK_I2CCLK USBDEV_CLK_I2CCLK
+#define USBOTG_CLK_PORTSELCLK USBDEV_CLK_PORTSELCLK
+#define USBOTG_CLK_OTGCLK USBDEV_CLK_OTGCLK
+#define USBOTG_CLK_AHBCLK USBDEV_CLK_AHBCLK
+
+/* Endpoints *************************************************************************/
+
+#define LPC17_40_EP0_OUT 0
+#define LPC17_40_EP0_IN 1
+#define LPC17_40_CTRLEP_OUT LPC17_40_EP0_OUT
+#define LPC17_40_CTRLEP_IN LPC17_40_EP0_IN
+#define LPC17_40_EP1_OUT 2
+#define LPC17_40_EP1_IN 3
+#define LPC17_40_EP2_OUT 4
+#define LPC17_40_EP2_IN 5
+#define LPC17_40_EP3_OUT 6
+#define LPC17_40_EP3_IN 7
+#define LPC17_40_EP4_OUT 8
+#define LPC17_40_EP4_IN 9
+#define LPC17_40_EP5_OUT 10
+#define LPC17_40_EP5_IN 11
+#define LPC17_40_EP6_OUT 12
+#define LPC17_40_EP6_IN 13
+#define LPC17_40_EP7_OUT 14
+#define LPC17_40_EP7_IN 15
+#define LPC17_40_EP8_OUT 16
+#define LPC17_40_EP8_IN 17
+#define LPC17_40_EP9_OUT 18
+#define LPC17_40_EP9_IN 19
+#define LPC17_40_EP10_OUT 20
+#define LPC17_40_EP10_IN 21
+#define LPC17_40_EP11_OUT 22
+#define LPC17_40_EP11_IN 23
+#define LPC17_40_EP12_OUT 24
+#define LPC17_40_EP12_IN 25
+#define LPC17_40_EP13_OUT 26
+#define LPC17_40_EP13_IN 27
+#define LPC17_40_EP14_OUT 28
+#define LPC17_40_EP14_IN 29
+#define LPC17_40_EP15_OUT 30
+#define LPC17_40_EP15_IN 31
+#define LPC17_40_NUMEPS 32
+
+/* Commands *************************************************************************/
+
+/* USB Command Code Register */
+
+#define CMD_USBDEV_PHASESHIFT (8) /* Bits 8-15: Command phase value */
+#define CMD_USBDEV_PHASEMASK (0xff << CMD_USBDEV_PHASESHIFT)
+# define CMD_USBDEV_DATAWR (1 << CMD_USBDEV_PHASESHIFT)
+# define CMD_USBDEV_DATARD (2 << CMD_USBDEV_PHASESHIFT)
+# define CMD_USBDEV_CMDWR (5 << CMD_USBDEV_PHASESHIFT)
+#define CMD_USBDEV_CMDSHIFT (16) /* Bits 16-23: Device command/WDATA */
+#define CMD_USBDEV_CMDMASK (0xff << CMD_USBDEV_CMDSHIFT)
+#define CMD_USBDEV_WDATASHIFT CMD_USBDEV_CMDSHIFT
+#define CMD_USBDEV_WDATAMASK CMD_USBDEV_CMDMASK
+
+/* Device Commands */
+
+#define CMD_USBDEV_SETADDRESS (0x00d0)
+#define CMD_USBDEV_CONFIG (0x00d8)
+#define CMD_USBDEV_SETMODE (0x00f3)
+#define CMD_USBDEV_READFRAMENO (0x00f5)
+#define CMD_USBDEV_READTESTREG (0x00fd)
+#define CMD_USBDEV_SETSTATUS (0x01fe) /* Bit 8 set to distingish get from set */
+#define CMD_USBDEV_GETSTATUS (0x00fe)
+#define CMD_USBDEV_GETERRORCODE (0x00ff)
+#define CMD_USBDEV_READERRORSTATUS (0x00fb)
+
+/* Endpoint Commands */
+
+#define CMD_USBDEV_EPSELECT (0x0000)
+#define CMD_USBDEV_EPSELECTCLEAR (0x0040)
+#define CMD_USBDEV_EPSETSTATUS (0x0140) /* Bit 8 set to distingish get from selectclear */
+#define CMD_USBDEV_EPCLRBUFFER (0x00f2)
+#define CMD_USBDEV_EPVALIDATEBUFFER (0x00fa)
+
+/* Command/response bit definitions ********************************************/
+/* SETADDRESS (0xd0) command definitions */
+
+#define CMD_USBDEV_SETADDRESS_MASK (0x7f) /* Bits 0-6: Device address */
+#define CMD_USBDEV_SETADDRESS_DEVEN (1 << 7) /* Bit 7: Device enable */
+
+/* SETSTATUS (0xfe) and GETSTATUS (0xfe) response: */
+
+#define CMD_STATUS_CONNECT (1 << 0) /* Bit 0: Connected */
+#define CMD_STATUS_CONNCHG (1 << 1) /* Bit 1: Connect change */
+#define CMD_STATUS_SUSPEND (1 << 2) /* Bit 2: Suspend */
+#define CMD_STATUS_SUSPCHG (1 << 3) /* Bit 3: Suspend change */
+#define CMD_STATUS_RESET (1 << 4) /* Bit 4: Bus reset bit */
+
+/* EPSELECT (0x00) endpoint status response */
+
+#define CMD_EPSELECT_FE (1 << 0) /* Bit 0: IN empty or OUT full */
+#define CMD_EPSELECT_ST (1 << 1) /* Bit 1: Endpoint is stalled */
+#define CMD_EPSELECT_STP (1 << 2) /* Bit 2: Last packet was setup */
+#define CMD_EPSELECT_PO (1 << 3) /* Bit 3: Previous packet was overwritten */
+#define CMD_EPSELECT_EPN (1 << 4) /* Bit 4: NAK sent */
+#define CMD_EPSELECT_B1FULL (1 << 5) /* Bit 5: Buffer 1 full */
+#define CMD_EPSELECT_B2FULL (1 << 6) /* Bit 6: Buffer 2 full */
+ /* Bit 7: Reserved */
+/* EPSETSTATUS (0x40) command */
+
+#define CMD_SETSTAUS_ST (1 << 0) /* Bit 0: Stalled endpoint bit */
+ /* Bits 1-4: Reserved */
+#define CMD_SETSTAUS_DA (1 << 5) /* Bit 5: Disabled endpoint bit */
+#define CMD_SETSTAUS_RFMO (1 << 6) /* Bit 6: Rate feedback mode */
+#define CMD_SETSTAUS_CNDST (1 << 7) /* Bit 7: Conditional stall bit */
+
+/* EPCLRBUFFER (0xf2) response */
+
+#define CMD_USBDEV_CLRBUFFER_PO (0x00000001)
+
+/* SETMODE(0xf3) command */
+
+#define CMD_SETMODE_APCLK (1 << 0) /* Bit 0: Always PLL Clock */
+#define CMD_SETMODE_INAKCI (1 << 1) /* Bit 1: Interrupt on NAK for Control IN endpoint */
+#define CMD_SETMODE_INAKCO (1 << 2) /* Bit 2: Interrupt on NAK for Control OUT endpoint */
+#define CMD_SETMODE_INAKII (1 << 3) /* Bit 3: Interrupt on NAK for Interrupt IN endpoint */
+#define CMD_SETMODE_INAKIO (1 << 4) /* Bit 4: Interrupt on NAK for Interrupt OUT endpoints */
+#define CMD_SETMODE_INAKBI (1 << 5) /* Bit 5: Interrupt on NAK for Bulk IN endpoints */
+#define CMD_SETMODE_INAKBO (1 << 6) /* Bit 6: Interrupt on NAK for Bulk OUT endpoints */
+
+/* READERRORSTATUS (0xFb) command */
+
+#define CMD_READERRORSTATUS_PIDERR (1 << 0) /* Bit 0: PID encoding/unknown or Token CRC */
+#define CMD_READERRORSTATUS_UEPKT (1 << 1) /* Bit 1: Unexpected Packet */
+#define CMD_READERRORSTATUS_DCRC (1 << 2) /* Bit 2: Data CRC error */
+#define CMD_READERRORSTATUS_TIMEOUT (1 << 3) /* Bit 3: Time out error */
+#define CMD_READERRORSTATUS_EOP (1 << 4) /* Bit 4: End of packet error */
+#define CMD_READERRORSTATUS_BOVRN (1 << 5) /* Bit 5: Buffer Overrun */
+#define CMD_READERRORSTATUS_BTSTF (1 << 6) /* Bit 6: Bit stuff error */
+#define CMD_READERRORSTATUS_TGLERR (1 << 7) /* Bit 7: Wrong toggle in data PID */
+#define CMD_READERRORSTATUS_ALLERRS (0xff)
+
+/* DMA ******************************************************************************/
+/* The DMA descriptor */
+
+#define USB_DMADESC_NEXTDDPTR 0 /* Offset 0: Next USB descriptor in RAM */
+#define USB_DMADESC_CONFIG 1 /* Offset 1: DMA configuration info. */
+#define USB_DMADESC_STARTADDR 2 /* Offset 2: DMA start address */
+#define USB_DMADESC_STATUS 3 /* Offset 3: DMA status info (read only) */
+#define USB_DMADESC_ISOCSIZEADDR 4 /* Offset 4: Isoc. packet size address */
+
+/* Bit settings for CONFIG (offset 1 )*/
+
+#define USB_DMADESC_MODE_SHIFT (0) /* Bits 0-1: DMA mode */
+#define USB_DMADESC_MODE_MASK (3 << USB_DMADESC_MODE_SHIFT)
+# define USB_DMADESC_MODENORMAL (0 << USB_DMADESC_MODE_SHIFT) /* Mode normal */
+# define USB_DMADESC_MODEATLE (1 << USB_DMADESC_MODE_SHIFT) /* ATLE normal */
+#define USB_DMADESC_NEXTDDVALID (1 << 2) /* Bit 2: Next descriptor valid */
+ /* Bit 3: Reserved */
+#define USB_DMADESC_ISCOEP (1 << 4) /* Bit 4: ISOC endpoint */
+#define USB_DMADESC_PKTSIZE_SHIFT (5) /* Bits 5-15: Max packet size */
+#define USB_DMADESC_PKTSIZE_MASK (0x7ff << USB_DMADESC_PKTSIZE_SHIFT)
+#define USB_DMADESC_BUFLEN_SHIFT (16) /* Bits 16-31: DMA buffer length */
+#define USB_DMADESC_BUFLEN_MASK (0xffff << USB_DMADESC_BUFLEN_SHIFT
+
+/* Bit settings for STATUS (offset 3). All must be initialized to zero. */
+
+#define USB_DMADESC_STATUS_SHIFT (1) /* Bits 1-4: DMA status */
+#define USB_DMADESC_STATUS_MASK (15 << USB_DMADESC_STATUS_SHIFT)
+# define USB_DMADESC_NOTSERVICED (0 << USB_DMADESC_STATUS_SHIFT)
+# define USB_DMADESC_BEINGSERVICED (1 << USB_DMADESC_STATUS_SHIFT)
+# define USB_DMADESC_NORMALCOMPLETION (2 << USB_DMADESC_STATUS_SHIFT)
+# define USB_DMADESC_DATAUNDERRUN (3 << USB_DMADESC_STATUS_SHIFT)
+# define USB_DMADESC_DATAOVERRUN (8 << USB_DMADESC_STATUS_SHIFT)
+# define USB_DMADESC_SYSTEMERROR (9 << USB_DMADESC_STATUS_SHIFT)
+#define USB_DMADESC_PKTVALID (1 << 5) /* Bit 5: Packet valid */
+#define USB_DMADESC_LSBEXTRACTED (1 << 6) /* Bit 6: LS byte extracted */
+#define USB_DMADESC_MSBEXTRACTED (1 << 7) /* Bit 7: MS byte extracted */
+#define USB_DMADESC_MSGLENPOS_SHIFT (8) /* Bits 8-13: Message length position */
+#define USB_DMADESC_MSGLENPOS_MASK (0x3f << USB_DMADESC_MSGLENPOS_SHIFT)
+#define USB_DMADESC_DMACOUNT_SHIFT (16) /* Bits 16-31: DMA count */
+#define USB_DMADESC_DMACOUNT_MASK (0xffff << USB_DMADESC_DMACOUNT_SHIFT)
+
+/* DMA packet size format */
+
+#define USB_DMAPKTSIZE_PKTLEN_SHIFT (0) /* Bits 0-15: Packet length */
+#define USB_DMAPKTSIZE_PKTLEN_MASK (0xffff << USB_DMAPKTSIZE_PKTLEN_SHIFT)
+#define USB_DMAPKTSIZE_PKTVALID (1 << 16) /* Bit 16: Packet valid */
+#define USB_DMAPKTSIZE_FRAMENO_SHIFT (17) /* Bit 17-31: Frame number */
+#define USB_DMAPKTSIZE_FRAMENO_MASK (0x7fff << USB_DMAPKTSIZE_FRAMENO_SHIFT)
+
+/************************************************************************************
+ * Public Types
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Data
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+#endif /* __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC17_40_USB_H */
diff --git a/arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_wdt.h b/arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_wdt.h
new file mode 100644
index 00000000000..26a257ea694
--- /dev/null
+++ b/arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_wdt.h
@@ -0,0 +1,156 @@
+/************************************************************************************
+ * arch/arm/src/lpc17xx_40xx/hardware/lpc17_40_wdt.h
+ *
+ * Copyright (C) 2010, 2013 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ * 3. Neither the name NuttX 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 THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#ifndef __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC17_40_WDT_H
+#define __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC17_40_WDT_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include
+
+#include "chip.h"
+#include "hardware/lpc17_40_memorymap.h"
+
+/************************************************************************************
+ * Pre-processor Definitions
+ ************************************************************************************/
+
+/* Register offsets *****************************************************************/
+
+#define LPC17_40_WDT_MOD_OFFSET 0x0000 /* Watchdog mode register */
+#define LPC17_40_WDT_TC_OFFSET 0x0004 /* Watchdog timer constant register */
+#define LPC17_40_WDT_FEED_OFFSET 0x0008 /* Watchdog feed sequence register */
+#define LPC17_40_WDT_TV_OFFSET 0x000c /* Watchdog timer value register */
+
+#ifdef LPC176x
+# define LPC17_40_WDT_CLKSEL_OFFSET 0x0010 /* Watchdog clock source selection register */
+#endif
+
+#ifdef LPC178x_40xx
+# define LPC17_40_WDT_WARNINT_OFFSET 0x0014 /* Watchdog warning interrupt */
+# define LPC17_40_WDT_WINDOW_OFFSET 0x0018 /* Watchdog window compare value */
+#endif
+
+/* Register addresses ***************************************************************/
+
+#define LPC17_40_WDT_MOD (LPC17_40_WDT_BASE+LPC17_40_WDT_MOD_OFFSET)
+#define LPC17_40_WDT_TC (LPC17_40_WDT_BASE+LPC17_40_WDT_TC_OFFSET)
+#define LPC17_40_WDT_FEED (LPC17_40_WDT_BASE+LPC17_40_WDT_FEED_OFFSET)
+#define LPC17_40_WDT_TV (LPC17_40_WDT_BASE+LPC17_40_WDT_TV_OFFSET)
+#define LPC17_40_WDT_CLKSEL (LPC17_40_WDT_BASE+LPC17_40_WDT_CLKSEL_OFFSET)
+
+#ifdef LPC178x_40xx
+# define LPC17_40_WDT_WARNINT (LPC17_40_WDT_BASE+LPC17_40_WDT_WARNINT_OFFSET)
+# define LPC17_40_WDT_WINDOW (LPC17_40_WDT_BASE+LPC17_40_WDT_WINDOW_OFFSET)
+#endif
+
+/* Register bit definitions *********************************************************/
+
+/* Watchdog mode register */
+
+#define WDT_MOD_WDEN (1 << 0) /* Bit 0: Watchdog enable */
+#define WDT_MOD_WDRESET (1 << 1) /* Bit 1: Watchdog reset enable */
+#define WDT_MOD_WDTOF (1 << 2) /* Bit 2: Watchdog time-out */
+#define WDT_MOD_WDINT (1 << 3) /* Bit 3: Watchdog interrupt */
+#ifdef LPC178x_40xx
+# define WDT_MOD_WDPROTECT (1 << 4) /* Bit 4: Watchdog interrupt */
+#endif
+ /* Bits 5-31: Reserved */
+/* Watchdog timer constant register */
+
+#ifdef LPC176x
+# define WDT_TC (0xffffffff) /* Bits 0-31: Watchdog time-out interval */
+#endif
+#ifdef LPC178x_40xx
+# define WDT_TC (0x00ffffff) /* Bits 0-23: Watchdog time-out interval */
+ /* Bits 24-31: Reserved */
+#endif
+
+/* Watchdog feed sequence register */
+
+#define WDT_FEED_MASK (0xff) /* Bits 0-7: Feed value should be 0xaa
+ * followed by 0x55 */
+ /* Bits 14-31: Reserved */
+/* Watchdog timer value register */
+
+#ifdef LPC176x
+# define WDT_TVT (0xffffffff) /* Bits 0-31: Watchdog timer value */
+#endif
+#ifdef LPC178x_40xx
+# define WDT_TVT (0xffffff) /* Bits 0-23: Watchdog timer value */
+ /* Bits 24-31: Reserved */
+#endif
+
+/* Watchdog clock source selection register */
+
+#ifdef LPC176x
+# define WDT_CLKSEL_WDSEL_SHIFT (0) /* Bits 0-1: Clock source for the Watchdog timer */
+# define WDT_CLKSEL_WDSEL_MASK (3 << WDT_CLKSEL_WDSEL_SHIFT)
+# define WDT_CLKSEL_WDSEL_INTRC (0 << WDT_CLKSEL_WDSEL_SHIFT) /* Internal RC osc */
+# define WDT_CLKSEL_WDSEL_APB (1 << WDT_CLKSEL_WDSEL_SHIFT) /* APB peripheral clock (watchdog pclk) */
+# define WDT_CLKSEL_WDSEL_RTC (2 << WDT_CLKSEL_WDSEL_SHIFT) /* RTC oscillator (rtc_clk) */
+ /* Bits 2-30: Reserved */
+# define WDT_CLKSEL_WDLOCK (1 << 31) /* Bit 31: Lock WDT register bits if set */
+#endif
+
+/* Watchdog timer warning interrupt register */
+
+#ifdef LPC178x_40xx
+# define WDT_WARNINT (0x3ff) /* Bits 0-9: Warning Interrupt compare value */
+ /* Bits 10-31: Reserved */
+#endif
+
+/* Watchdog timer value register */
+
+#ifdef LPC178x_40xx
+# define WDT_WINDOW (0xffffff) /* Bits 0-23: Watchdog window value */
+ /* Bits 24-31: Reserved */
+#endif
+
+/************************************************************************************
+ * Public Types
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Data
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+#endif /* __ARCH_ARM_SRC_LPC17XX_40XX_HARDWARE_LPC17_40_WDT_H */
diff --git a/arch/arm/src/lpc17xx/lpc176x_clockconfig.c b/arch/arm/src/lpc17xx_40xx/lpc176x_clockconfig.c
similarity index 71%
rename from arch/arm/src/lpc17xx/lpc176x_clockconfig.c
rename to arch/arm/src/lpc17xx_40xx/lpc176x_clockconfig.c
index cc9cc89b8b3..c857e8a27af 100644
--- a/arch/arm/src/lpc17xx/lpc176x_clockconfig.c
+++ b/arch/arm/src/lpc17xx_40xx/lpc176x_clockconfig.c
@@ -1,6 +1,6 @@
/****************************************************************************
- * arch/arm/src/lpc17xx/lpc17_clockconfig.c
- * arch/arm/src/chip/lpc17_clockconfig.c
+ * arch/arm/src/lpc17xx_40xx/lpc176x_clockconfig.c
+ * arch/arm/src/chip/lpc17_40_clockconfig.c
*
* Copyright (C) 2010, 2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt
@@ -48,8 +48,8 @@
#include "up_arch.h"
#include "up_internal.h"
-#include "lpc17_clockconfig.h"
-#include "hardware/lpc17_syscon.h"
+#include "lpc17_40_clockconfig.h"
+#include "hardware/lpc17_40_syscon.h"
/****************************************************************************
* Pre-processor Definitions
@@ -76,30 +76,30 @@
****************************************************************************/
/************************************************************************************
- * Name: lpc17_clockconfig
+ * Name: lpc17_40_clockconfig
*
* Description:
* Called to initialize the LPC176x. This does whatever setup is needed to put the
* SoC in a usable state. This includes the initialization of clocking using the
* settings in board.h.
*
- * The LPC176x and LPC178x system control block is *nearly* identical but we have
- * found that the LPC178x is more sensitive to the ordering of certain operations.
+ * The LPC176x and LPC178x/40xx system control block is *nearly* identical but we have
+ * found that the LPC178x/40xx is more sensitive to the ordering of certain operations.
* So, although the hardware seems very similar, the safer thing to do is to
- * separate the LPC176x and LPC178x into separate files.
+ * separate the LPC176x and LPC178x/40xx into separate files.
*
************************************************************************************/
-void lpc17_clockconfig(void)
+void lpc17_40_clockconfig(void)
{
/* Enable the main oscillator (or not) and the frequency range of the main oscillator */
- putreg32(BOARD_SCS_VALUE, LPC17_SYSCON_SCS);
+ putreg32(BOARD_SCS_VALUE, LPC17_40_SYSCON_SCS);
/* Wait for the main oscillator to be ready. */
-#ifdef CONFIG_LPC17_MAINOSC
- while ((getreg32(LPC17_SYSCON_SCS) & SYSCON_SCS_OSCSTAT) == 0);
+#ifdef CONFIG_LPC17_40_MAINOSC
+ while ((getreg32(LPC17_40_SYSCON_SCS) & SYSCON_SCS_OSCSTAT) == 0);
#endif
/* Setup up the divider value for the CPU clock. The output of the divider is CCLK.
@@ -109,112 +109,112 @@ void lpc17_clockconfig(void)
* configured.
*/
- putreg32(BOARD_CCLKCFG_VALUE, LPC17_SYSCON_CCLKCFG);
+ putreg32(BOARD_CCLKCFG_VALUE, LPC17_40_SYSCON_CCLKCFG);
/* PLL0 is used to generate the CPU clock divider input (PLLCLK). */
-#ifdef CONFIG_LPC17_PLL0
+#ifdef CONFIG_LPC17_40_PLL0
/* Select the PLL0 source clock, multiplier, and pre-divider values. NOTE that
* a special "feed" sequence must be written to the PLL0FEED register in order
* for changes to the PLL0CFG register to take effect.
*/
- putreg32(BOARD_CLKSRCSEL_VALUE, LPC17_SYSCON_CLKSRCSEL);
- putreg32(BOARD_PLL0CFG_VALUE, LPC17_SYSCON_PLL0CFG);
- putreg32(0xaa, LPC17_SYSCON_PLL0FEED);
- putreg32(0x55, LPC17_SYSCON_PLL0FEED);
+ putreg32(BOARD_CLKSRCSEL_VALUE, LPC17_40_SYSCON_CLKSRCSEL);
+ putreg32(BOARD_PLL0CFG_VALUE, LPC17_40_SYSCON_PLL0CFG);
+ putreg32(0xaa, LPC17_40_SYSCON_PLL0FEED);
+ putreg32(0x55, LPC17_40_SYSCON_PLL0FEED);
/* Enable the PLL. NOTE that a special "feed" sequence must be written to the
* PLL0FEED register in order for changes to the PLL0CON register to take effect.
*/
- putreg32(SYSCON_PLLCON_PLLE, LPC17_SYSCON_PLL0CON);
- putreg32(0xaa, LPC17_SYSCON_PLL0FEED);
- putreg32(0x55, LPC17_SYSCON_PLL0FEED);
+ putreg32(SYSCON_PLLCON_PLLE, LPC17_40_SYSCON_PLL0CON);
+ putreg32(0xaa, LPC17_40_SYSCON_PLL0FEED);
+ putreg32(0x55, LPC17_40_SYSCON_PLL0FEED);
/* Wait for PLL0 to lock */
- while ((getreg32(LPC17_SYSCON_PLL0STAT) & SYSCON_PLL0STAT_PLOCK) == 0);
+ while ((getreg32(LPC17_40_SYSCON_PLL0STAT) & SYSCON_PLL0STAT_PLOCK) == 0);
/* Enable and connect PLL0 */
- putreg32(SYSCON_PLLCON_PLLE | SYSCON_PLLCON_PLLC, LPC17_SYSCON_PLL0CON);
- putreg32(0xaa, LPC17_SYSCON_PLL0FEED);
- putreg32(0x55, LPC17_SYSCON_PLL0FEED);
+ putreg32(SYSCON_PLLCON_PLLE | SYSCON_PLLCON_PLLC, LPC17_40_SYSCON_PLL0CON);
+ putreg32(0xaa, LPC17_40_SYSCON_PLL0FEED);
+ putreg32(0x55, LPC17_40_SYSCON_PLL0FEED);
/* Wait for PLL to report that it is connected and enabled */
- while ((getreg32(LPC17_SYSCON_PLL0STAT) & (SYSCON_PLL0STAT_PLLE | SYSCON_PLL0STAT_PLLC))
+ while ((getreg32(LPC17_40_SYSCON_PLL0STAT) & (SYSCON_PLL0STAT_PLLE | SYSCON_PLL0STAT_PLLC))
!= (SYSCON_PLL0STAT_PLLE | SYSCON_PLL0STAT_PLLC));
-#endif /* CONFIG_LPC17_PLL0 */
+#endif /* CONFIG_LPC17_40_PLL0 */
/* PLL1 receives its clock input from the main oscillator only and can be used to
* provide a fixed 48 MHz clock only to the USB subsystem (if that clock cannot be
* obtained from PLL0).
*/
-#ifdef CONFIG_LPC17_PLL1
+#ifdef CONFIG_LPC17_40_PLL1
/* Select the PLL1 multiplier, and pre-divider values. NOTE that a special "feed"
* sequence must be written to the PLL1FEED register in order for changes to the
* PLL1CFG register to take effect.
*/
- putreg32(BOARD_PLL1CFG_VALUE, LPC17_SYSCON_PLL1CFG);
- putreg32(0xaa, LPC17_SYSCON_PLL1FEED);
- putreg32(0x55, LPC17_SYSCON_PLL1FEED);
+ putreg32(BOARD_PLL1CFG_VALUE, LPC17_40_SYSCON_PLL1CFG);
+ putreg32(0xaa, LPC17_40_SYSCON_PLL1FEED);
+ putreg32(0x55, LPC17_40_SYSCON_PLL1FEED);
/* Enable the PLL. NOTE that a special "feed" sequence must be written to the
* PLL1FEED register in order for changes to the PLL1CON register to take effect.
*/
- putreg32(SYSCON_PLLCON_PLLE, LPC17_SYSCON_PLL1CON);
- putreg32(0xaa, LPC17_SYSCON_PLL1FEED);
- putreg32(0x55, LPC17_SYSCON_PLL1FEED);
+ putreg32(SYSCON_PLLCON_PLLE, LPC17_40_SYSCON_PLL1CON);
+ putreg32(0xaa, LPC17_40_SYSCON_PLL1FEED);
+ putreg32(0x55, LPC17_40_SYSCON_PLL1FEED);
/* Wait for PLL1 to lock */
- while ((getreg32(LPC17_SYSCON_PLL1STAT) & SYSCON_PLL1STAT_PLOCK) == 0);
+ while ((getreg32(LPC17_40_SYSCON_PLL1STAT) & SYSCON_PLL1STAT_PLOCK) == 0);
/* Enable and connect PLL1 */
- putreg32(SYSCON_PLLCON_PLLE | SYSCON_PLLCON_PLLC, LPC17_SYSCON_PLL1CON);
- putreg32(0xaa, LPC17_SYSCON_PLL1FEED);
- putreg32(0x55, LPC17_SYSCON_PLL1FEED);
+ putreg32(SYSCON_PLLCON_PLLE | SYSCON_PLLCON_PLLC, LPC17_40_SYSCON_PLL1CON);
+ putreg32(0xaa, LPC17_40_SYSCON_PLL1FEED);
+ putreg32(0x55, LPC17_40_SYSCON_PLL1FEED);
/* Wait for PLL to report that it is connected and enabled */
- while ((getreg32(LPC17_SYSCON_PLL1STAT) & (SYSCON_PLL1STAT_PLLE | SYSCON_PLL1STAT_PLLC))
+ while ((getreg32(LPC17_40_SYSCON_PLL1STAT) & (SYSCON_PLL1STAT_PLLE | SYSCON_PLL1STAT_PLLC))
!= (SYSCON_PLL1STAT_PLLE | SYSCON_PLL1STAT_PLLC));
-#else /* CONFIG_LPC17_PLL1 */
+#else /* CONFIG_LPC17_40_PLL1 */
/* Otherwise, setup up the USB clock divider to generate the USB clock from PLL0 */
- putreg32(BOARD_USBCLKCFG_VALUE, LPC17_SYSCON_USBCLKCFG);
+ putreg32(BOARD_USBCLKCFG_VALUE, LPC17_40_SYSCON_USBCLKCFG);
-#endif /* CONFIG_LPC17_PLL1 */
+#endif /* CONFIG_LPC17_40_PLL1 */
/* Disable all peripheral clocks. They must be configured by each device driver
* when the device driver is initialized.
*/
- putreg32(0, LPC17_SYSCON_PCLKSEL0);
- putreg32(0, LPC17_SYSCON_PCLKSEL1);
+ putreg32(0, LPC17_40_SYSCON_PCLKSEL0);
+ putreg32(0, LPC17_40_SYSCON_PCLKSEL1);
/* Disable power to all peripherals (execpt GPIO). Peripherals must be re-powered
* one at a time by each device driver when the driver is initialized.
*/
- putreg32(SYSCON_PCONP_PCGPIO, LPC17_SYSCON_PCONP);
+ putreg32(SYSCON_PCONP_PCGPIO, LPC17_40_SYSCON_PCONP);
/* Disable CLKOUT */
- putreg32(0, LPC17_SYSCON_CLKOUTCFG);
+ putreg32(0, LPC17_40_SYSCON_CLKOUTCFG);
/* Configure FLASH */
-#ifdef CONFIG_LPC17_FLASH
+#ifdef CONFIG_LPC17_40_FLASH
{
uint32_t regval;
@@ -224,12 +224,12 @@ void lpc17_clockconfig(void)
}
else
{
- regval = getreg32(LPC17_SYSCON_FLASHCFG);
+ regval = getreg32(LPC17_40_SYSCON_FLASHCFG);
regval &= ~SYSCON_FLASHCFG_TIM_MASK;
regval |= BOARD_FLASHCFG_VALUE;
}
- putreg32(BOARD_FLASHCFG_VALUE, LPC17_SYSCON_FLASHCFG);
+ putreg32(BOARD_FLASHCFG_VALUE, LPC17_40_SYSCON_FLASHCFG);
}
#endif
}
diff --git a/arch/arm/src/lpc17xx/lpc176x_gpio.c b/arch/arm/src/lpc17xx_40xx/lpc176x_gpio.c
similarity index 78%
rename from arch/arm/src/lpc17xx/lpc176x_gpio.c
rename to arch/arm/src/lpc17xx_40xx/lpc176x_gpio.c
index b2b8e9805ab..4cf6b4e2c29 100644
--- a/arch/arm/src/lpc17xx/lpc176x_gpio.c
+++ b/arch/arm/src/lpc17xx_40xx/lpc176x_gpio.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * arch/arm/src/lpc17xx/lpc176x_gpio.c
+ * arch/arm/src/lpc17xx_40xx/lpc176x_gpio.c
*
* Copyright (C) 2010-2011, 2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt
@@ -49,7 +49,7 @@
#include "up_arch.h"
#include "chip.h"
-#include "lpc17_gpio.h"
+#include "lpc17_40_gpio.h"
/****************************************************************************
* Pre-processor Definitions
@@ -71,14 +71,14 @@
* Public Data
****************************************************************************/
/* These tables have global scope because they are also used in
- * lpc17_gpiodbg.c
+ * lpc17_40_gpiodbg.c
*/
/* We have to remember the configured interrupt setting.. PINs are not
* actually set up to interrupt until the interrupt is enabled.
*/
-#ifdef CONFIG_LPC17_GPIOIRQ
+#ifdef CONFIG_LPC17_40_GPIOIRQ
uint64_t g_intedge0;
uint64_t g_intedge2;
#endif
@@ -87,13 +87,13 @@ uint64_t g_intedge2;
const uint32_t g_fiobase[GPIO_NPORTS] =
{
- LPC17_FIO0_BASE,
- LPC17_FIO1_BASE,
- LPC17_FIO2_BASE,
- LPC17_FIO3_BASE,
- LPC17_FIO4_BASE
+ LPC17_40_FIO0_BASE,
+ LPC17_40_FIO1_BASE,
+ LPC17_40_FIO2_BASE,
+ LPC17_40_FIO3_BASE,
+ LPC17_40_FIO4_BASE
#if GPIO_NPORTS > 5
- , LPC17_FIO5_BASE
+ , LPC17_40_FIO5_BASE
#endif
};
@@ -103,9 +103,9 @@ const uint32_t g_fiobase[GPIO_NPORTS] =
const uint32_t g_intbase[GPIO_NPORTS] =
{
- LPC17_GPIOINT0_BASE,
+ LPC17_40_GPIOINT0_BASE,
0,
- LPC17_GPIOINT2_BASE,
+ LPC17_40_GPIOINT2_BASE,
0,
0
#if GPIO_NPORTS > 5
@@ -115,9 +115,9 @@ const uint32_t g_intbase[GPIO_NPORTS] =
const uint32_t g_lopinsel[GPIO_NPORTS] =
{
- LPC17_PINCONN_PINSEL0,
- LPC17_PINCONN_PINSEL2,
- LPC17_PINCONN_PINSEL4,
+ LPC17_40_PINCONN_PINSEL0,
+ LPC17_40_PINCONN_PINSEL2,
+ LPC17_40_PINCONN_PINSEL4,
0,
0
#if GPIO_NPORTS > 5
@@ -127,11 +127,11 @@ const uint32_t g_lopinsel[GPIO_NPORTS] =
const uint32_t g_hipinsel[GPIO_NPORTS] =
{
- LPC17_PINCONN_PINSEL1,
- LPC17_PINCONN_PINSEL3,
+ LPC17_40_PINCONN_PINSEL1,
+ LPC17_40_PINCONN_PINSEL3,
0,
- LPC17_PINCONN_PINSEL7,
- LPC17_PINCONN_PINSEL9
+ LPC17_40_PINCONN_PINSEL7,
+ LPC17_40_PINCONN_PINSEL9
#if GPIO_NPORTS > 5
, 0
#endif
@@ -139,9 +139,9 @@ const uint32_t g_hipinsel[GPIO_NPORTS] =
const uint32_t g_lopinmode[GPIO_NPORTS] =
{
- LPC17_PINCONN_PINMODE0,
- LPC17_PINCONN_PINMODE2,
- LPC17_PINCONN_PINMODE4,
+ LPC17_40_PINCONN_PINMODE0,
+ LPC17_40_PINCONN_PINMODE2,
+ LPC17_40_PINCONN_PINMODE4,
0,
0
#if GPIO_NPORTS > 5
@@ -151,11 +151,11 @@ const uint32_t g_lopinmode[GPIO_NPORTS] =
const uint32_t g_hipinmode[GPIO_NPORTS] =
{
- LPC17_PINCONN_PINMODE1,
- LPC17_PINCONN_PINMODE3,
+ LPC17_40_PINCONN_PINMODE1,
+ LPC17_40_PINCONN_PINMODE3,
0,
- LPC17_PINCONN_PINMODE7,
- LPC17_PINCONN_PINMODE9
+ LPC17_40_PINCONN_PINMODE7,
+ LPC17_40_PINCONN_PINMODE9
#if GPIO_NPORTS > 5
, 0
#endif
@@ -163,11 +163,11 @@ const uint32_t g_hipinmode[GPIO_NPORTS] =
const uint32_t g_odmode[GPIO_NPORTS] =
{
- LPC17_PINCONN_ODMODE0,
- LPC17_PINCONN_ODMODE1,
- LPC17_PINCONN_ODMODE2,
- LPC17_PINCONN_ODMODE3,
- LPC17_PINCONN_ODMODE4
+ LPC17_40_PINCONN_ODMODE0,
+ LPC17_40_PINCONN_ODMODE1,
+ LPC17_40_PINCONN_ODMODE2,
+ LPC17_40_PINCONN_ODMODE3,
+ LPC17_40_PINCONN_ODMODE4
#if GPIO_NPORTS > 5
, 0
#endif
@@ -178,7 +178,7 @@ const uint32_t g_odmode[GPIO_NPORTS] =
****************************************************************************/
/****************************************************************************
- * Name: lpc17_pinsel
+ * Name: lpc17_40_pinsel
*
* Description:
* Get the address of the PINSEL register corresponding to this port and
@@ -186,7 +186,7 @@ const uint32_t g_odmode[GPIO_NPORTS] =
*
****************************************************************************/
-static int lpc17_pinsel(unsigned int port, unsigned int pin, unsigned int value)
+static int lpc17_40_pinsel(unsigned int port, unsigned int pin, unsigned int value)
{
const uint32_t *table;
uint32_t regaddr;
@@ -224,7 +224,7 @@ static int lpc17_pinsel(unsigned int port, unsigned int pin, unsigned int value)
}
/****************************************************************************
- * Name: lpc17_pullup
+ * Name: lpc17_40_pullup
*
* Description:
* Get the address of the PINMODE register corresponding to this port and
@@ -232,7 +232,7 @@ static int lpc17_pinsel(unsigned int port, unsigned int pin, unsigned int value)
*
****************************************************************************/
-static int lpc17_pullup(lpc17_pinset_t cfgset, unsigned int port,
+static int lpc17_40_pullup(lpc17_40_pinset_t cfgset, unsigned int port,
unsigned int pin)
{
const uint32_t *table;
@@ -292,7 +292,7 @@ static int lpc17_pullup(lpc17_pinset_t cfgset, unsigned int port,
}
/****************************************************************************
- * Name: lpc17_setintedge
+ * Name: lpc17_40_setintedge
*
* Description:
* Remember the configured interrupt edge. We can't actually enable the
@@ -300,8 +300,8 @@ static int lpc17_pullup(lpc17_pinset_t cfgset, unsigned int port,
*
****************************************************************************/
-#ifdef CONFIG_LPC17_GPIOIRQ
-static void lpc17_setintedge(unsigned int port, unsigned int pin,
+#ifdef CONFIG_LPC17_40_GPIOIRQ
+static void lpc17_40_setintedge(unsigned int port, unsigned int pin,
unsigned int value)
{
uint64_t *intedge;
@@ -328,17 +328,17 @@ static void lpc17_setintedge(unsigned int port, unsigned int pin,
*intedge &= ~((uint64_t)3 << shift);
*intedge |= ((uint64_t)value << shift);
}
-#endif /* CONFIG_LPC17_GPIOIRQ */
+#endif /* CONFIG_LPC17_40_GPIOIRQ */
/****************************************************************************
- * Name: lpc17_setopendrain
+ * Name: lpc17_40_setopendrain
*
* Description:
* Set the ODMODE register for open drain mode
*
****************************************************************************/
-static void lpc17_setopendrain(unsigned int port, unsigned int pin)
+static void lpc17_40_setopendrain(unsigned int port, unsigned int pin)
{
uint32_t regaddr;
uint32_t regval;
@@ -350,14 +350,14 @@ static void lpc17_setopendrain(unsigned int port, unsigned int pin)
}
/****************************************************************************
- * Name: lpc17_clropendrain
+ * Name: lpc17_40_clropendrain
*
* Description:
* Reset the ODMODE register to disable open drain mode
*
****************************************************************************/
-static void lpc17_clropendrain(unsigned int port, unsigned int pin)
+static void lpc17_40_clropendrain(unsigned int port, unsigned int pin)
{
uint32_t regaddr;
uint32_t regval;
@@ -369,14 +369,14 @@ static void lpc17_clropendrain(unsigned int port, unsigned int pin)
}
/****************************************************************************
- * Name: lpc17_configinput
+ * Name: lpc17_40_configinput
*
* Description:
* Configure a GPIO inpue pin based on bit-encoded description of the pin.
*
****************************************************************************/
-static inline int lpc17_configinput(lpc17_pinset_t cfgset, unsigned int port, unsigned int pin)
+static inline int lpc17_40_configinput(lpc17_40_pinset_t cfgset, unsigned int port, unsigned int pin)
{
uint32_t regval;
uint32_t fiobase;
@@ -389,9 +389,9 @@ static inline int lpc17_configinput(lpc17_pinset_t cfgset, unsigned int port, un
/* Set as input */
- regval = getreg32(fiobase + LPC17_FIO_DIR_OFFSET);
+ regval = getreg32(fiobase + LPC17_40_FIO_DIR_OFFSET);
regval &= ~pinmask;
- putreg32(regval, fiobase + LPC17_FIO_DIR_OFFSET);
+ putreg32(regval, fiobase + LPC17_40_FIO_DIR_OFFSET);
/* Set up interrupt registers */
@@ -400,74 +400,74 @@ static inline int lpc17_configinput(lpc17_pinset_t cfgset, unsigned int port, un
{
/* Disable any rising edge interrupts */
- regval = getreg32(intbase + LPC17_GPIOINT_INTENR_OFFSET);
+ regval = getreg32(intbase + LPC17_40_GPIOINT_INTENR_OFFSET);
regval &= ~pinmask;
- putreg32(regval, intbase + LPC17_GPIOINT_INTENR_OFFSET);
+ putreg32(regval, intbase + LPC17_40_GPIOINT_INTENR_OFFSET);
/* Disable any falling edge interrupts */
- regval = getreg32(intbase + LPC17_GPIOINT_INTENF_OFFSET);
+ regval = getreg32(intbase + LPC17_40_GPIOINT_INTENF_OFFSET);
regval &= ~pinmask;
- putreg32(regval, intbase + LPC17_GPIOINT_INTENF_OFFSET);
+ putreg32(regval, intbase + LPC17_40_GPIOINT_INTENF_OFFSET);
/* Forget about any falling/rising edge interrupt enabled */
-#ifdef CONFIG_LPC17_GPIOIRQ
- lpc17_setintedge(port, pin, 0);
+#ifdef CONFIG_LPC17_40_GPIOIRQ
+ lpc17_40_setintedge(port, pin, 0);
#endif
}
/* Set up PINSEL registers */
/* Configure as GPIO */
- lpc17_pinsel(port, pin, PINCONN_PINSEL_GPIO);
+ lpc17_40_pinsel(port, pin, PINCONN_PINSEL_GPIO);
/* Set pull-up mode */
- lpc17_pullup(cfgset, port, pin);
+ lpc17_40_pullup(cfgset, port, pin);
/* Open drain only applies to outputs */
- lpc17_clropendrain(port, pin);
+ lpc17_40_clropendrain(port, pin);
return OK;
}
/****************************************************************************
- * Name: lpc17_configinterrupt
+ * Name: lpc17_40_configinterrupt
*
* Description:
* Configure a GPIO interrupt pin based on bit-encoded description of the pin.
*
****************************************************************************/
-static inline int lpc17_configinterrupt(lpc17_pinset_t cfgset, unsigned int port,
+static inline int lpc17_40_configinterrupt(lpc17_40_pinset_t cfgset, unsigned int port,
unsigned int pin)
{
/* First, configure the port as a generic input so that we have a known
* starting point and consistent behavior during the re-configuration.
*/
- (void)lpc17_configinput(cfgset, port, pin);
+ (void)lpc17_40_configinput(cfgset, port, pin);
/* Then just remember the rising/falling edge interrupt enabled */
DEBUGASSERT(port == 0 || port == 2);
-#ifdef CONFIG_LPC17_GPIOIRQ
- lpc17_setintedge(port, pin, (cfgset & GPIO_EDGE_MASK) >> GPIO_EDGE_SHIFT);
+#ifdef CONFIG_LPC17_40_GPIOIRQ
+ lpc17_40_setintedge(port, pin, (cfgset & GPIO_EDGE_MASK) >> GPIO_EDGE_SHIFT);
#endif
return OK;
}
/****************************************************************************
- * Name: lpc17_configoutput
+ * Name: lpc17_40_configoutput
*
* Description:
* Configure a GPIO output pin based on bit-encoded description of the pin.
*
****************************************************************************/
-static inline int lpc17_configoutput(lpc17_pinset_t cfgset, unsigned int port,
+static inline int lpc17_40_configoutput(lpc17_40_pinset_t cfgset, unsigned int port,
unsigned int pin)
{
uint32_t fiobase;
@@ -477,7 +477,7 @@ static inline int lpc17_configoutput(lpc17_pinset_t cfgset, unsigned int port,
* starting point and consistent behavior during the re-configuration.
*/
- (void)lpc17_configinput(DEFAULT_INPUT, port, pin);
+ (void)lpc17_40_configinput(DEFAULT_INPUT, port, pin);
/* Check for open drain output */
@@ -487,30 +487,30 @@ static inline int lpc17_configoutput(lpc17_pinset_t cfgset, unsigned int port,
* meaning if the port is an open drain output.
*/
- lpc17_pullup(cfgset, port, pin);
+ lpc17_40_pullup(cfgset, port, pin);
/* Select open drain output */
- lpc17_setopendrain(port, pin);
+ lpc17_40_setopendrain(port, pin);
}
/* Set the initial value of the output */
- lpc17_gpiowrite(cfgset, ((cfgset & GPIO_VALUE) != GPIO_VALUE_ZERO));
+ lpc17_40_gpiowrite(cfgset, ((cfgset & GPIO_VALUE) != GPIO_VALUE_ZERO));
/* Now, reconfigure the pin as an output */
fiobase = g_fiobase[port];
- regval = getreg32(fiobase + LPC17_FIO_DIR_OFFSET);
+ regval = getreg32(fiobase + LPC17_40_FIO_DIR_OFFSET);
regval |= (1 << pin);
- putreg32(regval, fiobase + LPC17_FIO_DIR_OFFSET);
+ putreg32(regval, fiobase + LPC17_40_FIO_DIR_OFFSET);
return OK;
}
/****************************************************************************
- * Name: lpc17_configalternate
+ * Name: lpc17_40_configalternate
*
* Description:
* Configure a GPIO alternate function pin based on bit-encoded description
@@ -518,23 +518,23 @@ static inline int lpc17_configoutput(lpc17_pinset_t cfgset, unsigned int port,
*
****************************************************************************/
-static int lpc17_configalternate(lpc17_pinset_t cfgset, unsigned int port,
+static int lpc17_40_configalternate(lpc17_40_pinset_t cfgset, unsigned int port,
unsigned int pin, uint32_t alt)
{
/* First, configure the port as an input so that we have a known
* starting point and consistent behavior during the re-configuration.
*/
- (void)lpc17_configinput(DEFAULT_INPUT, port, pin);
+ (void)lpc17_40_configinput(DEFAULT_INPUT, port, pin);
/* Set up PINSEL registers */
/* Configure as GPIO */
- lpc17_pinsel(port, pin, alt);
+ lpc17_40_pinsel(port, pin, alt);
/* Set pull-up mode */
- lpc17_pullup(cfgset, port, pin);
+ lpc17_40_pullup(cfgset, port, pin);
/* Check for open drain output */
@@ -542,7 +542,7 @@ static int lpc17_configalternate(lpc17_pinset_t cfgset, unsigned int port,
{
/* Select open drain output */
- lpc17_setopendrain(port, pin);
+ lpc17_40_setopendrain(port, pin);
}
return OK;
@@ -553,14 +553,14 @@ static int lpc17_configalternate(lpc17_pinset_t cfgset, unsigned int port,
****************************************************************************/
/****************************************************************************
- * Name: lpc17_configgpio
+ * Name: lpc17_40_configgpio
*
* Description:
* Configure a GPIO pin based on bit-encoded description of the pin.
*
****************************************************************************/
-int lpc17_configgpio(lpc17_pinset_t cfgset)
+int lpc17_40_configgpio(lpc17_40_pinset_t cfgset)
{
unsigned int port;
unsigned int pin;
@@ -580,29 +580,29 @@ int lpc17_configgpio(lpc17_pinset_t cfgset)
switch (cfgset & GPIO_FUNC_MASK)
{
case GPIO_INPUT: /* GPIO input pin */
- ret = lpc17_configinput(cfgset, port, pin);
+ ret = lpc17_40_configinput(cfgset, port, pin);
break;
case GPIO_INTFE: /* GPIO interrupt falling edge */
case GPIO_INTRE: /* GPIO interrupt rising edge */
case GPIO_INTBOTH: /* GPIO interrupt both edges */
- ret = lpc17_configinterrupt(cfgset, port, pin);
+ ret = lpc17_40_configinterrupt(cfgset, port, pin);
break;
case GPIO_OUTPUT: /* GPIO outpout pin */
- ret = lpc17_configoutput(cfgset, port, pin);
+ ret = lpc17_40_configoutput(cfgset, port, pin);
break;
case GPIO_ALT1: /* Alternate function 1 */
- ret = lpc17_configalternate(cfgset, port, pin, PINCONN_PINSEL_ALT1);
+ ret = lpc17_40_configalternate(cfgset, port, pin, PINCONN_PINSEL_ALT1);
break;
case GPIO_ALT2: /* Alternate function 2 */
- ret = lpc17_configalternate(cfgset, port, pin, PINCONN_PINSEL_ALT2);
+ ret = lpc17_40_configalternate(cfgset, port, pin, PINCONN_PINSEL_ALT2);
break;
case GPIO_ALT3: /* Alternate function 3 */
- ret = lpc17_configalternate(cfgset, port, pin, PINCONN_PINSEL_ALT3);
+ ret = lpc17_40_configalternate(cfgset, port, pin, PINCONN_PINSEL_ALT3);
break;
default:
@@ -614,14 +614,14 @@ int lpc17_configgpio(lpc17_pinset_t cfgset)
}
/****************************************************************************
- * Name: lpc17_gpiowrite
+ * Name: lpc17_40_gpiowrite
*
* Description:
* Write one or zero to the selected GPIO pin
*
****************************************************************************/
-void lpc17_gpiowrite(lpc17_pinset_t pinset, bool value)
+void lpc17_40_gpiowrite(lpc17_40_pinset_t pinset, bool value)
{
uint32_t fiobase;
uint32_t offset;
@@ -643,11 +643,11 @@ void lpc17_gpiowrite(lpc17_pinset_t pinset, bool value)
if (value)
{
- offset = LPC17_FIO_SET_OFFSET;
+ offset = LPC17_40_FIO_SET_OFFSET;
}
else
{
- offset = LPC17_FIO_CLR_OFFSET;
+ offset = LPC17_40_FIO_CLR_OFFSET;
}
putreg32((1 << pin), fiobase + offset);
@@ -655,14 +655,14 @@ void lpc17_gpiowrite(lpc17_pinset_t pinset, bool value)
}
/****************************************************************************
- * Name: lpc17_gpioread
+ * Name: lpc17_40_gpioread
*
* Description:
* Read one or zero from the selected GPIO pin
*
****************************************************************************/
-bool lpc17_gpioread(lpc17_pinset_t pinset)
+bool lpc17_40_gpioread(lpc17_40_pinset_t pinset)
{
uint32_t fiobase;
unsigned int port;
@@ -678,7 +678,7 @@ bool lpc17_gpioread(lpc17_pinset_t pinset)
/* Get the pin number and return the input state of that pin */
pin = (pinset & GPIO_PIN_MASK) >> GPIO_PIN_SHIFT;
- return ((getreg32(fiobase + LPC17_FIO_PIN_OFFSET) & (1 << pin)) != 0);
+ return ((getreg32(fiobase + LPC17_40_FIO_PIN_OFFSET) & (1 << pin)) != 0);
}
return false;
diff --git a/arch/arm/src/lpc17xx/lpc176x_gpio.h b/arch/arm/src/lpc17xx_40xx/lpc176x_gpio.h
similarity index 95%
rename from arch/arm/src/lpc17xx/lpc176x_gpio.h
rename to arch/arm/src/lpc17xx_40xx/lpc176x_gpio.h
index acdd1dcf695..8fdc07bf089 100644
--- a/arch/arm/src/lpc17xx/lpc176x_gpio.h
+++ b/arch/arm/src/lpc17xx_40xx/lpc176x_gpio.h
@@ -1,5 +1,5 @@
/************************************************************************************
- * arch/arm/src/lpc17xx/lpc176x_gpio.h
+ * arch/arm/src/lpc17xx_40xx/lpc176x_gpio.h
*
* Copyright (C) 2010, 2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt
@@ -33,8 +33,8 @@
*
************************************************************************************/
-#ifndef __ARCH_ARM_SRC_LPC17XX_LPC176X_GPIO_H
-#define __ARCH_ARM_SRC_LPC17XX_LPC176X_GPIO_H
+#ifndef __ARCH_ARM_SRC_LPC17XX_40XX_LPC176X_GPIO_H
+#define __ARCH_ARM_SRC_LPC17XX_40XX_LPC176X_GPIO_H
/************************************************************************************
* Included Files
@@ -43,7 +43,7 @@
/************************************************************************************
* Pre-processor Definitions
************************************************************************************/
-/* Bit-encoded input to lpc17_configgpio() ******************************************/
+/* Bit-encoded input to lpc17_40_configgpio() ******************************************/
/* Encoding: FFFx MMOV PPPN NNNN
*
@@ -159,7 +159,7 @@
* Public Types
************************************************************************************/
-typedef uint16_t lpc17_pinset_t;
+typedef uint16_t lpc17_40_pinset_t;
/************************************************************************************
* Public Data
@@ -175,8 +175,8 @@ extern "C"
#define EXTERN extern
#endif
-/* These tables have global scope only because they are shared between lpc17_gpio.c,
- * lpc17_gpioint.c, and lpc17_gpiodbg.c
+/* These tables have global scope only because they are shared between lpc17_40_gpio.c,
+ * lpc17_40_gpioint.c, and lpc17_40_gpiodbg.c
*/
EXTERN const uint32_t g_lopinsel[GPIO_NPORTS];
@@ -194,4 +194,4 @@ EXTERN const uint32_t g_odmode[GPIO_NPORTS];
#endif
#endif /* __ASSEMBLY__ */
-#endif /* __ARCH_ARM_SRC_LPC17XX_LPC176X_GPIO_H */
+#endif /* __ARCH_ARM_SRC_LPC17XX_40XX_LPC176X_GPIO_H */
diff --git a/arch/arm/src/lpc17xx/lpc176x_rtc.c b/arch/arm/src/lpc17xx_40xx/lpc176x_rtc.c
similarity index 87%
rename from arch/arm/src/lpc17xx/lpc176x_rtc.c
rename to arch/arm/src/lpc17xx_40xx/lpc176x_rtc.c
index ae5a18949d7..b56d73cb580 100644
--- a/arch/arm/src/lpc17xx/lpc176x_rtc.c
+++ b/arch/arm/src/lpc17xx_40xx/lpc176x_rtc.c
@@ -1,5 +1,5 @@
/************************************************************************************
- * arch/arm/src/lpc17xx/lpc176x_rtcc.c
+ * arch/arm/src/lpc17xx_40xx/lpc176x_rtcc.c
*
* Copyright (C) 2014 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt
@@ -52,9 +52,9 @@
#include "up_internal.h"
#include "chip.h"
-#include "hardware/lpc17_syscon.h"
+#include "hardware/lpc17_40_syscon.h"
-#include "lpc17_rtc.h"
+#include "lpc17_40_rtc.h"
#ifdef CONFIG_RTC
@@ -111,8 +111,8 @@ volatile bool g_rtc_enabled = false;
static void rtc_dumpregs(FAR const char *msg)
{
rtcinfo("%s:\n", msg);
- rtcinfo(" DOM : %08x\n", (getreg32(LPC17_RTC_DOM) & RTC_DOM_MASK));
- rtcinfo(" DOW : %08x\n", (getreg32(LPC17_RTC_DOW) & RTC_DOW_MASK));
+ rtcinfo(" DOM : %08x\n", (getreg32(LPC17_40_RTC_DOM) & RTC_DOM_MASK));
+ rtcinfo(" DOW : %08x\n", (getreg32(LPC17_40_RTC_DOW) & RTC_DOW_MASK));
}
#else
# define rtc_dumpregs(msg)
@@ -169,21 +169,21 @@ static int rtc_setup(void)
/* Clear all register to be default */
- putreg32((uint32_t)0x00, LPC17_RTC_ILR);
- putreg32((uint32_t)0x00, LPC17_RTC_CCR);
- putreg32((uint32_t)0x00, LPC17_RTC_CIIR);
- putreg32((uint32_t)0xff, LPC17_RTC_AMR);
- putreg32((uint32_t)0x00, LPC17_RTC_CALIB);
+ putreg32((uint32_t)0x00, LPC17_40_RTC_ILR);
+ putreg32((uint32_t)0x00, LPC17_40_RTC_CCR);
+ putreg32((uint32_t)0x00, LPC17_40_RTC_CIIR);
+ putreg32((uint32_t)0xff, LPC17_40_RTC_AMR);
+ putreg32((uint32_t)0x00, LPC17_40_RTC_CALIB);
/* Enable power to the RTC module */
- regval = getreg32(LPC17_SYSCON_PCONP);
+ regval = getreg32(LPC17_40_SYSCON_PCONP);
regval |= SYSCON_PCONP_PCRTC;
- putreg32(regval, LPC17_SYSCON_PCONP);
+ putreg32(regval, LPC17_40_SYSCON_PCONP);
/* Enable counters */
- putreg32((uint32_t)0x01, LPC17_RTC_CCR);
+ putreg32((uint32_t)0x01, LPC17_40_RTC_CCR);
return OK;
}
@@ -262,10 +262,10 @@ int up_rtc_initialize(void)
/* Attach the RTC interrupt handler */
#ifdef CONFIG_RTC_ALARM
- ret = irq_attach(LPC17_IRQ_RTC, rtc_interrupt, NULL);
+ ret = irq_attach(LPC17_40_IRQ_RTC, rtc_interrupt, NULL);
if (ret == OK)
{
- up_enable_irq(LPC17_IRQ_RTC);
+ up_enable_irq(LPC17_40_IRQ_RTC);
}
#endif /* CONFIG_RTC_ALARM */
@@ -320,9 +320,9 @@ int up_rtc_getdatetime(FAR struct tm *tp)
* register.
*/
- tp->tm_sec = ((getreg32(LPC17_RTC_SEC) & RTC_SEC_MASK));
- tp->tm_min = ((getreg32(LPC17_RTC_MIN) & RTC_MIN_MASK));
- tp->tm_hour = ((getreg32(LPC17_RTC_HOUR) & RTC_HOUR_MASK));
+ tp->tm_sec = ((getreg32(LPC17_40_RTC_SEC) & RTC_SEC_MASK));
+ tp->tm_min = ((getreg32(LPC17_40_RTC_MIN) & RTC_MIN_MASK));
+ tp->tm_hour = ((getreg32(LPC17_40_RTC_HOUR) & RTC_HOUR_MASK));
/* Now convert the RTC date to fields in struct tm format:
* Days: 1-31 match in both cases.
@@ -333,9 +333,9 @@ int up_rtc_getdatetime(FAR struct tm *tp)
* years 2000-2099? I'll assume so.
*/
- tp->tm_mday = ((getreg32(LPC17_RTC_DOM) & RTC_DOM_MASK));
- tp->tm_mon = ((getreg32(LPC17_RTC_MONTH) & RTC_MONTH_MASK)) - 1;
- tp->tm_year = ((getreg32(LPC17_RTC_YEAR) & RTC_YEAR_MASK)-1900);
+ tp->tm_mday = ((getreg32(LPC17_40_RTC_DOM) & RTC_DOM_MASK));
+ tp->tm_mon = ((getreg32(LPC17_40_RTC_MONTH) & RTC_MONTH_MASK)) - 1;
+ tp->tm_year = ((getreg32(LPC17_40_RTC_YEAR) & RTC_YEAR_MASK)-1900);
rtc_dumptime(tp, "Returning");
return OK;
@@ -367,18 +367,18 @@ int up_rtc_settime(FAR const struct timespec *tp)
/* Then write the broken out values to the RTC */
- putreg32(((newtime.tm_sec) & RTC_SEC_MASK), LPC17_RTC_SEC);
- putreg32(((newtime.tm_min) & RTC_MIN_MASK), LPC17_RTC_MIN);
- putreg32(((newtime.tm_hour) & RTC_HOUR_MASK), LPC17_RTC_HOUR);
- putreg32(((newtime.tm_mday) & RTC_DOM_MASK), LPC17_RTC_DOM);
- putreg32((((newtime.tm_mon)+1) & RTC_MONTH_MASK), LPC17_RTC_MONTH);
- putreg32(((newtime.tm_year) & RTC_YEAR_MASK)+1900, LPC17_RTC_YEAR);
+ putreg32(((newtime.tm_sec) & RTC_SEC_MASK), LPC17_40_RTC_SEC);
+ putreg32(((newtime.tm_min) & RTC_MIN_MASK), LPC17_40_RTC_MIN);
+ putreg32(((newtime.tm_hour) & RTC_HOUR_MASK), LPC17_40_RTC_HOUR);
+ putreg32(((newtime.tm_mday) & RTC_DOM_MASK), LPC17_40_RTC_DOM);
+ putreg32((((newtime.tm_mon)+1) & RTC_MONTH_MASK), LPC17_40_RTC_MONTH);
+ putreg32(((newtime.tm_year) & RTC_YEAR_MASK)+1900, LPC17_40_RTC_YEAR);
return OK;
}
/************************************************************************************
- * Name: lpc17_rtc_setalarm
+ * Name: lpc17_40_rtc_setalarm
*
* Description:
* Set up an alarm. Up to two alarms can be supported (ALARM A and ALARM B).
@@ -393,7 +393,7 @@ int up_rtc_settime(FAR const struct timespec *tp)
************************************************************************************/
#ifdef CONFIG_RTC_ALARM
-int lpc17_rtc_setalarm(FAR const struct timespec *tp, alarmcb_t callback)
+int lpc17_40_rtc_setalarm(FAR const struct timespec *tp, alarmcb_t callback)
{
int ret = -EBUSY;
diff --git a/arch/arm/src/lpc17xx/lpc178x_clockconfig.c b/arch/arm/src/lpc17xx_40xx/lpc178x_40xx_clockconfig.c
similarity index 77%
rename from arch/arm/src/lpc17xx/lpc178x_clockconfig.c
rename to arch/arm/src/lpc17xx_40xx/lpc178x_40xx_clockconfig.c
index 216d27012ff..c068dba23fe 100644
--- a/arch/arm/src/lpc17xx/lpc178x_clockconfig.c
+++ b/arch/arm/src/lpc17xx_40xx/lpc178x_40xx_clockconfig.c
@@ -1,6 +1,6 @@
/****************************************************************************
- * arch/arm/src/lpc17xx/lpc17_clockconfig.c
- * arch/arm/src/chip/lpc17_clockconfig.c
+ * arch/arm/src/lpc17xx_40xx/lpc178x_40xx_clockconfig.c
+ * arch/arm/src/chip/lpc17_40_clockconfig.c
*
* Copyright (C) 2010, 2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt
@@ -48,15 +48,15 @@
#include "up_arch.h"
#include "up_internal.h"
-#include "lpc17_clockconfig.h"
-#include "hardware/lpc17_syscon.h"
+#include "lpc17_40_clockconfig.h"
+#include "hardware/lpc17_40_syscon.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
-#ifndef LPC178x
-# error "The logic in this file applies only to the LPC178x family"
+#ifndef LPC178x_40xx
+# error "The logic in this file applies only to the LPC178x/40xx family"
#endif
/****************************************************************************
@@ -76,21 +76,21 @@
****************************************************************************/
/************************************************************************************
- * Name: lpc17_clockconfig
+ * Name: lpc17_40_clockconfig
*
* Description:
- * Called to initialize the LPC17xx. This does whatever setup is needed to put the
+ * Called to initialize the LPC17xx/LPC40xx. This does whatever setup is needed to put the
* SoC in a usable state. This includes the initialization of clocking using the
* settings in board.h.
*
- * The LPC176x and LPC178x system control block is *nearly* identical but we have
- * found that the LPC178x is more sensitive to the ordering of certain operations.
+ * The LPC176x and LPC178x/40xx system control block is *nearly* identical but we have
+ * found that the LPC178x/40xx is more sensitive to the ordering of certain operations.
* So, although the hardware seems very similar, the safer thing to do is to
- * separate the LPC176x and LPC178x into separate files.
+ * separate the LPC176x and LPC178x/40xx into separate files.
*
************************************************************************************/
-void lpc17_clockconfig(void)
+void lpc17_40_clockconfig(void)
{
uint32_t regval;
@@ -113,17 +113,17 @@ void lpc17_clockconfig(void)
/* Enable the main oscillator (or not) and the frequency range of the main oscillator */
- putreg32(BOARD_SCS_VALUE, LPC17_SYSCON_SCS);
+ putreg32(BOARD_SCS_VALUE, LPC17_40_SYSCON_SCS);
/* Wait for the main oscillator to be ready. */
-#ifdef CONFIG_LPC17_MAINOSC
- while ((getreg32(LPC17_SYSCON_SCS) & SYSCON_SCS_OSCSTAT) == 0);
+#ifdef CONFIG_LPC17_40_MAINOSC
+ while ((getreg32(LPC17_40_SYSCON_SCS) & SYSCON_SCS_OSCSTAT) == 0);
#endif
/* PLL0 is used to generate the CPU clock divider input (PLLCLK). */
-#ifdef CONFIG_LPC17_PLL0
+#ifdef CONFIG_LPC17_40_PLL0
/* (3) "Write PLL new setup values to the PLLCFG register. Write a 1 to the
* PLLE bit in the PLLCON register. Perform a PLL feed sequence by writing
* first the value 0xAA, then the value 0x55 to the PLLFEED register"
@@ -133,32 +133,32 @@ void lpc17_clockconfig(void)
* for changes to the PLL0CFG register to take effect.
*/
- putreg32(BOARD_CLKSRCSEL_VALUE, LPC17_SYSCON_CLKSRCSEL);
- putreg32(BOARD_PLL0CFG_VALUE, LPC17_SYSCON_PLL0CFG);
- putreg32(SYSCON_PLLCON_PLLE, LPC17_SYSCON_PLL0CON);
+ putreg32(BOARD_CLKSRCSEL_VALUE, LPC17_40_SYSCON_CLKSRCSEL);
+ putreg32(BOARD_PLL0CFG_VALUE, LPC17_40_SYSCON_PLL0CFG);
+ putreg32(SYSCON_PLLCON_PLLE, LPC17_40_SYSCON_PLL0CON);
/* Enable the PLL. NOTE that a special "feed" sequence must be written to the
* PLL0FEED register in order for changes to the PLL0CON register to take effect.
*/
- putreg32(0xaa, LPC17_SYSCON_PLL0FEED);
- putreg32(0x55, LPC17_SYSCON_PLL0FEED);
+ putreg32(0xaa, LPC17_40_SYSCON_PLL0FEED);
+ putreg32(0x55, LPC17_40_SYSCON_PLL0FEED);
/* (4) "Set up the necessary clock dividers. These may include the CCLKSEL,
* PCLKSEL, EMCCLKSEL, USBCLKSEL, and the SPIFICLKSEL registers.
*/
- putreg32(BOARD_CCLKSEL_VALUE, LPC17_SYSCON_CCLKSEL);
- putreg32(BOARD_PCLKDIV, LPC17_SYSCON_PCLKSEL);
+ putreg32(BOARD_CCLKSEL_VALUE, LPC17_40_SYSCON_CCLKSEL);
+ putreg32(BOARD_PCLKDIV, LPC17_40_SYSCON_PCLKSEL);
-#ifdef CONFIG_LPC17_EMC
- putreg32(BOARD_EMCCLKSEL_VALUE, LPC17_SYSCON_EMCCLKSEL);
+#ifdef CONFIG_LPC17_40_EMC
+ putreg32(BOARD_EMCCLKSEL_VALUE, LPC17_40_SYSCON_EMCCLKSEL);
#endif
-#if defined(CONFIG_LPC17_USBDEV) || defined(CONFIG_LPC17_USBHOST)
- putreg32(BOARD_USBCLKSEL_VALUE, LPC17_SYSCON_USBCLKSEL);
+#if defined(CONFIG_LPC17_40_USBDEV) || defined(CONFIG_LPC17_40_USBHOST)
+ putreg32(BOARD_USBCLKSEL_VALUE, LPC17_40_SYSCON_USBCLKSEL);
#endif
-#ifdef CONFIG_LPC17_SPIFI
- putreg32(BOARD_SPIFICLKSEL_VALUE, LPC17_SPIFICLKSEL_CCLKSEL);
+#ifdef CONFIG_LPC17_40_SPIFI
+ putreg32(BOARD_SPIFICLKSEL_VALUE, LPC17_40_SPIFICLKSEL_CCLKSEL);
#endif
/* (5) "Wait for the PLL to lock. This may be accomplished by polling the
@@ -166,20 +166,20 @@ void lpc17_clockconfig(void)
* interrupt.Wait for PLL0 to lock.
*/
- while ((getreg32(LPC17_SYSCON_PLL0STAT) & SYSCON_PLL0STAT_PLOCK) == 0);
+ while ((getreg32(LPC17_40_SYSCON_PLL0STAT) & SYSCON_PLL0STAT_PLOCK) == 0);
/* (6) "Connect the PLL by selecting its output in the appropriate places. This
* may include the CCLKSEL, USBCLKSEL, and SPIFICLKSEL registers.
*/
-#endif /* CONFIG_LPC17_PLL0 */
+#endif /* CONFIG_LPC17_40_PLL0 */
/* PLL1 receives its clock input from the main oscillator only and can be used to
* provide a fixed 48 MHz clock only to the USB subsystem (if that clock cannot be
* obtained from PLL0).
*/
-#ifdef CONFIG_LPC17_PLL1
+#ifdef CONFIG_LPC17_40_PLL1
/* (3) "Write PLL new setup values to the PLLCFG register. Write a 1 to the
* PLLE bit in the PLLCON register. Perform a PLL feed sequence by writing
* first the value 0xAA, then the value 0x55 to the PLLFEED register"
@@ -189,15 +189,15 @@ void lpc17_clockconfig(void)
* PLL1CFG register to take effect.
*/
- putreg32(BOARD_PLL1CFG_VALUE, LPC17_SYSCON_PLL1CFG);
- putreg32(SYSCON_PLLCON_PLLE, LPC17_SYSCON_PLL1CON);
+ putreg32(BOARD_PLL1CFG_VALUE, LPC17_40_SYSCON_PLL1CFG);
+ putreg32(SYSCON_PLLCON_PLLE, LPC17_40_SYSCON_PLL1CON);
/* Enable the PLL. NOTE that a special "feed" sequence must be written to the
* PLL1FEED register in order for changes to the PLL1CON register to take effect.
*/
- putreg32(0xaa, LPC17_SYSCON_PLL1FEED);
- putreg32(0x55, LPC17_SYSCON_PLL1FEED);
+ putreg32(0xaa, LPC17_40_SYSCON_PLL1FEED);
+ putreg32(0x55, LPC17_40_SYSCON_PLL1FEED);
/* (4) "Set up the necessary clock dividers. These may include the CCLKSEL,
* PCLKSEL, EMCCLKSEL, USBCLKSEL, and the SPIFICLKSEL registers.
@@ -208,13 +208,13 @@ void lpc17_clockconfig(void)
* interrupt.Wait for PLL0 to lock.
*/
- while ((getreg32(LPC17_SYSCON_PLL1STAT) & SYSCON_PLL1STAT_PLOCK) == 0);
+ while ((getreg32(LPC17_40_SYSCON_PLL1STAT) & SYSCON_PLL1STAT_PLOCK) == 0);
/* (6) "Connect the PLL by selecting its output in the appropriate places. This
* may include the CCLKSEL, USBCLKSEL, and SPIFICLKSEL registers.
*/
-#endif /* CONFIG_LPC17_PLL1 */
+#endif /* CONFIG_LPC17_40_PLL1 */
/* Disable power to all peripherals (except GPIO and left EMC intact).
* EMC is switched off after reset but if there is boot-loader,
@@ -223,19 +223,19 @@ void lpc17_clockconfig(void)
* one at a time by each device driver when the driver is initialized.
*/
- regval = getreg32(LPC17_SYSCON_PCONP);
+ regval = getreg32(LPC17_40_SYSCON_PCONP);
regval &= SYSCON_PCONP_PCEMC;
regval |= SYSCON_PCONP_PCGPIO;
- putreg32(regval, LPC17_SYSCON_PCONP);
+ putreg32(regval, LPC17_40_SYSCON_PCONP);
/* Disable CLKOUT */
- putreg32(0, LPC17_SYSCON_CLKOUTCFG);
+ putreg32(0, LPC17_40_SYSCON_CLKOUTCFG);
/* Configure FLASH */
-#ifdef CONFIG_LPC17_FLASH
- putreg32(BOARD_FLASHCFG_VALUE, LPC17_SYSCON_FLASHCFG);
+#ifdef CONFIG_LPC17_40_FLASH
+ putreg32(BOARD_FLASHCFG_VALUE, LPC17_40_SYSCON_FLASHCFG);
#endif
}
diff --git a/arch/arm/src/lpc17xx/lpc178x_gpio.c b/arch/arm/src/lpc17xx_40xx/lpc178x_40xx_gpio.c
similarity index 77%
rename from arch/arm/src/lpc17xx/lpc178x_gpio.c
rename to arch/arm/src/lpc17xx_40xx/lpc178x_40xx_gpio.c
index a6892d597f6..be114cac937 100644
--- a/arch/arm/src/lpc17xx/lpc178x_gpio.c
+++ b/arch/arm/src/lpc17xx_40xx/lpc178x_40xx_gpio.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * arch/arm/src/lpc17xx/lpc178x_gpio.c
+ * arch/arm/src/lpc17xx_40xx/lpc178x_40xx_gpio.c
*
* Copyright (C) 2010-2011, 2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt
@@ -50,7 +50,7 @@
#include "up_arch.h"
#include "chip.h"
-#include "lpc17_gpio.h"
+#include "lpc17_40_gpio.h"
/****************************************************************************
* Pre-processor Definitions
@@ -72,14 +72,14 @@
* Public Data
****************************************************************************/
/* These tables have global scope because they are also used in
- * lpc17_gpiodbg.c
+ * lpc17_40_gpiodbg.c
*/
/* We have to remember the configured interrupt setting.. PINs are not
* actually set up to interrupt until the interrupt is enabled.
*/
-#ifdef CONFIG_LPC17_GPIOIRQ
+#ifdef CONFIG_LPC17_40_GPIOIRQ
uint64_t g_intedge0;
uint64_t g_intedge2;
#endif
@@ -88,13 +88,13 @@ uint64_t g_intedge2;
const uint32_t g_fiobase[GPIO_NPORTS] =
{
- LPC17_FIO0_BASE,
- LPC17_FIO1_BASE,
- LPC17_FIO2_BASE,
- LPC17_FIO3_BASE,
- LPC17_FIO4_BASE
+ LPC17_40_FIO0_BASE,
+ LPC17_40_FIO1_BASE,
+ LPC17_40_FIO2_BASE,
+ LPC17_40_FIO3_BASE,
+ LPC17_40_FIO4_BASE
#if GPIO_NPORTS > 5
- , LPC17_FIO5_BASE
+ , LPC17_40_FIO5_BASE
#endif
};
@@ -104,9 +104,9 @@ const uint32_t g_fiobase[GPIO_NPORTS] =
const uint32_t g_intbase[GPIO_NPORTS] =
{
- LPC17_GPIOINT0_BASE,
+ LPC17_40_GPIOINT0_BASE,
0,
- LPC17_GPIOINT2_BASE,
+ LPC17_40_GPIOINT2_BASE,
0,
0
#if GPIO_NPORTS > 5
@@ -119,10 +119,10 @@ const uint32_t g_intbase[GPIO_NPORTS] =
****************************************************************************/
/****************************************************************************
- * Name: lpc17_getioconmask
+ * Name: lpc17_40_getioconmask
*
* Description:
- * Get the LPC178x IOCON register mask.
+ * Get the LPC178x/40xx IOCON register mask.
*
* Type D: FUNC, MODE, HYS, INV, SLEW, OD -
* Type A: FUNC, MODE, INV, ADMODE, FILTER, OD, DACEN -P0[12:13,23:26],P1[30:31]
@@ -133,7 +133,7 @@ const uint32_t g_intbase[GPIO_NPORTS] =
****************************************************************************/
#if 0 /* Not used */
-static uint32_t lpc17_getioconmask(unsigned int port, unsigned int pin)
+static uint32_t lpc17_40_getioconmask(unsigned int port, unsigned int pin)
{
uint32_t typemask = IOCON_TYPE_D_MASK;
@@ -210,20 +210,20 @@ static uint32_t lpc17_getioconmask(unsigned int port, unsigned int pin)
#endif
/****************************************************************************
- * Name: lpc17_seti2cmode
+ * Name: lpc17_40_seti2cmode
*
* Description:
* Configure I2C pin drive mode. Applies to Type I pins
*
****************************************************************************/
-static void lpc17_seti2cmode(unsigned int port, unsigned int pin,
+static void lpc17_40_seti2cmode(unsigned int port, unsigned int pin,
uint32_t value)
{
uint32_t regaddr;
uint32_t regval;
- regaddr = LPC17_IOCON_P(port, pin);
+ regaddr = LPC17_40_IOCON_P(port, pin);
regval = getreg32(regaddr);
regval &= ~IOCON_I2CMODE_MASK;
regval |= ((value << IOCON_I2CMODE_SHIFT) & IOCON_I2CMODE_MASK);
@@ -231,20 +231,20 @@ static void lpc17_seti2cmode(unsigned int port, unsigned int pin,
}
/****************************************************************************
- * Name: lpc17_setpinfunction
+ * Name: lpc17_40_setpinfunction
*
* Description:
* Select pin function.
*
****************************************************************************/
-static void lpc17_setpinfunction(unsigned int port, unsigned int pin,
+static void lpc17_40_setpinfunction(unsigned int port, unsigned int pin,
unsigned int value)
{
uint32_t regaddr;
uint32_t regval;
- regaddr = LPC17_IOCON_P(port, pin);
+ regaddr = LPC17_40_IOCON_P(port, pin);
regval = getreg32(regaddr);
regval &= ~IOCON_FUNC_MASK;
@@ -253,33 +253,33 @@ static void lpc17_setpinfunction(unsigned int port, unsigned int pin,
}
/****************************************************************************
- * Name: lpc17_setinvertinput
+ * Name: lpc17_40_setinvertinput
*
* Description:
* Configure pin input polarity. Applies to Type D, A, I and W pins.
*
****************************************************************************/
-static void lpc17_setinvertinput(unsigned int port, unsigned int pin)
+static void lpc17_40_setinvertinput(unsigned int port, unsigned int pin)
{
uint32_t regaddr;
uint32_t regval;
- regaddr = LPC17_IOCON_P(port, pin);
+ regaddr = LPC17_40_IOCON_P(port, pin);
regval = getreg32(regaddr);
regval |= IOCON_INV_MASK;
putreg32(regval, regaddr);
}
/****************************************************************************
- * Name: lpc17_setslewfast
+ * Name: lpc17_40_setslewfast
*
* Description:
* Configure pin mode slew rate drive. Applies to Type D and Type W pins
*
****************************************************************************/
-static void lpc17_setslewmode(lpc17_pinset_t cfgset, unsigned int port,
+static void lpc17_40_setslewmode(lpc17_40_pinset_t cfgset, unsigned int port,
unsigned int pin)
{
uint32_t regaddr;
@@ -292,7 +292,7 @@ static void lpc17_setslewmode(lpc17_pinset_t cfgset, unsigned int port,
/* Get the current IOCON register contents */
- regaddr = LPC17_IOCON_P(port, pin);
+ regaddr = LPC17_40_IOCON_P(port, pin);
regval = getreg32(regaddr);
/* Set the driver slew rate */
@@ -303,7 +303,7 @@ static void lpc17_setslewmode(lpc17_pinset_t cfgset, unsigned int port,
}
/****************************************************************************
- * Name: lpc17_setmodedigital
+ * Name: lpc17_40_setmodedigital
*
* Description:
* Configure pin mode as analog or digital IO. Applies to Type A pins
@@ -311,12 +311,12 @@ static void lpc17_setslewmode(lpc17_pinset_t cfgset, unsigned int port,
****************************************************************************/
#if 0 /* Not used */
-static void lpc17_setmodedigital(unsigned int port, unsigned int pin)
+static void lpc17_40_setmodedigital(unsigned int port, unsigned int pin)
{
uint32_t regaddr;
uint32_t regval;
- regaddr = LPC17_IOCON_P(port, pin);
+ regaddr = LPC17_40_IOCON_P(port, pin);
regval = getreg32(regaddr);
regval |= IOCON_ADMODE_MASK;
putreg32(regval, regaddr);
@@ -324,45 +324,45 @@ static void lpc17_setmodedigital(unsigned int port, unsigned int pin)
#endif
/****************************************************************************
- * Name: lpc17_setmodeanalog
+ * Name: lpc17_40_setmodeanalog
*
* Description:
* Configure pin mode as analog or digital IO. Applies to Type A pins
*
****************************************************************************/
-static void lpc17_setmodeanalog(unsigned int port, unsigned int pin)
+static void lpc17_40_setmodeanalog(unsigned int port, unsigned int pin)
{
uint32_t regaddr;
uint32_t regval;
- regaddr = LPC17_IOCON_P(port, pin);
+ regaddr = LPC17_40_IOCON_P(port, pin);
regval = getreg32(regaddr);
regval &= ~IOCON_ADMODE_MASK;
putreg32(regval, regaddr);
}
/****************************************************************************
- * Name: lpc17_setdacenable
+ * Name: lpc17_40_setdacenable
*
* Description:
* Configure DAC output. Applies to Type A pins P0:26 only
*
****************************************************************************/
-static void lpc17_setdacenable(unsigned int port, unsigned int pin)
+static void lpc17_40_setdacenable(unsigned int port, unsigned int pin)
{
uint32_t regaddr;
uint32_t regval;
- regaddr = LPC17_IOCON_P(port, pin);
+ regaddr = LPC17_40_IOCON_P(port, pin);
regval = getreg32(regaddr);
regval |= IOCON_DACEN_MASK;
putreg32(regval, regaddr);
}
/****************************************************************************
- * Name: lpc17_setdacdisable
+ * Name: lpc17_40_setdacdisable
*
* Description:
* Configure DAC output. Applies to Type A pins P0:26 only
@@ -370,12 +370,12 @@ static void lpc17_setdacenable(unsigned int port, unsigned int pin)
****************************************************************************/
#if 0 /* Not used */
-static void lpc17_setdacdisable(unsigned int port, unsigned int pin)
+static void lpc17_40_setdacdisable(unsigned int port, unsigned int pin)
{
uint32_t regaddr;
uint32_t regval;
- regaddr = LPC17_IOCON_P(port, pin);
+ regaddr = LPC17_40_IOCON_P(port, pin);
regval = getreg32(regaddr);
regval &= ~IOCON_DACEN_MASK;
putreg32(regval, regaddr);
@@ -383,14 +383,14 @@ static void lpc17_setdacdisable(unsigned int port, unsigned int pin)
#endif
/****************************************************************************
- * Name: lpc17_setfilter
+ * Name: lpc17_40_setfilter
*
* Description:
* Configure analog pin's glitch filter. Applies to Type A and Type W pins
*
****************************************************************************/
-static void lpc17_setfilter(lpc17_pinset_t cfgset, unsigned int port,
+static void lpc17_40_setfilter(lpc17_40_pinset_t cfgset, unsigned int port,
unsigned int pin)
{
uint32_t regaddr;
@@ -403,7 +403,7 @@ static void lpc17_setfilter(lpc17_pinset_t cfgset, unsigned int port,
/* Get the current IOCON register contents */
- regaddr = LPC17_IOCON_P(port, pin);
+ regaddr = LPC17_40_IOCON_P(port, pin);
regval = getreg32(regaddr);
/* Set the input filter enable bit */
@@ -414,7 +414,7 @@ static void lpc17_setfilter(lpc17_pinset_t cfgset, unsigned int port,
}
/****************************************************************************
- * Name: lpc17_setopendrain
+ * Name: lpc17_40_setopendrain
*
* Description:
* Configure a GPIO's opendrain mode. Applies to Type A, Type D, and
@@ -422,19 +422,19 @@ static void lpc17_setfilter(lpc17_pinset_t cfgset, unsigned int port,
*
****************************************************************************/
-static void lpc17_setopendrain(unsigned int port, unsigned int pin)
+static void lpc17_40_setopendrain(unsigned int port, unsigned int pin)
{
uint32_t regaddr;
uint32_t regval;
- regaddr = LPC17_IOCON_P(port, pin);
+ regaddr = LPC17_40_IOCON_P(port, pin);
regval = getreg32(regaddr);
regval |= IOCON_OD_MASK;
putreg32(regval, regaddr);
}
/****************************************************************************
- * Name: lpc17_clropendrain
+ * Name: lpc17_40_clropendrain
*
* Description:
* Configure a GPIO's opendrain mode. Applies to Type A, Type D, and
@@ -442,19 +442,19 @@ static void lpc17_setopendrain(unsigned int port, unsigned int pin)
*
****************************************************************************/
-static void lpc17_clropendrain(unsigned int port, unsigned int pin)
+static void lpc17_40_clropendrain(unsigned int port, unsigned int pin)
{
uint32_t regaddr;
uint32_t regval;
- regaddr = LPC17_IOCON_P(port, pin);
+ regaddr = LPC17_40_IOCON_P(port, pin);
regval = getreg32(regaddr);
regval &= ~IOCON_OD_MASK;
putreg32(regval, regaddr);
}
/****************************************************************************
- * Name: lpc17_sethysteresis
+ * Name: lpc17_40_sethysteresis
*
* Description:
* Configure a GPIO's hysteresis mode. Applies to Type D and Type W pins
@@ -462,7 +462,7 @@ static void lpc17_clropendrain(unsigned int port, unsigned int pin)
*
****************************************************************************/
-static void lpc17_sethysteresis(lpc17_pinset_t cfgset, unsigned int port,
+static void lpc17_40_sethysteresis(lpc17_40_pinset_t cfgset, unsigned int port,
unsigned int pin)
{
uint32_t regaddr;
@@ -475,7 +475,7 @@ static void lpc17_sethysteresis(lpc17_pinset_t cfgset, unsigned int port,
/* Get the current IOCON register contents */
- regaddr = LPC17_IOCON_P(port, pin);
+ regaddr = LPC17_40_IOCON_P(port, pin);
regval = getreg32(regaddr);
/* Set the input buffer enable bit */
@@ -486,7 +486,7 @@ static void lpc17_sethysteresis(lpc17_pinset_t cfgset, unsigned int port,
}
/****************************************************************************
- * Name: lpc17_pullup
+ * Name: lpc17_40_pullup
*
* Description:
* Clear and set the pin mode bits. Applies to Type A, Type D, and
@@ -494,7 +494,7 @@ static void lpc17_sethysteresis(lpc17_pinset_t cfgset, unsigned int port,
*
****************************************************************************/
-static void lpc17_setpullup(lpc17_pinset_t cfgset, unsigned int port,
+static void lpc17_40_setpullup(lpc17_40_pinset_t cfgset, unsigned int port,
unsigned int pin)
{
uint32_t regaddr;
@@ -507,7 +507,7 @@ static void lpc17_setpullup(lpc17_pinset_t cfgset, unsigned int port,
/* Get the current IOCON register contents */
- regaddr = LPC17_IOCON_P(port, pin);
+ regaddr = LPC17_40_IOCON_P(port, pin);
regval = getreg32(regaddr);
/* Set the new mode bits */
@@ -518,7 +518,7 @@ static void lpc17_setpullup(lpc17_pinset_t cfgset, unsigned int port,
}
/****************************************************************************
- * Name: lpc17_setintedge
+ * Name: lpc17_40_setintedge
*
* Description:
* Remember the configured interrupt edge. We can't actually enable the
@@ -526,8 +526,8 @@ static void lpc17_setpullup(lpc17_pinset_t cfgset, unsigned int port,
*
****************************************************************************/
-#ifdef CONFIG_LPC17_GPIOIRQ
-static void lpc17_setintedge(unsigned int port, unsigned int pin,
+#ifdef CONFIG_LPC17_40_GPIOIRQ
+static void lpc17_40_setintedge(unsigned int port, unsigned int pin,
unsigned int value)
{
uint64_t *intedge;
@@ -554,17 +554,17 @@ static void lpc17_setintedge(unsigned int port, unsigned int pin,
*intedge &= ~((uint64_t)3 << shift);
*intedge |= ((uint64_t)value << shift);
}
-#endif /* CONFIG_LPC17_GPIOIRQ */
+#endif /* CONFIG_LPC17_40_GPIOIRQ */
/****************************************************************************
- * Name: lpc17_configinput
+ * Name: lpc17_40_configinput
*
* Description:
* Configure a GPIO input pin based on bit-encoded description of the pin.
*
****************************************************************************/
-static inline int lpc17_configinput(lpc17_pinset_t cfgset, unsigned int port,
+static inline int lpc17_40_configinput(lpc17_40_pinset_t cfgset, unsigned int port,
unsigned int pin)
{
uint32_t regval;
@@ -578,9 +578,9 @@ static inline int lpc17_configinput(lpc17_pinset_t cfgset, unsigned int port,
/* Set as input */
- regval = getreg32(fiobase + LPC17_FIO_DIR_OFFSET);
+ regval = getreg32(fiobase + LPC17_40_FIO_DIR_OFFSET);
regval &= ~pinmask;
- putreg32(regval, fiobase + LPC17_FIO_DIR_OFFSET);
+ putreg32(regval, fiobase + LPC17_40_FIO_DIR_OFFSET);
/* Set up interrupt registers */
@@ -589,88 +589,88 @@ static inline int lpc17_configinput(lpc17_pinset_t cfgset, unsigned int port,
{
/* Disable any rising edge interrupts */
- regval = getreg32(intbase + LPC17_GPIOINT_INTENR_OFFSET);
+ regval = getreg32(intbase + LPC17_40_GPIOINT_INTENR_OFFSET);
regval &= ~pinmask;
- putreg32(regval, intbase + LPC17_GPIOINT_INTENR_OFFSET);
+ putreg32(regval, intbase + LPC17_40_GPIOINT_INTENR_OFFSET);
/* Disable any falling edge interrupts */
- regval = getreg32(intbase + LPC17_GPIOINT_INTENF_OFFSET);
+ regval = getreg32(intbase + LPC17_40_GPIOINT_INTENF_OFFSET);
regval &= ~pinmask;
- putreg32(regval, intbase + LPC17_GPIOINT_INTENF_OFFSET);
+ putreg32(regval, intbase + LPC17_40_GPIOINT_INTENF_OFFSET);
/* Forget about any falling/rising edge interrupt enabled */
-#ifdef CONFIG_LPC17_GPIOIRQ
- lpc17_setintedge(port, pin, 0);
+#ifdef CONFIG_LPC17_40_GPIOIRQ
+ lpc17_40_setintedge(port, pin, 0);
#endif
}
/* Set pull-up mode */
- lpc17_setpullup(cfgset, port, pin);
+ lpc17_40_setpullup(cfgset, port, pin);
/* Clear opendrain */
- lpc17_clropendrain(port, pin);
+ lpc17_40_clropendrain(port, pin);
/* Set input polarity */
if ((cfgset & GPIO_INVERT) != 0)
{
- lpc17_setinvertinput(port, pin);
+ lpc17_40_setinvertinput(port, pin);
}
/* Set input hysteresis */
- lpc17_sethysteresis(cfgset, port, pin);
+ lpc17_40_sethysteresis(cfgset, port, pin);
/* Set input filtering */
- lpc17_setfilter(cfgset, port, pin);
+ lpc17_40_setfilter(cfgset, port, pin);
/* Configure as GPIO */
- lpc17_setpinfunction(port, pin, IOCON_FUNC_GPIO);
+ lpc17_40_setpinfunction(port, pin, IOCON_FUNC_GPIO);
return OK;
}
/****************************************************************************
- * Name: lpc17_configinterrupt
+ * Name: lpc17_40_configinterrupt
*
* Description:
* Configure a GPIO interrupt pin based on bit-encoded description of the pin.
*
****************************************************************************/
-static inline int lpc17_configinterrupt(lpc17_pinset_t cfgset, unsigned int port,
+static inline int lpc17_40_configinterrupt(lpc17_40_pinset_t cfgset, unsigned int port,
unsigned int pin)
{
/* First, configure the port as a generic input so that we have a known
* starting point and consistent behavior during the re-configuration.
*/
- (void)lpc17_configinput(cfgset, port, pin);
+ (void)lpc17_40_configinput(cfgset, port, pin);
/* Then just remember the rising/falling edge interrupt enabled */
DEBUGASSERT(port == 0 || port == 2);
-#ifdef CONFIG_LPC17_GPIOIRQ
- lpc17_setintedge(port, pin, (cfgset & GPIO_EDGE_MASK) >> GPIO_EDGE_SHIFT);
+#ifdef CONFIG_LPC17_40_GPIOIRQ
+ lpc17_40_setintedge(port, pin, (cfgset & GPIO_EDGE_MASK) >> GPIO_EDGE_SHIFT);
#endif
return OK;
}
/****************************************************************************
- * Name: lpc17_configoutput
+ * Name: lpc17_40_configoutput
*
* Description:
* Configure a GPIO output pin based on bit-encoded description of the pin.
*
****************************************************************************/
-static inline int lpc17_configoutput(lpc17_pinset_t cfgset, unsigned int port,
+static inline int lpc17_40_configoutput(lpc17_40_pinset_t cfgset, unsigned int port,
unsigned int pin)
{
uint32_t fiobase;
@@ -680,14 +680,14 @@ static inline int lpc17_configoutput(lpc17_pinset_t cfgset, unsigned int port,
* starting point and consistent behavior during the re-configuration.
*/
- (void)lpc17_configinput(DEFAULT_INPUT, port, pin);
+ (void)lpc17_40_configinput(DEFAULT_INPUT, port, pin);
/* Now, reconfigure the pin as an output */
fiobase = g_fiobase[port];
- regval = getreg32(fiobase + LPC17_FIO_DIR_OFFSET);
+ regval = getreg32(fiobase + LPC17_40_FIO_DIR_OFFSET);
regval |= (1 << pin);
- putreg32(regval, fiobase + LPC17_FIO_DIR_OFFSET);
+ putreg32(regval, fiobase + LPC17_40_FIO_DIR_OFFSET);
/* Check for open drain output */
@@ -697,26 +697,26 @@ static inline int lpc17_configoutput(lpc17_pinset_t cfgset, unsigned int port,
* meaning if the port is an open drain output.
*/
- lpc17_setpullup(cfgset, port, pin);
+ lpc17_40_setpullup(cfgset, port, pin);
/* Select open drain output */
- lpc17_setopendrain(port, pin);
+ lpc17_40_setopendrain(port, pin);
}
/* Set output slew rate */
- lpc17_setslewmode(cfgset, port, pin);
+ lpc17_40_setslewmode(cfgset, port, pin);
/* Set the initial value of the output */
- lpc17_gpiowrite(cfgset, ((cfgset & GPIO_VALUE) != GPIO_VALUE_ZERO));
+ lpc17_40_gpiowrite(cfgset, ((cfgset & GPIO_VALUE) != GPIO_VALUE_ZERO));
return OK;
}
/****************************************************************************
- * Name: lpc17_configalternate
+ * Name: lpc17_40_configalternate
*
* Description:
* Configure a GPIO alternate function pin based on bit-encoded description
@@ -724,7 +724,7 @@ static inline int lpc17_configoutput(lpc17_pinset_t cfgset, unsigned int port,
*
****************************************************************************/
-static int lpc17_configalternate(lpc17_pinset_t cfgset, unsigned int port,
+static int lpc17_40_configalternate(lpc17_40_pinset_t cfgset, unsigned int port,
unsigned int pin, uint32_t alt)
{
uint32_t i2cmode;
@@ -733,23 +733,23 @@ static int lpc17_configalternate(lpc17_pinset_t cfgset, unsigned int port,
* starting point and consistent behavior during the re-configuration.
*/
- (void)lpc17_configinput(DEFAULT_INPUT, port, pin);
+ (void)lpc17_40_configinput(DEFAULT_INPUT, port, pin);
/* Set pull-up mode */
- lpc17_setpullup(cfgset, port, pin);
+ lpc17_40_setpullup(cfgset, port, pin);
/* Check for analog mode */
if ((cfgset & GPIO_MODE_ANALOG) != 0)
{
- lpc17_setmodeanalog(port, pin);
+ lpc17_40_setmodeanalog(port, pin);
/* Check for DAC output enable */
if ((cfgset & GPIO_DACEN) != 0)
{
- lpc17_setdacenable(port, pin);
+ lpc17_40_setdacenable(port, pin);
}
}
@@ -763,7 +763,7 @@ static int lpc17_configalternate(lpc17_pinset_t cfgset, unsigned int port,
/* Set I2C Modes */
- lpc17_seti2cmode(port, pin, i2cmode);
+ lpc17_40_seti2cmode(port, pin, i2cmode);
}
/* Check for open drain output */
@@ -772,16 +772,16 @@ static int lpc17_configalternate(lpc17_pinset_t cfgset, unsigned int port,
{
/* Select open drain output */
- lpc17_setopendrain(port, pin);
+ lpc17_40_setopendrain(port, pin);
}
/* Set output slew rate */
- lpc17_setslewmode(cfgset, port, pin);
+ lpc17_40_setslewmode(cfgset, port, pin);
/* Select the alternate pin */
- lpc17_setpinfunction(port, pin, alt);
+ lpc17_40_setpinfunction(port, pin, alt);
return OK;
}
@@ -791,14 +791,14 @@ static int lpc17_configalternate(lpc17_pinset_t cfgset, unsigned int port,
****************************************************************************/
/****************************************************************************
- * Name: lpc17_configgpio
+ * Name: lpc17_40_configgpio
*
* Description:
* Configure a GPIO pin based on bit-encoded description of the pin.
*
****************************************************************************/
-int lpc17_configgpio(lpc17_pinset_t cfgset)
+int lpc17_40_configgpio(lpc17_40_pinset_t cfgset)
{
unsigned int port;
unsigned int pin;
@@ -821,45 +821,45 @@ int lpc17_configgpio(lpc17_pinset_t cfgset)
switch (cfgset & GPIO_FUNC_MASK)
{
case GPIO_INPUT: /* GPIO input pin */
- ret = lpc17_configinput(cfgset, port, pin);
+ ret = lpc17_40_configinput(cfgset, port, pin);
break;
case GPIO_INTFE: /* GPIO interrupt falling edge */
case GPIO_INTRE: /* GPIO interrupt rising edge */
case GPIO_INTBOTH: /* GPIO interrupt both edges */
- ret = lpc17_configinterrupt(cfgset, port, pin);
+ ret = lpc17_40_configinterrupt(cfgset, port, pin);
break;
case GPIO_OUTPUT: /* GPIO outpout pin */
- ret = lpc17_configoutput(cfgset, port, pin);
+ ret = lpc17_40_configoutput(cfgset, port, pin);
break;
case GPIO_ALT1: /* Alternate function 1 */
- ret = lpc17_configalternate(cfgset, port, pin, IOCON_FUNC_ALT1);
+ ret = lpc17_40_configalternate(cfgset, port, pin, IOCON_FUNC_ALT1);
break;
case GPIO_ALT2: /* Alternate function 2 */
- ret = lpc17_configalternate(cfgset, port, pin, IOCON_FUNC_ALT2);
+ ret = lpc17_40_configalternate(cfgset, port, pin, IOCON_FUNC_ALT2);
break;
case GPIO_ALT3: /* Alternate function 3 */
- ret = lpc17_configalternate(cfgset, port, pin, IOCON_FUNC_ALT3);
+ ret = lpc17_40_configalternate(cfgset, port, pin, IOCON_FUNC_ALT3);
break;
case GPIO_ALT4: /* Alternate function 4 */
- ret = lpc17_configalternate(cfgset, port, pin, IOCON_FUNC_ALT4);
+ ret = lpc17_40_configalternate(cfgset, port, pin, IOCON_FUNC_ALT4);
break;
case GPIO_ALT5: /* Alternate function 5 */
- ret = lpc17_configalternate(cfgset, port, pin, IOCON_FUNC_ALT5);
+ ret = lpc17_40_configalternate(cfgset, port, pin, IOCON_FUNC_ALT5);
break;
case GPIO_ALT6: /* Alternate function 6 */
- ret = lpc17_configalternate(cfgset, port, pin, IOCON_FUNC_ALT6);
+ ret = lpc17_40_configalternate(cfgset, port, pin, IOCON_FUNC_ALT6);
break;
case GPIO_ALT7: /* Alternate function 7 */
- ret = lpc17_configalternate(cfgset, port, pin, IOCON_FUNC_ALT7);
+ ret = lpc17_40_configalternate(cfgset, port, pin, IOCON_FUNC_ALT7);
break;
default:
@@ -871,14 +871,14 @@ int lpc17_configgpio(lpc17_pinset_t cfgset)
}
/****************************************************************************
- * Name: lpc17_gpiowrite
+ * Name: lpc17_40_gpiowrite
*
* Description:
* Write one or zero to the selected GPIO pin
*
****************************************************************************/
-void lpc17_gpiowrite(lpc17_pinset_t pinset, bool value)
+void lpc17_40_gpiowrite(lpc17_40_pinset_t pinset, bool value)
{
uint32_t fiobase;
uint32_t offset;
@@ -900,11 +900,11 @@ void lpc17_gpiowrite(lpc17_pinset_t pinset, bool value)
if (value)
{
- offset = LPC17_FIO_SET_OFFSET;
+ offset = LPC17_40_FIO_SET_OFFSET;
}
else
{
- offset = LPC17_FIO_CLR_OFFSET;
+ offset = LPC17_40_FIO_CLR_OFFSET;
}
putreg32((1 << pin), fiobase + offset);
@@ -912,14 +912,14 @@ void lpc17_gpiowrite(lpc17_pinset_t pinset, bool value)
}
/****************************************************************************
- * Name: lpc17_gpioread
+ * Name: lpc17_40_gpioread
*
* Description:
* Read one or zero from the selected GPIO pin
*
****************************************************************************/
-bool lpc17_gpioread(lpc17_pinset_t pinset)
+bool lpc17_40_gpioread(lpc17_40_pinset_t pinset)
{
uint32_t fiobase;
unsigned int port;
@@ -935,7 +935,7 @@ bool lpc17_gpioread(lpc17_pinset_t pinset)
/* Get the pin number and return the input state of that pin */
pin = (pinset & GPIO_PIN_MASK) >> GPIO_PIN_SHIFT;
- return ((getreg32(fiobase + LPC17_FIO_PIN_OFFSET) & (1 << pin)) != 0);
+ return ((getreg32(fiobase + LPC17_40_FIO_PIN_OFFSET) & (1 << pin)) != 0);
}
return false;
diff --git a/arch/arm/src/lpc17xx/lpc178x_gpio.h b/arch/arm/src/lpc17xx_40xx/lpc178x_40xx_gpio.h
similarity index 96%
rename from arch/arm/src/lpc17xx/lpc178x_gpio.h
rename to arch/arm/src/lpc17xx_40xx/lpc178x_40xx_gpio.h
index 2ddfd6ce6bc..3db6b18e207 100644
--- a/arch/arm/src/lpc17xx/lpc178x_gpio.h
+++ b/arch/arm/src/lpc17xx_40xx/lpc178x_40xx_gpio.h
@@ -1,5 +1,5 @@
/************************************************************************************
- * arch/arm/src/lpc17xx/lpc178x_gpio.h
+ * arch/arm/src/lpc17xx_40xx/lpc178x_40xx_gpio.h
*
* Copyright (C) 2010, 2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt
@@ -33,8 +33,8 @@
*
************************************************************************************/
-#ifndef __ARCH_ARM_SRC_LPC17XX_LPC178X_GPIO_H
-#define __ARCH_ARM_SRC_LPC17XX_LPC178X_GPIO_H
+#ifndef __ARCH_ARM_SRC_LPC17XX_40XX_LPC178X_GPIO_H
+#define __ARCH_ARM_SRC_LPC17XX_40XX_LPC178X_GPIO_H
/************************************************************************************
* Included Files
@@ -43,7 +43,7 @@
/************************************************************************************
* Pre-processor Definitions
************************************************************************************/
-/* Bit-encoded input to lpc17_configgpio() ******************************************/
+/* Bit-encoded input to lpc17_40_configgpio() ******************************************/
/* Encoding: TTTT TTTT FFFF MMOV PPPN NNNN
*
@@ -197,7 +197,7 @@
* Public Types
************************************************************************************/
-typedef uint32_t lpc17_pinset_t;
+typedef uint32_t lpc17_40_pinset_t;
/************************************************************************************
* Public Data
@@ -222,4 +222,4 @@ extern "C"
#endif
#endif /* __ASSEMBLY__ */
-#endif /* __ARCH_ARM_SRC_LPC17XX_LPC178X_GPIO_H */
+#endif /* __ARCH_ARM_SRC_LPC17XX_40XX_LPC178X_GPIO_H */
diff --git a/arch/arm/src/lpc17xx/lpc17_adc.c b/arch/arm/src/lpc17xx_40xx/lpc17_40_adc.c
similarity index 83%
rename from arch/arm/src/lpc17xx/lpc17_adc.c
rename to arch/arm/src/lpc17xx_40xx/lpc17_40_adc.c
index b7d22b393b1..c09512813fb 100644
--- a/arch/arm/src/lpc17xx/lpc17_adc.c
+++ b/arch/arm/src/lpc17xx_40xx/lpc17_40_adc.c
@@ -1,5 +1,5 @@
/************************************************************************************
- * arch/arm/src/lpc17xx/lpc17_adc.c
+ * arch/arm/src/lpc17xx_40xx/lpc17_40_adc.c
*
* Copyright (C) 2011 Li Zhuoyi. All rights reserved.
* Copyright (C) 2016 Gregory Nutt. All rights reserved.
@@ -63,26 +63,26 @@
#include "up_arch.h"
#include "chip.h"
-#include "hardware/lpc17_syscon.h"
-#include "lpc17_gpio.h"
-#include "lpc17_adc.h"
+#include "hardware/lpc17_40_syscon.h"
+#include "lpc17_40_gpio.h"
+#include "lpc17_40_adc.h"
-#if defined(CONFIG_LPC17_ADC)
+#if defined(CONFIG_LPC17_40_ADC)
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
-#ifndef CONFIG_LPC17_ADC0_MASK
-# define CONFIG_LPC17_ADC0_MASK 0x01
+#ifndef CONFIG_LPC17_40_ADC0_MASK
+# define CONFIG_LPC17_40_ADC0_MASK 0x01
#endif
-#ifndef CONFIG_LPC17_ADC0_SPS
-# define CONFIG_LPC17_ADC0_SPS 1000
+#ifndef CONFIG_LPC17_40_ADC0_SPS
+# define CONFIG_LPC17_40_ADC0_SPS 1000
#endif
-#ifndef CONFIG_LPC17_ADC0_AVERAGE
-# define CONFIG_LPC17_ADC0_AVERAGE 200
+#ifndef CONFIG_LPC17_40_ADC0_AVERAGE
+# define CONFIG_LPC17_40_ADC0_AVERAGE 200
#endif
/****************************************************************************
@@ -132,9 +132,9 @@ static const struct adc_ops_s g_adcops =
static struct up_dev_s g_adcpriv =
{
- .sps = CONFIG_LPC17_ADC0_SPS,
- .mask = CONFIG_LPC17_ADC0_MASK,
- .irq = LPC17_IRQ_ADC,
+ .sps = CONFIG_LPC17_40_ADC0_SPS,
+ .mask = CONFIG_LPC17_40_ADC0_MASK,
+ .irq = LPC17_40_IRQ_ADC,
};
static struct adc_dev_s g_adcdev =
@@ -205,24 +205,24 @@ static void adc_reset(FAR struct adc_dev_s *dev)
flags = enter_critical_section();
- regval = getreg32(LPC17_SYSCON_PCONP);
+ regval = getreg32(LPC17_40_SYSCON_PCONP);
regval |= SYSCON_PCONP_PCADC;
- putreg32(regval, LPC17_SYSCON_PCONP);
+ putreg32(regval, LPC17_40_SYSCON_PCONP);
/* Power up before we access hardware */
- putreg32(ADC_CR_PDN, LPC17_ADC_CR);
+ putreg32(ADC_CR_PDN, LPC17_40_ADC_CR);
- regval = getreg32(LPC17_SYSCON_PCLKSEL0);
+ regval = getreg32(LPC17_40_SYSCON_PCLKSEL0);
regval &= ~SYSCON_PCLKSEL0_ADC_MASK;
regval |= (SYSCON_PCLKSEL_CCLK8 << SYSCON_PCLKSEL0_ADC_SHIFT);
- putreg32(regval, LPC17_SYSCON_PCLKSEL0);
+ putreg32(regval, LPC17_40_SYSCON_PCLKSEL0);
-#ifdef CONFIG_LPC17_ADC_BURSTMODE
- clkdiv = LPC17_CCLK / 3 / 65 / priv->sps;
+#ifdef CONFIG_LPC17_40_ADC_BURSTMODE
+ clkdiv = LPC17_40_CCLK / 3 / 65 / priv->sps;
-//putreg32(0x04, LPC17_ADC_INTEN); /* Enable only last channel interrupt */
- putreg32(0x100, LPC17_ADC_INTEN); /* Enable only global interrupt */
+//putreg32(0x04, LPC17_40_ADC_INTEN); /* Enable only last channel interrupt */
+ putreg32(0x100, LPC17_40_ADC_INTEN); /* Enable only global interrupt */
putreg32((priv->mask) | /* Select channels 0 to 7 on ADC0 */
// (clkdiv) << 8) | /* CLKDIV = divisor to make the samples
@@ -236,55 +236,55 @@ static void adc_reset(FAR struct adc_dev_s *dev)
(1 << 26) | (0 << 25) | (0 << 24) | /* START = at MAT0 signal */
(1 << 27), /* EDGE = 1 (CAP/MAT signal rising
* trigger A/D conversion) */
- LPC17_ADC_CR);
+ LPC17_40_ADC_CR);
-#else /* CONFIG_LPC17_ADC_BURSTMODE */
+#else /* CONFIG_LPC17_40_ADC_BURSTMODE */
- clkdiv = LPC17_CCLK / 8 / 65 / priv->sps;
+ clkdiv = LPC17_40_CCLK / 8 / 65 / priv->sps;
clkdiv <<= 8;
clkdiv &= 0xff00;
- putreg32(ADC_CR_PDN | ADC_CR_BURST | clkdiv | priv->mask, LPC17_ADC_CR);
+ putreg32(ADC_CR_PDN | ADC_CR_BURST | clkdiv | priv->mask, LPC17_40_ADC_CR);
-#endif /* CONFIG_LPC17_ADC_BURSTMODE */
+#endif /* CONFIG_LPC17_40_ADC_BURSTMODE */
if ((priv->mask & 0x01) != 0)
{
- lpc17_configgpio(GPIO_AD0p0);
+ lpc17_40_configgpio(GPIO_AD0p0);
}
if ((priv->mask & 0x02) != 0)
{
- lpc17_configgpio(GPIO_AD0p1);
+ lpc17_40_configgpio(GPIO_AD0p1);
}
if ((priv->mask & 0x04) != 0)
{
- lpc17_configgpio(GPIO_AD0p2);
+ lpc17_40_configgpio(GPIO_AD0p2);
}
if ((priv->mask & 0x08) != 0)
{
- lpc17_configgpio(GPIO_AD0p3);
+ lpc17_40_configgpio(GPIO_AD0p3);
}
if ((priv->mask & 0x10) != 0)
{
- lpc17_configgpio(GPIO_AD0p4);
+ lpc17_40_configgpio(GPIO_AD0p4);
}
if ((priv->mask & 0x20) != 0)
{
- lpc17_configgpio(GPIO_AD0p5);
+ lpc17_40_configgpio(GPIO_AD0p5);
}
if ((priv->mask & 0x40) != 0)
{
- lpc17_configgpio(GPIO_AD0p6);
+ lpc17_40_configgpio(GPIO_AD0p6);
}
if ((priv->mask & 0x80) != 0)
{
- lpc17_configgpio(GPIO_AD0p7);
+ lpc17_40_configgpio(GPIO_AD0p7);
}
leave_critical_section(flags);
@@ -338,7 +338,7 @@ static void adc_shutdown(FAR struct adc_dev_s *dev)
* level of the NVIC.
*/
- putreg32(0, LPC17_ADC_INTEN);
+ putreg32(0, LPC17_40_ADC_INTEN);
up_disable_irq(priv->irq);
/* Then detach the ADC interrupt handler. */
@@ -360,28 +360,28 @@ static void adc_rxint(FAR struct adc_dev_s *dev, bool enable)
if (enable)
{
-#ifndef CONFIG_LPC17_ADC_BURSTMODE
-#ifdef CONFIG_LPC17_ADC_CHANLIST
+#ifndef CONFIG_LPC17_40_ADC_BURSTMODE
+#ifdef CONFIG_LPC17_40_ADC_CHANLIST
/* Trigger interrupt at the end of conversion on the last A/D channel
* in the channel list.
*/
- putreg32(ADC_INTEN_CHAN(g_adc_chanlist[CONFIG_LPC17_ADC_NCHANNELS - 1]),
- LPC17_ADC_INTEN);
+ putreg32(ADC_INTEN_CHAN(g_adc_chanlist[CONFIG_LPC17_40_ADC_NCHANNELS - 1]),
+ LPC17_40_ADC_INTEN);
#else
/* Trigger interrupt using the global DONE flag. */
- putreg32(ADC_INTEN_GLOBAL, LPC17_ADC_INTEN);
+ putreg32(ADC_INTEN_GLOBAL, LPC17_40_ADC_INTEN);
#endif
-#else /* CONFIG_LPC17_ADC_BURSTMODE */
+#else /* CONFIG_LPC17_40_ADC_BURSTMODE */
/* Enable only global interrupt */
- putreg32(0x100, LPC17_ADC_INTEN);
-#endif /* CONFIG_LPC17_ADC_BURSTMODE */
+ putreg32(0x100, LPC17_40_ADC_INTEN);
+#endif /* CONFIG_LPC17_40_ADC_BURSTMODE */
}
else
{
- putreg32(0, LPC17_ADC_INTEN);
+ putreg32(0, LPC17_40_ADC_INTEN);
}
}
@@ -410,8 +410,8 @@ static int adc_ioctl(FAR struct adc_dev_s *dev, int cmd, unsigned long arg)
static int adc_interrupt(int irq, void *context, FAR void *arg)
{
-#ifndef CONFIG_LPC17_ADC_BURSTMODE
-#ifdef CONFIG_LPC17_ADC_CHANLIST
+#ifndef CONFIG_LPC17_40_ADC_BURSTMODE
+#ifdef CONFIG_LPC17_40_ADC_CHANLIST
FAR struct up_dev_s *priv = (FAR struct up_dev_s *)g_adcdev.ad_priv;
uint32_t regval;
@@ -419,18 +419,18 @@ static int adc_interrupt(int irq, void *context, FAR void *arg)
int32_t value;
int i;
- regval = getreg32(LPC17_ADC_GDR);
- for (i = 0; i < CONFIG_LPC17_ADC_NCHANNELS; i++)
+ regval = getreg32(LPC17_40_ADC_GDR);
+ for (i = 0; i < CONFIG_LPC17_40_ADC_NCHANNELS; i++)
{
ch = g_adc_chanlist[i];
- regval = getreg32(LPC17_ADC_DR(ch));
+ regval = getreg32(LPC17_40_ADC_DR(ch));
if (regval&ADC_DR_DONE)
{
priv->count[ch]++;
priv->buf[ch] += regval & 0xfff0;
- if (priv->count[ch] >= CONFIG_LPC17_ADC0_AVERAGE)
+ if (priv->count[ch] >= CONFIG_LPC17_40_ADC0_AVERAGE)
{
value = priv->buf[ch] / priv->count[ch];
value <<= 15;
@@ -450,12 +450,12 @@ static int adc_interrupt(int irq, void *context, FAR void *arg)
unsigned char ch;
int32_t value;
- regval = getreg32(LPC17_ADC_GDR);
+ regval = getreg32(LPC17_40_ADC_GDR);
ch = (regval >> 24) & 0x07;
priv->buf[ch] += regval & 0xfff0;
priv->count[ch]++;
- if (priv->count[ch] >= CONFIG_LPC17_ADC0_AVERAGE)
+ if (priv->count[ch] >= CONFIG_LPC17_40_ADC0_AVERAGE)
{
value = priv->buf[ch] / priv->count[ch];
value <<= 15;
@@ -467,19 +467,19 @@ static int adc_interrupt(int irq, void *context, FAR void *arg)
return OK;
#endif
-#else /* CONFIG_LPC17_ADC_BURSTMODE */
+#else /* CONFIG_LPC17_40_ADC_BURSTMODE */
FAR struct up_dev_s *priv = (FAR struct up_dev_s *)g_adcdev.ad_priv;
volatile uint32_t regVal, regVal2, regVal3;
/* Verify that an interrupt has actually occured */
- regVal2 = getreg32(LPC17_ADC_STAT); /* Read ADSTAT will clear the interrupt flag */
+ regVal2 = getreg32(LPC17_40_ADC_STAT); /* Read ADSTAT will clear the interrupt flag */
if ((regVal2) & (1 << 16))
{
if ((priv->mask & 0x01) != 0)
{
- regVal = getreg32(LPC17_ADC_DR0);
+ regVal = getreg32(LPC17_40_ADC_DR0);
#ifdef CONFIG_ADC_DIRECT_ACCESS
/* Store the data value plus the status bits */
@@ -505,7 +505,7 @@ static int adc_interrupt(int irq, void *context, FAR void *arg)
if ((priv->mask & 0x02) != 0)
{
- regVal = getreg32(LPC17_ADC_DR1);
+ regVal = getreg32(LPC17_40_ADC_DR1);
#ifdef CONFIG_ADC_DIRECT_ACCESS
/* Store the data value plus the status bits */
@@ -532,7 +532,7 @@ static int adc_interrupt(int irq, void *context, FAR void *arg)
if ((priv->mask & 0x04) != 0)
{
- regVal = getreg32(LPC17_ADC_DR2);
+ regVal = getreg32(LPC17_40_ADC_DR2);
#ifdef CONFIG_ADC_DIRECT_ACCESS
/* Store the data value plus the status bits */
@@ -559,7 +559,7 @@ static int adc_interrupt(int irq, void *context, FAR void *arg)
if ((priv->mask & 0x08) != 0)
{
- regVal = getreg32(LPC17_ADC_DR3);
+ regVal = getreg32(LPC17_40_ADC_DR3);
if ((regVal) & (1 << 31))
{
adc_receive(priv, 3, (regVal >> 4) & 0xFFF);
@@ -568,7 +568,7 @@ static int adc_interrupt(int irq, void *context, FAR void *arg)
if ((priv->mask & 0x10) != 0)
{
- regVal = getreg32(LPC17_ADC_DR4);
+ regVal = getreg32(LPC17_40_ADC_DR4);
if ((regVal) & (1 << 31))
{
adc_receive(priv, 4, (regVal >> 4) & 0xFFF);
@@ -577,7 +577,7 @@ static int adc_interrupt(int irq, void *context, FAR void *arg)
if ((priv->mask & 0x20) != 0)
{
- regVal = getreg32(LPC17_ADC_DR5);
+ regVal = getreg32(LPC17_40_ADC_DR5);
if ((regVal) & (1 << 31))
{
adc_receive(priv, 5, (regVal >> 4) & 0xFFF);
@@ -586,7 +586,7 @@ static int adc_interrupt(int irq, void *context, FAR void *arg)
if ((priv->mask & 0x40) != 0)
{
- regVal = getreg32(LPC17_ADC_DR6);
+ regVal = getreg32(LPC17_40_ADC_DR6);
if ((regVal) & (1 << 31))
{
adc_receive(priv, 6, (regVal >> 4) & 0xFFF);
@@ -595,7 +595,7 @@ static int adc_interrupt(int irq, void *context, FAR void *arg)
if ((priv->mask & 0x80) != 0)
{
- regVal = getreg32(LPC17_ADC_DR7);
+ regVal = getreg32(LPC17_40_ADC_DR7);
if ((regVal) & (1 << 31))
{
adc_receive(priv, 7, (regVal >> 4) & 0xFFF);
@@ -612,7 +612,7 @@ static int adc_interrupt(int irq, void *context, FAR void *arg)
#endif /* CONFIG_ADC_WORKER_THREAD */
}
- regVal3 = getreg32(LPC17_ADC_GDR); /* Read ADGDR clear the DONE and OVERRUN bits */
+ regVal3 = getreg32(LPC17_40_ADC_GDR); /* Read ADGDR clear the DONE and OVERRUN bits */
putreg32((priv->mask) | /* Select channels 0 to 7 on ADC0 */
(32 << 8) | /* CLKDIV = 16 */
(0 << 16) | /* BURST = 1, BURST capture all selected channels */
@@ -621,12 +621,12 @@ static int adc_interrupt(int irq, void *context, FAR void *arg)
(1 << 26) | (0 << 25) | (0 << 24) | /* START = at MAT0 signal */
(1 << 27), /* EDGE = 1 (CAP/MAT signal rising trigger A/D
* conversion) */
- LPC17_ADC_CR);
+ LPC17_40_ADC_CR);
-//lpc17_gpiowrite(LPCXPRESSO_GPIO0_21, 0); /* Reset pin P0.21 */
+//lpc17_40_gpiowrite(LPCXPRESSO_GPIO0_21, 0); /* Reset pin P0.21 */
//leave_critical_section(saved_state);
return OK;
-#endif /* CONFIG_LPC17_ADC_BURSTMODE */
+#endif /* CONFIG_LPC17_40_ADC_BURSTMODE */
}
/****************************************************************************
@@ -634,7 +634,7 @@ static int adc_interrupt(int irq, void *context, FAR void *arg)
****************************************************************************/
/****************************************************************************
- * Name: lpc17_adcinitialize
+ * Name: lpc17_40_adcinitialize
*
* Description:
* Initialize the adc
@@ -644,9 +644,9 @@ static int adc_interrupt(int irq, void *context, FAR void *arg)
*
****************************************************************************/
-FAR struct adc_dev_s *lpc17_adcinitialize(void)
+FAR struct adc_dev_s *lpc17_40_adcinitialize(void)
{
return &g_adcdev;
}
-#endif /* CONFIG_LPC17_ADC */
+#endif /* CONFIG_LPC17_40_ADC */
diff --git a/arch/arm/src/lpc17xx/lpc17_adc.h b/arch/arm/src/lpc17xx_40xx/lpc17_40_adc.h
similarity index 79%
rename from arch/arm/src/lpc17xx/lpc17_adc.h
rename to arch/arm/src/lpc17xx_40xx/lpc17_40_adc.h
index 09f1b669840..c09a41cb478 100644
--- a/arch/arm/src/lpc17xx/lpc17_adc.h
+++ b/arch/arm/src/lpc17xx_40xx/lpc17_40_adc.h
@@ -1,5 +1,5 @@
/****************************************************************************
- * arch/arm/src/lpc17xx/lpc17_adc.h
+ * arch/arm/src/lpc17xx_40xx/lpc17_40_adc.h
*
* Copyright (C) 2010, 2012, 2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt
@@ -33,31 +33,31 @@
*
****************************************************************************/
-#ifndef __ARCH_ARM_SRC_LPC17XX_LPC17_ADC_H
-#define __ARCH_ARM_SRC_LPC17XX_LPC17_ADC_H
+#ifndef __ARCH_ARM_SRC_LPC17XX_40XX_LPC17_40_ADC_H
+#define __ARCH_ARM_SRC_LPC17XX_40XX_LPC17_40_ADC_H
/****************************************************************************
* Included Files
****************************************************************************/
#include
-#include "hardware/lpc17_adc.h"
+#include "hardware/lpc17_40_adc.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* Configuration ************************************************************/
-/* If CONFIG_LPC17_ADC_CHANLIST is enabled, then the platform specific code
- * must do two things: (1) define CONFIG_LPC17_ADC_NCHANNELS in the
+/* If CONFIG_LPC17_40_ADC_CHANLIST is enabled, then the platform specific code
+ * must do two things: (1) define CONFIG_LPC17_40_ADC_NCHANNELS in the
* configuration file and (2) provide an array g_adc_chanlist[] with the
* channel numbers matching the ADC0_MASK within the board-specific library.
*/
-#ifdef CONFIG_LPC17_ADC_CHANLIST
-# if !defined(CONFIG_LPC17_ADC_NCHANNELS)
-# error "CONFIG_LPC17_ADC_CHANLIST must defined in this configuration"
-# elif CONFIG_LPC17_ADC_NCHANNELS < 1
-# error "The value of CONFIG_LPC17_ADC_NCHANNELS is invalid"
+#ifdef CONFIG_LPC17_40_ADC_CHANLIST
+# if !defined(CONFIG_LPC17_40_ADC_NCHANNELS)
+# error "CONFIG_LPC17_40_ADC_CHANLIST must defined in this configuration"
+# elif CONFIG_LPC17_40_ADC_NCHANNELS < 1
+# error "The value of CONFIG_LPC17_40_ADC_NCHANNELS is invalid"
# endif
#endif
@@ -81,19 +81,19 @@ extern "C"
/* The errata that states: "A/D Global Data register should not be used with
* burst mode or hardware triggering". The configuration option
- * CONFIG_LPC17_ADC_CHANLIST is a workaround for this errata. If this option
+ * CONFIG_LPC17_40_ADC_CHANLIST is a workaround for this errata. If this option
* is selected, then the ADC driver will grab from the individual channel
* registers rather than from the global data register as this is the stated
* workaround in the errata.
*
* If this option is enabled, then the platform specific code must do two
- * things: (1) define CONFIG_LPC17_ADC_NCHANNELS in the configuration file
+ * things: (1) define CONFIG_LPC17_40_ADC_NCHANNELS in the configuration file
* and (2) provide an array g_adc_chanlist[] with the channel numbers
* matching the ADC0_MASK within the board-specific library.
*/
-#ifdef CONFIG_LPC17_ADC_CHANLIST
-EXTERN uint8_t g_adc_chanlist[CONFIG_LPC17_ADC_NCHANNELS];
+#ifdef CONFIG_LPC17_40_ADC_CHANLIST
+EXTERN uint8_t g_adc_chanlist[CONFIG_LPC17_40_ADC_NCHANNELS];
#endif
/****************************************************************************
@@ -101,7 +101,7 @@ EXTERN uint8_t g_adc_chanlist[CONFIG_LPC17_ADC_NCHANNELS];
****************************************************************************/
/****************************************************************************
- * Name: lpc17_adcinitialize
+ * Name: lpc17_40_adcinitialize
*
* Description:
* Initialize the adc
@@ -111,8 +111,8 @@ EXTERN uint8_t g_adc_chanlist[CONFIG_LPC17_ADC_NCHANNELS];
*
****************************************************************************/
-#ifdef CONFIG_LPC17_ADC
-FAR struct adc_dev_s *lpc17_adcinitialize(void);
+#ifdef CONFIG_LPC17_40_ADC
+FAR struct adc_dev_s *lpc17_40_adcinitialize(void);
#endif
#undef EXTERN
@@ -120,4 +120,4 @@ FAR struct adc_dev_s *lpc17_adcinitialize(void);
}
#endif
-#endif /* __ARCH_ARM_SRC_LPC17XX_LPC17_ADC_H */
+#endif /* __ARCH_ARM_SRC_LPC17XX_40XX_LPC17_40_ADC_H */
diff --git a/arch/arm/src/lpc17xx/lpc17_allocateheap.c b/arch/arm/src/lpc17xx_40xx/lpc17_40_allocateheap.c
similarity index 78%
rename from arch/arm/src/lpc17xx/lpc17_allocateheap.c
rename to arch/arm/src/lpc17xx_40xx/lpc17_40_allocateheap.c
index 14c5508598e..1775ab2b6a6 100644
--- a/arch/arm/src/lpc17xx/lpc17_allocateheap.c
+++ b/arch/arm/src/lpc17xx_40xx/lpc17_40_allocateheap.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * arch/arm/src/lpc17xx/lpc17_allocateheap.c
+ * arch/arm/src/lpc17xx_40xx/lpc17_40_allocateheap.c
*
* Copyright (C) 2010-2011, 2013, 2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt
@@ -52,11 +52,11 @@
#include "up_arch.h"
#include "up_internal.h"
-#include "hardware/lpc17_memorymap.h"
-#include "lpc17_emacram.h"
-#include "lpc17_ohciram.h"
-#include "lpc17_mpuinit.h"
-#include "lpc17_start.h"
+#include "hardware/lpc17_40_memorymap.h"
+#include "lpc17_40_emacram.h"
+#include "lpc17_40_ohciram.h"
+#include "lpc17_40_mpuinit.h"
+#include "lpc17_40_start.h"
/****************************************************************************
* Pre-processor Definitions
@@ -65,23 +65,23 @@
/* Configuration ************************************************************/
/* The configured RAM start address must be the beginning of CPU SRAM */
-#if CONFIG_RAM_START != LPC17_SRAM_BASE
-# warning "CONFIG_RAM_START is not at LPC17_SRAM_BASE"
+#if CONFIG_RAM_START != LPC17_40_SRAM_BASE
+# warning "CONFIG_RAM_START is not at LPC17_40_SRAM_BASE"
# undef CONFIG_RAM_START
# undef CONFIG_RAM_END
-# define CONFIG_RAM_START LPC17_SRAM_BASE
-# define CONFIG_RAM_END (LPC17_SRAM_BASE+LPC17_CPUSRAM_SIZE)
+# define CONFIG_RAM_START LPC17_40_SRAM_BASE
+# define CONFIG_RAM_END (LPC17_40_SRAM_BASE+LPC17_40_CPUSRAM_SIZE)
#endif
/* The configured RAM size must be less then or equal to the CPU SRAM size */
-#if CONFIG_RAM_SIZE > LPC17_CPUSRAM_SIZE
+#if CONFIG_RAM_SIZE > LPC17_40_CPUSRAM_SIZE
# warning "CONFIG_RAM_SIZE is larger than the size of CPU SRAM"
# undef CONFIG_RAM_SIZE
# undef CONFIG_RAM_END
-# define CONFIG_RAM_SIZE LPC17_CPUSRAM_SIZE
-# define CONFIG_RAM_END (LPC17_SRAM_BASE+LPC17_CPUSRAM_SIZE)
-#elif CONFIG_RAM_SIZE < LPC17_CPUSRAM_SIZE
+# define CONFIG_RAM_SIZE LPC17_40_CPUSRAM_SIZE
+# define CONFIG_RAM_END (LPC17_40_SRAM_BASE+LPC17_40_CPUSRAM_SIZE)
+#elif CONFIG_RAM_SIZE < LPC17_40_CPUSRAM_SIZE
# warning "CONFIG_RAM_END is before end of CPU SRAM... not all of CPU SRAM used"
#endif
@@ -97,82 +97,82 @@
* end of Bank 0.
*/
-#undef LPC17_AHB_HEAPBASE /* Assume that nothing is available */
-#undef LPC17_AHB_HEAPSIZE
+#undef LPC17_40_AHB_HEAPBASE /* Assume that nothing is available */
+#undef LPC17_40_AHB_HEAPSIZE
/* If we have Bank 0, then we may possibly also have Bank 1 */
-#ifdef LPC17_HAVE_BANK0
+#ifdef LPC17_40_HAVE_BANK0
/* We have BANK0 (and, hence, possibly Bank1). Is Bank0 all used for
* Ethernet packet buffering? Or is there any part of Bank0 available for
* the heap.
*/
-# ifdef LPC17_BANK0_HEAPSIZE
+# ifdef LPC17_40_BANK0_HEAPSIZE
/* Some or all of Bank0 is available for the heap. The heap will begin
* in bank 1.
*/
-# define LPC17_AHB_HEAPBASE LPC17_BANK0_HEAPBASE
+# define LPC17_40_AHB_HEAPBASE LPC17_40_BANK0_HEAPBASE
/* Is Bank1 present? Has there available heap memory in Bank 1? */
-# if defined(LPC17_HAVE_BANK1) && defined(LPC17_BANK1_HEAPSIZE)
+# if defined(LPC17_40_HAVE_BANK1) && defined(LPC17_40_BANK1_HEAPSIZE)
/* Yes... the heap space available is the unused memory at the end
* of Bank0 plus the unused memory at the beginning of Bank 1.
*/
-# define LPC17_AHB_HEAPSIZE (LPC17_BANK0_HEAPSIZE + LPC17_BANK1_HEAPSIZE)
+# define LPC17_40_AHB_HEAPSIZE (LPC17_40_BANK0_HEAPSIZE + LPC17_40_BANK1_HEAPSIZE)
# else
/* No... the heap space available is only the unused memory at the
* end of Bank 0.
*/
-# define LPC17_AHB_HEAPSIZE LPC17_BANK0_HEAPSIZE
+# define LPC17_40_AHB_HEAPSIZE LPC17_40_BANK0_HEAPSIZE
-# endif /* LPC17_HAVE_BANK1 && LPC17_BANK1_HEAPSIZE */
-# else /* !LPC17_BANK0_HEAPSIZE */
+# endif /* LPC17_40_HAVE_BANK1 && LPC17_40_BANK1_HEAPSIZE */
+# else /* !LPC17_40_BANK0_HEAPSIZE */
/* We have Bank 0, but no memory is available for the heap there.
* Do we have Bank 1? Is any heap memory available in Bank 1?
*/
-# if defined(LPC17_HAVE_BANK1) && defined(LPC17_BANK1_HEAPSIZE)
+# if defined(LPC17_40_HAVE_BANK1) && defined(LPC17_40_BANK1_HEAPSIZE)
/* Yes... the heap space available is the unused memory at the
* beginning of Bank1.
*/
-# define LPC17_AHB_HEAPBASE LPC17_BANK1_HEAPBASE
-# define LPC17_AHB_HEAPSIZE LPC17_BANK1_HEAPSIZE
+# define LPC17_40_AHB_HEAPBASE LPC17_40_BANK1_HEAPBASE
+# define LPC17_40_AHB_HEAPSIZE LPC17_40_BANK1_HEAPSIZE
-# endif /* LPC17_HAVE_BANK1 && LPC17_BANK1_HEAPSIZE */
-# endif /* LPC17_BANK0_HEAPSIZE */
-#endif /* LPC17_HAVE_BANK0 */
+# endif /* LPC17_40_HAVE_BANK1 && LPC17_40_BANK1_HEAPSIZE */
+# endif /* LPC17_40_BANK0_HEAPSIZE */
+#endif /* LPC17_40_HAVE_BANK0 */
/* Sanity checking */
-#if !defined(CONFIG_LPC17_EXTDRAMHEAP) && !defined(CONFIG_LPC17_EXTSRAM0HEAP)
-# define LPC17_EXT_MM_REGIONS 0
-#elif defined(CONFIG_LPC17_EXTDRAMHEAP) && defined(CONFIG_LPC17_EXTSRAM0HEAP)
-# define LPC17_EXT_MM_REGIONS 2
+#if !defined(CONFIG_LPC17_40_EXTDRAMHEAP) && !defined(CONFIG_LPC17_40_EXTSRAM0HEAP)
+# define LPC17_40_EXT_MM_REGIONS 0
+#elif defined(CONFIG_LPC17_40_EXTDRAMHEAP) && defined(CONFIG_LPC17_40_EXTSRAM0HEAP)
+# define LPC17_40_EXT_MM_REGIONS 2
#else
-# define LPC17_EXT_MM_REGIONS 1
+# define LPC17_40_EXT_MM_REGIONS 1
#endif
-#ifdef LPC17_AHB_HEAPBASE
-# if CONFIG_MM_REGIONS < 2 + LPC17_EXT_MM_REGIONS
+#ifdef LPC17_40_AHB_HEAPBASE
+# if CONFIG_MM_REGIONS < 2 + LPC17_40_EXT_MM_REGIONS
# warning "CONFIG_MM_REGIONS < 2: Available AHB SRAM Bank(s) not included in HEAP"
# endif
-# if (CONFIG_MM_REGIONS > 2 + LPC17_EXT_MM_REGIONS)
+# if (CONFIG_MM_REGIONS > 2 + LPC17_40_EXT_MM_REGIONS)
# warning "CONFIG_MM_REGIONS > 2: Are additional regions handled by application?"
# endif
#else
-# if CONFIG_MM_REGIONS > 1 + LPC17_EXT_MM_REGIONS
+# if CONFIG_MM_REGIONS > 1 + LPC17_40_EXT_MM_REGIONS
# warning "CONFIG_MM_REGIONS > 1: This configuration has no available AHB SRAM Bank0/1"
# warning "CONFIG_MM_REGIONS > 1: Are additional regions handled by application?"
# endif
@@ -248,10 +248,10 @@ void up_allocate_heap(FAR void **heap_start, size_t *heap_size)
/* Allow user-mode access to the user heap memory */
- lpc17_mpu_uheap((uintptr_t)ubase, usize);
+ lpc17_40_mpu_uheap((uintptr_t)ubase, usize);
-#elif CONFIG_MM_REGIONS >= 3 && defined(CONFIG_LPC17_EXTDRAM) && \
- defined(CONFIG_LPC17_EXTDRAMHEAP)
+#elif CONFIG_MM_REGIONS >= 3 && defined(CONFIG_LPC17_40_EXTDRAM) && \
+ defined(CONFIG_LPC17_40_EXTDRAMHEAP)
/* We are going to allocate a DRAM heap. In the case where a bootloader
* is used (and has initialized SDRAM), it is possible that .data, .bss,
* and the IDLE stack reside in SDRAM.
@@ -364,38 +364,38 @@ void up_addregion(void)
* Is any memory available in AHB SRAM for the heap?
*/
-#ifdef LPC17_AHB_HEAPBASE
+#ifdef LPC17_40_AHB_HEAPBASE
#if defined(CONFIG_BUILD_PROTECTED) && defined(CONFIG_MM_KERNEL_HEAP)
/* Yes.. allow user-mode access to the AHB SRAM user heap memory */
-#if defined(LPC17_BANK0_HEAPBASE) && defined(LPC17_BANK0_HEAPSIZE)
- lpc17_mpu_uheap((uintptr_t)LPC17_BANK0_HEAPBASE, LPC17_BANK0_HEAPSIZE);
+#if defined(LPC17_40_BANK0_HEAPBASE) && defined(LPC17_40_BANK0_HEAPSIZE)
+ lpc17_40_mpu_uheap((uintptr_t)LPC17_40_BANK0_HEAPBASE, LPC17_40_BANK0_HEAPSIZE);
#endif
-#if defined(LPC17_BANK1_HEAPBASE) && defined(LPC17_BANK1_HEAPSIZE)
- lpc17_mpu_uheap((uintptr_t)LPC17_BANK1_HEAPBASE, LPC17_BANK1_HEAPSIZE);
+#if defined(LPC17_40_BANK1_HEAPBASE) && defined(LPC17_40_BANK1_HEAPSIZE)
+ lpc17_40_mpu_uheap((uintptr_t)LPC17_40_BANK1_HEAPBASE, LPC17_40_BANK1_HEAPSIZE);
#endif
#endif /* CONFIG_BUILD_PROTECTED && CONFIG_MM_KERNEL_HEAP */
/* Add the AHB SRAM user heap region. */
- kumm_addregion((FAR void *)LPC17_AHB_HEAPBASE, LPC17_AHB_HEAPSIZE);
+ kumm_addregion((FAR void *)LPC17_40_AHB_HEAPBASE, LPC17_40_AHB_HEAPSIZE);
#endif
#if CONFIG_MM_REGIONS >= 3
-#if defined(CONFIG_LPC17_EXTDRAM) && defined(CONFIG_LPC17_EXTDRAMHEAP)
+#if defined(CONFIG_LPC17_40_EXTDRAM) && defined(CONFIG_LPC17_40_EXTDRAMHEAP)
{
/* Memory may be reserved at the beginning of DRAM for other purposes
* (for example for video framebuffers). Memory can similar be
- * reserved at the end of DRAM using LPC17_EXTDRAMSIZE. The amount to
- * be added to the heap will be from DRAM_BASE + LPC17_EXTDRAMHEAP_OFFSET
- * through DRAM_BASE + LPC17_EXTDRAMSIZE where (DRAM_BASE is the base
+ * reserved at the end of DRAM using LPC17_40_EXTDRAMSIZE. The amount to
+ * be added to the heap will be from DRAM_BASE + LPC17_40_EXTDRAMHEAP_OFFSET
+ * through DRAM_BASE + LPC17_40_EXTDRAMSIZE where (DRAM_BASE is the base
* address of CS0).
*/
- uintptr_t dram_end = LPC17_EXTDRAM_CS0 + CONFIG_LPC17_EXTDRAMSIZE;
+ uintptr_t dram_end = LPC17_40_EXTDRAM_CS0 + CONFIG_LPC17_40_EXTDRAMSIZE;
uintptr_t dram_start;
uintptr_t heap_size;
@@ -403,7 +403,7 @@ void up_addregion(void)
* stack lie in SDRAM?
*/
- if (g_idle_topstack >= LPC17_EXTDRAM_CS0 &&
+ if (g_idle_topstack >= LPC17_40_EXTDRAM_CS0 &&
g_idle_topstack < dram_end)
{
/* Yes, then the SDRAM heap starts in SDRAM after the IDLE stack */
@@ -416,7 +416,7 @@ void up_addregion(void)
* the beginning of DRAM).
*/
- dram_start = LPC17_EXTDRAM_CS0 + CONFIG_LPC17_EXTDRAMHEAP_OFFSET;
+ dram_start = LPC17_40_EXTDRAM_CS0 + CONFIG_LPC17_40_EXTDRAMHEAP_OFFSET;
}
heap_size = dram_end - dram_start;
@@ -429,7 +429,7 @@ void up_addregion(void)
* region if dram_start is not at the beginning of CS0.
*/
- lpc17_mpu_uheap(dram_start, heap_size);
+ lpc17_40_mpu_uheap(dram_start, heap_size);
#endif
/* Add external DRAM heap memory to the user heap */
@@ -438,17 +438,17 @@ void up_addregion(void)
}
#endif
-#if !defined(CONFIG_LPC17_EXTDRAMHEAP) || (CONFIG_MM_REGIONS >= 4)
-#if defined(CONFIG_LPC17_EXTSRAM0) && defined(CONFIG_LPC17_EXTSRAM0HEAP)
+#if !defined(CONFIG_LPC17_40_EXTDRAMHEAP) || (CONFIG_MM_REGIONS >= 4)
+#if defined(CONFIG_LPC17_40_EXTSRAM0) && defined(CONFIG_LPC17_40_EXTSRAM0HEAP)
#if defined(CONFIG_BUILD_PROTECTED) && defined(CONFIG_MM_KERNEL_HEAP)
/* Allow user-mode access to external SRAM heap memory */
- lpc17_mpu_uheap((uintptr_t)LPC17_EXTSRAM_CS0, CONFIG_LPC17_EXTSRAM0SIZE);
+ lpc17_40_mpu_uheap((uintptr_t)LPC17_40_EXTSRAM_CS0, CONFIG_LPC17_40_EXTSRAM0SIZE);
#endif
/* Add external SRAM heap memory to the user heap */
- kumm_addregion((FAR void *)LPC17_EXTSRAM_CS0, CONFIG_LPC17_EXTSRAM0SIZE);
+ kumm_addregion((FAR void *)LPC17_40_EXTSRAM_CS0, CONFIG_LPC17_40_EXTSRAM0SIZE);
#endif
#endif
#endif /* CONFIG_MM_REGIONS >= 3 */
diff --git a/arch/arm/src/lpc17xx/lpc17_can.c b/arch/arm/src/lpc17xx_40xx/lpc17_40_can.c
similarity index 81%
rename from arch/arm/src/lpc17xx/lpc17_can.c
rename to arch/arm/src/lpc17xx_40xx/lpc17_40_can.c
index 3d3069b0b55..2c596559806 100644
--- a/arch/arm/src/lpc17xx/lpc17_can.c
+++ b/arch/arm/src/lpc17xx_40xx/lpc17_40_can.c
@@ -1,5 +1,5 @@
/************************************************************************************
- * arch/arm/src/lpc17xx/lpc17_can.c
+ * arch/arm/src/lpc17xx_40xx/lpc17_40_can.c
*
* Copyright (C) 2011 Li Zhuoyi. All rights reserved.
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
@@ -63,111 +63,111 @@
#include "up_arch.h"
#include "chip.h"
-#include "hardware/lpc17_syscon.h"
-#include "lpc17_gpio.h"
-#include "lpc17_can.h"
+#include "hardware/lpc17_40_syscon.h"
+#include "lpc17_40_gpio.h"
+#include "lpc17_40_can.h"
-#if defined(CONFIG_LPC17_CAN1) || defined(CONFIG_LPC17_CAN2)
+#if defined(CONFIG_LPC17_40_CAN1) || defined(CONFIG_LPC17_40_CAN2)
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* Configuration ************************************************************/
-#ifdef CONFIG_LPC17_CAN1
+#ifdef CONFIG_LPC17_40_CAN1
/* A CAN bit rate must be provided */
-# ifndef CONFIG_LPC17_CAN1_BAUD
-# error "CONFIG_LPC17_CAN1_BAUD is not defined"
+# ifndef CONFIG_LPC17_40_CAN1_BAUD
+# error "CONFIG_LPC17_40_CAN1_BAUD is not defined"
# endif
/* If no divsor is provided, use a divisor of 4 */
-# ifndef CONFIG_LPC17_CAN1_DIVISOR
-# define CONFIG_LPC17_CAN1_DIVISOR 4
+# ifndef CONFIG_LPC17_40_CAN1_DIVISOR
+# define CONFIG_LPC17_40_CAN1_DIVISOR 4
# endif
/* Get the SYSCON_PCLKSEL value for CAN1 the implements this divisor */
-# if CONFIG_LPC17_CAN1_DIVISOR == 1
+# if CONFIG_LPC17_40_CAN1_DIVISOR == 1
# define CAN1_CCLK_DIVISOR SYSCON_PCLKSEL_CCLK
-# elif CONFIG_LPC17_CAN1_DIVISOR == 2
+# elif CONFIG_LPC17_40_CAN1_DIVISOR == 2
# define CAN1_CCLK_DIVISOR SYSCON_PCLKSEL_CCLK2
-# elif CONFIG_LPC17_CAN1_DIVISOR == 4
+# elif CONFIG_LPC17_40_CAN1_DIVISOR == 4
# define CAN1_CCLK_DIVISOR SYSCON_PCLKSEL_CCLK4
-# elif CONFIG_LPC17_CAN1_DIVISOR == 6
+# elif CONFIG_LPC17_40_CAN1_DIVISOR == 6
# define CAN1_CCLK_DIVISOR SYSCON_PCLKSEL_CCLK6
# else
-# error "Unsupported value of CONFIG_LPC17_CAN1_DIVISOR"
+# error "Unsupported value of CONFIG_LPC17_40_CAN1_DIVISOR"
# endif
#endif
-#ifdef CONFIG_LPC17_CAN2
+#ifdef CONFIG_LPC17_40_CAN2
/* A CAN bit rate must be provided */
-# ifndef CONFIG_LPC17_CAN2_BAUD
-# error "CONFIG_LPC17_CAN2_BAUD is not defined"
+# ifndef CONFIG_LPC17_40_CAN2_BAUD
+# error "CONFIG_LPC17_40_CAN2_BAUD is not defined"
# endif
/* If no divsor is provided, use a divisor of 4 */
-# ifndef CONFIG_LPC17_CAN2_DIVISOR
-# define CONFIG_LPC17_CAN2_DIVISOR 4
+# ifndef CONFIG_LPC17_40_CAN2_DIVISOR
+# define CONFIG_LPC17_40_CAN2_DIVISOR 4
# endif
/* Get the SYSCON_PCLKSEL value for CAN2 the implements this divisor */
-# if CONFIG_LPC17_CAN2_DIVISOR == 1
+# if CONFIG_LPC17_40_CAN2_DIVISOR == 1
# define CAN2_CCLK_DIVISOR SYSCON_PCLKSEL_CCLK
-# elif CONFIG_LPC17_CAN2_DIVISOR == 2
+# elif CONFIG_LPC17_40_CAN2_DIVISOR == 2
# define CAN2_CCLK_DIVISOR SYSCON_PCLKSEL_CCLK2
-# elif CONFIG_LPC17_CAN2_DIVISOR == 4
+# elif CONFIG_LPC17_40_CAN2_DIVISOR == 4
# define CAN2_CCLK_DIVISOR SYSCON_PCLKSEL_CCLK4
-# elif CONFIG_LPC17_CAN2_DIVISOR == 6
+# elif CONFIG_LPC17_40_CAN2_DIVISOR == 6
# define CAN2_CCLK_DIVISOR SYSCON_PCLKSEL_CCLK6
# else
-# error "Unsupported value of CONFIG_LPC17_CAN2_DIVISOR"
+# error "Unsupported value of CONFIG_LPC17_40_CAN2_DIVISOR"
# endif
#endif
/* User-defined TSEG1 and TSEG2 settings may be used.
*
- * CONFIG_LPC17_CAN_TSEG1 = the number of CAN time quanta in segment 1
- * CONFIG_LPC17_CAN_TSEG2 = the number of CAN time quanta in segment 2
+ * CONFIG_LPC17_40_CAN_TSEG1 = the number of CAN time quanta in segment 1
+ * CONFIG_LPC17_40_CAN_TSEG2 = the number of CAN time quanta in segment 2
* CAN_BIT_QUANTA = The number of CAN time quanta in on bit time
*/
-#ifndef CONFIG_LPC17_CAN_TSEG1
-# define CONFIG_LPC17_CAN_TSEG1 6
+#ifndef CONFIG_LPC17_40_CAN_TSEG1
+# define CONFIG_LPC17_40_CAN_TSEG1 6
#endif
-#if CONFIG_LPC17_CAN_TSEG1 < 1 || CONFIG_LPC17_CAN_TSEG1 > CAN_BTR_TSEG1_MAX
-# errror "CONFIG_LPC17_CAN_TSEG1 is out of range"
+#if CONFIG_LPC17_40_CAN_TSEG1 < 1 || CONFIG_LPC17_40_CAN_TSEG1 > CAN_BTR_TSEG1_MAX
+# errror "CONFIG_LPC17_40_CAN_TSEG1 is out of range"
#endif
-#ifndef CONFIG_LPC17_CAN_TSEG2
-# define CONFIG_LPC17_CAN_TSEG2 7
+#ifndef CONFIG_LPC17_40_CAN_TSEG2
+# define CONFIG_LPC17_40_CAN_TSEG2 7
#endif
-#if CONFIG_LPC17_CAN_TSEG2 < 1 || CONFIG_LPC17_CAN_TSEG2 > CAN_BTR_TSEG2_MAX
-# errror "CONFIG_LPC17_CAN_TSEG2 is out of range"
+#if CONFIG_LPC17_40_CAN_TSEG2 < 1 || CONFIG_LPC17_40_CAN_TSEG2 > CAN_BTR_TSEG2_MAX
+# errror "CONFIG_LPC17_40_CAN_TSEG2 is out of range"
#endif
-#define CAN_BIT_QUANTA (CONFIG_LPC17_CAN_TSEG1 + CONFIG_LPC17_CAN_TSEG2 + 1)
+#define CAN_BIT_QUANTA (CONFIG_LPC17_40_CAN_TSEG1 + CONFIG_LPC17_40_CAN_TSEG2 + 1)
/* Debug ********************************************************************/
/* Non-standard debug that may be enabled just for testing CAN */
#ifndef CONFIG_DEBUG_CAN_INFO
-# undef CONFIG_LPC17_CAN_REGDEBUG
+# undef CONFIG_LPC17_40_CAN_REGDEBUG
#endif
/* Timing *******************************************************************/
/* CAN clocking is provided at CCLK divided by the configured divisor */
-#define CAN_CLOCK_FREQUENCY(d) ((uint32_t)LPC17_CCLK / (uint32_t)(d))
+#define CAN_CLOCK_FREQUENCY(d) ((uint32_t)LPC17_40_CCLK / (uint32_t)(d))
/****************************************************************************
* Private Types
@@ -186,14 +186,14 @@ struct up_dev_s
****************************************************************************/
/* CAN Register access */
-#ifdef CONFIG_LPC17_CAN_REGDEBUG
+#ifdef CONFIG_LPC17_40_CAN_REGDEBUG
static void can_printreg(uint32_t addr, uint32_t value);
#endif
static uint32_t can_getreg(struct up_dev_s *priv, int offset);
static void can_putreg(struct up_dev_s *priv, int offset, uint32_t value);
-#ifdef CONFIG_LPC17_CAN_REGDEBUG
+#ifdef CONFIG_LPC17_40_CAN_REGDEBUG
static uint32_t can_getcommon(uint32_t addr);
static void can_putcommon(uint32_t addr, uint32_t value);
#else
@@ -241,13 +241,13 @@ static const struct can_ops_s g_canops =
.co_txempty = lpc17can_txempty,
};
-#ifdef CONFIG_LPC17_CAN1
+#ifdef CONFIG_LPC17_40_CAN1
static struct up_dev_s g_can1priv =
{
.port = 1,
- .divisor = CONFIG_LPC17_CAN1_DIVISOR,
- .baud = CONFIG_LPC17_CAN1_BAUD,
- .base = LPC17_CAN1_BASE,
+ .divisor = CONFIG_LPC17_40_CAN1_DIVISOR,
+ .baud = CONFIG_LPC17_40_CAN1_BAUD,
+ .base = LPC17_40_CAN1_BASE,
};
static struct can_dev_s g_can1dev =
@@ -257,13 +257,13 @@ static struct can_dev_s g_can1dev =
};
#endif
-#ifdef CONFIG_LPC17_CAN2
+#ifdef CONFIG_LPC17_40_CAN2
static struct up_dev_s g_can2priv =
{
.port = 2,
- .divisor = CONFIG_LPC17_CAN2_DIVISOR,
- .baud = CONFIG_LPC17_CAN2_BAUD,
- .base = LPC17_CAN2_BASE,
+ .divisor = CONFIG_LPC17_40_CAN2_DIVISOR,
+ .baud = CONFIG_LPC17_40_CAN2_BAUD,
+ .base = LPC17_40_CAN2_BASE,
};
static struct can_dev_s g_can2dev =
@@ -291,7 +291,7 @@ static struct can_dev_s g_can2dev =
*
****************************************************************************/
-#ifdef CONFIG_LPC17_CAN_REGDEBUG
+#ifdef CONFIG_LPC17_40_CAN_REGDEBUG
static void can_printreg(uint32_t addr, uint32_t value)
{
static uint32_t prevaddr = 0;
@@ -355,7 +355,7 @@ static void can_printreg(uint32_t addr, uint32_t value)
*
****************************************************************************/
-#ifdef CONFIG_LPC17_CAN_REGDEBUG
+#ifdef CONFIG_LPC17_40_CAN_REGDEBUG
static uint32_t can_getreg(struct up_dev_s *priv, int offset)
{
uint32_t addr;
@@ -391,7 +391,7 @@ static uint32_t can_getreg(struct up_dev_s *priv, int offset)
*
****************************************************************************/
-#ifdef CONFIG_LPC17_CAN_REGDEBUG
+#ifdef CONFIG_LPC17_40_CAN_REGDEBUG
static void can_putreg(struct up_dev_s *priv, int offset, uint32_t value)
{
uint32_t addr = priv->base + offset;
@@ -425,7 +425,7 @@ static void can_putreg(struct up_dev_s *priv, int offset, uint32_t value)
*
****************************************************************************/
-#ifdef CONFIG_LPC17_CAN_REGDEBUG
+#ifdef CONFIG_LPC17_40_CAN_REGDEBUG
static uint32_t can_getcommon(uint32_t addr)
{
uint32_t value;
@@ -453,7 +453,7 @@ static uint32_t can_getcommon(uint32_t addr)
*
****************************************************************************/
-#ifdef CONFIG_LPC17_CAN_REGDEBUG
+#ifdef CONFIG_LPC17_40_CAN_REGDEBUG
static void can_putcommon(uint32_t addr, uint32_t value)
{
/* Show the register value being written */
@@ -493,10 +493,10 @@ static void lpc17can_reset(FAR struct can_dev_s *dev)
/* Disable the CAN and stop ongong transmissions */
- can_putreg(priv, LPC17_CAN_MOD_OFFSET, CAN_MOD_RM); /* Enter Reset Mode */
- can_putreg(priv, LPC17_CAN_IER_OFFSET, 0); /* Disable interrupts */
- can_putreg(priv, LPC17_CAN_GSR_OFFSET, 0); /* Clear status bits */
- can_putreg(priv, LPC17_CAN_CMR_OFFSET, CAN_CMR_AT); /* Abort transmission */
+ can_putreg(priv, LPC17_40_CAN_MOD_OFFSET, CAN_MOD_RM); /* Enter Reset Mode */
+ can_putreg(priv, LPC17_40_CAN_IER_OFFSET, 0); /* Disable interrupts */
+ can_putreg(priv, LPC17_40_CAN_GSR_OFFSET, 0); /* Clear status bits */
+ can_putreg(priv, LPC17_40_CAN_CMR_OFFSET, CAN_CMR_AT); /* Abort transmission */
/* Set bit timing */
@@ -509,11 +509,11 @@ static void lpc17can_reset(FAR struct can_dev_s *dev)
/* Restart the CAN */
#ifdef CONFIG_CAN_LOOPBACK
- can_putreg(priv, LPC17_CAN_MOD_OFFSET, CAN_MOD_STM); /* Leave Reset Mode, enter Test Mode */
+ can_putreg(priv, LPC17_40_CAN_MOD_OFFSET, CAN_MOD_STM); /* Leave Reset Mode, enter Test Mode */
#else
- can_putreg(priv, LPC17_CAN_MOD_OFFSET, 0); /* Leave Reset Mode */
+ can_putreg(priv, LPC17_40_CAN_MOD_OFFSET, 0); /* Leave Reset Mode */
#endif
- can_putcommon(LPC17_CANAF_AFMR, CANAF_AFMR_ACCBP); /* All RX messages accepted */
+ can_putcommon(LPC17_40_CANAF_AFMR, CANAF_AFMR_ACCBP); /* All RX messages accepted */
leave_critical_section(flags);
}
@@ -543,10 +543,10 @@ static int lpc17can_setup(FAR struct can_dev_s *dev)
caninfo("CAN%d\n", priv->port);
- ret = irq_attach(LPC17_IRQ_CAN, can12_interrupt, NULL);
+ ret = irq_attach(LPC17_40_IRQ_CAN, can12_interrupt, NULL);
if (ret == OK)
{
- up_enable_irq(LPC17_IRQ_CAN);
+ up_enable_irq(LPC17_40_IRQ_CAN);
}
return ret;
@@ -575,8 +575,8 @@ static void lpc17can_shutdown(FAR struct can_dev_s *dev)
caninfo("CAN%d\n", priv->port);
#endif
- up_disable_irq(LPC17_IRQ_CAN);
- irq_detach(LPC17_IRQ_CAN);
+ up_disable_irq(LPC17_40_IRQ_CAN);
+ irq_detach(LPC17_40_IRQ_CAN);
}
/****************************************************************************
@@ -606,7 +606,7 @@ static void lpc17can_rxint(FAR struct can_dev_s *dev, bool enable)
*/
flags = enter_critical_section();
- regval = can_getreg(priv, LPC17_CAN_IER_OFFSET);
+ regval = can_getreg(priv, LPC17_40_CAN_IER_OFFSET);
if (enable)
{
regval |= CAN_IER_RIE;
@@ -616,7 +616,7 @@ static void lpc17can_rxint(FAR struct can_dev_s *dev, bool enable)
regval &= ~CAN_IER_RIE;
}
- can_putreg(priv, LPC17_CAN_IER_OFFSET, regval);
+ can_putreg(priv, LPC17_40_CAN_IER_OFFSET, regval);
leave_critical_section(flags);
}
@@ -657,9 +657,9 @@ static void lpc17can_txint(FAR struct can_dev_s *dev, bool enable)
/* Disable all TX interrupts */
- regval = can_getreg(priv, LPC17_CAN_IER_OFFSET);
+ regval = can_getreg(priv, LPC17_40_CAN_IER_OFFSET);
regval &= ~(CAN_IER_TIE1 | CAN_IER_TIE2 | CAN_IER_TIE3);
- can_putreg(priv, LPC17_CAN_IER_OFFSET, regval);
+ can_putreg(priv, LPC17_40_CAN_IER_OFFSET, regval);
leave_critical_section(flags);
}
@@ -769,7 +769,7 @@ static int lpc17can_send(FAR struct can_dev_s *dev, FAR struct can_msg_s *msg)
/* Pick a transmit buffer */
- regval = can_getreg(priv, LPC17_CAN_SR_OFFSET);
+ regval = can_getreg(priv, LPC17_40_CAN_SR_OFFSET);
if ((regval & CAN_SR_TBS1) != 0)
{
/* Make sure that buffer 1 TX interrupts are enabled BEFORE sending the
@@ -781,23 +781,23 @@ static int lpc17can_send(FAR struct can_dev_s *dev, FAR struct can_msg_s *msg)
* following is safe because interrupts are disabled here.
*/
- regval = can_getreg(priv, LPC17_CAN_IER_OFFSET);
+ regval = can_getreg(priv, LPC17_40_CAN_IER_OFFSET);
regval |= CAN_IER_TIE1;
- can_putreg(priv, LPC17_CAN_IER_OFFSET, regval);
+ can_putreg(priv, LPC17_40_CAN_IER_OFFSET, regval);
/* Set up the transfer */
- can_putreg(priv, LPC17_CAN_TFI1_OFFSET, tfi);
- can_putreg(priv, LPC17_CAN_TID1_OFFSET, tid);
- can_putreg(priv, LPC17_CAN_TDA1_OFFSET, *(uint32_t *)&msg->cm_data[0]);
- can_putreg(priv, LPC17_CAN_TDB1_OFFSET, *(uint32_t *)&msg->cm_data[4]);
+ can_putreg(priv, LPC17_40_CAN_TFI1_OFFSET, tfi);
+ can_putreg(priv, LPC17_40_CAN_TID1_OFFSET, tid);
+ can_putreg(priv, LPC17_40_CAN_TDA1_OFFSET, *(uint32_t *)&msg->cm_data[0]);
+ can_putreg(priv, LPC17_40_CAN_TDB1_OFFSET, *(uint32_t *)&msg->cm_data[4]);
/* Send the message */
#ifdef CONFIG_CAN_LOOPBACK
- can_putreg(priv, LPC17_CAN_CMR_OFFSET, CAN_CMR_STB1 | CAN_CMR_SRR);
+ can_putreg(priv, LPC17_40_CAN_CMR_OFFSET, CAN_CMR_STB1 | CAN_CMR_SRR);
#else
- can_putreg(priv, LPC17_CAN_CMR_OFFSET, CAN_CMR_STB1 | CAN_CMR_TR);
+ can_putreg(priv, LPC17_40_CAN_CMR_OFFSET, CAN_CMR_STB1 | CAN_CMR_TR);
#endif
}
else if ((regval & CAN_SR_TBS2) != 0)
@@ -811,23 +811,23 @@ static int lpc17can_send(FAR struct can_dev_s *dev, FAR struct can_msg_s *msg)
* following is safe because interrupts are disabled here.
*/
- regval = can_getreg(priv, LPC17_CAN_IER_OFFSET);
+ regval = can_getreg(priv, LPC17_40_CAN_IER_OFFSET);
regval |= CAN_IER_TIE2;
- can_putreg(priv, LPC17_CAN_IER_OFFSET, regval);
+ can_putreg(priv, LPC17_40_CAN_IER_OFFSET, regval);
/* Set up the transfer */
- can_putreg(priv, LPC17_CAN_TFI2_OFFSET, tfi);
- can_putreg(priv, LPC17_CAN_TID2_OFFSET, tid);
- can_putreg(priv, LPC17_CAN_TDA2_OFFSET, *(uint32_t *)&msg->cm_data[0]);
- can_putreg(priv, LPC17_CAN_TDB2_OFFSET, *(uint32_t *)&msg->cm_data[4]);
+ can_putreg(priv, LPC17_40_CAN_TFI2_OFFSET, tfi);
+ can_putreg(priv, LPC17_40_CAN_TID2_OFFSET, tid);
+ can_putreg(priv, LPC17_40_CAN_TDA2_OFFSET, *(uint32_t *)&msg->cm_data[0]);
+ can_putreg(priv, LPC17_40_CAN_TDB2_OFFSET, *(uint32_t *)&msg->cm_data[4]);
/* Send the message */
#ifdef CONFIG_CAN_LOOPBACK
- can_putreg(priv, LPC17_CAN_CMR_OFFSET, CAN_CMR_STB2 | CAN_CMR_SRR);
+ can_putreg(priv, LPC17_40_CAN_CMR_OFFSET, CAN_CMR_STB2 | CAN_CMR_SRR);
#else
- can_putreg(priv, LPC17_CAN_CMR_OFFSET, CAN_CMR_STB2 | CAN_CMR_TR);
+ can_putreg(priv, LPC17_40_CAN_CMR_OFFSET, CAN_CMR_STB2 | CAN_CMR_TR);
#endif
}
else if ((regval & CAN_SR_TBS3) != 0)
@@ -841,23 +841,23 @@ static int lpc17can_send(FAR struct can_dev_s *dev, FAR struct can_msg_s *msg)
* following is safe because interrupts are disabled here.
*/
- regval = can_getreg(priv, LPC17_CAN_IER_OFFSET);
+ regval = can_getreg(priv, LPC17_40_CAN_IER_OFFSET);
regval |= CAN_IER_TIE3;
- can_putreg(priv, LPC17_CAN_IER_OFFSET, regval);
+ can_putreg(priv, LPC17_40_CAN_IER_OFFSET, regval);
/* Set up the transfer */
- can_putreg(priv, LPC17_CAN_TFI3_OFFSET, tfi);
- can_putreg(priv, LPC17_CAN_TID3_OFFSET, tid);
- can_putreg(priv, LPC17_CAN_TDA3_OFFSET, *(uint32_t *)&msg->cm_data[0]);
- can_putreg(priv, LPC17_CAN_TDB3_OFFSET, *(uint32_t *)&msg->cm_data[4]);
+ can_putreg(priv, LPC17_40_CAN_TFI3_OFFSET, tfi);
+ can_putreg(priv, LPC17_40_CAN_TID3_OFFSET, tid);
+ can_putreg(priv, LPC17_40_CAN_TDA3_OFFSET, *(uint32_t *)&msg->cm_data[0]);
+ can_putreg(priv, LPC17_40_CAN_TDB3_OFFSET, *(uint32_t *)&msg->cm_data[4]);
/* Send the message */
#ifdef CONFIG_CAN_LOOPBACK
- can_putreg(priv, LPC17_CAN_CMR_OFFSET, CAN_CMR_STB3 | CAN_CMR_SRR);
+ can_putreg(priv, LPC17_40_CAN_CMR_OFFSET, CAN_CMR_STB3 | CAN_CMR_SRR);
#else
- can_putreg(priv, LPC17_CAN_CMR_OFFSET, CAN_CMR_STB3 | CAN_CMR_TR);
+ can_putreg(priv, LPC17_40_CAN_CMR_OFFSET, CAN_CMR_STB3 | CAN_CMR_TR);
#endif
}
else
@@ -887,7 +887,7 @@ static int lpc17can_send(FAR struct can_dev_s *dev, FAR struct can_msg_s *msg)
static bool lpc17can_txready(FAR struct can_dev_s *dev)
{
FAR struct up_dev_s *priv = (FAR struct up_dev_s *)dev->cd_priv;
- uint32_t regval = can_getreg(priv, LPC17_CAN_SR_OFFSET);
+ uint32_t regval = can_getreg(priv, LPC17_40_CAN_SR_OFFSET);
return ((regval & (CAN_SR_TBS1 | CAN_SR_TBS2 | CAN_SR_TBS3)) != 0);
}
@@ -912,7 +912,7 @@ static bool lpc17can_txready(FAR struct can_dev_s *dev)
static bool lpc17can_txempty(FAR struct can_dev_s *dev)
{
FAR struct up_dev_s *priv = (FAR struct up_dev_s *)dev->cd_priv;
- uint32_t regval = can_getreg(priv, LPC17_CAN_GSR_OFFSET);
+ uint32_t regval = can_getreg(priv, LPC17_40_CAN_GSR_OFFSET);
return ((regval & CAN_GSR_TBS) != 0);
}
@@ -941,21 +941,21 @@ static void can_interrupt(FAR struct can_dev_s *dev)
/* Read the interrupt and capture register (also clearing most status bits) */
- regval = can_getreg(priv, LPC17_CAN_ICR_OFFSET);
+ regval = can_getreg(priv, LPC17_40_CAN_ICR_OFFSET);
caninfo("CAN%d ICR: %08x\n", priv->port, regval);
/* Check for a receive interrupt */
if ((regval & CAN_ICR_RI) != 0)
{
- rfs = can_getreg(priv, LPC17_CAN_RFS_OFFSET);
- rid = can_getreg(priv, LPC17_CAN_RID_OFFSET);
- data[0] = can_getreg(priv, LPC17_CAN_RDA_OFFSET);
- data[1] = can_getreg(priv, LPC17_CAN_RDB_OFFSET);
+ rfs = can_getreg(priv, LPC17_40_CAN_RFS_OFFSET);
+ rid = can_getreg(priv, LPC17_40_CAN_RID_OFFSET);
+ data[0] = can_getreg(priv, LPC17_40_CAN_RDA_OFFSET);
+ data[1] = can_getreg(priv, LPC17_40_CAN_RDB_OFFSET);
/* Release the receive buffer */
- can_putreg(priv, LPC17_CAN_CMR_OFFSET, CAN_CMR_RRB);
+ can_putreg(priv, LPC17_40_CAN_CMR_OFFSET, CAN_CMR_RRB);
/* Construct the CAN header */
@@ -989,9 +989,9 @@ static void can_interrupt(FAR struct can_dev_s *dev)
{
/* Disable all further TX buffer 1 interrupts */
- regval = can_getreg(priv, LPC17_CAN_IER_OFFSET);
+ regval = can_getreg(priv, LPC17_40_CAN_IER_OFFSET);
regval &= ~CAN_IER_TIE1;
- can_putreg(priv, LPC17_CAN_IER_OFFSET, regval);
+ can_putreg(priv, LPC17_40_CAN_IER_OFFSET, regval);
/* Indicate that the TX is done and a new TX buffer is available */
@@ -1004,9 +1004,9 @@ static void can_interrupt(FAR struct can_dev_s *dev)
{
/* Disable all further TX buffer 2 interrupts */
- regval = can_getreg(priv, LPC17_CAN_IER_OFFSET);
+ regval = can_getreg(priv, LPC17_40_CAN_IER_OFFSET);
regval &= ~CAN_IER_TIE2;
- can_putreg(priv, LPC17_CAN_IER_OFFSET, regval);
+ can_putreg(priv, LPC17_40_CAN_IER_OFFSET, regval);
/* Indicate that the TX is done and a new TX buffer is available */
@@ -1019,9 +1019,9 @@ static void can_interrupt(FAR struct can_dev_s *dev)
{
/* Disable all further TX buffer 3 interrupts */
- regval = can_getreg(priv, LPC17_CAN_IER_OFFSET);
+ regval = can_getreg(priv, LPC17_40_CAN_IER_OFFSET);
regval &= ~CAN_IER_TIE3;
- can_putreg(priv, LPC17_CAN_IER_OFFSET, regval);
+ can_putreg(priv, LPC17_40_CAN_IER_OFFSET, regval);
/* Indicate that the TX is done and a new TX buffer is available */
@@ -1051,10 +1051,10 @@ static int can12_interrupt(int irq, void *context, FAR void *arg)
caninfo("irq: %d\n", irq);
-#ifdef CONFIG_LPC17_CAN1
+#ifdef CONFIG_LPC17_40_CAN1
can_interrupt(&g_can1dev);
#endif
-#ifdef CONFIG_LPC17_CAN2
+#ifdef CONFIG_LPC17_40_CAN2
can_interrupt(&g_can2dev);
#endif
@@ -1107,7 +1107,7 @@ static int can12_interrupt(int irq, void *context, FAR void *arg)
* Tq = brp * Tcan
*
* Where:
- * Tcan is the period of the APB clock (PCLK = CCLK / CONFIG_LPC17_CAN1_DIVISOR).
+ * Tcan is the period of the APB clock (PCLK = CCLK / CONFIG_LPC17_40_CAN1_DIVISOR).
*
* Input Parameters:
* priv - A reference to the CAN block status
@@ -1164,15 +1164,15 @@ static int can_bittiming(struct up_dev_s *priv)
}
}
- /* Otherwise, nquanta is CAN_BIT_QUANTA, ts1 is CONFIG_LPC17_CAN_TSEG1, ts2 is
- * CONFIG_LPC17_CAN_TSEG2 and we calculate brp to achieve CAN_BIT_QUANTA quanta
+ /* Otherwise, nquanta is CAN_BIT_QUANTA, ts1 is CONFIG_LPC17_40_CAN_TSEG1, ts2 is
+ * CONFIG_LPC17_40_CAN_TSEG2 and we calculate brp to achieve CAN_BIT_QUANTA quanta
* in the bit time
*/
else
{
- ts1 = CONFIG_LPC17_CAN_TSEG1;
- ts2 = CONFIG_LPC17_CAN_TSEG2;
+ ts1 = CONFIG_LPC17_40_CAN_TSEG1;
+ ts2 = CONFIG_LPC17_40_CAN_TSEG2;
brp = (nclks + (CAN_BIT_QUANTA / 2)) / CAN_BIT_QUANTA;
DEBUGASSERT(brp >=1 && brp <= CAN_BTR_BRP_MAX);
}
@@ -1188,7 +1188,7 @@ static int can_bittiming(struct up_dev_s *priv)
((ts2 - 1) << CAN_BTR_TSEG2_SHIFT) |
((sjw - 1) << CAN_BTR_SJW_SHIFT));
-#ifdef CONFIG_LPC17_CAN_SAM
+#ifdef CONFIG_LPC17_40_CAN_SAM
/* The bus is sampled 3 times (recommended for low to medium speed buses
* to spikes on the bus-line).
*/
@@ -1197,7 +1197,7 @@ static int can_bittiming(struct up_dev_s *priv)
#endif
caninfo("Setting CANxBTR= 0x%08x\n", btr);
- can_putreg(priv, LPC17_CAN_BTR_OFFSET, btr); /* Set bit timing */
+ can_putreg(priv, LPC17_40_CAN_BTR_OFFSET, btr); /* Set bit timing */
return OK;
}
@@ -1205,7 +1205,7 @@ static int can_bittiming(struct up_dev_s *priv)
* Public Functions
****************************************************************************/
/****************************************************************************
- * Name: lpc17_caninitialize
+ * Name: lpc17_40_caninitialize
*
* Description:
* Initialize the selected can port
@@ -1218,7 +1218,7 @@ static int can_bittiming(struct up_dev_s *priv)
*
****************************************************************************/
-FAR struct can_dev_s *lpc17_caninitialize(int port)
+FAR struct can_dev_s *lpc17_40_caninitialize(int port)
{
FAR struct can_dev_s *candev;
irqstate_t flags;
@@ -1228,67 +1228,67 @@ FAR struct can_dev_s *lpc17_caninitialize(int port)
flags = enter_critical_section();
-#ifdef CONFIG_LPC17_CAN1
+#ifdef CONFIG_LPC17_40_CAN1
if (port == 1)
{
/* Enable power to the CAN module */
- regval = can_getcommon(LPC17_SYSCON_PCONP);
+ regval = can_getcommon(LPC17_40_SYSCON_PCONP);
regval |= SYSCON_PCONP_PCCAN1;
- can_putcommon(LPC17_SYSCON_PCONP, regval);
+ can_putcommon(LPC17_40_SYSCON_PCONP, regval);
/* Enable clocking to the CAN module (not necessary... already done
* in low level clock configuration logic).
*/
-#ifdef LPC178x
- regval = can_getcommon(LPC17_SYSCON_PCLKSEL);
+#ifdef LPC178x_40xx
+ regval = can_getcommon(LPC17_40_SYSCON_PCLKSEL);
regval &= SYSCON_PCLKSEL_PCLKDIV_MASK
regval >>= SYSCON_PCLKSEL_PCLKDIV_SHIFT;
g_can1pri.divisor = regval;
#else
- regval = can_getcommon(LPC17_SYSCON_PCLKSEL0);
+ regval = can_getcommon(LPC17_40_SYSCON_PCLKSEL0);
regval &= ~SYSCON_PCLKSEL0_CAN1_MASK;
regval |= (CAN1_CCLK_DIVISOR << SYSCON_PCLKSEL0_CAN1_SHIFT);
- can_putcommon(LPC17_SYSCON_PCLKSEL0, regval);
+ can_putcommon(LPC17_40_SYSCON_PCLKSEL0, regval);
#endif
/* Configure CAN GPIO pins */
- lpc17_configgpio(GPIO_CAN1_RD);
- lpc17_configgpio(GPIO_CAN1_TD);
+ lpc17_40_configgpio(GPIO_CAN1_RD);
+ lpc17_40_configgpio(GPIO_CAN1_TD);
candev = &g_can1dev;
}
else
#endif
-#ifdef CONFIG_LPC17_CAN2
+#ifdef CONFIG_LPC17_40_CAN2
if (port == 2)
{
/* Enable power to the CAN module */
- regval = can_getcommon(LPC17_SYSCON_PCONP);
+ regval = can_getcommon(LPC17_40_SYSCON_PCONP);
regval |= SYSCON_PCONP_PCCAN2;
- can_putcommon(LPC17_SYSCON_PCONP, regval);
+ can_putcommon(LPC17_40_SYSCON_PCONP, regval);
/* Enable clocking to the CAN module (not necessary... already done
* in low level clock configuration logic).
*/
-#ifdef LPC178x
- regval = can_getcommon(LPC17_SYSCON_PCLKSEL);
+#ifdef LPC178x_40xx
+ regval = can_getcommon(LPC17_40_SYSCON_PCLKSEL);
regval &= SYSCON_PCLKSEL_PCLKDIV_MASK;
regval >>= SYSCON_PCLKSEL_PCLKDIV_SHIFT;
g_can2priv.divisor = regval;
#else
- regval = can_getcommon(LPC17_SYSCON_PCLKSEL0);
+ regval = can_getcommon(LPC17_40_SYSCON_PCLKSEL0);
regval &= ~SYSCON_PCLKSEL0_CAN2_MASK;
regval |= (CAN2_CCLK_DIVISOR << SYSCON_PCLKSEL0_CAN2_SHIFT);
- can_putcommon(LPC17_SYSCON_PCLKSEL0, regval);
+ can_putcommon(LPC17_40_SYSCON_PCLKSEL0, regval);
#endif
/* Configure CAN GPIO pins */
- lpc17_configgpio(GPIO_CAN2_RD);
- lpc17_configgpio(GPIO_CAN2_TD);
+ lpc17_40_configgpio(GPIO_CAN2_RD);
+ lpc17_40_configgpio(GPIO_CAN2_TD);
candev = &g_can2dev;
}
diff --git a/arch/arm/src/lpc17xx/lpc17_can.h b/arch/arm/src/lpc17xx_40xx/lpc17_40_can.h
similarity index 88%
rename from arch/arm/src/lpc17xx/lpc17_can.h
rename to arch/arm/src/lpc17xx_40xx/lpc17_40_can.h
index 271339ff054..cbbc752c821 100644
--- a/arch/arm/src/lpc17xx/lpc17_can.h
+++ b/arch/arm/src/lpc17xx_40xx/lpc17_40_can.h
@@ -1,5 +1,5 @@
/****************************************************************************
- * arch/arm/src/lpc17xx/lpc17_can.h
+ * arch/arm/src/lpc17xx_40xx/lpc17_40_can.h
*
* Copyright (C) 2010-2012, 2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt
@@ -33,15 +33,15 @@
*
****************************************************************************/
-#ifndef __ARCH_ARM_SRC_LPC17XX_LPC17_CAN_H
-#define __ARCH_ARM_SRC_LPC17XX_LPC17_CAN_H
+#ifndef __ARCH_ARM_SRC_LPC17XX_40XX_LPC17_40_CAN_H
+#define __ARCH_ARM_SRC_LPC17XX_40XX_LPC17_40_CAN_H
/****************************************************************************
* Included Files
****************************************************************************/
#include
-#include "hardware/lpc17_can.h"
+#include "hardware/lpc17_40_can.h"
/****************************************************************************
* Pre-processor Definitions
@@ -66,7 +66,7 @@ extern "C"
****************************************************************************/
/****************************************************************************
- * Name: lpc17_caninitialize
+ * Name: lpc17_40_caninitialize
*
* Description:
* Initialize the selected can port
@@ -79,9 +79,9 @@ extern "C"
*
****************************************************************************/
-#if defined(CONFIG_CAN) && (defined(CONFIG_LPC17_CAN1) || defined(CONFIG_LPC17_CAN2))
+#if defined(CONFIG_CAN) && (defined(CONFIG_LPC17_40_CAN1) || defined(CONFIG_LPC17_40_CAN2))
struct can_dev_s;
-FAR struct can_dev_s *lpc17_caninitialize(int port);
+FAR struct can_dev_s *lpc17_40_caninitialize(int port);
#endif
#ifdef __cplusplus
@@ -89,4 +89,4 @@ FAR struct can_dev_s *lpc17_caninitialize(int port);
#endif
#endif /* __ASSEMBLY__ */
-#endif /* __ARCH_ARM_SRC_LPC17XX_LPC17_CAN_H */
+#endif /* __ARCH_ARM_SRC_LPC17XX_40XX_LPC17_40_CAN_H */
diff --git a/arch/arm/src/lpc17xx/lpc17_clockconfig.c b/arch/arm/src/lpc17xx_40xx/lpc17_40_clockconfig.c
similarity index 82%
rename from arch/arm/src/lpc17xx/lpc17_clockconfig.c
rename to arch/arm/src/lpc17xx_40xx/lpc17_40_clockconfig.c
index 97ef496f0df..87ba4346c87 100644
--- a/arch/arm/src/lpc17xx/lpc17_clockconfig.c
+++ b/arch/arm/src/lpc17xx_40xx/lpc17_40_clockconfig.c
@@ -1,6 +1,6 @@
/****************************************************************************
- * arch/arm/src/lpc17xx/lpc17_clockconfig.c
- * arch/arm/src/chip/lpc17_clockconfig.c
+ * arch/arm/src/lpc17xx_40xx/lpc17_40_clockconfig.c
+ * arch/arm/src/chip/lpc17_40_clockconfig.c
*
* Copyright (C) 2010, 2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt
@@ -41,26 +41,26 @@
#include
/* This file is only a thin shell that includes the correct clock
- * configuration logic for the selected LPC17xx family. The correct file
+ * configuration logic for the selected LPC17xx/LPC40xx family. The correct file
* cannot be selected by the make system because it needs the intelligence
- * that only exists in chip.h that can associate an LPC17xx part number with
- * an LPC17xx family.
+ * that only exists in chip.h that can associate an LPC17xx/LPC40xx part number with
+ * an LPC17xx/LPC40xx family.
*
- * The LPC176x and LPC178x system control block is *nearly* identical but
- * we have found that the LPC178x is more sensitive to the ordering of
+ * The LPC176x and LPC178x_40xx system control block is *nearly* identical but
+ * we have found that the LPC178x_40xx is more sensitive to the ordering of
* certain operations. So, although the hardware seems very similar, the
- * safer thing to do is to separate the LPC176x and LPC178x into separate
+ * safer thing to do is to separate the LPC176x and LPC178x_40xx into separate
* files.
*/
-#include
+#include
#if defined(LPC176x)
# include "chip/lpc176x_clockconfig.c"
-#elif defined(LPC178x)
-# include "chip/lpc178x_clockconfig.c"
+#elif defined(LPC178x_40xx)
+# include "chip/lpc178x_40xx_clockconfig.c"
#else
-# error "Unrecognized LPC17xx family"
+# error "Unrecognized LPC17xx/LPC40xx family"
#endif
/****************************************************************************
diff --git a/arch/arm/src/lpc17xx/lpc17_clockconfig.h b/arch/arm/src/lpc17xx_40xx/lpc17_40_clockconfig.h
similarity index 89%
rename from arch/arm/src/lpc17xx/lpc17_clockconfig.h
rename to arch/arm/src/lpc17xx_40xx/lpc17_40_clockconfig.h
index ffc9fa88dd5..b2e778cbf90 100644
--- a/arch/arm/src/lpc17xx/lpc17_clockconfig.h
+++ b/arch/arm/src/lpc17xx_40xx/lpc17_40_clockconfig.h
@@ -1,5 +1,5 @@
/************************************************************************************
- * arch/arm/src/lpc17xx/lpc17_clockconfig.h
+ * arch/arm/src/lpc17xx_40xx/lpc17_40_clockconfig.h
*
* Copyright (C) 2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt
@@ -33,8 +33,8 @@
*
************************************************************************************/
-#ifndef __ARCH_ARM_SRC_LPC17XX_LPC17_CLOCKCONFIG_H
-#define __ARCH_ARM_SRC_LPC17XX_LPC17_CLOCKCONFIG_H
+#ifndef __ARCH_ARM_SRC_LPC17XX_40XX_LPC17_40_CLOCKCONFIG_H
+#define __ARCH_ARM_SRC_LPC17XX_40XX_LPC17_40_CLOCKCONFIG_H
/************************************************************************************
* Included Files
@@ -65,20 +65,20 @@ extern "C"
************************************************************************************/
/************************************************************************************
- * Name: lpc17_clockconfig
+ * Name: lpc17_40_clockconfig
*
* Description:
- * Called to initialize the LPC17XX. This does whatever setup is needed to put the
+ * Called to initialize the LPC17XX_40XX. This does whatever setup is needed to put the
* MCU in a usable state. This includes the initialization of clocking using the
* settings in board.h.
*
************************************************************************************/
-void lpc17_clockconfig(void);
+void lpc17_40_clockconfig(void);
#ifdef __cplusplus
}
#endif
#endif /* __ASSEMBLY__ */
-#endif /* __ARCH_ARM_SRC_LPC17XX_LPC17_CLOCKCONFIG_H */
+#endif /* __ARCH_ARM_SRC_LPC17XX_40XX_LPC17_40_CLOCKCONFIG_H */
diff --git a/arch/arm/src/lpc17xx/lpc17_clrpend.c b/arch/arm/src/lpc17xx_40xx/lpc17_40_clrpend.c
similarity index 87%
rename from arch/arm/src/lpc17xx/lpc17_clrpend.c
rename to arch/arm/src/lpc17xx_40xx/lpc17_40_clrpend.c
index 7a5552b3975..55546b66465 100644
--- a/arch/arm/src/lpc17xx/lpc17_clrpend.c
+++ b/arch/arm/src/lpc17xx_40xx/lpc17_40_clrpend.c
@@ -1,6 +1,6 @@
/****************************************************************************
- * arch/arm/src/lpc17/lpc17_clrpend.c
- * arch/arm/src/chip/lpc17_clrpend.c
+ * arch/arm/src/lpc17/lpc17_40_clrpend.c
+ * arch/arm/src/chip/lpc17_40_clrpend.c
*
* Copyright (C) 2010 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt
@@ -44,7 +44,7 @@
#include "nvic.h"
#include "up_arch.h"
-#include "lpc17_clrpend.h"
+#include "lpc17_40_clrpend.h"
/****************************************************************************
* Pre-processor Definitions
@@ -67,7 +67,7 @@
****************************************************************************/
/****************************************************************************
- * Name: lpc17_clrpend
+ * Name: lpc17_40_clrpend
*
* Description:
* Clear a pending interrupt at the NVIC. This does not seem to be required
@@ -75,23 +75,23 @@
* interrupt definitely needs it!
*
* I keep it in a separate file so that it will not increase the footprint
- * on LPC17xx platforms that do not need this function.
+ * on LPC17xx/LPC40xx platforms that do not need this function.
*
****************************************************************************/
-void lpc17_clrpend(int irq)
+void lpc17_40_clrpend(int irq)
{
/* Check for external interrupt */
- if (irq >= LPC17_IRQ_EXTINT)
+ if (irq >= LPC17_40_IRQ_EXTINT)
{
- if (irq < (LPC17_IRQ_EXTINT+32))
+ if (irq < (LPC17_40_IRQ_EXTINT+32))
{
- putreg32(1 << (irq - LPC17_IRQ_EXTINT), NVIC_IRQ0_31_CLRPEND);
+ putreg32(1 << (irq - LPC17_40_IRQ_EXTINT), NVIC_IRQ0_31_CLRPEND);
}
- else if (irq < LPC17_IRQ_NIRQS)
+ else if (irq < LPC17_40_IRQ_NIRQS)
{
- putreg32(1 << (irq - LPC17_IRQ_EXTINT - 32), NVIC_IRQ32_63_CLRPEND);
+ putreg32(1 << (irq - LPC17_40_IRQ_EXTINT - 32), NVIC_IRQ32_63_CLRPEND);
}
}
}
diff --git a/arch/arm/src/lpc17xx/lpc17_clrpend.h b/arch/arm/src/lpc17xx_40xx/lpc17_40_clrpend.h
similarity index 92%
rename from arch/arm/src/lpc17xx/lpc17_clrpend.h
rename to arch/arm/src/lpc17xx_40xx/lpc17_40_clrpend.h
index d7bf5b90dc5..6e00a63e5b9 100644
--- a/arch/arm/src/lpc17xx/lpc17_clrpend.h
+++ b/arch/arm/src/lpc17xx_40xx/lpc17_40_clrpend.h
@@ -1,5 +1,5 @@
/************************************************************************************
- * arch/arm/src/lpc17xx/lpc17_clrpend.h
+ * arch/arm/src/lpc17xx_40xx/lpc17_40_clrpend.h
*
* Copyright (C) 2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt
@@ -33,8 +33,8 @@
*
************************************************************************************/
-#ifndef __ARCH_ARM_SRC_LPC17XX_LPC17_CLRPEND_H
-#define __ARCH_ARM_SRC_LPC17XX_LPC17_CLRPEND_H
+#ifndef __ARCH_ARM_SRC_LPC17XX_40XX_LPC17_40_CLRPEND_H
+#define __ARCH_ARM_SRC_LPC17XX_40XX_LPC17_40_CLRPEND_H
/************************************************************************************
* Included Files
@@ -65,7 +65,7 @@ extern "C"
************************************************************************************/
/************************************************************************************
- * Name: lpc17_clrpend
+ * Name: lpc17_40_clrpend
*
* Description:
* Clear a pending interrupt at the NVIC. This does not seem to be required
@@ -74,11 +74,11 @@ extern "C"
*
************************************************************************************/
-void lpc17_clrpend(int irq);
+void lpc17_40_clrpend(int irq);
#ifdef __cplusplus
}
#endif
#endif /* __ASSEMBLY__ */
-#endif /* __ARCH_ARM_SRC_LPC17XX_LPC17_CLRPEND_H */
+#endif /* __ARCH_ARM_SRC_LPC17XX_40XX_LPC17_40_CLRPEND_H */
diff --git a/arch/arm/src/lpc17xx/lpc17_dac.c b/arch/arm/src/lpc17xx_40xx/lpc17_40_dac.c
similarity index 90%
rename from arch/arm/src/lpc17xx/lpc17_dac.c
rename to arch/arm/src/lpc17xx_40xx/lpc17_40_dac.c
index 301dc4133f1..19a09a3e9ca 100644
--- a/arch/arm/src/lpc17xx/lpc17_dac.c
+++ b/arch/arm/src/lpc17xx_40xx/lpc17_40_dac.c
@@ -1,5 +1,5 @@
/************************************************************************************
- * arch/arm/src/lpc17xx/lpc17_dac.c
+ * arch/arm/src/lpc17xx_40xx/lpc17_40_dac.c
*
* Copyright (C) 2011 Li Zhuoyi. All rights reserved.
* Author: Li Zhuoyi
@@ -62,12 +62,12 @@
#include "chip.h"
-#include "hardware/lpc17_syscon.h"
-#include "hardware/lpc17_pinconfig.h"
-#include "lpc17_gpio.h"
-#include "lpc17_dac.h"
+#include "hardware/lpc17_40_syscon.h"
+#include "hardware/lpc17_40_pinconfig.h"
+#include "lpc17_40_gpio.h"
+#include "lpc17_40_dac.h"
-#ifdef CONFIG_LPC17_DAC
+#ifdef CONFIG_LPC17_40_DAC
/****************************************************************************
* Private Types
@@ -120,14 +120,14 @@ static void dac_reset(FAR struct dac_dev_s *dev)
flags = enter_critical_section();
- regval = getreg32(LPC17_SYSCON_PCLKSEL0);
+ regval = getreg32(LPC17_40_SYSCON_PCLKSEL0);
regval &= ~SYSCON_PCLKSEL0_DAC_MASK;
regval |= (SYSCON_PCLKSEL_CCLK8 << SYSCON_PCLKSEL0_DAC_SHIFT);
- putreg32(regval, LPC17_SYSCON_PCLKSEL0);
+ putreg32(regval, LPC17_40_SYSCON_PCLKSEL0);
- //putreg32(DAC_CTRL_DBLBUFEN, LPC17_DAC_CTRL); ?
+ //putreg32(DAC_CTRL_DBLBUFEN, LPC17_40_DAC_CTRL); ?
- lpc17_configgpio(GPIO_AOUT);
+ lpc17_40_configgpio(GPIO_AOUT);
leave_critical_section(flags);
}
@@ -163,7 +163,7 @@ static int dac_send(FAR struct dac_dev_s *dev, FAR struct dac_msg_s *msg)
* speed profile in bit 16)
*/
- putreg32(((((msg->am_data) << 6) | 0x10000) & 0xffff), LPC17_DAC_CR);
+ putreg32(((((msg->am_data) << 6) | 0x10000) & 0xffff), LPC17_40_DAC_CR);
dac_txdone(&g_dacdev);
return 0;
}
@@ -181,7 +181,7 @@ static int dac_ioctl(FAR struct dac_dev_s *dev, int cmd, unsigned long arg)
****************************************************************************/
/****************************************************************************
- * Name: lpc17_dacinitialize
+ * Name: lpc17_40_dacinitialize
*
* Description:
* Initialize the DAC
@@ -191,10 +191,10 @@ static int dac_ioctl(FAR struct dac_dev_s *dev, int cmd, unsigned long arg)
*
****************************************************************************/
-FAR struct dac_dev_s *lpc17_dacinitialize(void)
+FAR struct dac_dev_s *lpc17_40_dacinitialize(void)
{
return &g_dacdev;
}
-#endif /* CONFIG_LPC17_DAC */
+#endif /* CONFIG_LPC17_40_DAC */
diff --git a/arch/arm/src/lpc17xx/lpc17_dac.h b/arch/arm/src/lpc17xx_40xx/lpc17_40_dac.h
similarity index 90%
rename from arch/arm/src/lpc17xx/lpc17_dac.h
rename to arch/arm/src/lpc17xx_40xx/lpc17_40_dac.h
index a27b6a66d17..924a6fb5b17 100644
--- a/arch/arm/src/lpc17xx/lpc17_dac.h
+++ b/arch/arm/src/lpc17xx_40xx/lpc17_40_dac.h
@@ -1,5 +1,5 @@
/************************************************************************************
- * arch/arm/src/lpc17xx/lpc17_dac.h
+ * arch/arm/src/lpc17xx_40xx/lpc17_40_dac.h
*
* Copyright (C) 2010, 2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt
@@ -33,15 +33,15 @@
*
************************************************************************************/
-#ifndef __ARCH_ARM_SRC_LPC17XX_LPC17_DAC_H
-#define __ARCH_ARM_SRC_LPC17XX_LPC17_DAC_H
+#ifndef __ARCH_ARM_SRC_LPC17XX_40XX_LPC17_40_DAC_H
+#define __ARCH_ARM_SRC_LPC17XX_40XX_LPC17_40_DAC_H
/************************************************************************************
* Included Files
************************************************************************************/
#include
-#include "hardware/lpc17_dac.h"
+#include "hardware/lpc17_40_dac.h"
/************************************************************************************
* Pre-processor Definitions
@@ -66,7 +66,7 @@ extern "C"
************************************************************************************/
/****************************************************************************
- * Name: lpc17_dacinitialize
+ * Name: lpc17_40_dacinitialize
*
* Description:
* Initialize the DAC
@@ -76,8 +76,8 @@ extern "C"
*
****************************************************************************/
-#ifdef CONFIG_LPC17_DAC
-FAR struct dac_dev_s *lpc17_dacinitialize(void);
+#ifdef CONFIG_LPC17_40_DAC
+FAR struct dac_dev_s *lpc17_40_dacinitialize(void);
#endif
#ifdef __cplusplus
@@ -85,4 +85,4 @@ FAR struct dac_dev_s *lpc17_dacinitialize(void);
#endif
#endif /* __ASSEMBLY__ */
-#endif /* __ARCH_ARM_SRC_LPC17XX_LPC17_DAC_H */
+#endif /* __ARCH_ARM_SRC_LPC17XX_40XX_LPC17_40_DAC_H */
diff --git a/arch/arm/src/lpc17xx/lpc17_emacram.h b/arch/arm/src/lpc17xx_40xx/lpc17_40_emacram.h
similarity index 58%
rename from arch/arm/src/lpc17xx/lpc17_emacram.h
rename to arch/arm/src/lpc17xx_40xx/lpc17_40_emacram.h
index f68e62734e4..37abaa63904 100644
--- a/arch/arm/src/lpc17xx/lpc17_emacram.h
+++ b/arch/arm/src/lpc17xx_40xx/lpc17_40_emacram.h
@@ -1,5 +1,5 @@
/************************************************************************************
- * arch/arm/src/lpc17xx/lpc17_emacram.h
+ * arch/arm/src/lpc17xx_40xx/lpc17_40_emacram.h
*
* Copyright (C) 2010 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt
@@ -33,8 +33,8 @@
*
************************************************************************************/
-#ifndef __ARCH_ARM_SRC_LPC17XX_LPC17_EMACRAM_H
-#define __ARCH_ARM_SRC_LPC17XX_LPC17_EMACRAM_H
+#ifndef __ARCH_ARM_SRC_LPC17XX_40XX_LPC17_40_EMACRAM_H
+#define __ARCH_ARM_SRC_LPC17XX_40XX_LPC17_40_EMACRAM_H
/************************************************************************************
* Included Files
@@ -42,47 +42,47 @@
#include
#include "chip.h"
-#include "hardware/lpc17_ethernet.h"
-#include "hardware/lpc17_memorymap.h"
+#include "hardware/lpc17_40_ethernet.h"
+#include "hardware/lpc17_40_memorymap.h"
/************************************************************************************
* Pre-processor Definitions
************************************************************************************/
/* Default, no-EMAC Case ************************************************************/
/* Assume that all of AHB SRAM will be available for heap. If this is not true, then
- * LPC17_BANK0_HEAPSIZE will be undefined and redefined below.
+ * LPC17_40_BANK0_HEAPSIZE will be undefined and redefined below.
*/
-#undef LPC17_BANK0_HEAPBASE
-#undef LPC17_BANK0_HEAPSIZE
-#ifdef LPC17_HAVE_BANK0
-# define LPC17_BANK0_HEAPBASE LPC17_SRAM_BANK0
-# define LPC17_BANK0_HEAPSIZE LPC17_BANK0_SIZE
+#undef LPC17_40_BANK0_HEAPBASE
+#undef LPC17_40_BANK0_HEAPSIZE
+#ifdef LPC17_40_HAVE_BANK0
+# define LPC17_40_BANK0_HEAPBASE LPC17_40_SRAM_BANK0
+# define LPC17_40_BANK0_HEAPSIZE LPC17_40_BANK0_SIZE
#endif
-/* Is networking enabled? Is the LPC17xx Ethernet device enabled? Does this chip have
+/* Is networking enabled? Is the LPC17xx/LPC40xx Ethernet device enabled? Does this chip have
* and Ethernet controller? Yes... then we will replace the above default definitions.
*/
-#if defined(CONFIG_NET) && defined(CONFIG_LPC17_ETHERNET) && LPC17_NETHCONTROLLERS > 0
+#if defined(CONFIG_NET) && defined(CONFIG_LPC17_40_ETHERNET) && LPC17_40_NETHCONTROLLERS > 0
/* EMAC RAM Configuration ***********************************************************/
/* Is AHB SRAM available? */
-#ifndef LPC17_HAVE_BANK0
+#ifndef LPC17_40_HAVE_BANK0
# error "AHB SRAM Bank0 is not available for EMAC RAM"
#endif
/* Number of Tx descriptors */
-#ifndef CONFIG_LPC17_ETH_NTXDESC
-# define CONFIG_LPC17_ETH_NTXDESC 13
+#ifndef CONFIG_LPC17_40_ETH_NTXDESC
+# define CONFIG_LPC17_40_ETH_NTXDESC 13
#endif
/* Number of Rx descriptors */
-#ifndef CONFIG_LPC17_ETH_NRXDESC
-# define CONFIG_LPC17_ETH_NRXDESC 13
+#ifndef CONFIG_LPC17_40_ETH_NRXDESC
+# define CONFIG_LPC17_40_ETH_NRXDESC 13
#endif
/* Size of the region at the beginning of AHB SRAM 0 set set aside for the EMAC.
@@ -90,15 +90,15 @@
* words.
*/
-#ifndef CONFIG_LPC17_EMACRAM_SIZE
-# define CONFIG_LPC17_EMACRAM_SIZE LPC17_BANK0_SIZE
+#ifndef CONFIG_LPC17_40_EMACRAM_SIZE
+# define CONFIG_LPC17_40_EMACRAM_SIZE LPC17_40_BANK0_SIZE
#endif
-#if CONFIG_LPC17_EMACRAM_SIZE > LPC17_BANK0_SIZE
+#if CONFIG_LPC17_40_EMACRAM_SIZE > LPC17_40_BANK0_SIZE
# error "EMAC RAM size cannot exceed the size of AHB SRAM Bank 0"
#endif
-#if (CONFIG_LPC17_EMACRAM_SIZE & 3) != 0
+#if (CONFIG_LPC17_40_EMACRAM_SIZE & 3) != 0
# error "EMAC RAM size must be in multiples of 32-bit words"
#endif
@@ -106,11 +106,11 @@
* could be added to the heap.
*/
-#undef LPC17_BANK0_HEAPBASE
-#undef LPC17_BANK0_HEAPSIZE
-#if CONFIG_LPC17_EMACRAM_SIZE < (LPC17_BANK0_SIZE-128)
-# define LPC17_BANK0_HEAPBASE (LPC17_SRAM_BANK0 + CONFIG_LPC17_EMACRAM_SIZE)
-# define LPC17_BANK0_HEAPSIZE (LPC17_BANK0_SIZE - CONFIG_LPC17_EMACRAM_SIZE)
+#undef LPC17_40_BANK0_HEAPBASE
+#undef LPC17_40_BANK0_HEAPSIZE
+#if CONFIG_LPC17_40_EMACRAM_SIZE < (LPC17_40_BANK0_SIZE-128)
+# define LPC17_40_BANK0_HEAPBASE (LPC17_40_SRAM_BANK0 + CONFIG_LPC17_40_EMACRAM_SIZE)
+# define LPC17_40_BANK0_HEAPSIZE (LPC17_40_BANK0_SIZE - CONFIG_LPC17_40_EMACRAM_SIZE)
#endif
/* Memory at the beginning of AHB SRAM, Bank 0 is set aside for EMAC Tx and Rx
@@ -118,15 +118,15 @@
* is controllable.
*/
-#define LPC17_EMACRAM_BASE LPC17_SRAM_BANK0
-#define LPC17_EMACRAM_SIZE CONFIG_LPC17_EMACRAM_SIZE
+#define LPC17_40_EMACRAM_BASE LPC17_40_SRAM_BANK0
+#define LPC17_40_EMACRAM_SIZE CONFIG_LPC17_40_EMACRAM_SIZE
/* Descriptor Memory Layout *********************************************************/
/* EMAC DMA RAM and descriptor definitions. The configured number of descriptors
* will determine the organization and the size of the descriptor and status tables.
* There is a complex interaction between the maximum packet size (CONFIG_NET_ETH_PKTSIZE)
- * and the number of Rx and Tx descriptors that can be supported (CONFIG_LPC17_ETH_NRXDESC
- * and CONFIG_LPC17_ETH_NTXDESC): Small buffers -> more packets. This is something that
+ * and the number of Rx and Tx descriptors that can be supported (CONFIG_LPC17_40_ETH_NRXDESC
+ * and CONFIG_LPC17_40_ETH_NTXDESC): Small buffers -> more packets. This is something that
* needs to be tuned for you system.
*
* For a 16Kb SRAM region, here is the relationship:
@@ -138,50 +138,50 @@
* 15,756 is not well aligned.).
*/
-#define LPC17_TXDESCTAB_SIZE (CONFIG_LPC17_ETH_NTXDESC*LPC17_TXDESC_SIZE)
-#define LPC17_TXSTATTAB_SIZE (CONFIG_LPC17_ETH_NTXDESC*LPC17_TXSTAT_SIZE)
-#define LPC17_TXTAB_SIZE (LPC17_TXDESCTAB_SIZE+LPC17_TXSTATTAB_SIZE)
+#define LPC17_40_TXDESCTAB_SIZE (CONFIG_LPC17_40_ETH_NTXDESC*LPC17_40_TXDESC_SIZE)
+#define LPC17_40_TXSTATTAB_SIZE (CONFIG_LPC17_40_ETH_NTXDESC*LPC17_40_TXSTAT_SIZE)
+#define LPC17_40_TXTAB_SIZE (LPC17_40_TXDESCTAB_SIZE+LPC17_40_TXSTATTAB_SIZE)
-#define LPC17_RXDESCTAB_SIZE (CONFIG_LPC17_ETH_NRXDESC*LPC17_RXDESC_SIZE)
-#define LPC17_RXSTATTAB_SIZE (CONFIG_LPC17_ETH_NRXDESC*LPC17_RXSTAT_SIZE)
-#define LPC17_RXTAB_SIZE (LPC17_RXDESCTAB_SIZE+LPC17_RXSTATTAB_SIZE)
+#define LPC17_40_RXDESCTAB_SIZE (CONFIG_LPC17_40_ETH_NRXDESC*LPC17_40_RXDESC_SIZE)
+#define LPC17_40_RXSTATTAB_SIZE (CONFIG_LPC17_40_ETH_NRXDESC*LPC17_40_RXSTAT_SIZE)
+#define LPC17_40_RXTAB_SIZE (LPC17_40_RXDESCTAB_SIZE+LPC17_40_RXSTATTAB_SIZE)
-#define LPC17_DESCTAB_SIZE (LPC17_TXTAB_SIZE+LPC17_RXTAB_SIZE)
+#define LPC17_40_DESCTAB_SIZE (LPC17_40_TXTAB_SIZE+LPC17_40_RXTAB_SIZE)
/* Descriptor table memory organization. Descriptor tables are packed at
* the end of AHB SRAM, Bank 0. The beginning of bank 0 is reserved for
* packet memory.
*/
-#define LPC17_DESC_BASE (LPC17_EMACRAM_BASE+LPC17_EMACRAM_SIZE-LPC17_DESCTAB_SIZE)
-#define LPC17_TXDESC_BASE LPC17_DESC_BASE
-#define LPC17_TXSTAT_BASE (LPC17_TXDESC_BASE+LPC17_TXDESCTAB_SIZE)
-#define LPC17_RXDESC_BASE (LPC17_TXSTAT_BASE+LPC17_TXSTATTAB_SIZE)
-#define LPC17_RXSTAT_BASE (LPC17_RXDESC_BASE + LPC17_RXDESCTAB_SIZE)
+#define LPC17_40_DESC_BASE (LPC17_40_EMACRAM_BASE+LPC17_40_EMACRAM_SIZE-LPC17_40_DESCTAB_SIZE)
+#define LPC17_40_TXDESC_BASE LPC17_40_DESC_BASE
+#define LPC17_40_TXSTAT_BASE (LPC17_40_TXDESC_BASE+LPC17_40_TXDESCTAB_SIZE)
+#define LPC17_40_RXDESC_BASE (LPC17_40_TXSTAT_BASE+LPC17_40_TXSTATTAB_SIZE)
+#define LPC17_40_RXSTAT_BASE (LPC17_40_RXDESC_BASE + LPC17_40_RXDESCTAB_SIZE)
/* Now carve up the beginning of SRAM for packet memory. The size of a
* packet buffer is related to the size of the MTU. We'll round sizes up
* to multiples of 256 bytes.
*/
-#define LPC17_PKTMEM_BASE LPC17_EMACRAM_BASE
-#define LPC17_PKTMEM_SIZE (LPC17_EMACRAM_SIZE-LPC17_DESCTAB_SIZE)
-#define LPC17_PKTMEM_END (LPC17_EMACRAM_BASE+LPC17_PKTMEM_SIZE)
+#define LPC17_40_PKTMEM_BASE LPC17_40_EMACRAM_BASE
+#define LPC17_40_PKTMEM_SIZE (LPC17_40_EMACRAM_SIZE-LPC17_40_DESCTAB_SIZE)
+#define LPC17_40_PKTMEM_END (LPC17_40_EMACRAM_BASE+LPC17_40_PKTMEM_SIZE)
-#define LPC17_MAXPACKET_SIZE ((CONFIG_NET_ETH_PKTSIZE + CONFIG_NET_GUARDSIZE + 3) & ~3)
-#define LPC17_NTXPKTS CONFIG_LPC17_ETH_NTXDESC
-#define LPC17_NRXPKTS CONFIG_LPC17_ETH_NRXDESC
+#define LPC17_40_MAXPACKET_SIZE ((CONFIG_NET_ETH_PKTSIZE + CONFIG_NET_GUARDSIZE + 3) & ~3)
+#define LPC17_40_NTXPKTS CONFIG_LPC17_40_ETH_NTXDESC
+#define LPC17_40_NRXPKTS CONFIG_LPC17_40_ETH_NRXDESC
-#define LPC17_TXBUFFER_SIZE (LPC17_NTXPKTS * LPC17_MAXPACKET_SIZE)
-#define LPC17_RXBUFFER_SIZE (LPC17_NRXPKTS * LPC17_MAXPACKET_SIZE)
-#define LPC17_BUFFER_SIZE (LPC17_TXBUFFER_SIZE + LPC17_RXBUFFER_SIZE)
+#define LPC17_40_TXBUFFER_SIZE (LPC17_40_NTXPKTS * LPC17_40_MAXPACKET_SIZE)
+#define LPC17_40_RXBUFFER_SIZE (LPC17_40_NRXPKTS * LPC17_40_MAXPACKET_SIZE)
+#define LPC17_40_BUFFER_SIZE (LPC17_40_TXBUFFER_SIZE + LPC17_40_RXBUFFER_SIZE)
-#define LPC17_BUFFER_BASE LPC17_PKTMEM_BASE
-#define LPC17_TXBUFFER_BASE LPC17_BUFFER_BASE
-#define LPC17_RXBUFFER_BASE (LPC17_TXBUFFER_BASE + LPC17_TXBUFFER_SIZE)
-#define LPC17_BUFFER_END (LPC17_BUFFER_BASE + LPC17_BUFFER_SIZE)
+#define LPC17_40_BUFFER_BASE LPC17_40_PKTMEM_BASE
+#define LPC17_40_TXBUFFER_BASE LPC17_40_BUFFER_BASE
+#define LPC17_40_RXBUFFER_BASE (LPC17_40_TXBUFFER_BASE + LPC17_40_TXBUFFER_SIZE)
+#define LPC17_40_BUFFER_END (LPC17_40_BUFFER_BASE + LPC17_40_BUFFER_SIZE)
-#if LPC17_BUFFER_END > LPC17_PKTMEM_END
+#if LPC17_40_BUFFER_END > LPC17_40_PKTMEM_END
# error "Packet memory overlaps descriptor tables"
#endif
@@ -197,5 +197,5 @@
* Public Functions
************************************************************************************/
-#endif /* CONFIG_NET && CONFIG_LPC17_ETHERNET && LPC17_NETHCONTROLLERS > 0*/
-#endif /* __ARCH_ARM_SRC_LPC17XX_LPC17_EMACRAM_H */
+#endif /* CONFIG_NET && CONFIG_LPC17_40_ETHERNET && LPC17_40_NETHCONTROLLERS > 0*/
+#endif /* __ARCH_ARM_SRC_LPC17XX_40XX_LPC17_40_EMACRAM_H */
diff --git a/arch/arm/src/lpc17xx/lpc17_emc.c b/arch/arm/src/lpc17xx_40xx/lpc17_40_emc.c
similarity index 84%
rename from arch/arm/src/lpc17xx/lpc17_emc.c
rename to arch/arm/src/lpc17xx_40xx/lpc17_40_emc.c
index ca24d060bd5..c12898c35ef 100644
--- a/arch/arm/src/lpc17xx/lpc17_emc.c
+++ b/arch/arm/src/lpc17xx_40xx/lpc17_40_emc.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * arch/arm/src/lpc17/lpc17_emc.c
+ * arch/arm/src/lpc17/lpc17_40_emc.c
*
* Copyright (C) 2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt
@@ -45,9 +45,9 @@
#include "up_arch.h"
-#include "hardware/lpc17_syscon.h"
-#include "lpc17_gpio.h"
-#include "lpc17_emc.h"
+#include "hardware/lpc17_40_syscon.h"
+#include "lpc17_40_gpio.h"
+#include "lpc17_40_emc.h"
/****************************************************************************
* Pre-processor Definitions
@@ -61,7 +61,7 @@
* Private Data
****************************************************************************/
-static const lpc17_pinset_t g_emcctrl[] =
+static const lpc17_40_pinset_t g_emcctrl[] =
{
GPIO_EMC_OE, GPIO_EMC_WE,
GPIO_EMC_BLS0, GPIO_EMC_BLS1, GPIO_EMC_BLS2, GPIO_EMC_BLS3,
@@ -72,9 +72,9 @@ static const lpc17_pinset_t g_emcctrl[] =
GPIO_EMC_CKE0, GPIO_EMC_CKE1, GPIO_EMC_CKE2, GPIO_EMC_CKE3,
GPIO_EMC_DQM0, GPIO_EMC_DQM1, GPIO_EMC_DQM2, GPIO_EMC_DQM3,
};
-#define EMC_NCTRL (sizeof(g_emcctrl) / sizeof(lpc17_pinset_t))
+#define EMC_NCTRL (sizeof(g_emcctrl) / sizeof(lpc17_40_pinset_t))
-static const lpc17_pinset_t g_emcdata[] =
+static const lpc17_40_pinset_t g_emcdata[] =
{
GPIO_EMC_D0, GPIO_EMC_D1, GPIO_EMC_D2, GPIO_EMC_D3,
GPIO_EMC_D4, GPIO_EMC_D5, GPIO_EMC_D6, GPIO_EMC_D7,
@@ -93,10 +93,10 @@ static const lpc17_pinset_t g_emcdata[] =
#ifdef BOARD_NDATA
# define EMC_NDATA BOARD_NDATA
#else
-# define EMC_NDATA (sizeof(g_emcdata) / sizeof(lpc17_pinset_t))
+# define EMC_NDATA (sizeof(g_emcdata) / sizeof(lpc17_40_pinset_t))
#endif
-static const lpc17_pinset_t g_emcaddr[] =
+static const lpc17_40_pinset_t g_emcaddr[] =
{
GPIO_EMC_A0, GPIO_EMC_A1, GPIO_EMC_A2, GPIO_EMC_A3,
GPIO_EMC_A4, GPIO_EMC_A5, GPIO_EMC_A6, GPIO_EMC_A7,
@@ -114,7 +114,7 @@ static const lpc17_pinset_t g_emcaddr[] =
#ifdef BOARD_NADDR
# define EMC_NADDR BOARD_NADDR
#else
-# define EMC_NADDR (sizeof(g_emcaddr) / sizeof(lpc17_pinset_t))
+# define EMC_NADDR (sizeof(g_emcaddr) / sizeof(lpc17_40_pinset_t))
#endif
/****************************************************************************
@@ -123,7 +123,7 @@ static const lpc17_pinset_t g_emcaddr[] =
/*****************************************************************************
* Name:
- * lpc17_running_from_sdram
+ * lpc17_40_running_from_sdram
*
* Descriptions:
* Check whether currently execution from SDRAM.
@@ -133,13 +133,13 @@ static const lpc17_pinset_t g_emcaddr[] =
*
****************************************************************************/
-static int lpc17_running_from_sdram(void)
+static int lpc17_40_running_from_sdram(void)
{
- uint32_t extdram_bank_size = LPC17_EXTDRAM_CS3 - LPC17_EXTDRAM_CS2;
- uint32_t extdram_end = LPC17_EXTDRAM_CS3 + extdram_bank_size;
+ uint32_t extdram_bank_size = LPC17_40_EXTDRAM_CS3 - LPC17_40_EXTDRAM_CS2;
+ uint32_t extdram_end = LPC17_40_EXTDRAM_CS3 + extdram_bank_size;
- if (((uint32_t)lpc17_running_from_sdram >= LPC17_EXTDRAM_CS0) &&
- ((uint32_t)lpc17_running_from_sdram < extdram_end))
+ if (((uint32_t)lpc17_40_running_from_sdram >= LPC17_40_EXTDRAM_CS0) &&
+ ((uint32_t)lpc17_40_running_from_sdram < extdram_end))
{
return 1;
}
@@ -154,7 +154,7 @@ static int lpc17_running_from_sdram(void)
****************************************************************************/
/****************************************************************************
- * Name: lpc17_emcinitialize
+ * Name: lpc17_40_emcinitialize
*
* Description:
* Initialize EMC clocking and pin configuration. This function should be
@@ -163,16 +163,16 @@ static int lpc17_running_from_sdram(void)
*
****************************************************************************/
-void lpc17_emcinitialize(void)
+void lpc17_40_emcinitialize(void)
{
uint32_t regval;
int i;
/* Enable clocking for the EMC */
- regval = getreg32(LPC17_SYSCON_PCONP);
+ regval = getreg32(LPC17_40_SYSCON_PCONP);
regval |= SYSCON_PCONP_PCEMC;
- putreg32(regval, LPC17_SYSCON_PCONP);
+ putreg32(regval, LPC17_40_SYSCON_PCONP);
/* Set EMC delay values:
*
@@ -189,7 +189,7 @@ void lpc17_emcinitialize(void)
* (CLKOUT1DLY+1) * 250 picoseconds.
*/
- if (lpc17_running_from_sdram())
+ if (lpc17_40_running_from_sdram())
{
return;
}
@@ -198,32 +198,32 @@ void lpc17_emcinitialize(void)
SYSCON_EMCDLYCTL_FBCLKDLY(BOARD_FBCLKDLY) |
SYSCON_EMCDLYCTL_CLKOUT0DLY(BOARD_CLKOUT0DLY) |
SYSCON_EMCDLYCTL_CLKOUT1DLY(BOARD_CLKOUT1DLY);
- putreg32(regval, LPC17_SYSCON_EMCDLYCTL);
+ putreg32(regval, LPC17_40_SYSCON_EMCDLYCTL);
/* Enable the EMC */
- putreg32(EMC_CONTROL_E, LPC17_EMC_CONTROL);
- putreg32(0, LPC17_EMC_CONFIG);
+ putreg32(EMC_CONTROL_E, LPC17_40_EMC_CONTROL);
+ putreg32(0, LPC17_40_EMC_CONFIG);
/* Configure EMC pins */
/* Control signals */
for (i = 0; i < EMC_NCTRL; i++)
{
- lpc17_configgpio(g_emcctrl[i]);
+ lpc17_40_configgpio(g_emcctrl[i]);
}
/* Data lines */
for (i = 0; i < EMC_NDATA; i++)
{
- lpc17_configgpio(g_emcdata[i]);
+ lpc17_40_configgpio(g_emcdata[i]);
}
/* Address lines */
for (i = 0; i < EMC_NADDR; i++)
{
- lpc17_configgpio(g_emcaddr[i]);
+ lpc17_40_configgpio(g_emcaddr[i]);
}
}
diff --git a/arch/arm/src/lpc17xx/lpc17_emc.h b/arch/arm/src/lpc17xx_40xx/lpc17_40_emc.h
similarity index 90%
rename from arch/arm/src/lpc17xx/lpc17_emc.h
rename to arch/arm/src/lpc17xx_40xx/lpc17_40_emc.h
index 4b020762fe1..454faf40bb4 100644
--- a/arch/arm/src/lpc17xx/lpc17_emc.h
+++ b/arch/arm/src/lpc17xx_40xx/lpc17_40_emc.h
@@ -1,5 +1,5 @@
/****************************************************************************
- * arch/arm/src/lpc17xx/lpc17_emc.h
+ * arch/arm/src/lpc17xx_40xx/lpc17_40_emc.h
*
* Copyright (C) 2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt
@@ -33,15 +33,15 @@
*
****************************************************************************/
-#ifndef __ARCH_ARM_SRC_LPC17XX_LPC17_EMC_H
-#define __ARCH_ARM_SRC_LPC17XX_LPC17_EMC_H
+#ifndef __ARCH_ARM_SRC_LPC17XX_40XX_LPC17_40_EMC_H
+#define __ARCH_ARM_SRC_LPC17XX_40XX_LPC17_40_EMC_H
/****************************************************************************
* Included Files
****************************************************************************/
#include
-#include "hardware/lpc17_emc.h"
+#include "hardware/lpc17_40_emc.h"
/****************************************************************************
* Pre-processor Definitions
@@ -60,7 +60,7 @@
****************************************************************************/
/****************************************************************************
- * Name: lpc17_emcinitialize
+ * Name: lpc17_40_emcinitialize
*
* Description:
* Initialize EMC clocking and pin configuration. This function should be
@@ -69,6 +69,6 @@
*
****************************************************************************/
-void lpc17_emcinitialize(void);
+void lpc17_40_emcinitialize(void);
-#endif /* __ARCH_ARM_SRC_LPC17XX_LPC17_EMC_H */
+#endif /* __ARCH_ARM_SRC_LPC17XX_40XX_LPC17_40_EMC_H */
diff --git a/arch/arm/src/lpc17xx/lpc17_ethernet.c b/arch/arm/src/lpc17xx_40xx/lpc17_40_ethernet.c
similarity index 73%
rename from arch/arm/src/lpc17xx/lpc17_ethernet.c
rename to arch/arm/src/lpc17xx_40xx/lpc17_40_ethernet.c
index de08bb75cd8..3f500b6d336 100644
--- a/arch/arm/src/lpc17xx/lpc17_ethernet.c
+++ b/arch/arm/src/lpc17xx_40xx/lpc17_40_ethernet.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * arch/arm/src/lpc17xx/lpc17_ethernet.c
+ * arch/arm/src/lpc17xx_40xx/lpc17_40_ethernet.c
*
* Copyright (C) 2010-2015, 2017-2018 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt
@@ -38,7 +38,7 @@
****************************************************************************/
#include
-#if defined(CONFIG_NET) && defined(CONFIG_LPC17_ETHERNET)
+#if defined(CONFIG_NET) && defined(CONFIG_LPC17_40_ETHERNET)
#include
#include
@@ -65,17 +65,17 @@
#include "up_arch.h"
#include "chip.h"
-#include "hardware/lpc17_syscon.h"
-#include "lpc17_gpio.h"
-#include "lpc17_ethernet.h"
-#include "lpc17_emacram.h"
-#include "lpc17_clrpend.h"
+#include "hardware/lpc17_40_syscon.h"
+#include "lpc17_40_gpio.h"
+#include "lpc17_40_ethernet.h"
+#include "lpc17_40_emacram.h"
+#include "lpc17_40_clrpend.h"
#include
/* Does this chip have an Ethernet controller? */
-#if LPC17_NETHCONTROLLERS > 0
+#if LPC17_40_NETHCONTROLLERS > 0
/****************************************************************************
* Pre-processor Definitions
@@ -100,31 +100,31 @@
#define ETHWORK LPWORK
-/* CONFIG_LPC17_NINTERFACES determines the number of physical interfaces
+/* CONFIG_LPC17_40_NINTERFACES determines the number of physical interfaces
* that will be supported -- unless it is more than actually supported by the
* hardware!
*/
-#if !defined(CONFIG_LPC17_NINTERFACES) || CONFIG_LPC17_NINTERFACES > LPC17_NETHCONTROLLERS
-# undef CONFIG_LPC17_NINTERFACES
-# define CONFIG_LPC17_NINTERFACES LPC17_NETHCONTROLLERS
+#if !defined(CONFIG_LPC17_40_NINTERFACES) || CONFIG_LPC17_40_NINTERFACES > LPC17_40_NETHCONTROLLERS
+# undef CONFIG_LPC17_40_NINTERFACES
+# define CONFIG_LPC17_40_NINTERFACES LPC17_40_NETHCONTROLLERS
#endif
/* The logic here has a few hooks for support for multiple interfaces, but
* that capability is not yet in place (and I won't worry about it until I get
- * the first multi-interface LPC17xx).
+ * the first multi-interface LPC17xx/LPC40xx).
*/
-#if CONFIG_LPC17_NINTERFACES > 1
+#if CONFIG_LPC17_40_NINTERFACES > 1
# warning "Only a single ethernet controller is supported"
-# undef CONFIG_LPC17_NINTERFACES
-# define CONFIG_LPC17_NINTERFACES 1
+# undef CONFIG_LPC17_40_NINTERFACES
+# define CONFIG_LPC17_40_NINTERFACES 1
#endif
/* If IGMP is enabled, then accept multi-cast frames. */
-#if defined(CONFIG_NET_MCASTGROUP) && !defined(CONFIG_LPC17_MULTICAST)
-# define CONFIG_LPC17_MULTICAST 1
+#if defined(CONFIG_NET_MCASTGROUP) && !defined(CONFIG_LPC17_40_MULTICAST)
+# define CONFIG_LPC17_40_MULTICAST 1
#endif
#define PKTBUF_SIZE (MAX_NETDEV_PKTSIZE + CONFIG_NET_GUARDSIZE)
@@ -133,7 +133,7 @@
/* Register debug -- can only happen of CONFIG_DEBUG_NET_INFO is selected */
#ifndef CONFIG_DEBUG_NET_INFO
-# undef CONFIG_LPC17_NET_REGDEBUG
+# undef CONFIG_LPC17_40_NET_REGDEBUG
#endif
/* CONFIG_NET_DUMPPACKET will dump the contents of each packet to the
@@ -145,20 +145,20 @@
#endif
#ifdef CONFIG_NET_DUMPPACKET
-# define lpc17_dumppacket(m,a,n) lib_dumpbuffer(m,a,n)
+# define lpc17_40_dumppacket(m,a,n) lib_dumpbuffer(m,a,n)
#else
-# define lpc17_dumppacket(m,a,n)
+# define lpc17_40_dumppacket(m,a,n)
#endif
/* Timing *******************************************************************/
/* TX poll deley = 1 seconds. CLK_TCK is the number of clock ticks per second */
-#define LPC17_WDDELAY (1*CLK_TCK)
+#define LPC17_40_WDDELAY (1*CLK_TCK)
/* TX timeout = 1 minute */
-#define LPC17_TXTIMEOUT (60*CLK_TCK)
+#define LPC17_40_TXTIMEOUT (60*CLK_TCK)
/* Interrupts ***************************************************************/
@@ -181,63 +181,63 @@
/* Select PHY-specific values. Add more PHYs as needed. */
#if defined(CONFIG_ETH0_PHY_KS8721)
-# define LPC17_PHYNAME "KS8721"
-# define LPC17_PHYID1 MII_PHYID1_KS8721
-# define LPC17_PHYID2 MII_PHYID2_KS8721
-# define LPC17_HAVE_PHY 1
+# define LPC17_40_PHYNAME "KS8721"
+# define LPC17_40_PHYID1 MII_PHYID1_KS8721
+# define LPC17_40_PHYID2 MII_PHYID2_KS8721
+# define LPC17_40_HAVE_PHY 1
#elif defined(CONFIG_ETH0_PHY_KSZ8041)
-# define LPC17_PHYNAME "KSZ8041"
-# define LPC17_PHYID1 MII_PHYID1_KSZ8041
-# define LPC17_PHYID2 MII_PHYID2_KSZ8041
-# define LPC17_HAVE_PHY 1
+# define LPC17_40_PHYNAME "KSZ8041"
+# define LPC17_40_PHYID1 MII_PHYID1_KSZ8041
+# define LPC17_40_PHYID2 MII_PHYID2_KSZ8041
+# define LPC17_40_HAVE_PHY 1
#elif defined(CONFIG_ETH0_PHY_DP83848C)
-# define LPC17_PHYNAME "DP83848C"
-# define LPC17_PHYID1 MII_PHYID1_DP83848C
-# define LPC17_PHYID2 MII_PHYID2_DP83848C
-# define LPC17_HAVE_PHY 1
+# define LPC17_40_PHYNAME "DP83848C"
+# define LPC17_40_PHYID1 MII_PHYID1_DP83848C
+# define LPC17_40_PHYID2 MII_PHYID2_DP83848C
+# define LPC17_40_HAVE_PHY 1
#elif defined(CONFIG_ETH0_PHY_LAN8720)
-# define LPC17_PHYNAME "LAN8720"
-# define LPC17_PHYID1 MII_PHYID1_LAN8720
-# define LPC17_PHYID2 MII_PHYID2_LAN8720
-# define LPC17_HAVE_PHY 1
+# define LPC17_40_PHYNAME "LAN8720"
+# define LPC17_40_PHYID1 MII_PHYID1_LAN8720
+# define LPC17_40_PHYID2 MII_PHYID2_LAN8720
+# define LPC17_40_HAVE_PHY 1
#elif defined(CONFIG_ETH0_PHY_KSZ8081)
-# define LPC17_PHYNAME "KSZ8081"
-# define LPC17_PHYID1 MII_PHYID1_KSZ8081
-# define LPC17_PHYID2 MII_PHYID2_KSZ8081
-# define LPC17_HAVE_PHY 1
+# define LPC17_40_PHYNAME "KSZ8081"
+# define LPC17_40_PHYID1 MII_PHYID1_KSZ8081
+# define LPC17_40_PHYID2 MII_PHYID2_KSZ8081
+# define LPC17_40_HAVE_PHY 1
#else
# warning "No PHY specified!"
-# undef LPC17_HAVE_PHY
+# undef LPC17_40_HAVE_PHY
#endif
#define MII_BIG_TIMEOUT 666666
/* These definitions are used to remember the speed/duplex settings */
-#define LPC17_SPEED_MASK 0x01
-#define LPC17_SPEED_100 0x01
-#define LPC17_SPEED_10 0x00
+#define LPC17_40_SPEED_MASK 0x01
+#define LPC17_40_SPEED_100 0x01
+#define LPC17_40_SPEED_10 0x00
-#define LPC17_DUPLEX_MASK 0x02
-#define LPC17_DUPLEX_FULL 0x02
-#define LPC17_DUPLEX_HALF 0x00
+#define LPC17_40_DUPLEX_MASK 0x02
+#define LPC17_40_DUPLEX_FULL 0x02
+#define LPC17_40_DUPLEX_HALF 0x00
-#define LPC17_10BASET_HD (LPC17_SPEED_10 | LPC17_DUPLEX_HALF)
-#define LPC17_10BASET_FD (LPC17_SPEED_10 | LPC17_DUPLEX_FULL)
-#define LPC17_100BASET_HD (LPC17_SPEED_100 | LPC17_DUPLEX_HALF)
-#define LPC17_100BASET_FD (LPC17_SPEED_100 | LPC17_DUPLEX_FULL)
+#define LPC17_40_10BASET_HD (LPC17_40_SPEED_10 | LPC17_40_DUPLEX_HALF)
+#define LPC17_40_10BASET_FD (LPC17_40_SPEED_10 | LPC17_40_DUPLEX_FULL)
+#define LPC17_40_100BASET_HD (LPC17_40_SPEED_100 | LPC17_40_DUPLEX_HALF)
+#define LPC17_40_100BASET_FD (LPC17_40_SPEED_100 | LPC17_40_DUPLEX_FULL)
-#ifdef CONFIG_LPC17_PHY_SPEED100
-# ifdef CONFIG_LPC17_PHY_FDUPLEX
-# define LPC17_MODE_DEFLT LPC17_100BASET_FD
+#ifdef CONFIG_LPC17_40_PHY_SPEED100
+# ifdef CONFIG_LPC17_40_PHY_FDUPLEX
+# define LPC17_40_MODE_DEFLT LPC17_40_100BASET_FD
# else
-# define LPC17_MODE_DEFLT LPC17_100BASET_HD
+# define LPC17_40_MODE_DEFLT LPC17_40_100BASET_HD
# endif
#else
-# ifdef CONFIG_LPC17_PHY_FDUPLEX
-# define LPC17_MODE_DEFLT LPC17_10BASET_FD
+# ifdef CONFIG_LPC17_40_PHY_FDUPLEX
+# define LPC17_40_MODE_DEFLT LPC17_40_10BASET_FD
# else
-# define LPC17_MODE_DEFLT LPC17_10BASET_HD
+# define LPC17_40_MODE_DEFLT LPC17_40_10BASET_HD
# endif
#endif
@@ -279,17 +279,17 @@
* Private Types
****************************************************************************/
-/* The lpc17_driver_s encapsulates all state information for a single hardware
+/* The lpc17_40_driver_s encapsulates all state information for a single hardware
* interface
*/
-struct lpc17_driver_s
+struct lpc17_40_driver_s
{
/* The following fields would only be necessary on chips that support
* multiple Ethernet controllers.
*/
-#if CONFIG_LPC17_NINTERFACES > 1
+#if CONFIG_LPC17_40_NINTERFACES > 1
uint32_t lp_base; /* Ethernet controller base address */
int lp_irq; /* Ethernet controller IRQ */
#endif
@@ -297,7 +297,7 @@ struct lpc17_driver_s
bool lp_ifup; /* true:ifup false:ifdown */
bool lp_mode; /* speed/duplex */
bool lp_txpending; /* There is a pending Tx in lp_dev */
-#ifdef LPC17_HAVE_PHY
+#ifdef LPC17_40_HAVE_PHY
uint8_t lp_phyaddr; /* PHY device address */
#endif
uint32_t lp_inten; /* Shadow copy of INTEN register */
@@ -320,11 +320,11 @@ struct lpc17_driver_s
/* A single packet buffer per interface is used */
-static uint8_t g_pktbuf[PKTBUF_SIZE * CONFIG_LPC17_NINTERFACES];
+static uint8_t g_pktbuf[PKTBUF_SIZE * CONFIG_LPC17_40_NINTERFACES];
/* Array of ethernet driver status structures */
-static struct lpc17_driver_s g_ethdrvr[CONFIG_LPC17_NINTERFACES];
+static struct lpc17_40_driver_s g_ethdrvr[CONFIG_LPC17_40_NINTERFACES];
/* ENET pins are on P1[0,1,4,6,8,9,10,14,15] + MDC on P1[16] or P2[8] and
* MDIO on P1[17] or P2[9]. The board.h file will define GPIO_ENET_MDC and
@@ -345,131 +345,131 @@ static const uint16_t g_enetpins[GPIO_NENET_PINS] =
/* Register operations */
-#ifdef CONFIG_LPC17_NET_REGDEBUG
-static void lpc17_printreg(uint32_t addr, uint32_t val, bool iswrite);
-static void lpc17_checkreg(uint32_t addr, uint32_t val, bool iswrite);
-static uint32_t lpc17_getreg(uint32_t addr);
-static void lpc17_putreg(uint32_t val, uint32_t addr);
+#ifdef CONFIG_LPC17_40_NET_REGDEBUG
+static void lpc17_40_printreg(uint32_t addr, uint32_t val, bool iswrite);
+static void lpc17_40_checkreg(uint32_t addr, uint32_t val, bool iswrite);
+static uint32_t lpc17_40_getreg(uint32_t addr);
+static void lpc17_40_putreg(uint32_t val, uint32_t addr);
#else
-# define lpc17_getreg(addr) getreg32(addr)
-# define lpc17_putreg(val,addr) putreg32(val,addr)
+# define lpc17_40_getreg(addr) getreg32(addr)
+# define lpc17_40_putreg(val,addr) putreg32(val,addr)
#endif
/* Common TX logic */
-static int lpc17_txdesc(struct lpc17_driver_s *priv);
-static int lpc17_transmit(struct lpc17_driver_s *priv);
-static int lpc17_txpoll(struct net_driver_s *dev);
+static int lpc17_40_txdesc(struct lpc17_40_driver_s *priv);
+static int lpc17_40_transmit(struct lpc17_40_driver_s *priv);
+static int lpc17_40_txpoll(struct net_driver_s *dev);
/* Interrupt handling */
-static void lpc17_response(struct lpc17_driver_s *priv);
+static void lpc17_40_response(struct lpc17_40_driver_s *priv);
-static void lpc17_txdone_work(FAR void *arg);
-static void lpc17_rxdone_work(FAR void *arg);
-static int lpc17_interrupt(int irq, void *context, FAR void *arg);
+static void lpc17_40_txdone_work(FAR void *arg);
+static void lpc17_40_rxdone_work(FAR void *arg);
+static int lpc17_40_interrupt(int irq, void *context, FAR void *arg);
/* Watchdog timer expirations */
-static void lpc17_txtimeout_work(FAR void *arg);
-static void lpc17_txtimeout_expiry(int argc, uint32_t arg, ...);
+static void lpc17_40_txtimeout_work(FAR void *arg);
+static void lpc17_40_txtimeout_expiry(int argc, uint32_t arg, ...);
-static void lpc17_poll_work(FAR void *arg);
-static void lpc17_poll_expiry(int argc, uint32_t arg, ...);
+static void lpc17_40_poll_work(FAR void *arg);
+static void lpc17_40_poll_expiry(int argc, uint32_t arg, ...);
/* NuttX callback functions */
#ifdef CONFIG_NET_ICMPv6
-static void lpc17_ipv6multicast(FAR struct lpc17_driver_s *priv);
+static void lpc17_40_ipv6multicast(FAR struct lpc17_40_driver_s *priv);
#endif
-static int lpc17_ifup(struct net_driver_s *dev);
-static int lpc17_ifdown(struct net_driver_s *dev);
+static int lpc17_40_ifup(struct net_driver_s *dev);
+static int lpc17_40_ifdown(struct net_driver_s *dev);
-static void lpc17_txavail_work(FAR void *arg);
-static int lpc17_txavail(struct net_driver_s *dev);
+static void lpc17_40_txavail_work(FAR void *arg);
+static int lpc17_40_txavail(struct net_driver_s *dev);
#if defined(CONFIG_NET_MCASTGROUP) || defined(CONFIG_NET_ICMPv6)
-static uint32_t lpc17_calcethcrc(const uint8_t *data, size_t length);
-static int lpc17_addmac(struct net_driver_s *dev, const uint8_t *mac);
+static uint32_t lpc17_40_calcethcrc(const uint8_t *data, size_t length);
+static int lpc17_40_addmac(struct net_driver_s *dev, const uint8_t *mac);
#endif
#ifdef CONFIG_NET_MCASTGROUP
-static int lpc17_rmmac(struct net_driver_s *dev, const uint8_t *mac);
+static int lpc17_40_rmmac(struct net_driver_s *dev, const uint8_t *mac);
#endif
#ifdef CONFIG_NETDEV_IOCTL
-static int lpc17_eth_ioctl(struct net_driver_s *dev, int cmd,
+static int lpc17_40_eth_ioctl(struct net_driver_s *dev, int cmd,
unsigned long arg);
#endif
/* Initialization functions */
-#if defined(CONFIG_LPC17_NET_REGDEBUG) && defined(CONFIG_DEBUG_GPIO_INFO)
-static void lpc17_showpins(void);
+#if defined(CONFIG_LPC17_40_NET_REGDEBUG) && defined(CONFIG_DEBUG_GPIO_INFO)
+static void lpc17_40_showpins(void);
#else
-# define lpc17_showpins()
+# define lpc17_40_showpins()
#endif
/* PHY initialization functions */
-#ifdef LPC17_HAVE_PHY
-# ifdef CONFIG_LPC17_NET_REGDEBUG
-static void lpc17_showmii(uint8_t phyaddr, const char *msg);
+#ifdef LPC17_40_HAVE_PHY
+# ifdef CONFIG_LPC17_40_NET_REGDEBUG
+static void lpc17_40_showmii(uint8_t phyaddr, const char *msg);
# else
-# define lpc17_showmii(phyaddr,msg)
+# define lpc17_40_showmii(phyaddr,msg)
# endif
#if defined(CONFIG_NETDEV_PHY_IOCTL) && defined(CONFIG_ARCH_PHY_INTERRUPT)
-static int lpc17_phyintenable(FAR struct lpc17_driver_s *priv);
+static int lpc17_40_phyintenable(FAR struct lpc17_40_driver_s *priv);
#endif
-static void lpc17_phywrite(uint8_t phyaddr, uint8_t regaddr,
+static void lpc17_40_phywrite(uint8_t phyaddr, uint8_t regaddr,
uint16_t phydata);
-static uint16_t lpc17_phyread(uint8_t phyaddr, uint8_t regaddr);
-static inline int lpc17_phyreset(uint8_t phyaddr);
-# ifdef CONFIG_LPC17_PHY_AUTONEG
-static inline int lpc17_phyautoneg(uint8_t phyaddr);
+static uint16_t lpc17_40_phyread(uint8_t phyaddr, uint8_t regaddr);
+static inline int lpc17_40_phyreset(uint8_t phyaddr);
+# ifdef CONFIG_LPC17_40_PHY_AUTONEG
+static inline int lpc17_40_phyautoneg(uint8_t phyaddr);
# endif
-static int lpc17_phymode(uint8_t phyaddr, uint8_t mode);
-static inline int lpc17_phyinit(struct lpc17_driver_s *priv);
+static int lpc17_40_phymode(uint8_t phyaddr, uint8_t mode);
+static inline int lpc17_40_phyinit(struct lpc17_40_driver_s *priv);
#else
-# define lpc17_phyinit(priv)
+# define lpc17_40_phyinit(priv)
#endif
/* EMAC Initialization functions */
-static inline void lpc17_txdescinit(struct lpc17_driver_s *priv);
-static inline void lpc17_rxdescinit(struct lpc17_driver_s *priv);
-static void lpc17_macmode(uint8_t mode);
-static void lpc17_ethreset(struct lpc17_driver_s *priv);
+static inline void lpc17_40_txdescinit(struct lpc17_40_driver_s *priv);
+static inline void lpc17_40_rxdescinit(struct lpc17_40_driver_s *priv);
+static void lpc17_40_macmode(uint8_t mode);
+static void lpc17_40_ethreset(struct lpc17_40_driver_s *priv);
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
- * Name: lpc17_printreg
+ * Name: lpc17_40_printreg
*
* Description:
- * Print the contents of an LPC17xx register operation
+ * Print the contents of an LPC17xx/LPC40xx register operation
*
****************************************************************************/
-#ifdef CONFIG_LPC17_NET_REGDEBUG
-static void lpc17_printreg(uint32_t addr, uint32_t val, bool iswrite)
+#ifdef CONFIG_LPC17_40_NET_REGDEBUG
+static void lpc17_40_printreg(uint32_t addr, uint32_t val, bool iswrite)
{
ninfo("%08x%s%08x\n", addr, iswrite ? "<-" : "->", val);
}
#endif
/****************************************************************************
- * Name: lpc17_checkreg
+ * Name: lpc17_40_checkreg
*
* Description:
- * Get the contents of an LPC17xx register
+ * Get the contents of an LPC17xx/LPC40xx register
*
****************************************************************************/
-#ifdef CONFIG_LPC17_NET_REGDEBUG
-static void lpc17_checkreg(uint32_t addr, uint32_t val, bool iswrite)
+#ifdef CONFIG_LPC17_40_NET_REGDEBUG
+static void lpc17_40_checkreg(uint32_t addr, uint32_t val, bool iswrite)
{
static uint32_t prevaddr = 0;
static uint32_t preval = 0;
@@ -500,7 +500,7 @@ static void lpc17_checkreg(uint32_t addr, uint32_t val, bool iswrite)
{
/* Yes.. Just one */
- lpc17_printreg(prevaddr, preval, prevwrite);
+ lpc17_40_printreg(prevaddr, preval, prevwrite);
}
else
{
@@ -519,21 +519,21 @@ static void lpc17_checkreg(uint32_t addr, uint32_t val, bool iswrite)
/* Show the new regisgter access */
- lpc17_printreg(addr, val, iswrite);
+ lpc17_40_printreg(addr, val, iswrite);
}
}
#endif
/****************************************************************************
- * Name: lpc17_getreg
+ * Name: lpc17_40_getreg
*
* Description:
- * Get the contents of an LPC17xx register
+ * Get the contents of an LPC17xx/LPC40xx register
*
****************************************************************************/
-#ifdef CONFIG_LPC17_NET_REGDEBUG
-static uint32_t lpc17_getreg(uint32_t addr)
+#ifdef CONFIG_LPC17_40_NET_REGDEBUG
+static uint32_t lpc17_40_getreg(uint32_t addr)
{
/* Read the value from the register */
@@ -541,25 +541,25 @@ static uint32_t lpc17_getreg(uint32_t addr)
/* Check if we need to print this value */
- lpc17_checkreg(addr, val, false);
+ lpc17_40_checkreg(addr, val, false);
return val;
}
#endif
/****************************************************************************
- * Name: lpc17_putreg
+ * Name: lpc17_40_putreg
*
* Description:
- * Set the contents of an LPC17xx register to a value
+ * Set the contents of an LPC17xx/LPC40xx register to a value
*
****************************************************************************/
-#ifdef CONFIG_LPC17_NET_REGDEBUG
-static void lpc17_putreg(uint32_t val, uint32_t addr)
+#ifdef CONFIG_LPC17_40_NET_REGDEBUG
+static void lpc17_40_putreg(uint32_t val, uint32_t addr)
{
/* Check if we need to print this value */
- lpc17_checkreg(addr, val, true);
+ lpc17_40_checkreg(addr, val, true);
/* Write the value */
@@ -568,7 +568,7 @@ static void lpc17_putreg(uint32_t val, uint32_t addr)
#endif
/****************************************************************************
- * Function: lpc17_txdesc
+ * Function: lpc17_40_txdesc
*
* Description:
* Check if a free TX descriptor is available.
@@ -586,15 +586,15 @@ static void lpc17_putreg(uint32_t val, uint32_t addr)
*
****************************************************************************/
-static int lpc17_txdesc(struct lpc17_driver_s *priv)
+static int lpc17_40_txdesc(struct lpc17_40_driver_s *priv)
{
unsigned int prodidx;
unsigned int considx;
/* Get the next producer index */
- prodidx = lpc17_getreg(LPC17_ETH_TXPRODIDX) & ETH_TXPRODIDX_MASK;
- if (++prodidx >= CONFIG_LPC17_ETH_NTXDESC)
+ prodidx = lpc17_40_getreg(LPC17_40_ETH_TXPRODIDX) & ETH_TXPRODIDX_MASK;
+ if (++prodidx >= CONFIG_LPC17_40_ETH_NTXDESC)
{
/* Wrap back to index zero */
@@ -605,12 +605,12 @@ static int lpc17_txdesc(struct lpc17_driver_s *priv)
* are no available Tx descriptors.
*/
- considx = lpc17_getreg(LPC17_ETH_TXCONSIDX) & ETH_TXCONSIDX_MASK;
+ considx = lpc17_40_getreg(LPC17_40_ETH_TXCONSIDX) & ETH_TXCONSIDX_MASK;
return prodidx != considx ? OK : -EAGAIN;
}
/****************************************************************************
- * Function: lpc17_transmit
+ * Function: lpc17_40_transmit
*
* Description:
* Start hardware transmission. Called either from the txdone interrupt
@@ -629,7 +629,7 @@ static int lpc17_txdesc(struct lpc17_driver_s *priv)
*
****************************************************************************/
-static int lpc17_transmit(struct lpc17_driver_s *priv)
+static int lpc17_40_transmit(struct lpc17_40_driver_s *priv)
{
uint32_t *txdesc;
void *txbuffer;
@@ -640,23 +640,23 @@ static int lpc17_transmit(struct lpc17_driver_s *priv)
* must have assured that there is no transmission in progress.
*/
- DEBUGASSERT(lpc17_txdesc(priv) == OK);
+ DEBUGASSERT(lpc17_40_txdesc(priv) == OK);
/* Increment statistics and dump the packet *if so configured) */
NETDEV_TXPACKETS(&priv->lp_dev);
- lpc17_dumppacket("Transmit packet",
+ lpc17_40_dumppacket("Transmit packet",
priv->lp_dev.d_buf, priv->lp_dev.d_len);
/* Get the current producer index */
- prodidx = lpc17_getreg(LPC17_ETH_TXPRODIDX) & ETH_TXPRODIDX_MASK;
+ prodidx = lpc17_40_getreg(LPC17_40_ETH_TXPRODIDX) & ETH_TXPRODIDX_MASK;
/* Get the packet address from the descriptor and set the descriptor control
* fields.
*/
- txdesc = (uint32_t *)(LPC17_TXDESC_BASE + (prodidx << 3));
+ txdesc = (uint32_t *)(LPC17_40_TXDESC_BASE + (prodidx << 3));
txbuffer = (void *)*txdesc++;
*txdesc = TXDESC_CONTROL_INT | TXDESC_CONTROL_LAST | TXDESC_CONTROL_CRC |
(priv->lp_dev.d_len - 1);
@@ -672,34 +672,34 @@ static int lpc17_transmit(struct lpc17_driver_s *priv)
* DMA memory. This could eliminate the following, costly memcpy.
*/
- DEBUGASSERT(priv->lp_dev.d_len <= LPC17_MAXPACKET_SIZE);
+ DEBUGASSERT(priv->lp_dev.d_len <= LPC17_40_MAXPACKET_SIZE);
memcpy(txbuffer, priv->lp_dev.d_buf, priv->lp_dev.d_len);
/* Bump the producer index, making the packet available for transmission. */
- if (++prodidx >= CONFIG_LPC17_ETH_NTXDESC)
+ if (++prodidx >= CONFIG_LPC17_40_ETH_NTXDESC)
{
/* Wrap back to index zero */
prodidx = 0;
}
- lpc17_putreg(prodidx, LPC17_ETH_TXPRODIDX);
+ lpc17_40_putreg(prodidx, LPC17_40_ETH_TXPRODIDX);
/* Enable Tx interrupts */
priv->lp_inten |= ETH_TXINTS;
- lpc17_putreg(priv->lp_inten, LPC17_ETH_INTEN);
+ lpc17_40_putreg(priv->lp_inten, LPC17_40_ETH_INTEN);
/* Setup the TX timeout watchdog (perhaps restarting the timer) */
- (void)wd_start(priv->lp_txtimeout, LPC17_TXTIMEOUT, lpc17_txtimeout_expiry,
+ (void)wd_start(priv->lp_txtimeout, LPC17_40_TXTIMEOUT, lpc17_40_txtimeout_expiry,
1, (uint32_t)priv);
return OK;
}
/****************************************************************************
- * Function: lpc17_txpoll
+ * Function: lpc17_40_txpoll
*
* Description:
* The transmitter is available, check if the network layer has any
@@ -723,9 +723,9 @@ static int lpc17_transmit(struct lpc17_driver_s *priv)
*
****************************************************************************/
-static int lpc17_txpoll(struct net_driver_s *dev)
+static int lpc17_40_txpoll(struct net_driver_s *dev)
{
- struct lpc17_driver_s *priv = (struct lpc17_driver_s *)dev->d_private;
+ struct lpc17_40_driver_s *priv = (struct lpc17_40_driver_s *)dev->d_private;
int ret = OK;
/* If the polling resulted in data that should be sent out on the network,
@@ -762,13 +762,13 @@ static int lpc17_txpoll(struct net_driver_s *dev)
* at least one more packet in the descriptor list.
*/
- lpc17_transmit(priv);
+ lpc17_40_transmit(priv);
/* Check if there is room in the device to hold another packet. If not,
* return any non-zero value to terminate the poll.
*/
- ret = lpc17_txdesc(priv);
+ ret = lpc17_40_txdesc(priv);
}
}
@@ -780,7 +780,7 @@ static int lpc17_txpoll(struct net_driver_s *dev)
}
/****************************************************************************
- * Function: lpc17_response
+ * Function: lpc17_40_response
*
* Description:
* While processing an RxDone event, higher logic decides to send a packet,
@@ -803,18 +803,18 @@ static int lpc17_txpoll(struct net_driver_s *dev)
*
****************************************************************************/
-static void lpc17_response(struct lpc17_driver_s *priv)
+static void lpc17_40_response(struct lpc17_40_driver_s *priv)
{
int ret;
/* Check if there is room in the device to hold another packet. */
- ret = lpc17_txdesc(priv);
+ ret = lpc17_40_txdesc(priv);
if (ret == OK)
{
/* Yes.. queue the packet now. */
- lpc17_transmit(priv);
+ lpc17_40_transmit(priv);
}
else
{
@@ -826,12 +826,12 @@ static void lpc17_response(struct lpc17_driver_s *priv)
priv->lp_txpending = true;
priv->lp_inten &= ~ETH_RXINTS;
- lpc17_putreg(priv->lp_inten, LPC17_ETH_INTEN);
+ lpc17_40_putreg(priv->lp_inten, LPC17_40_ETH_INTEN);
}
}
/****************************************************************************
- * Function: lpc17_rxdone_work
+ * Function: lpc17_40_rxdone_work
*
* Description:
* Perform Rx interrupt handling logic outside of the interrupt handler (on
@@ -847,9 +847,9 @@ static void lpc17_response(struct lpc17_driver_s *priv)
*
****************************************************************************/
-static void lpc17_rxdone_work(FAR void *arg)
+static void lpc17_40_rxdone_work(FAR void *arg)
{
- FAR struct lpc17_driver_s *priv = (FAR struct lpc17_driver_s *)arg;
+ FAR struct lpc17_40_driver_s *priv = (FAR struct lpc17_40_driver_s *)arg;
irqstate_t flags;
uint32_t *rxstat;
bool fragment;
@@ -867,8 +867,8 @@ static void lpc17_rxdone_work(FAR void *arg)
/* Get the current producer and consumer indices */
- considx = lpc17_getreg(LPC17_ETH_RXCONSIDX) & ETH_RXCONSIDX_MASK;
- prodidx = lpc17_getreg(LPC17_ETH_RXPRODIDX) & ETH_RXPRODIDX_MASK;
+ considx = lpc17_40_getreg(LPC17_40_ETH_RXCONSIDX) & ETH_RXCONSIDX_MASK;
+ prodidx = lpc17_40_getreg(LPC17_40_ETH_RXPRODIDX) & ETH_RXPRODIDX_MASK;
/* Loop while there are incoming packets to be processed, that is, while
* the producer index is not equal to the consumer index.
@@ -883,7 +883,7 @@ static void lpc17_rxdone_work(FAR void *arg)
/* Get the Rx status and packet length (-4+1) */
- rxstat = (uint32_t *)(LPC17_RXSTAT_BASE + (considx << 3));
+ rxstat = (uint32_t *)(LPC17_40_RXSTAT_BASE + (considx << 3));
pktlen = (*rxstat & RXSTAT_INFO_RXSIZE_MASK) - 3;
/* Check for errors. NOTE: The DMA engine reports bogus length errors,
@@ -930,7 +930,7 @@ static void lpc17_rxdone_work(FAR void *arg)
/* Get the Rx buffer address from the Rx descriptor */
- rxdesc = (uint32_t *)(LPC17_RXDESC_BASE + (considx << 3));
+ rxdesc = (uint32_t *)(LPC17_40_RXDESC_BASE + (considx << 3));
rxbuffer = (void *)*rxdesc;
/* Copy the data data from the EMAC DMA RAM to priv->lp_dev.d_buf.
@@ -945,7 +945,7 @@ static void lpc17_rxdone_work(FAR void *arg)
memcpy(priv->lp_dev.d_buf, rxbuffer, pktlen);
priv->lp_dev.d_len = pktlen;
- lpc17_dumppacket("Received packet",
+ lpc17_40_dumppacket("Received packet",
priv->lp_dev.d_buf, priv->lp_dev.d_len);
#ifdef CONFIG_NET_PKT
@@ -995,7 +995,7 @@ static void lpc17_rxdone_work(FAR void *arg)
/* And send the packet */
- lpc17_response(priv);
+ lpc17_40_response(priv);
}
}
else
@@ -1034,7 +1034,7 @@ static void lpc17_rxdone_work(FAR void *arg)
/* And send the packet */
- lpc17_response(priv);
+ lpc17_40_response(priv);
}
}
else
@@ -1052,7 +1052,7 @@ static void lpc17_rxdone_work(FAR void *arg)
if (priv->lp_dev.d_len > 0)
{
- lpc17_response(priv);
+ lpc17_40_response(priv);
}
}
else
@@ -1068,15 +1068,15 @@ static void lpc17_rxdone_work(FAR void *arg)
* might also have gotten bumped up by the hardware).
*/
- if (++considx >= CONFIG_LPC17_ETH_NRXDESC)
+ if (++considx >= CONFIG_LPC17_40_ETH_NRXDESC)
{
/* Wrap back to index zero */
considx = 0;
}
- lpc17_putreg(considx, LPC17_ETH_RXCONSIDX);
- prodidx = lpc17_getreg(LPC17_ETH_RXPRODIDX) & ETH_RXPRODIDX_MASK;
+ lpc17_40_putreg(considx, LPC17_40_ETH_RXCONSIDX);
+ prodidx = lpc17_40_getreg(LPC17_40_ETH_RXPRODIDX) & ETH_RXPRODIDX_MASK;
}
net_unlock();
@@ -1089,7 +1089,7 @@ static void lpc17_rxdone_work(FAR void *arg)
if (!priv->lp_txpending)
{
priv->lp_inten |= ETH_RXINTS;
- lpc17_putreg(priv->lp_inten, LPC17_ETH_INTEN);
+ lpc17_40_putreg(priv->lp_inten, LPC17_40_ETH_INTEN);
}
leave_critical_section(flags);
@@ -1097,7 +1097,7 @@ static void lpc17_rxdone_work(FAR void *arg)
/****************************************************************************
- * Function: lpc17_txdone_work
+ * Function: lpc17_40_txdone_work
*
* Description:
* Perform Tx interrupt handling logic outside of the interrupt handler (on
@@ -1111,16 +1111,16 @@ static void lpc17_rxdone_work(FAR void *arg)
*
****************************************************************************/
-static void lpc17_txdone_work(FAR void *arg)
+static void lpc17_40_txdone_work(FAR void *arg)
{
- FAR struct lpc17_driver_s *priv = (FAR struct lpc17_driver_s *)arg;
+ FAR struct lpc17_40_driver_s *priv = (FAR struct lpc17_40_driver_s *)arg;
/* Verify that the hardware is ready to send another packet. Since a Tx
* just completed, this must be the case.
*/
DEBUGASSERT(priv);
- DEBUGASSERT(lpc17_txdesc(priv) == OK);
+ DEBUGASSERT(lpc17_40_txdesc(priv) == OK);
/* Check if there is a pending Tx transfer that was scheduled by Rx handling
* while the Tx logic was busy. If so, processing that pending Tx now.
@@ -1133,24 +1133,24 @@ static void lpc17_txdone_work(FAR void *arg)
priv->lp_txpending = false;
- lpc17_transmit(priv);
+ lpc17_40_transmit(priv);
priv->lp_inten |= ETH_RXINTS;
- lpc17_putreg(priv->lp_inten, LPC17_ETH_INTEN);
+ lpc17_40_putreg(priv->lp_inten, LPC17_40_ETH_INTEN);
}
/* Otherwise poll the network layer for new XMIT data */
else
{
- (void)devif_poll(&priv->lp_dev, lpc17_txpoll);
+ (void)devif_poll(&priv->lp_dev, lpc17_40_txpoll);
}
net_unlock();
}
/****************************************************************************
- * Function: lpc17_interrupt
+ * Function: lpc17_40_interrupt
*
* Description:
* Hardware interrupt handler
@@ -1166,12 +1166,12 @@ static void lpc17_txdone_work(FAR void *arg)
*
****************************************************************************/
-static int lpc17_interrupt(int irq, void *context, FAR void *arg)
+static int lpc17_40_interrupt(int irq, void *context, FAR void *arg)
{
- register struct lpc17_driver_s *priv;
+ register struct lpc17_40_driver_s *priv;
uint32_t status;
-#if CONFIG_LPC17_NINTERFACES > 1
+#if CONFIG_LPC17_40_NINTERFACES > 1
# error "A mechanism to associate and interface with an IRQ is needed"
#else
priv = &g_ethdrvr[0];
@@ -1179,17 +1179,17 @@ static int lpc17_interrupt(int irq, void *context, FAR void *arg)
/* Get the interrupt status (zero means no interrupts pending). */
- status = lpc17_getreg(LPC17_ETH_INTST);
+ status = lpc17_40_getreg(LPC17_40_ETH_INTST);
if (status != 0)
{
/* Clear all pending interrupts */
- lpc17_putreg(status, LPC17_ETH_INTCLR);
+ lpc17_40_putreg(status, LPC17_40_ETH_INTCLR);
/* Handle each pending interrupt **************************************/
/* Check for Wake-Up on Lan *******************************************/
-#ifdef CONFIG_LPC17_ETH_WOL
+#ifdef CONFIG_LPC17_40_ETH_WOL
if ((status & ETH_INT_WKUP) != 0)
{
# warning "Missing logic"
@@ -1223,14 +1223,14 @@ static int lpc17_interrupt(int irq, void *context, FAR void *arg)
/* ifup() will reset the EMAC and bring it back up */
- (void)lpc17_ifup(&priv->lp_dev);
+ (void)lpc17_40_ifup(&priv->lp_dev);
}
else
{
/* Check for receive events ***************************************/
/* RX ERROR -- Triggered on receive errors: AlignmentError,
* RangeError, LengthError, SymbolError, CRCError or NoDescriptor
- * or Overrun. NOTE: (1) We will still need to call lpc17_rxdone_process
+ * or Overrun. NOTE: (1) We will still need to call lpc17_40_rxdone_process
* on RX errors to bump the considx over the bad packet. (2) The
* DMA engine reports bogus length errors, making this a pretty
* useless (as well as annoying) check anyway.
@@ -1262,20 +1262,20 @@ static int lpc17_interrupt(int irq, void *context, FAR void *arg)
*/
priv->lp_inten &= ~ETH_RXINTS;
- lpc17_putreg(priv->lp_inten, LPC17_ETH_INTEN);
+ lpc17_40_putreg(priv->lp_inten, LPC17_40_ETH_INTEN);
/* Schedule RX-related work to be performed on the work thread,
* perhaps cancelling any pending RX work.
*/
- work_queue(ETHWORK, &priv->lp_rxwork, (worker_t)lpc17_rxdone_work,
+ work_queue(ETHWORK, &priv->lp_rxwork, (worker_t)lpc17_40_rxdone_work,
priv, 0);
}
/* Check for Tx events ********************************************/
/* TX ERROR -- Triggered on transmit errors: LateCollision,
* ExcessiveCollision and ExcessiveDefer, NoDescriptor or Underrun.
- * NOTE: We will still need to call lpc17_txdone_process() in order to
+ * NOTE: We will still need to call lpc17_40_txdone_process() in order to
* clean up after the failed transmit.
*/
@@ -1312,11 +1312,11 @@ static int lpc17_interrupt(int irq, void *context, FAR void *arg)
/* Disable further Tx interrupts. Tx interrupts may be
* re-enabled again depending upon the actions of
- * lpc17_txdone_process()
+ * lpc17_40_txdone_process()
*/
priv->lp_inten &= ~ETH_TXINTS;
- lpc17_putreg(priv->lp_inten, LPC17_ETH_INTEN);
+ lpc17_40_putreg(priv->lp_inten, LPC17_40_ETH_INTEN);
/* Cancel any pending TX done work (to prevent overruns and also
* to avoid race conditions with the TX timeout work)
@@ -1328,7 +1328,7 @@ static int lpc17_interrupt(int irq, void *context, FAR void *arg)
* perhaps cancelling any pending TX work.
*/
- work_queue(ETHWORK, &priv->lp_txwork, (worker_t)lpc17_txdone_work,
+ work_queue(ETHWORK, &priv->lp_txwork, (worker_t)lpc17_40_txdone_work,
priv, 0);
}
}
@@ -1337,10 +1337,10 @@ static int lpc17_interrupt(int irq, void *context, FAR void *arg)
/* Clear the pending interrupt */
#if 0 /* Apparently not necessary */
-# if CONFIG_LPC17_NINTERFACES > 1
- lpc17_clrpend(priv->irq);
+# if CONFIG_LPC17_40_NINTERFACES > 1
+ lpc17_40_clrpend(priv->irq);
# else
- lpc17_clrpend(LPC17_IRQ_ETH);
+ lpc17_40_clrpend(LPC17_40_IRQ_ETH);
# endif
#endif
@@ -1348,7 +1348,7 @@ static int lpc17_interrupt(int irq, void *context, FAR void *arg)
}
/****************************************************************************
- * Function: lpc17_txtimeout_work
+ * Function: lpc17_40_txtimeout_work
*
* Description:
* Perform TX timeout related work from the worker thread
@@ -1364,9 +1364,9 @@ static int lpc17_interrupt(int irq, void *context, FAR void *arg)
*
****************************************************************************/
-static void lpc17_txtimeout_work(FAR void *arg)
+static void lpc17_40_txtimeout_work(FAR void *arg)
{
- FAR struct lpc17_driver_s *priv = (FAR struct lpc17_driver_s *)arg;
+ FAR struct lpc17_40_driver_s *priv = (FAR struct lpc17_40_driver_s *)arg;
/* Increment statistics and dump debug info */
@@ -1378,18 +1378,18 @@ static void lpc17_txtimeout_work(FAR void *arg)
* it back up.
*/
- (void)lpc17_ifup(&priv->lp_dev);
+ (void)lpc17_40_ifup(&priv->lp_dev);
/* Then poll the network layer for new XMIT data */
- (void)devif_poll(&priv->lp_dev, lpc17_txpoll);
+ (void)devif_poll(&priv->lp_dev, lpc17_40_txpoll);
}
net_unlock();
}
/****************************************************************************
- * Function: lpc17_txtimeout_expiry
+ * Function: lpc17_40_txtimeout_expiry
*
* Description:
* Our TX watchdog timed out. Called from the timer interrupt handler.
@@ -1407,16 +1407,16 @@ static void lpc17_txtimeout_work(FAR void *arg)
*
****************************************************************************/
-static void lpc17_txtimeout_expiry(int argc, uint32_t arg, ...)
+static void lpc17_40_txtimeout_expiry(int argc, uint32_t arg, ...)
{
- struct lpc17_driver_s *priv = (struct lpc17_driver_s *)arg;
+ struct lpc17_40_driver_s *priv = (struct lpc17_40_driver_s *)arg;
/* Disable further Tx interrupts. Tx interrupts may be re-enabled again
- * depending upon the actions of lpc17_poll_process()
+ * depending upon the actions of lpc17_40_poll_process()
*/
priv->lp_inten &= ~ETH_TXINTS;
- lpc17_putreg(priv->lp_inten, LPC17_ETH_INTEN);
+ lpc17_40_putreg(priv->lp_inten, LPC17_40_ETH_INTEN);
/* Is the single TX work structure available? If not, then there is
* pending TX work to be done this must be a false alarm TX timeout.
@@ -1426,12 +1426,12 @@ static void lpc17_txtimeout_expiry(int argc, uint32_t arg, ...)
{
/* Schedule to perform the interrupt processing on the worker thread. */
- work_queue(ETHWORK, &priv->lp_txwork, lpc17_txtimeout_work, priv, 0);
+ work_queue(ETHWORK, &priv->lp_txwork, lpc17_40_txtimeout_work, priv, 0);
}
}
/****************************************************************************
- * Function: lpc17_poll_work
+ * Function: lpc17_40_poll_work
*
* Description:
* Perform periodic polling from the worker thread
@@ -1447,9 +1447,9 @@ static void lpc17_txtimeout_expiry(int argc, uint32_t arg, ...)
*
****************************************************************************/
-static void lpc17_poll_work(FAR void *arg)
+static void lpc17_40_poll_work(FAR void *arg)
{
- FAR struct lpc17_driver_s *priv = (FAR struct lpc17_driver_s *)arg;
+ FAR struct lpc17_40_driver_s *priv = (FAR struct lpc17_40_driver_s *)arg;
unsigned int prodidx;
unsigned int considx;
@@ -1458,14 +1458,14 @@ static void lpc17_poll_work(FAR void *arg)
*/
net_lock();
- if (lpc17_txdesc(priv) == OK)
+ if (lpc17_40_txdesc(priv) == OK)
{
/* If so, update TCP timing states and poll the network layer for new
* XMIT data. Hmmm.. might be bug here. Does this mean if there is a
* transmit in progress, we will missing TCP time state updates?
*/
- (void)devif_timer(&priv->lp_dev, lpc17_txpoll);
+ (void)devif_timer(&priv->lp_dev, lpc17_40_txpoll);
}
/* Simulate a fake receive to relaunch the data exchanges when a receive
@@ -1474,24 +1474,24 @@ static void lpc17_poll_work(FAR void *arg)
/* Get the current producer and consumer indices */
- considx = lpc17_getreg(LPC17_ETH_RXCONSIDX) & ETH_RXCONSIDX_MASK;
- prodidx = lpc17_getreg(LPC17_ETH_RXPRODIDX) & ETH_RXPRODIDX_MASK;
+ considx = lpc17_40_getreg(LPC17_40_ETH_RXCONSIDX) & ETH_RXCONSIDX_MASK;
+ prodidx = lpc17_40_getreg(LPC17_40_ETH_RXPRODIDX) & ETH_RXPRODIDX_MASK;
if (considx != prodidx)
{
- work_queue(ETHWORK, &priv->lp_rxwork, (worker_t)lpc17_rxdone_work,
+ work_queue(ETHWORK, &priv->lp_rxwork, (worker_t)lpc17_40_rxdone_work,
priv, 0);
}
/* Setup the watchdog poll timer again */
- (void)wd_start(priv->lp_txpoll, LPC17_WDDELAY, lpc17_poll_expiry,
+ (void)wd_start(priv->lp_txpoll, LPC17_40_WDDELAY, lpc17_40_poll_expiry,
1, priv);
net_unlock();
}
/****************************************************************************
- * Function: lpc17_poll_expiry
+ * Function: lpc17_40_poll_expiry
*
* Description:
* Periodic timer handler. Called from the timer interrupt handler.
@@ -1508,19 +1508,19 @@ static void lpc17_poll_work(FAR void *arg)
*
****************************************************************************/
-static void lpc17_poll_expiry(int argc, uint32_t arg, ...)
+static void lpc17_40_poll_expiry(int argc, uint32_t arg, ...)
{
- FAR struct lpc17_driver_s *priv = (FAR struct lpc17_driver_s *)arg;
+ FAR struct lpc17_40_driver_s *priv = (FAR struct lpc17_40_driver_s *)arg;
DEBUGASSERT(arg);
/* Schedule to perform the interrupt processing on the worker thread. */
- work_queue(ETHWORK, &priv->lp_pollwork, lpc17_poll_work, priv, 0);
+ work_queue(ETHWORK, &priv->lp_pollwork, lpc17_40_poll_work, priv, 0);
}
/****************************************************************************
- * Function: lpc17_ipv6multicast
+ * Function: lpc17_40_ipv6multicast
*
* Description:
* Configure the IPv6 multicast MAC address.
@@ -1536,7 +1536,7 @@ static void lpc17_poll_expiry(int argc, uint32_t arg, ...)
****************************************************************************/
#ifdef CONFIG_NET_ICMPv6
-static void lpc17_ipv6multicast(FAR struct lpc17_driver_s *priv)
+static void lpc17_40_ipv6multicast(FAR struct lpc17_40_driver_s *priv)
{
struct net_driver_s *dev;
uint16_t tmp16;
@@ -1569,7 +1569,7 @@ static void lpc17_ipv6multicast(FAR struct lpc17_driver_s *priv)
ninfo("IPv6 Multicast: %02x:%02x:%02x:%02x:%02x:%02x\n",
mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
- (void)lpc17_addmac(dev, mac);
+ (void)lpc17_40_addmac(dev, mac);
#ifdef CONFIG_NET_ICMPv6_AUTOCONF
/* Add the IPv6 all link-local nodes Ethernet address. This is the
@@ -1577,7 +1577,7 @@ static void lpc17_ipv6multicast(FAR struct lpc17_driver_s *priv)
* packets.
*/
- (void)lpc17_addmac(dev, g_ipv6_ethallnodes.ether_addr_octet);
+ (void)lpc17_40_addmac(dev, g_ipv6_ethallnodes.ether_addr_octet);
#endif /* CONFIG_NET_ICMPv6_AUTOCONF */
#ifdef CONFIG_NET_ICMPv6_ROUTER
@@ -1586,14 +1586,14 @@ static void lpc17_ipv6multicast(FAR struct lpc17_driver_s *priv)
* packets.
*/
- (void)lpc17_addmac(dev, g_ipv6_ethallrouters.ether_addr_octet);
+ (void)lpc17_40_addmac(dev, g_ipv6_ethallrouters.ether_addr_octet);
#endif /* CONFIG_NET_ICMPv6_ROUTER */
}
#endif /* CONFIG_NET_ICMPv6 */
/****************************************************************************
- * Function: lpc17_ifup
+ * Function: lpc17_40_ifup
*
* Description:
* NuttX Callback: Bring up the Ethernet interface when an IP address is
@@ -1609,9 +1609,9 @@ static void lpc17_ipv6multicast(FAR struct lpc17_driver_s *priv)
*
****************************************************************************/
-static int lpc17_ifup(struct net_driver_s *dev)
+static int lpc17_40_ifup(struct net_driver_s *dev)
{
- struct lpc17_driver_s *priv = (struct lpc17_driver_s *)dev->d_private;
+ struct lpc17_40_driver_s *priv = (struct lpc17_40_driver_s *)dev->d_private;
uint32_t regval;
int ret;
@@ -1621,14 +1621,14 @@ static int lpc17_ifup(struct net_driver_s *dev)
/* Reset the Ethernet controller (again) */
- lpc17_ethreset(priv);
+ lpc17_40_ethreset(priv);
/* Initialize the PHY and wait for the link to be established */
- ret = lpc17_phyinit(priv);
+ ret = lpc17_40_phyinit(priv);
if (ret != 0)
{
- nerr("ERROR: lpc17_phyinit failed: %d\n", ret);
+ nerr("ERROR: lpc17_40_phyinit failed: %d\n", ret);
return ret;
}
@@ -1636,36 +1636,36 @@ static int lpc17_ifup(struct net_driver_s *dev)
regval = (uint32_t)priv->lp_dev.d_mac.ether.ether_addr_octet[5] << 8 |
(uint32_t)priv->lp_dev.d_mac.ether.ether_addr_octet[4];
- lpc17_putreg(regval, LPC17_ETH_SA0);
+ lpc17_40_putreg(regval, LPC17_40_ETH_SA0);
regval = (uint32_t)priv->lp_dev.d_mac.ether.ether_addr_octet[3] << 8 |
(uint32_t)priv->lp_dev.d_mac.ether.ether_addr_octet[2];
- lpc17_putreg(regval, LPC17_ETH_SA1);
+ lpc17_40_putreg(regval, LPC17_40_ETH_SA1);
regval = (uint32_t)priv->lp_dev.d_mac.ether.ether_addr_octet[1] << 8 |
(uint32_t)priv->lp_dev.d_mac.ether.ether_addr_octet[0];
- lpc17_putreg(regval, LPC17_ETH_SA2);
+ lpc17_40_putreg(regval, LPC17_40_ETH_SA2);
#ifdef CONFIG_NET_ICMPv6
/* Set up the IPv6 multicast address */
- lpc17_ipv6multicast(priv);
+ lpc17_40_ipv6multicast(priv);
#endif
/* Initialize Ethernet interface for the PHY setup */
- lpc17_macmode(priv->lp_mode);
+ lpc17_40_macmode(priv->lp_mode);
/* Initialize EMAC DMA memory -- descriptors, status, packet buffers, etc. */
- lpc17_txdescinit(priv);
- lpc17_rxdescinit(priv);
+ lpc17_40_txdescinit(priv);
+ lpc17_40_rxdescinit(priv);
/* Configure to pass all received frames */
- regval = lpc17_getreg(LPC17_ETH_MAC1);
+ regval = lpc17_40_getreg(LPC17_40_ETH_MAC1);
regval |= ETH_MAC1_PARF;
- lpc17_putreg(regval, LPC17_ETH_MAC1);
+ lpc17_40_putreg(regval, LPC17_40_ETH_MAC1);
/* Set up RX filter and configure to accept broadcast addresses, multicast
* addresses, and perfect station address matches. We should also accept
@@ -1676,33 +1676,33 @@ static int lpc17_ifup(struct net_driver_s *dev)
*/
regval = ETH_RXFLCTRL_PERFEN | ETH_RXFLCTRL_BCASTEN;
-#ifdef CONFIG_LPC17_MULTICAST
+#ifdef CONFIG_LPC17_40_MULTICAST
regval |= (ETH_RXFLCTRL_MCASTEN | ETH_RXFLCTRL_UCASTEN);
#endif
-#ifdef CONFIG_LPC17_ETH_HASH
+#ifdef CONFIG_LPC17_40_ETH_HASH
regval |= (ETH_RXFLCTRL_MCASTHASHEN | ETH_RXFLCTRL_UCASTHASHEN);
#endif
- lpc17_putreg(regval, LPC17_ETH_RXFLCTRL);
+ lpc17_40_putreg(regval, LPC17_40_ETH_RXFLCTRL);
/* Clear any pending interrupts (shouldn't be any) */
- lpc17_putreg(0xffffffff, LPC17_ETH_INTCLR);
+ lpc17_40_putreg(0xffffffff, LPC17_40_ETH_INTCLR);
/* Enable Ethernet interrupts. The way we do this depends on whether or
* not Wakeup on Lan (WoL) has been configured.
*/
-#ifdef CONFIG_LPC17_ETH_WOL
+#ifdef CONFIG_LPC17_40_ETH_WOL
/* Configure WoL: Clear all receive filter WoLs and enable the perfect
* match WoL interrupt. We will wait until the Wake-up to finish
* bringing things up.
*/
- lpc17_putreg(0xffffffff, LPC17_ETH_RXFLWOLCLR);
- lpc17_putreg(ETH_RXFLCTRL_RXFILEN, LPC17_ETH_RXFLCTRL);
+ lpc17_40_putreg(0xffffffff, LPC17_40_ETH_RXFLWOLCLR);
+ lpc17_40_putreg(ETH_RXFLCTRL_RXFILEN, LPC17_40_ETH_RXFLCTRL);
priv->lp_inten = ETH_INT_WKUP;
- lpc17_putreg(ETH_INT_WKUP, LPC17_ETH_INTEN);
+ lpc17_40_putreg(ETH_INT_WKUP, LPC17_40_ETH_INTEN);
#else
/* Otherwise, enable all Rx interrupts. Tx interrupts, SOFTINT and WoL are
* excluded. Tx interrupts will not be enabled until there is data to be
@@ -1710,7 +1710,7 @@ static int lpc17_ifup(struct net_driver_s *dev)
*/
priv->lp_inten = ETH_RXINTS;
- lpc17_putreg(ETH_RXINTS, LPC17_ETH_INTEN);
+ lpc17_40_putreg(ETH_RXINTS, LPC17_40_ETH_INTEN);
#endif
/* Enable Rx. "Enabling of the receive function is located in two places.
@@ -1721,23 +1721,23 @@ static int lpc17_ifup(struct net_driver_s *dev)
* path in the MAC by setting the RECEIVE ENABLE bit in the MAC1 register."
*/
- regval = lpc17_getreg(LPC17_ETH_CMD);
+ regval = lpc17_40_getreg(LPC17_40_ETH_CMD);
regval |= ETH_CMD_RXEN;
- lpc17_putreg(regval, LPC17_ETH_CMD);
+ lpc17_40_putreg(regval, LPC17_40_ETH_CMD);
- regval = lpc17_getreg(LPC17_ETH_MAC1);
+ regval = lpc17_40_getreg(LPC17_40_ETH_MAC1);
regval |= ETH_MAC1_RE;
- lpc17_putreg(regval, LPC17_ETH_MAC1);
+ lpc17_40_putreg(regval, LPC17_40_ETH_MAC1);
/* Enable Tx */
- regval = lpc17_getreg(LPC17_ETH_CMD);
+ regval = lpc17_40_getreg(LPC17_40_ETH_CMD);
regval |= ETH_CMD_TXEN;
- lpc17_putreg(regval, LPC17_ETH_CMD);
+ lpc17_40_putreg(regval, LPC17_40_ETH_CMD);
/* Set and activate a timer process */
- (void)wd_start(priv->lp_txpoll, LPC17_WDDELAY, lpc17_poll_expiry, 1,
+ (void)wd_start(priv->lp_txpoll, LPC17_40_WDDELAY, lpc17_40_poll_expiry, 1,
(uint32_t)priv);
/* Finally, make the interface up and enable the Ethernet interrupt at
@@ -1745,16 +1745,16 @@ static int lpc17_ifup(struct net_driver_s *dev)
*/
priv->lp_ifup = true;
-#if CONFIG_LPC17_NINTERFACES > 1
+#if CONFIG_LPC17_40_NINTERFACES > 1
up_enable_irq(priv->irq);
#else
- up_enable_irq(LPC17_IRQ_ETH);
+ up_enable_irq(LPC17_40_IRQ_ETH);
#endif
return OK;
}
/****************************************************************************
- * Function: lpc17_ifdown
+ * Function: lpc17_40_ifdown
*
* Description:
* NuttX Callback: Stop the interface.
@@ -1769,15 +1769,15 @@ static int lpc17_ifup(struct net_driver_s *dev)
*
****************************************************************************/
-static int lpc17_ifdown(struct net_driver_s *dev)
+static int lpc17_40_ifdown(struct net_driver_s *dev)
{
- struct lpc17_driver_s *priv = (struct lpc17_driver_s *)dev->d_private;
+ struct lpc17_40_driver_s *priv = (struct lpc17_40_driver_s *)dev->d_private;
irqstate_t flags;
/* Disable the Ethernet interrupt */
flags = enter_critical_section();
- up_disable_irq(LPC17_IRQ_ETH);
+ up_disable_irq(LPC17_40_IRQ_ETH);
/* Cancel the TX poll timer and TX timeout timers */
@@ -1786,14 +1786,14 @@ static int lpc17_ifdown(struct net_driver_s *dev)
/* Reset the device and mark it as down. */
- lpc17_ethreset(priv);
+ lpc17_40_ethreset(priv);
priv->lp_ifup = false;
leave_critical_section(flags);
return OK;
}
/****************************************************************************
- * Function: lpc17_txavail_work
+ * Function: lpc17_40_txavail_work
*
* Description:
* Perform an out-of-cycle poll on the worker thread.
@@ -1809,9 +1809,9 @@ static int lpc17_ifdown(struct net_driver_s *dev)
*
****************************************************************************/
-static void lpc17_txavail_work(FAR void *arg)
+static void lpc17_40_txavail_work(FAR void *arg)
{
- FAR struct lpc17_driver_s *priv = (FAR struct lpc17_driver_s *)arg;
+ FAR struct lpc17_40_driver_s *priv = (FAR struct lpc17_40_driver_s *)arg;
/* Ignore the notification if the interface is not yet up */
@@ -1820,11 +1820,11 @@ static void lpc17_txavail_work(FAR void *arg)
{
/* Check if there is room in the hardware to hold another outgoing packet. */
- if (lpc17_txdesc(priv) == OK)
+ if (lpc17_40_txdesc(priv) == OK)
{
/* If so, then poll the network layer for new XMIT data */
- (void)devif_poll(&priv->lp_dev, lpc17_txpoll);
+ (void)devif_poll(&priv->lp_dev, lpc17_40_txpoll);
}
}
@@ -1832,7 +1832,7 @@ static void lpc17_txavail_work(FAR void *arg)
}
/****************************************************************************
- * Function: lpc17_txavail
+ * Function: lpc17_40_txavail
*
* Description:
* Driver callback invoked when new TX data is available. This is a
@@ -1850,9 +1850,9 @@ static void lpc17_txavail_work(FAR void *arg)
*
****************************************************************************/
-static int lpc17_txavail(struct net_driver_s *dev)
+static int lpc17_40_txavail(struct net_driver_s *dev)
{
- FAR struct lpc17_driver_s *priv = (FAR struct lpc17_driver_s *)dev->d_private;
+ FAR struct lpc17_40_driver_s *priv = (FAR struct lpc17_40_driver_s *)dev->d_private;
/* Is our single poll work structure available? It may not be if there
* are pending polling actions and we will have to ignore the Tx
@@ -1864,14 +1864,14 @@ static int lpc17_txavail(struct net_driver_s *dev)
{
/* Schedule to serialize the poll on the worker thread. */
- work_queue(ETHWORK, &priv->lp_pollwork, lpc17_txavail_work, priv, 0);
+ work_queue(ETHWORK, &priv->lp_pollwork, lpc17_40_txavail_work, priv, 0);
}
return OK;
}
/****************************************************************************
- * Function: lpc17_calcethcrc
+ * Function: lpc17_40_calcethcrc
*
* Description:
* Function to calculate the CRC used by LPC17 to check an Ethernet frame
@@ -1901,7 +1901,7 @@ static int lpc17_txavail(struct net_driver_s *dev)
****************************************************************************/
#if defined(CONFIG_NET_MCASTGROUP) || defined(CONFIG_NET_ICMPv6)
-static uint32_t lpc17_calcethcrc(const uint8_t *data, size_t length)
+static uint32_t lpc17_40_calcethcrc(const uint8_t *data, size_t length)
{
char byte;
int crc;
@@ -1964,7 +1964,7 @@ static uint32_t lpc17_calcethcrc(const uint8_t *data, size_t length)
#endif /* CONFIG_NET_MCASTGROUP || CONFIG_NET_ICMPv6 */
/****************************************************************************
- * Function: lpc17_addmac
+ * Function: lpc17_40_addmac
*
* Description:
* NuttX Callback: Add the specified MAC address to the hardware multicast
@@ -1982,7 +1982,7 @@ static uint32_t lpc17_calcethcrc(const uint8_t *data, size_t length)
****************************************************************************/
#if defined(CONFIG_NET_MCASTGROUP) || defined(CONFIG_NET_ICMPv6)
-static int lpc17_addmac(struct net_driver_s *dev, const uint8_t *mac)
+static int lpc17_40_addmac(struct net_driver_s *dev, const uint8_t *mac)
{
uintptr_t regaddr;
uint32_t regval;
@@ -2002,24 +2002,24 @@ static int lpc17_addmac(struct net_driver_s *dev, const uint8_t *mac)
* is 1, the frame is accepted.
*/
- crc = lpc17_calcethcrc(mac, 6);
+ crc = lpc17_40_calcethcrc(mac, 6);
ndx = (crc >> 23) & 0x3f;
/* Add the MAC address to the hardware multicast hash table */
if (ndx > 31)
{
- regaddr = LPC17_ETH_HASHFLH; /* Hash filter table MSBs register */
+ regaddr = LPC17_40_ETH_HASHFLH; /* Hash filter table MSBs register */
ndx -= 32;
}
else
{
- regaddr = LPC17_ETH_HASHFLL; /* Hash filter table LSBs register */
+ regaddr = LPC17_40_ETH_HASHFLL; /* Hash filter table LSBs register */
}
- regval = lpc17_getreg(regaddr);
+ regval = lpc17_40_getreg(regaddr);
regval |= 1 << ndx;
- lpc17_putreg(regval, regaddr);
+ lpc17_40_putreg(regval, regaddr);
/* Enabled multicast address filtering in the RxFilterControl register:
*
@@ -2029,17 +2029,17 @@ static int lpc17_addmac(struct net_driver_s *dev, const uint8_t *mac)
* imperfect hash filter are accepted.
*/
- regval = lpc17_getreg(LPC17_ETH_RXFLCTRL);
+ regval = lpc17_40_getreg(LPC17_40_ETH_RXFLCTRL);
regval &= ~ETH_RXFLCTRL_UCASTHASHEN;
regval |= ETH_RXFLCTRL_MCASTHASHEN;
- lpc17_putreg(regval, LPC17_ETH_RXFLCTRL);
+ lpc17_40_putreg(regval, LPC17_40_ETH_RXFLCTRL);
return OK;
}
#endif /* CONFIG_NET_MCASTGROUP || CONFIG_NET_ICMPv6 */
/****************************************************************************
- * Function: lpc17_rmmac
+ * Function: lpc17_40_rmmac
*
* Description:
* NuttX Callback: Remove the specified MAC address from the hardware multicast
@@ -2057,7 +2057,7 @@ static int lpc17_addmac(struct net_driver_s *dev, const uint8_t *mac)
****************************************************************************/
#ifdef CONFIG_NET_MCASTGROUP
-static int lpc17_rmmac(struct net_driver_s *dev, const uint8_t *mac)
+static int lpc17_40_rmmac(struct net_driver_s *dev, const uint8_t *mac)
{
uintptr_t regaddr1;
uintptr_t regaddr2;
@@ -2078,32 +2078,32 @@ static int lpc17_rmmac(struct net_driver_s *dev, const uint8_t *mac)
* is 1, the frame is accepted.
*/
- crc = lpc17_calcethcrc(mac, 6);
+ crc = lpc17_40_calcethcrc(mac, 6);
ndx = (crc >> 23) & 0x3f;
/* Remove the MAC address to the hardware multicast hash table */
if (ndx > 31)
{
- regaddr1 = LPC17_ETH_HASHFLH; /* Hash filter table MSBs register */
- regaddr2 = LPC17_ETH_HASHFLL; /* Hash filter table LSBs register */
+ regaddr1 = LPC17_40_ETH_HASHFLH; /* Hash filter table MSBs register */
+ regaddr2 = LPC17_40_ETH_HASHFLL; /* Hash filter table LSBs register */
ndx -= 32;
}
else
{
- regaddr1 = LPC17_ETH_HASHFLL; /* Hash filter table LSBs register */
- regaddr2 = LPC17_ETH_HASHFLH; /* Hash filter table MSBs register */
+ regaddr1 = LPC17_40_ETH_HASHFLL; /* Hash filter table LSBs register */
+ regaddr2 = LPC17_40_ETH_HASHFLH; /* Hash filter table MSBs register */
}
- regval = lpc17_getreg(regaddr1);
+ regval = lpc17_40_getreg(regaddr1);
regval &= ~(1 << ndx);
- lpc17_putreg(regval, regaddr1);
+ lpc17_40_putreg(regval, regaddr1);
/* If there are no longer addresses being filtered , disable multicast
* filtering.
*/
- if (regval == 0 && lpc17_getreg(regaddr2) == 0)
+ if (regval == 0 && lpc17_40_getreg(regaddr2) == 0)
{
/* AcceptUnicastHashEn: When set to ’1’, unicast frames that pass the
* imperfect hash filter are accepted.
@@ -2111,9 +2111,9 @@ static int lpc17_rmmac(struct net_driver_s *dev, const uint8_t *mac)
* imperfect hash filter are accepted.
*/
- regval = lpc17_getreg(LPC17_ETH_RXFLCTRL);
+ regval = lpc17_40_getreg(LPC17_40_ETH_RXFLCTRL);
regval &= ~(ETH_RXFLCTRL_UCASTHASHEN | ETH_RXFLCTRL_MCASTHASHEN);
- lpc17_putreg(regval, LPC17_ETH_RXFLCTRL);
+ lpc17_40_putreg(regval, LPC17_40_ETH_RXFLCTRL);
}
return OK;
@@ -2121,7 +2121,7 @@ static int lpc17_rmmac(struct net_driver_s *dev, const uint8_t *mac)
#endif
/****************************************************************************
- * Name: lpc17_eth_ioctl
+ * Name: lpc17_40_eth_ioctl
*
* Description:
* Handle network IOCTL commands directed to this device.
@@ -2140,11 +2140,11 @@ static int lpc17_rmmac(struct net_driver_s *dev, const uint8_t *mac)
****************************************************************************/
#ifdef CONFIG_NETDEV_IOCTL
-static int lpc17_eth_ioctl(struct net_driver_s *dev, int cmd,
+static int lpc17_40_eth_ioctl(struct net_driver_s *dev, int cmd,
unsigned long arg)
{
#ifdef CONFIG_NETDEV_PHY_IOCTL
- struct lpc17_driver_s *priv = (struct lpc17_driver_s *)dev->d_private;
+ struct lpc17_40_driver_s *priv = (struct lpc17_40_driver_s *)dev->d_private;
#endif
int ret;
@@ -2163,7 +2163,7 @@ static int lpc17_eth_ioctl(struct net_driver_s *dev, int cmd,
{
/* Enable PHY link up/down interrupts */
- ret = lpc17_phyintenable(priv);
+ ret = lpc17_40_phyintenable(priv);
}
}
break;
@@ -2179,7 +2179,7 @@ static int lpc17_eth_ioctl(struct net_driver_s *dev, int cmd,
case SIOCGMIIREG: /* Get register from MII PHY */
{
struct mii_ioctl_data_s *req = (struct mii_ioctl_data_s *)((uintptr_t)arg);
- req->val_out = lpc17_phyread(priv->lp_phyaddr, req->reg_num);
+ req->val_out = lpc17_40_phyread(priv->lp_phyaddr, req->reg_num);
ret = OK;
}
break;
@@ -2187,7 +2187,7 @@ static int lpc17_eth_ioctl(struct net_driver_s *dev, int cmd,
case SIOCSMIIREG: /* Set register in MII PHY */
{
struct mii_ioctl_data_s *req = (struct mii_ioctl_data_s *)((uintptr_t)arg);
- lpc17_phywrite(priv->lp_phyaddr, req->reg_num, req->val_in);
+ lpc17_40_phywrite(priv->lp_phyaddr, req->reg_num, req->val_in);
ret = OK;
}
break;
@@ -2203,7 +2203,7 @@ static int lpc17_eth_ioctl(struct net_driver_s *dev, int cmd,
#endif
/****************************************************************************
- * Function: lpc17_phyintenable
+ * Function: lpc17_40_phyintenable
*
* Description:
* Enable link up/down PHY interrupts. The interrupt protocol is like
@@ -2223,15 +2223,15 @@ static int lpc17_eth_ioctl(struct net_driver_s *dev, int cmd,
****************************************************************************/
#if defined(CONFIG_NETDEV_PHY_IOCTL) && defined(CONFIG_ARCH_PHY_INTERRUPT)
-static int lpc17_phyintenable(struct lpc17_driver_s *priv)
+static int lpc17_40_phyintenable(struct lpc17_40_driver_s *priv)
{
uint16_t phyval;
- phyval = lpc17_phyread(priv->lp_phyaddr, MII_INT_REG);
+ phyval = lpc17_40_phyread(priv->lp_phyaddr, MII_INT_REG);
/* Enable link up/down interrupts */
- lpc17_phywrite(priv->lp_phyaddr, MII_INT_REG,
+ lpc17_40_phywrite(priv->lp_phyaddr, MII_INT_REG,
(phyval & ~MII_INT_CLREN) | MII_INT_SETEN);
return OK;
@@ -2239,7 +2239,7 @@ static int lpc17_phyintenable(struct lpc17_driver_s *priv)
#endif
/****************************************************************************
- * Name: lpc17_showpins
+ * Name: lpc17_40_showpins
*
* Description:
* Dump GPIO registers
@@ -2254,16 +2254,16 @@ static int lpc17_phyintenable(struct lpc17_driver_s *priv)
*
****************************************************************************/
-#if defined(CONFIG_LPC17_NET_REGDEBUG) && defined(CONFIG_DEBUG_GPIO_INFO)
-static void lpc17_showpins(void)
+#if defined(CONFIG_LPC17_40_NET_REGDEBUG) && defined(CONFIG_DEBUG_GPIO_INFO)
+static void lpc17_40_showpins(void)
{
- lpc17_dumpgpio(GPIO_PORT1 | GPIO_PIN0, "P1[1-15]");
- lpc17_dumpgpio(GPIO_PORT1 | GPIO_PIN16, "P1[16-31]");
+ lpc17_40_dumpgpio(GPIO_PORT1 | GPIO_PIN0, "P1[1-15]");
+ lpc17_40_dumpgpio(GPIO_PORT1 | GPIO_PIN16, "P1[16-31]");
}
#endif
/****************************************************************************
- * Name: lpc17_showmii
+ * Name: lpc17_40_showmii
*
* Description:
* Dump PHY MII registers
@@ -2278,23 +2278,23 @@ static void lpc17_showpins(void)
*
****************************************************************************/
-#if defined(CONFIG_LPC17_NET_REGDEBUG) && defined(LPC17_HAVE_PHY)
-static void lpc17_showmii(uint8_t phyaddr, const char *msg)
+#if defined(CONFIG_LPC17_40_NET_REGDEBUG) && defined(LPC17_40_HAVE_PHY)
+static void lpc17_40_showmii(uint8_t phyaddr, const char *msg)
{
- ninfo("PHY " LPC17_PHYNAME ": %s\n", msg);
- ninfo(" MCR: %04x\n", lpc17_phyread(phyaddr, MII_MCR));
- ninfo(" MSR: %04x\n", lpc17_phyread(phyaddr, MII_MSR));
- ninfo(" ADVERTISE: %04x\n", lpc17_phyread(phyaddr, MII_ADVERTISE));
- ninfo(" LPA: %04x\n", lpc17_phyread(phyaddr, MII_LPA));
- ninfo(" EXPANSION: %04x\n", lpc17_phyread(phyaddr, MII_EXPANSION));
+ ninfo("PHY " LPC17_40_PHYNAME ": %s\n", msg);
+ ninfo(" MCR: %04x\n", lpc17_40_phyread(phyaddr, MII_MCR));
+ ninfo(" MSR: %04x\n", lpc17_40_phyread(phyaddr, MII_MSR));
+ ninfo(" ADVERTISE: %04x\n", lpc17_40_phyread(phyaddr, MII_ADVERTISE));
+ ninfo(" LPA: %04x\n", lpc17_40_phyread(phyaddr, MII_LPA));
+ ninfo(" EXPANSION: %04x\n", lpc17_40_phyread(phyaddr, MII_EXPANSION));
#ifdef CONFIG_ETH0_PHY_KS8721
- ninfo(" 10BTCR: %04x\n", lpc17_phyread(phyaddr, MII_KS8721_10BTCR));
+ ninfo(" 10BTCR: %04x\n", lpc17_40_phyread(phyaddr, MII_KS8721_10BTCR));
#endif
}
#endif
/****************************************************************************
- * Function: lpc17_phywrite
+ * Function: lpc17_40_phywrite
*
* Description:
* Write a value to an MII PHY register
@@ -2311,8 +2311,8 @@ static void lpc17_showmii(uint8_t phyaddr, const char *msg)
*
****************************************************************************/
-#ifdef LPC17_HAVE_PHY
-static void lpc17_phywrite(uint8_t phyaddr, uint8_t regaddr, uint16_t phydata)
+#ifdef LPC17_40_HAVE_PHY
+static void lpc17_40_phywrite(uint8_t phyaddr, uint8_t regaddr, uint16_t phydata)
{
uint32_t regval;
@@ -2320,24 +2320,24 @@ static void lpc17_phywrite(uint8_t phyaddr, uint8_t regaddr, uint16_t phydata)
regval = ((uint32_t)phyaddr << ETH_MADR_PHYADDR_SHIFT) |
((uint32_t)regaddr << ETH_MADR_REGADDR_SHIFT);
- lpc17_putreg(regval, LPC17_ETH_MADR);
+ lpc17_40_putreg(regval, LPC17_40_ETH_MADR);
/* Set up to write */
- lpc17_putreg(ETH_MCMD_WRITE, LPC17_ETH_MCMD);
+ lpc17_40_putreg(ETH_MCMD_WRITE, LPC17_40_ETH_MCMD);
/* Write the register data to the PHY */
- lpc17_putreg((uint32_t)phydata, LPC17_ETH_MWTD);
+ lpc17_40_putreg((uint32_t)phydata, LPC17_40_ETH_MWTD);
/* Wait for the PHY command to complete */
- while ((lpc17_getreg(LPC17_ETH_MIND) & ETH_MIND_BUSY) != 0);
+ while ((lpc17_40_getreg(LPC17_40_ETH_MIND) & ETH_MIND_BUSY) != 0);
}
#endif
/****************************************************************************
- * Function: lpc17_phyread
+ * Function: lpc17_40_phyread
*
* Description:
* Read a value from an MII PHY register
@@ -2353,36 +2353,36 @@ static void lpc17_phywrite(uint8_t phyaddr, uint8_t regaddr, uint16_t phydata)
*
****************************************************************************/
-#ifdef LPC17_HAVE_PHY
-static uint16_t lpc17_phyread(uint8_t phyaddr, uint8_t regaddr)
+#ifdef LPC17_40_HAVE_PHY
+static uint16_t lpc17_40_phyread(uint8_t phyaddr, uint8_t regaddr)
{
uint32_t regval;
- lpc17_putreg(0, LPC17_ETH_MCMD);
+ lpc17_40_putreg(0, LPC17_40_ETH_MCMD);
/* Set PHY address and PHY register address */
regval = ((uint32_t)phyaddr << ETH_MADR_PHYADDR_SHIFT) |
((uint32_t)regaddr << ETH_MADR_REGADDR_SHIFT);
- lpc17_putreg(regval, LPC17_ETH_MADR);
+ lpc17_40_putreg(regval, LPC17_40_ETH_MADR);
/* Set up to read */
- lpc17_putreg(ETH_MCMD_READ, LPC17_ETH_MCMD);
+ lpc17_40_putreg(ETH_MCMD_READ, LPC17_40_ETH_MCMD);
/* Wait for the PHY command to complete */
- while ((lpc17_getreg(LPC17_ETH_MIND) & (ETH_MIND_BUSY | ETH_MIND_NVALID)) != 0);
- lpc17_putreg(0, LPC17_ETH_MCMD);
+ while ((lpc17_40_getreg(LPC17_40_ETH_MIND) & (ETH_MIND_BUSY | ETH_MIND_NVALID)) != 0);
+ lpc17_40_putreg(0, LPC17_40_ETH_MCMD);
/* Return the PHY register data */
- return (uint16_t)(lpc17_getreg(LPC17_ETH_MRDD) & ETH_MRDD_MASK);
+ return (uint16_t)(lpc17_40_getreg(LPC17_40_ETH_MRDD) & ETH_MRDD_MASK);
}
#endif
/****************************************************************************
- * Function: lpc17_phyreset
+ * Function: lpc17_40_phyreset
*
* Description:
* Reset the PHY
@@ -2397,15 +2397,15 @@ static uint16_t lpc17_phyread(uint8_t phyaddr, uint8_t regaddr)
*
****************************************************************************/
-#ifdef LPC17_HAVE_PHY
-static inline int lpc17_phyreset(uint8_t phyaddr)
+#ifdef LPC17_40_HAVE_PHY
+static inline int lpc17_40_phyreset(uint8_t phyaddr)
{
int32_t timeout;
uint16_t phyreg;
/* Reset the PHY. Needs a minimal 50uS delay after reset. */
- lpc17_phywrite(phyaddr, MII_MCR, MII_MCR_RESET);
+ lpc17_40_phywrite(phyaddr, MII_MCR, MII_MCR_RESET);
/* Wait for a minimum of 50uS no matter what */
@@ -2417,7 +2417,7 @@ static inline int lpc17_phyreset(uint8_t phyaddr)
for (timeout = MII_BIG_TIMEOUT; timeout > 0; timeout--)
{
- phyreg = lpc17_phyread(phyaddr, MII_MCR);
+ phyreg = lpc17_40_phyread(phyaddr, MII_MCR);
if ((phyreg & MII_MCR_RESET) == 0)
{
return OK;
@@ -2430,7 +2430,7 @@ static inline int lpc17_phyreset(uint8_t phyaddr)
#endif
/****************************************************************************
- * Function: lpc17_phyautoneg
+ * Function: lpc17_40_phyautoneg
*
* Description:
* Enable auto-negotiation.
@@ -2446,15 +2446,15 @@ static inline int lpc17_phyreset(uint8_t phyaddr)
*
****************************************************************************/
-#if defined(LPC17_HAVE_PHY) && defined(CONFIG_LPC17_PHY_AUTONEG)
-static inline int lpc17_phyautoneg(uint8_t phyaddr)
+#if defined(LPC17_40_HAVE_PHY) && defined(CONFIG_LPC17_40_PHY_AUTONEG)
+static inline int lpc17_40_phyautoneg(uint8_t phyaddr)
{
int32_t timeout;
uint16_t phyreg;
/* Start auto-negotiation */
- lpc17_phywrite(phyaddr, MII_MCR, MII_MCR_ANENABLE | MII_MCR_ANRESTART);
+ lpc17_40_phywrite(phyaddr, MII_MCR, MII_MCR_ANENABLE | MII_MCR_ANRESTART);
/* Wait for autonegotiation to complete */
@@ -2462,7 +2462,7 @@ static inline int lpc17_phyautoneg(uint8_t phyaddr)
{
/* Check if auto-negotiation has completed */
- phyreg = lpc17_phyread(phyaddr, MII_MSR);
+ phyreg = lpc17_40_phyread(phyaddr, MII_MSR);
if ((phyreg & MII_MSR_ANEGCOMPLETE) != 0)
{
/* Yes.. return success */
@@ -2477,7 +2477,7 @@ static inline int lpc17_phyautoneg(uint8_t phyaddr)
#endif
/****************************************************************************
- * Function: lpc17_phymode
+ * Function: lpc17_40_phymode
*
* Description:
* Set the PHY to operate at a selected speed/duplex mode.
@@ -2493,8 +2493,8 @@ static inline int lpc17_phyautoneg(uint8_t phyaddr)
*
****************************************************************************/
-#ifdef LPC17_HAVE_PHY
-static int lpc17_phymode(uint8_t phyaddr, uint8_t mode)
+#ifdef LPC17_40_HAVE_PHY
+static int lpc17_40_phymode(uint8_t phyaddr, uint8_t mode)
{
int32_t timeout;
uint16_t phyreg;
@@ -2515,17 +2515,17 @@ static int lpc17_phymode(uint8_t phyaddr, uint8_t mode)
*/
phyreg = 0;
- if ((mode & LPC17_SPEED_MASK) == LPC17_SPEED_100)
+ if ((mode & LPC17_40_SPEED_MASK) == LPC17_40_SPEED_100)
{
phyreg = MII_MCR_SPEED100;
}
- if ((mode & LPC17_DUPLEX_MASK) == LPC17_DUPLEX_FULL)
+ if ((mode & LPC17_40_DUPLEX_MASK) == LPC17_40_DUPLEX_FULL)
{
phyreg |= MII_MCR_FULLDPLX;
}
- lpc17_phywrite(phyaddr, MII_MCR, phyreg);
+ lpc17_40_phywrite(phyaddr, MII_MCR, phyreg);
/* Then wait for the link to be established */
@@ -2537,7 +2537,7 @@ static int lpc17_phymode(uint8_t phyaddr, uint8_t mode)
*/
#if defined(CONFIG_ETH0_PHY_DP83848C) && !defined(CONFIG_ARCH_BOARD_MBED)
- phyreg = lpc17_phyread(phyaddr, MII_DP83848C_STS);
+ phyreg = lpc17_40_phyread(phyaddr, MII_DP83848C_STS);
if ((phyreg & 0x0001) != 0)
{
/* Yes.. return success */
@@ -2545,7 +2545,7 @@ static int lpc17_phymode(uint8_t phyaddr, uint8_t mode)
return OK;
}
#else
- phyreg = lpc17_phyread(phyaddr, MII_MSR);
+ phyreg = lpc17_40_phyread(phyaddr, MII_MSR);
if ((phyreg & MII_MSR_LINKSTATUS) != 0)
{
/* Yes.. return success */
@@ -2561,7 +2561,7 @@ static int lpc17_phymode(uint8_t phyaddr, uint8_t mode)
#endif
/****************************************************************************
- * Function: lpc17_phyinit
+ * Function: lpc17_40_phyinit
*
* Description:
* Initialize the PHY
@@ -2577,8 +2577,8 @@ static int lpc17_phymode(uint8_t phyaddr, uint8_t mode)
*
****************************************************************************/
-#ifdef LPC17_HAVE_PHY
-static inline int lpc17_phyinit(struct lpc17_driver_s *priv)
+#ifdef LPC17_40_HAVE_PHY
+static inline int lpc17_40_phyinit(struct lpc17_40_driver_s *priv)
{
unsigned int phyaddr;
uint16_t phyreg;
@@ -2589,13 +2589,13 @@ static inline int lpc17_phyinit(struct lpc17_driver_s *priv)
* preamble, no scan increment.
*/
- lpc17_putreg(ETH_MCFG_CLKSEL_DIV, LPC17_ETH_MCFG);
- lpc17_putreg(0, LPC17_ETH_MCMD);
+ lpc17_40_putreg(ETH_MCFG_CLKSEL_DIV, LPC17_40_ETH_MCFG);
+ lpc17_40_putreg(0, LPC17_40_ETH_MCMD);
/* Enter RMII mode and select 100 MBPS support */
- lpc17_putreg(ETH_CMD_RMII, LPC17_ETH_CMD);
- lpc17_putreg(ETH_SUPP_SPEED, LPC17_ETH_SUPP);
+ lpc17_40_putreg(ETH_CMD_RMII, LPC17_40_ETH_CMD);
+ lpc17_40_putreg(ETH_SUPP_SPEED, LPC17_40_ETH_SUPP);
/* Find PHY Address. Because the controller has a pull-up and the
* PHY has pull-down resistors on RXD lines some times the PHY
@@ -2608,21 +2608,21 @@ static inline int lpc17_phyinit(struct lpc17_driver_s *priv)
* PHY address.
*/
- phyreg = (unsigned int)lpc17_phyread(phyaddr, MII_PHYID1);
+ phyreg = (unsigned int)lpc17_40_phyread(phyaddr, MII_PHYID1);
ninfo("Addr: %d PHY ID1: %04x\n", phyaddr, phyreg);
/* Compare OUI bits 3-18 */
- if (phyreg == LPC17_PHYID1)
+ if (phyreg == LPC17_40_PHYID1)
{
- phyreg = lpc17_phyread(phyaddr, MII_PHYID2);
+ phyreg = lpc17_40_phyread(phyaddr, MII_PHYID2);
ninfo("Addr: %d PHY ID2: %04x\n", phyaddr, phyreg);
/* Compare OUI bits 19-24 and the 6-bit model number (ignoring the
* 4-bit revision number).
*/
- if ((phyreg & 0xfff0) == (LPC17_PHYID2 & 0xfff0))
+ if ((phyreg & 0xfff0) == (LPC17_40_PHYID2 & 0xfff0))
{
break;
}
@@ -2646,38 +2646,38 @@ static inline int lpc17_phyinit(struct lpc17_driver_s *priv)
/* Reset the PHY */
- ret = lpc17_phyreset(phyaddr);
+ ret = lpc17_40_phyreset(phyaddr);
if (ret < 0)
{
return ret;
}
- lpc17_showmii(phyaddr, "After reset");
+ lpc17_40_showmii(phyaddr, "After reset");
/* Check for preamble suppression support */
- phyreg = lpc17_phyread(phyaddr, MII_MSR);
+ phyreg = lpc17_40_phyread(phyaddr, MII_MSR);
if ((phyreg & MII_MSR_MFRAMESUPPRESS) != 0)
{
/* The PHY supports preamble suppression */
- regval = lpc17_getreg(LPC17_ETH_MCFG);
+ regval = lpc17_40_getreg(LPC17_40_ETH_MCFG);
regval |= ETH_MCFG_SUPPRE;
- lpc17_putreg(regval, LPC17_ETH_MCFG);
+ lpc17_40_putreg(regval, LPC17_40_ETH_MCFG);
}
/* Are we configured to do auto-negotiation? */
-#ifdef CONFIG_LPC17_PHY_AUTONEG
+#ifdef CONFIG_LPC17_40_PHY_AUTONEG
/* Setup the Auto-negotiation advertisement: 100 or 10, and HD or FD */
- lpc17_phywrite(phyaddr, MII_ADVERTISE,
+ lpc17_40_phywrite(phyaddr, MII_ADVERTISE,
(MII_ADVERTISE_100BASETXFULL | MII_ADVERTISE_100BASETXHALF |
MII_ADVERTISE_10BASETXFULL | MII_ADVERTISE_10BASETXHALF |
MII_ADVERTISE_CSMA));
/* Then perform the auto-negotiation */
- ret = lpc17_phyautoneg(phyaddr);
+ ret = lpc17_40_phyautoneg(phyaddr);
if (ret < 0)
{
return ret;
@@ -2685,7 +2685,7 @@ static inline int lpc17_phyinit(struct lpc17_driver_s *priv)
#else
/* Set up the fixed PHY configuration */
- ret = lpc17_phymode(phyaddr, LPC17_MODE_DEFLT);
+ ret = lpc17_40_phymode(phyaddr, LPC17_40_MODE_DEFLT);
if (ret < 0)
{
return ret;
@@ -2694,31 +2694,31 @@ static inline int lpc17_phyinit(struct lpc17_driver_s *priv)
/* The link is established */
- lpc17_showmii(phyaddr, "After link established");
+ lpc17_40_showmii(phyaddr, "After link established");
/* Check configuration */
#if defined(CONFIG_ETH0_PHY_KS8721)
- phyreg = lpc17_phyread(phyaddr, MII_KS8721_10BTCR);
+ phyreg = lpc17_40_phyread(phyaddr, MII_KS8721_10BTCR);
switch (phyreg & KS8721_10BTCR_MODE_MASK)
{
case KS8721_10BTCR_MODE_10BTHD: /* 10BASE-T half duplex */
- priv->lp_mode = LPC17_10BASET_HD;
- lpc17_putreg(0, LPC17_ETH_SUPP);
+ priv->lp_mode = LPC17_40_10BASET_HD;
+ lpc17_40_putreg(0, LPC17_40_ETH_SUPP);
break;
case KS8721_10BTCR_MODE_100BTHD: /* 100BASE-T half duplex */
- priv->lp_mode = LPC17_100BASET_HD;
+ priv->lp_mode = LPC17_40_100BASET_HD;
break;
case KS8721_10BTCR_MODE_10BTFD: /* 10BASE-T full duplex */
- priv->lp_mode = LPC17_10BASET_FD;
- lpc17_putreg(0, LPC17_ETH_SUPP);
+ priv->lp_mode = LPC17_40_10BASET_FD;
+ lpc17_40_putreg(0, LPC17_40_ETH_SUPP);
break;
case KS8721_10BTCR_MODE_100BTFD: /* 100BASE-T full duplex */
- priv->lp_mode = LPC17_100BASET_FD;
+ priv->lp_mode = LPC17_40_100BASET_FD;
break;
default:
@@ -2727,26 +2727,26 @@ static inline int lpc17_phyinit(struct lpc17_driver_s *priv)
}
#elif defined(CONFIG_ETH0_PHY_KSZ8041)
- phyreg = lpc17_phyread(phyaddr, MII_KSZ8041_PHYCTRL2);
+ phyreg = lpc17_40_phyread(phyaddr, MII_KSZ8041_PHYCTRL2);
switch (phyreg & MII_PHYCTRL2_MODE_MASK)
{
case MII_PHYCTRL2_MODE_10HDX: /* 10BASE-T half duplex */
- priv->lp_mode = LPC17_10BASET_HD;
- lpc17_putreg(0, LPC17_ETH_SUPP);
+ priv->lp_mode = LPC17_40_10BASET_HD;
+ lpc17_40_putreg(0, LPC17_40_ETH_SUPP);
break;
case MII_PHYCTRL2_MODE_100HDX: /* 100BASE-T half duplex */
- priv->lp_mode = LPC17_100BASET_HD;
+ priv->lp_mode = LPC17_40_100BASET_HD;
break;
case MII_PHYCTRL2_MODE_10FDX: /* 10BASE-T full duplex */
- priv->lp_mode = LPC17_10BASET_FD;
- lpc17_putreg(0, LPC17_ETH_SUPP);
+ priv->lp_mode = LPC17_40_10BASET_FD;
+ lpc17_40_putreg(0, LPC17_40_ETH_SUPP);
break;
case MII_PHYCTRL2_MODE_100FDX: /* 100BASE-T full duplex */
- priv->lp_mode = LPC17_100BASET_FD;
+ priv->lp_mode = LPC17_40_100BASET_FD;
break;
default:
@@ -2754,26 +2754,26 @@ static inline int lpc17_phyinit(struct lpc17_driver_s *priv)
return -ENODEV;
}
#elif defined(CONFIG_ETH0_PHY_KSZ8081)
- phyreg = lpc17_phyread(phyaddr, MII_KSZ8081_PHYCTRL1);
+ phyreg = lpc17_40_phyread(phyaddr, MII_KSZ8081_PHYCTRL1);
switch (phyreg & MII_PHYCTRL1_MODE_MASK)
{
case MII_PHYCTRL1_MODE_10HDX: /* 10BASE-T half duplex */
- priv->lp_mode = LPC17_10BASET_HD;
- lpc17_putreg(0, LPC17_ETH_SUPP);
+ priv->lp_mode = LPC17_40_10BASET_HD;
+ lpc17_40_putreg(0, LPC17_40_ETH_SUPP);
break;
case MII_PHYCTRL1_MODE_100HDX: /* 100BASE-T half duplex */
- priv->lp_mode = LPC17_100BASET_HD;
+ priv->lp_mode = LPC17_40_100BASET_HD;
break;
case MII_PHYCTRL1_MODE_10FDX: /* 10BASE-T full duplex */
- priv->lp_mode = LPC17_10BASET_FD;
- lpc17_putreg(0, LPC17_ETH_SUPP);
+ priv->lp_mode = LPC17_40_10BASET_FD;
+ lpc17_40_putreg(0, LPC17_40_ETH_SUPP);
break;
case MII_PHYCTRL1_MODE_100FDX: /* 100BASE-T full duplex */
- priv->lp_mode = LPC17_100BASET_FD;
+ priv->lp_mode = LPC17_40_100BASET_FD;
break;
default:
@@ -2781,26 +2781,26 @@ static inline int lpc17_phyinit(struct lpc17_driver_s *priv)
return -ENODEV;
}
#elif defined(CONFIG_ETH0_PHY_DP83848C)
- phyreg = lpc17_phyread(phyaddr, MII_DP83848C_STS);
+ phyreg = lpc17_40_phyread(phyaddr, MII_DP83848C_STS);
/* Configure for full/half duplex mode and speed */
switch (phyreg & 0x0006)
{
case 0x0000:
- priv->lp_mode = LPC17_100BASET_HD;
+ priv->lp_mode = LPC17_40_100BASET_HD;
break;
case 0x0002:
- priv->lp_mode = LPC17_10BASET_HD;
+ priv->lp_mode = LPC17_40_10BASET_HD;
break;
case 0x0004:
- priv->lp_mode = LPC17_100BASET_FD;
+ priv->lp_mode = LPC17_40_100BASET_FD;
break;
case 0x0006:
- priv->lp_mode = LPC17_10BASET_FD;
+ priv->lp_mode = LPC17_40_10BASET_FD;
break;
default:
@@ -2814,15 +2814,15 @@ static inline int lpc17_phyinit(struct lpc17_driver_s *priv)
uint16_t lpa;
up_udelay(500);
- advertise = lpc17_phyread(phyaddr, MII_ADVERTISE);
- lpa = lpc17_phyread(phyaddr, MII_LPA);
+ advertise = lpc17_40_phyread(phyaddr, MII_ADVERTISE);
+ lpa = lpc17_40_phyread(phyaddr, MII_LPA);
/* Check for 100BASETX full duplex */
if ((advertise & MII_ADVERTISE_100BASETXFULL) != 0 &&
(lpa & MII_LPA_100BASETXFULL) != 0)
{
- priv->lp_mode = LPC17_100BASET_FD;
+ priv->lp_mode = LPC17_40_100BASET_FD;
}
/* Check for 100BASETX half duplex */
@@ -2830,7 +2830,7 @@ static inline int lpc17_phyinit(struct lpc17_driver_s *priv)
else if ((advertise & MII_ADVERTISE_100BASETXHALF) != 0 &&
(lpa & MII_LPA_100BASETXHALF) != 0)
{
- priv->lp_mode = LPC17_100BASET_HD;
+ priv->lp_mode = LPC17_40_100BASET_HD;
}
/* Check for 10BASETX full duplex */
@@ -2838,7 +2838,7 @@ static inline int lpc17_phyinit(struct lpc17_driver_s *priv)
else if ((advertise & MII_ADVERTISE_10BASETXFULL) != 0 &&
(lpa & MII_LPA_10BASETXFULL) != 0)
{
- priv->lp_mode = LPC17_10BASET_FD;
+ priv->lp_mode = LPC17_40_10BASET_FD;
}
/* Check for 10BASETX half duplex */
@@ -2846,7 +2846,7 @@ static inline int lpc17_phyinit(struct lpc17_driver_s *priv)
else if ((advertise & MII_ADVERTISE_10BASETXHALF) != 0 &&
(lpa & MII_LPA_10BASETXHALF) != 0)
{
- priv->lp_mode = LPC17_10BASET_HD;
+ priv->lp_mode = LPC17_40_10BASET_HD;
}
else
{
@@ -2860,34 +2860,34 @@ static inline int lpc17_phyinit(struct lpc17_driver_s *priv)
#endif
ninfo("%dBase-T %s duplex\n",
- (priv->lp_mode & LPC17_SPEED_MASK) == LPC17_SPEED_100 ? 100 : 10,
- (priv->lp_mode & LPC17_DUPLEX_MASK) == LPC17_DUPLEX_FULL ?"full" : "half");
+ (priv->lp_mode & LPC17_40_SPEED_MASK) == LPC17_40_SPEED_100 ? 100 : 10,
+ (priv->lp_mode & LPC17_40_DUPLEX_MASK) == LPC17_40_DUPLEX_FULL ?"full" : "half");
/* Disable auto-configuration. Set the fixed speed/duplex mode.
* (probably more than little redundant).
*
* REVISIT: Revisit the following CONFIG_PHY_CEMENT_DISABLE work-around.
- * It is should not needed if CONFIG_LPC17_PHY_AUTONEG is defined and is known
+ * It is should not needed if CONFIG_LPC17_40_PHY_AUTONEG is defined and is known
* cause a problem for at least one PHY (DP83848I PHY). It might be
* safe just to remove this elided coded for all PHYs.
*/
#ifndef CONFIG_PHY_CEMENT_DISABLE
- ret = lpc17_phymode(phyaddr, priv->lp_mode);
+ ret = lpc17_40_phymode(phyaddr, priv->lp_mode);
#endif
- lpc17_showmii(phyaddr, "After final configuration");
+ lpc17_40_showmii(phyaddr, "After final configuration");
return ret;
}
#else
-static inline int lpc17_phyinit(struct lpc17_driver_s *priv)
+static inline int lpc17_40_phyinit(struct lpc17_40_driver_s *priv)
{
- priv->lp_mode = LPC17_MODE_DEFLT;
+ priv->lp_mode = LPC17_40_MODE_DEFLT;
return OK;
}
#endif
/****************************************************************************
- * Function: lpc17_txdescinit
+ * Function: lpc17_40_txdescinit
*
* Description:
* Initialize the EMAC Tx descriptor table
@@ -2904,7 +2904,7 @@ static inline int lpc17_phyinit(struct lpc17_driver_s *priv)
*
****************************************************************************/
-static inline void lpc17_txdescinit(struct lpc17_driver_s *priv)
+static inline void lpc17_40_txdescinit(struct lpc17_40_driver_s *priv)
{
uint32_t *txdesc;
uint32_t *txstat;
@@ -2913,37 +2913,37 @@ static inline void lpc17_txdescinit(struct lpc17_driver_s *priv)
/* Configure Tx descriptor and status tables */
- lpc17_putreg(LPC17_TXDESC_BASE, LPC17_ETH_TXDESC);
- lpc17_putreg(LPC17_TXSTAT_BASE, LPC17_ETH_TXSTAT);
- lpc17_putreg(CONFIG_LPC17_ETH_NTXDESC-1, LPC17_ETH_TXDESCRNO);
+ lpc17_40_putreg(LPC17_40_TXDESC_BASE, LPC17_40_ETH_TXDESC);
+ lpc17_40_putreg(LPC17_40_TXSTAT_BASE, LPC17_40_ETH_TXSTAT);
+ lpc17_40_putreg(CONFIG_LPC17_40_ETH_NTXDESC-1, LPC17_40_ETH_TXDESCRNO);
/* Initialize Tx descriptors and link to packet buffers */
- txdesc = (uint32_t *)LPC17_TXDESC_BASE;
- pktaddr = LPC17_TXBUFFER_BASE;
+ txdesc = (uint32_t *)LPC17_40_TXDESC_BASE;
+ pktaddr = LPC17_40_TXBUFFER_BASE;
- for (i = 0; i < CONFIG_LPC17_ETH_NTXDESC; i++)
+ for (i = 0; i < CONFIG_LPC17_40_ETH_NTXDESC; i++)
{
*txdesc++ = pktaddr;
- *txdesc++ = (TXDESC_CONTROL_INT | (LPC17_MAXPACKET_SIZE - 1));
- pktaddr += LPC17_MAXPACKET_SIZE;
+ *txdesc++ = (TXDESC_CONTROL_INT | (LPC17_40_MAXPACKET_SIZE - 1));
+ pktaddr += LPC17_40_MAXPACKET_SIZE;
}
/* Initialize Tx status */
- txstat = (uint32_t *)LPC17_TXSTAT_BASE;
- for (i = 0; i < CONFIG_LPC17_ETH_NTXDESC; i++)
+ txstat = (uint32_t *)LPC17_40_TXSTAT_BASE;
+ for (i = 0; i < CONFIG_LPC17_40_ETH_NTXDESC; i++)
{
*txstat++ = 0;
}
/* Point to first Tx descriptor */
- lpc17_putreg(0, LPC17_ETH_TXPRODIDX);
+ lpc17_40_putreg(0, LPC17_40_ETH_TXPRODIDX);
}
/****************************************************************************
- * Function: lpc17_rxdescinit
+ * Function: lpc17_40_rxdescinit
*
* Description:
* Initialize the EMAC Rx descriptor table
@@ -2960,7 +2960,7 @@ static inline void lpc17_txdescinit(struct lpc17_driver_s *priv)
*
****************************************************************************/
-static inline void lpc17_rxdescinit(struct lpc17_driver_s *priv)
+static inline void lpc17_40_rxdescinit(struct lpc17_40_driver_s *priv)
{
uint32_t *rxdesc;
uint32_t *rxstat;
@@ -2969,26 +2969,26 @@ static inline void lpc17_rxdescinit(struct lpc17_driver_s *priv)
/* Configure Rx descriptor and status tables */
- lpc17_putreg(LPC17_RXDESC_BASE, LPC17_ETH_RXDESC);
- lpc17_putreg(LPC17_RXSTAT_BASE, LPC17_ETH_RXSTAT);
- lpc17_putreg(CONFIG_LPC17_ETH_NRXDESC-1, LPC17_ETH_RXDESCNO);
+ lpc17_40_putreg(LPC17_40_RXDESC_BASE, LPC17_40_ETH_RXDESC);
+ lpc17_40_putreg(LPC17_40_RXSTAT_BASE, LPC17_40_ETH_RXSTAT);
+ lpc17_40_putreg(CONFIG_LPC17_40_ETH_NRXDESC-1, LPC17_40_ETH_RXDESCNO);
/* Initialize Rx descriptors and link to packet buffers */
- rxdesc = (uint32_t *)LPC17_RXDESC_BASE;
- pktaddr = LPC17_RXBUFFER_BASE;
+ rxdesc = (uint32_t *)LPC17_40_RXDESC_BASE;
+ pktaddr = LPC17_40_RXBUFFER_BASE;
- for (i = 0; i < CONFIG_LPC17_ETH_NRXDESC; i++)
+ for (i = 0; i < CONFIG_LPC17_40_ETH_NRXDESC; i++)
{
*rxdesc++ = pktaddr;
- *rxdesc++ = (RXDESC_CONTROL_INT | (LPC17_MAXPACKET_SIZE - 1));
- pktaddr += LPC17_MAXPACKET_SIZE;
+ *rxdesc++ = (RXDESC_CONTROL_INT | (LPC17_40_MAXPACKET_SIZE - 1));
+ pktaddr += LPC17_40_MAXPACKET_SIZE;
}
/* Initialize Rx status */
- rxstat = (uint32_t *)LPC17_RXSTAT_BASE;
- for (i = 0; i < CONFIG_LPC17_ETH_NRXDESC; i++)
+ rxstat = (uint32_t *)LPC17_40_RXSTAT_BASE;
+ for (i = 0; i < CONFIG_LPC17_40_ETH_NRXDESC; i++)
{
*rxstat++ = 0;
*rxstat++ = 0;
@@ -2996,11 +2996,11 @@ static inline void lpc17_rxdescinit(struct lpc17_driver_s *priv)
/* Point to first Rx descriptor */
- lpc17_putreg(0, LPC17_ETH_RXCONSIDX);
+ lpc17_40_putreg(0, LPC17_40_ETH_RXCONSIDX);
}
/****************************************************************************
- * Function: lpc17_macmode
+ * Function: lpc17_40_macmode
*
* Description:
* Set the MAC to operate at a selected speed/duplex mode.
@@ -3015,59 +3015,59 @@ static inline void lpc17_rxdescinit(struct lpc17_driver_s *priv)
*
****************************************************************************/
-#ifdef LPC17_HAVE_PHY
-static void lpc17_macmode(uint8_t mode)
+#ifdef LPC17_40_HAVE_PHY
+static void lpc17_40_macmode(uint8_t mode)
{
uint32_t regval;
/* Set up for full or half duplex operation */
- if ((mode & LPC17_DUPLEX_MASK) == LPC17_DUPLEX_FULL)
+ if ((mode & LPC17_40_DUPLEX_MASK) == LPC17_40_DUPLEX_FULL)
{
/* Set the back-to-back inter-packet gap */
- lpc17_putreg(21, LPC17_ETH_IPGT);
+ lpc17_40_putreg(21, LPC17_40_ETH_IPGT);
/* Set MAC to operate in full duplex mode with CRC and Pad enabled */
- regval = lpc17_getreg(LPC17_ETH_MAC2);
+ regval = lpc17_40_getreg(LPC17_40_ETH_MAC2);
regval |= (ETH_MAC2_FD | ETH_MAC2_CRCEN | ETH_MAC2_PADCRCEN);
- lpc17_putreg(regval, LPC17_ETH_MAC2);
+ lpc17_40_putreg(regval, LPC17_40_ETH_MAC2);
/* Select full duplex operation for ethernet controller */
- regval = lpc17_getreg(LPC17_ETH_CMD);
+ regval = lpc17_40_getreg(LPC17_40_ETH_CMD);
regval |= (ETH_CMD_FD | ETH_CMD_RMII | ETH_CMD_PRFRAME);
- lpc17_putreg(regval, LPC17_ETH_CMD);
+ lpc17_40_putreg(regval, LPC17_40_ETH_CMD);
}
else
{
/* Set the back-to-back inter-packet gap */
- lpc17_putreg(18, LPC17_ETH_IPGT);
+ lpc17_40_putreg(18, LPC17_40_ETH_IPGT);
/* Set MAC to operate in half duplex mode with CRC and Pad enabled */
- regval = lpc17_getreg(LPC17_ETH_MAC2);
+ regval = lpc17_40_getreg(LPC17_40_ETH_MAC2);
regval &= ~ETH_MAC2_FD;
regval |= (ETH_MAC2_CRCEN | ETH_MAC2_PADCRCEN);
- lpc17_putreg(regval, LPC17_ETH_MAC2);
+ lpc17_40_putreg(regval, LPC17_40_ETH_MAC2);
/* Select half duplex operation for ethernet controller */
- regval = lpc17_getreg(LPC17_ETH_CMD);
+ regval = lpc17_40_getreg(LPC17_40_ETH_CMD);
regval &= ~ETH_CMD_FD;
regval |= (ETH_CMD_RMII | ETH_CMD_PRFRAME);
- lpc17_putreg(regval, LPC17_ETH_CMD);
+ lpc17_40_putreg(regval, LPC17_40_ETH_CMD);
}
- /* This is currently done in lpc17_phyinit(). That doesn't
+ /* This is currently done in lpc17_40_phyinit(). That doesn't
* seem like the right place. It should be done here.
*/
#if 0
- regval = lpc17_getreg(LPC17_ETH_SUPP);
- if ((mode & LPC17_SPEED_MASK) == LPC17_SPEED_100)
+ regval = lpc17_40_getreg(LPC17_40_ETH_SUPP);
+ if ((mode & LPC17_40_SPEED_MASK) == LPC17_40_SPEED_100)
{
regval |= ETH_SUPP_SPEED;
}
@@ -3075,13 +3075,13 @@ static void lpc17_macmode(uint8_t mode)
{
regval &= ~ETH_SUPP_SPEED;
}
- lpc17_putreg(regval, LPC17_ETH_SUPP);
+ lpc17_40_putreg(regval, LPC17_40_ETH_SUPP);
#endif
}
#endif
/****************************************************************************
- * Function: lpc17_ethreset
+ * Function: lpc17_40_ethreset
*
* Description:
* Configure and reset the Ethernet module, leaving it in a disabled state.
@@ -3096,7 +3096,7 @@ static void lpc17_macmode(uint8_t mode)
*
****************************************************************************/
-static void lpc17_ethreset(struct lpc17_driver_s *priv)
+static void lpc17_40_ethreset(struct lpc17_40_driver_s *priv)
{
irqstate_t flags;
@@ -3106,35 +3106,35 @@ static void lpc17_ethreset(struct lpc17_driver_s *priv)
/* Put the MAC into the reset state */
- lpc17_putreg((ETH_MAC1_TXRST | ETH_MAC1_MCSTXRST | ETH_MAC1_RXRST |
+ lpc17_40_putreg((ETH_MAC1_TXRST | ETH_MAC1_MCSTXRST | ETH_MAC1_RXRST |
ETH_MAC1_MCSRXRST | ETH_MAC1_SIMRST | ETH_MAC1_SOFTRST),
- LPC17_ETH_MAC1);
+ LPC17_40_ETH_MAC1);
/* Disable RX/RX, clear modes, reset all control registers */
- lpc17_putreg((ETH_CMD_REGRST | ETH_CMD_TXRST | ETH_CMD_RXRST),
- LPC17_ETH_CMD);
+ lpc17_40_putreg((ETH_CMD_REGRST | ETH_CMD_TXRST | ETH_CMD_RXRST),
+ LPC17_40_ETH_CMD);
/* Take the MAC out of the reset state */
up_udelay(50);
- lpc17_putreg(0, LPC17_ETH_MAC1);
+ lpc17_40_putreg(0, LPC17_40_ETH_MAC1);
/* The RMII bit must be set on initialization (I'm not sure this needs
* to be done here but... oh well).
*/
- lpc17_putreg(ETH_CMD_RMII, LPC17_ETH_CMD);
+ lpc17_40_putreg(ETH_CMD_RMII, LPC17_40_ETH_CMD);
/* Set other misc configuration-related registers to default values */
- lpc17_putreg(0, LPC17_ETH_MAC2);
- lpc17_putreg(0, LPC17_ETH_SUPP);
- lpc17_putreg(0, LPC17_ETH_TEST);
+ lpc17_40_putreg(0, LPC17_40_ETH_MAC2);
+ lpc17_40_putreg(0, LPC17_40_ETH_SUPP);
+ lpc17_40_putreg(0, LPC17_40_ETH_TEST);
- lpc17_putreg(18, LPC17_ETH_IPGR);
- lpc17_putreg(((15 << ETH_CLRT_RMAX_SHIFT) | (55 << ETH_CLRT_COLWIN_SHIFT)),
- LPC17_ETH_CLRT);
+ lpc17_40_putreg(18, LPC17_40_ETH_IPGR);
+ lpc17_40_putreg(((15 << ETH_CLRT_RMAX_SHIFT) | (55 << ETH_CLRT_COLWIN_SHIFT)),
+ LPC17_40_ETH_CLRT);
/* Set the Maximum Frame size register. "This field resets to the value
* 0x0600, which represents a maximum receive frame of 1536 octets. An
@@ -3143,15 +3143,15 @@ static void lpc17_ethreset(struct lpc17_driver_s *priv)
* restriction is desired, program this 16-bit field."
*/
- lpc17_putreg(LPC17_MAXPACKET_SIZE, LPC17_ETH_MAXF);
+ lpc17_40_putreg(LPC17_40_MAXPACKET_SIZE, LPC17_40_ETH_MAXF);
/* Disable all Ethernet controller interrupts */
- lpc17_putreg(0, LPC17_ETH_INTEN);
+ lpc17_40_putreg(0, LPC17_40_ETH_INTEN);
/* Clear any pending interrupts (shouldn't be any) */
- lpc17_putreg(0xffffffff, LPC17_ETH_INTCLR);
+ lpc17_40_putreg(0xffffffff, LPC17_40_ETH_INTCLR);
leave_critical_section(flags);
}
@@ -3160,7 +3160,7 @@ static void lpc17_ethreset(struct lpc17_driver_s *priv)
****************************************************************************/
/****************************************************************************
- * Function: lpc17_ethinitialize
+ * Function: lpc17_40_ethinitialize
*
* Description:
* Initialize one Ethernet controller and driver structure.
@@ -3175,35 +3175,35 @@ static void lpc17_ethreset(struct lpc17_driver_s *priv)
*
****************************************************************************/
-#if CONFIG_LPC17_NINTERFACES > 1 || defined(CONFIG_NETDEV_LATEINIT)
-int lpc17_ethinitialize(int intf)
+#if CONFIG_LPC17_40_NINTERFACES > 1 || defined(CONFIG_NETDEV_LATEINIT)
+int lpc17_40_ethinitialize(int intf)
#else
-static inline int lpc17_ethinitialize(int intf)
+static inline int lpc17_40_ethinitialize(int intf)
#endif
{
- struct lpc17_driver_s *priv;
+ struct lpc17_40_driver_s *priv;
uint8_t *pktbuf;
uint32_t regval;
int ret;
int i;
- DEBUGASSERT(intf < CONFIG_LPC17_NINTERFACES);
+ DEBUGASSERT(intf < CONFIG_LPC17_40_NINTERFACES);
priv = &g_ethdrvr[intf];
/* Turn on the ethernet MAC clock */
- regval = lpc17_getreg(LPC17_SYSCON_PCONP);
+ regval = lpc17_40_getreg(LPC17_40_SYSCON_PCONP);
regval |= SYSCON_PCONP_PCENET;
- lpc17_putreg(regval, LPC17_SYSCON_PCONP);
+ lpc17_40_putreg(regval, LPC17_40_SYSCON_PCONP);
/* Configure all GPIO pins needed by ENET */
for (i = 0; i < GPIO_NENET_PINS; i++)
{
- (void)lpc17_configgpio(g_enetpins[i]);
+ (void)lpc17_40_configgpio(g_enetpins[i]);
}
- lpc17_showpins();
+ lpc17_40_showpins();
/* Select the packet buffer */
@@ -3211,21 +3211,21 @@ static inline int lpc17_ethinitialize(int intf)
/* Initialize the driver structure */
- memset(priv, 0, sizeof(struct lpc17_driver_s));
+ memset(priv, 0, sizeof(struct lpc17_40_driver_s));
priv->lp_dev.d_buf = pktbuf; /* Single packet buffer */
- priv->lp_dev.d_ifup = lpc17_ifup; /* I/F down callback */
- priv->lp_dev.d_ifdown = lpc17_ifdown; /* I/F up (new IP address) callback */
- priv->lp_dev.d_txavail = lpc17_txavail; /* New TX data callback */
+ priv->lp_dev.d_ifup = lpc17_40_ifup; /* I/F down callback */
+ priv->lp_dev.d_ifdown = lpc17_40_ifdown; /* I/F up (new IP address) callback */
+ priv->lp_dev.d_txavail = lpc17_40_txavail; /* New TX data callback */
#ifdef CONFIG_NET_MCASTGROUP
- priv->lp_dev.d_addmac = lpc17_addmac; /* Add multicast MAC address */
- priv->lp_dev.d_rmmac = lpc17_rmmac; /* Remove multicast MAC address */
+ priv->lp_dev.d_addmac = lpc17_40_addmac; /* Add multicast MAC address */
+ priv->lp_dev.d_rmmac = lpc17_40_rmmac; /* Remove multicast MAC address */
#endif
#ifdef CONFIG_NETDEV_IOCTL
- priv->lp_dev.d_ioctl = lpc17_eth_ioctl; /* Handle network IOCTL commands */
+ priv->lp_dev.d_ioctl = lpc17_40_eth_ioctl; /* Handle network IOCTL commands */
#endif
priv->lp_dev.d_private = (void *)priv; /* Used to recover private state from dev */
-#if CONFIG_LPC17_NINTERFACES > 1
+#if CONFIG_LPC17_40_NINTERFACES > 1
# error "A mechanism to associate base address an IRQ with an interface is needed"
priv->lp_base = ??; /* Ethernet controller base address */
priv->lp_irq = ??; /* Ethernet controller IRQ number */
@@ -3238,17 +3238,17 @@ static inline int lpc17_ethinitialize(int intf)
/* Reset the Ethernet controller and leave in the ifdown statue. The
* Ethernet controller will be properly re-initialized each time
- * lpc17_ifup() is called.
+ * lpc17_40_ifup() is called.
*/
- lpc17_ifdown(&priv->lp_dev);
+ lpc17_40_ifdown(&priv->lp_dev);
/* Attach the IRQ to the driver */
-#if CONFIG_LPC17_NINTERFACES > 1
- ret = irq_attach(priv->irq, lpc17_interrupt, NULL);
+#if CONFIG_LPC17_40_NINTERFACES > 1
+ ret = irq_attach(priv->irq, lpc17_40_interrupt, NULL);
#else
- ret = irq_attach(LPC17_IRQ_ETH, lpc17_interrupt, NULL);
+ ret = irq_attach(LPC17_40_IRQ_ETH, lpc17_40_interrupt, NULL);
#endif
if (ret != 0)
{
@@ -3274,11 +3274,11 @@ static inline int lpc17_ethinitialize(int intf)
*
****************************************************************************/
-#if CONFIG_LPC17_NINTERFACES == 1 && !defined(CONFIG_NETDEV_LATEINIT)
+#if CONFIG_LPC17_40_NINTERFACES == 1 && !defined(CONFIG_NETDEV_LATEINIT)
void up_netinitialize(void)
{
- (void)lpc17_ethinitialize(0);
+ (void)lpc17_40_ethinitialize(0);
}
#endif
-#endif /* LPC17_NETHCONTROLLERS > 0 */
-#endif /* CONFIG_NET && CONFIG_LPC17_ETHERNET */
+#endif /* LPC17_40_NETHCONTROLLERS > 0 */
+#endif /* CONFIG_NET && CONFIG_LPC17_40_ETHERNET */
diff --git a/arch/arm/src/lpc17xx/lpc17_ethernet.h b/arch/arm/src/lpc17xx_40xx/lpc17_40_ethernet.h
similarity index 91%
rename from arch/arm/src/lpc17xx/lpc17_ethernet.h
rename to arch/arm/src/lpc17xx_40xx/lpc17_40_ethernet.h
index 9aebf2d7e78..1151aaac9c6 100644
--- a/arch/arm/src/lpc17xx/lpc17_ethernet.h
+++ b/arch/arm/src/lpc17xx_40xx/lpc17_40_ethernet.h
@@ -1,5 +1,5 @@
/************************************************************************************
- * arch/arm/src/lpc17xx/lpc17_ethernet.h
+ * arch/arm/src/lpc17xx_40xx/lpc17_40_ethernet.h
*
* Copyright (C) 2010, 2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt
@@ -33,15 +33,15 @@
*
************************************************************************************/
-#ifndef __ARCH_ARM_SRC_LPC17XX_LPC17_ETHERNET_H
-#define __ARCH_ARM_SRC_LPC17XX_LPC17_ETHERNET_H
+#ifndef __ARCH_ARM_SRC_LPC17XX_40XX_LPC17_40_ETHERNET_H
+#define __ARCH_ARM_SRC_LPC17XX_40XX_LPC17_40_ETHERNET_H
/************************************************************************************
* Included Files
************************************************************************************/
#include
-#include "hardware/lpc17_ethernet.h"
+#include "hardware/lpc17_40_ethernet.h"
/************************************************************************************
* Pre-processor Definitions
@@ -70,4 +70,4 @@ extern "C"
#endif
#endif /* __ASSEMBLY__ */
-#endif /* __ARCH_ARM_SRC_LPC17XX_LPC17_ETHERNET_H */
+#endif /* __ARCH_ARM_SRC_LPC17XX_40XX_LPC17_40_ETHERNET_H */
diff --git a/arch/arm/src/lpc17xx/lpc17_gpdma.c b/arch/arm/src/lpc17xx_40xx/lpc17_40_gpdma.c
similarity index 72%
rename from arch/arm/src/lpc17xx/lpc17_gpdma.c
rename to arch/arm/src/lpc17xx_40xx/lpc17_40_gpdma.c
index 9de5338a867..45b09804ece 100644
--- a/arch/arm/src/lpc17xx/lpc17_gpdma.c
+++ b/arch/arm/src/lpc17xx_40xx/lpc17_40_gpdma.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * arch/arm/src/lpc17xx/lpc17_gpdma.c
+ * arch/arm/src/lpc17xx_40xx/lpc17_40_gpdma.c
*
* Copyright (C) 2010, 2014, 2016-2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt
@@ -55,10 +55,10 @@
#include "chip.h"
-#include "hardware/lpc17_syscon.h"
-#include "lpc17_gpdma.h"
+#include "hardware/lpc17_40_syscon.h"
+#include "lpc17_40_gpdma.h"
-#ifdef CONFIG_LPC17_GPDMA
+#ifdef CONFIG_LPC17_40_GPDMA
/****************************************************************************
* Pre-processor Definitions
@@ -69,7 +69,7 @@
****************************************************************************/
/* This structure represents the state of one DMA channel */
-struct lpc17_dmach_s
+struct lpc17_40_dmach_s
{
uint8_t chn; /* The DMA channel number */
bool inuse; /* True: The channel is in use */
@@ -81,13 +81,13 @@ struct lpc17_dmach_s
/* This structure represents the state of the LPC17 DMA block */
-struct lpc17_gpdma_s
+struct lpc17_40_gpdma_s
{
sem_t exclsem; /* For exclusive access to the DMA channel list */
/* This is the state of each DMA channel */
- struct lpc17_dmach_s dmach[LPC17_NDMACH];
+ struct lpc17_40_dmach_s dmach[LPC17_40_NDMACH];
};
/****************************************************************************
@@ -99,7 +99,7 @@ struct lpc17_gpdma_s
****************************************************************************/
/* The state of the LPC17 DMA block */
-static struct lpc17_gpdma_s g_gpdma;
+static struct lpc17_40_gpdma_s g_gpdma;
/****************************************************************************
* Public Data
@@ -121,7 +121,7 @@ volatile uint8_t g_dma_inprogress;
****************************************************************************/
/****************************************************************************
- * Name: lpc17_dmainprogress
+ * Name: lpc17_40_dmainprogress
*
* Description:
* Another DMA has started. Increment the g_dma_inprogress counter.
@@ -131,28 +131,28 @@ volatile uint8_t g_dma_inprogress;
*
****************************************************************************/
-static void lpc17_dmainprogress(struct lpc17_dmach_s *dmach)
+static void lpc17_40_dmainprogress(struct lpc17_40_dmach_s *dmach)
{
irqstate_t flags;
/* Increment the DMA in progress counter */
flags = enter_critical_section();
- DEBUGASSERT(!dmach->inprogress && g_dma_inprogress < LPC17_NDMACH);
+ DEBUGASSERT(!dmach->inprogress && g_dma_inprogress < LPC17_40_NDMACH);
g_dma_inprogress++;
dmach->inprogress = true;
leave_critical_section(flags);
}
/****************************************************************************
- * Name: lpc17_dmadone
+ * Name: lpc17_40_dmadone
*
* Description:
* A DMA has completed. Decrement the g_dma_inprogress counter.
*
- * This function is called only from lpc17_dmastop which, in turn, will be
+ * This function is called only from lpc17_40_dmastop which, in turn, will be
* called either by the user directly, by the user indirectly via
- * lpc17_dmafree(), or from gpdma_interrupt when the transfer completes.
+ * lpc17_40_dmafree(), or from gpdma_interrupt when the transfer completes.
*
* NOTE: In the first two cases, we must be able to handle the case where
* there is no DMA in progress and gracefully ignore the call.
@@ -162,7 +162,7 @@ static void lpc17_dmainprogress(struct lpc17_dmach_s *dmach)
*
****************************************************************************/
-static void lpc17_dmadone(struct lpc17_dmach_s *dmach)
+static void lpc17_40_dmadone(struct lpc17_40_dmach_s *dmach)
{
irqstate_t flags;
@@ -192,7 +192,7 @@ static void lpc17_dmadone(struct lpc17_dmach_s *dmach)
static int gpdma_interrupt(int irq, FAR void *context, FAR void *arg)
{
- struct lpc17_dmach_s *dmach;
+ struct lpc17_40_dmach_s *dmach;
uint32_t regval;
uint32_t chbit;
int result;
@@ -200,7 +200,7 @@ static int gpdma_interrupt(int irq, FAR void *context, FAR void *arg)
/* Check each DMA channel */
- for (i = 0; i < LPC17_NDMACH; i++)
+ for (i = 0; i < LPC17_40_NDMACH; i++)
{
chbit = DMACH((uint32_t)i);
@@ -210,7 +210,7 @@ static int gpdma_interrupt(int irq, FAR void *context, FAR void *arg)
* either the error or terminal count interrupt requests.
*/
- regval = getreg32(LPC17_DMA_INTST);
+ regval = getreg32(LPC17_40_DMA_INTST);
if ((regval & chbit) != 0)
{
/* Yes.. Is this channel assigned? Is there a callback function? */
@@ -220,7 +220,7 @@ static int gpdma_interrupt(int irq, FAR void *context, FAR void *arg)
{
/* Yes.. did an error occur? */
- regval = getreg32(LPC17_DMA_INTERRST);
+ regval = getreg32(LPC17_40_DMA_INTERRST);
if ((regval & chbit) != 0)
{
/* Yes.. report error status */
@@ -234,7 +234,7 @@ static int gpdma_interrupt(int irq, FAR void *context, FAR void *arg)
{
/* Let's make sure it is the terminal transfer event. */
- regval = getreg32(LPC17_DMA_INTTCST);
+ regval = getreg32(LPC17_40_DMA_INTTCST);
if ((regval & chbit) != 0)
{
result = OK;
@@ -257,7 +257,7 @@ static int gpdma_interrupt(int irq, FAR void *context, FAR void *arg)
* this channel, and clear any pending interrupts.
*/
- lpc17_dmastop((DMA_HANDLE)dmach);
+ lpc17_40_dmastop((DMA_HANDLE)dmach);
}
}
@@ -288,27 +288,27 @@ void weak_function up_dma_initialize(void)
/* Enable clocking to the GPDMA block */
- regval = getreg32(LPC17_SYSCON_PCONP);
+ regval = getreg32(LPC17_40_SYSCON_PCONP);
regval |= SYSCON_PCONP_PCGPDMA;
- putreg32(regval, LPC17_SYSCON_PCONP);
+ putreg32(regval, LPC17_40_SYSCON_PCONP);
/* Reset all channel configurations */
- for (i = 0; i < LPC17_NDMACH; i++)
+ for (i = 0; i < LPC17_40_NDMACH; i++)
{
- putreg32(0, LPC17_DMACH_CONFIG(i));
+ putreg32(0, LPC17_40_DMACH_CONFIG(i));
}
/* Clear all DMA interrupts */
- putreg32(DMACH_ALL, LPC17_DMA_INTTCCLR);
- putreg32(DMACH_ALL, LPC17_DMA_INTERRCLR);
+ putreg32(DMACH_ALL, LPC17_40_DMA_INTTCCLR);
+ putreg32(DMACH_ALL, LPC17_40_DMA_INTERRCLR);
/* Initialize the DMA state structure */
nxsem_init(&g_gpdma.exclsem, 0, 1);
- for (i = 0; i < LPC17_NDMACH; i++)
+ for (i = 0; i < LPC17_40_NDMACH; i++)
{
g_gpdma.dmach[i].chn = i; /* Channel number */
g_gpdma.dmach[i].inuse = false; /* Channel is not in-use */
@@ -316,19 +316,19 @@ void weak_function up_dma_initialize(void)
/* Attach and enable the common interrupt handler */
- ret = irq_attach(LPC17_IRQ_GPDMA, gpdma_interrupt, NULL);
+ ret = irq_attach(LPC17_40_IRQ_GPDMA, gpdma_interrupt, NULL);
if (ret == OK)
{
- up_enable_irq(LPC17_IRQ_GPDMA);
+ up_enable_irq(LPC17_40_IRQ_GPDMA);
}
/* Enable the DMA controller (for little endian operation) */
- putreg32(DMA_CONFIG_E, LPC17_DMA_CONFIG);
+ putreg32(DMA_CONFIG_E, LPC17_40_DMA_CONFIG);
}
/****************************************************************************
- * Name: lpc17_dmaconfigure
+ * Name: lpc17_40_dmaconfigure
*
* Description:
* Configure a DMA request. Each DMA request may have two different DMA
@@ -339,11 +339,11 @@ void weak_function up_dma_initialize(void)
*
****************************************************************************/
-void lpc17_dmaconfigure(uint8_t dmarequest, bool alternate)
+void lpc17_40_dmaconfigure(uint8_t dmarequest, bool alternate)
{
uint32_t regval;
- DEBUGASSERT(dmarequest < LPC17_NDMAREQ);
+ DEBUGASSERT(dmarequest < LPC17_40_NDMAREQ);
#ifdef LPC176x
/* For the LPC176x family, only request numbers 8-15 have DMASEL bits */
@@ -358,7 +358,7 @@ void lpc17_dmaconfigure(uint8_t dmarequest, bool alternate)
/* Set or clear the DMASEL bit corresponding to the request number */
- regval = getreg32(LPC17_SYSCON_DMAREQSEL);
+ regval = getreg32(LPC17_40_SYSCON_DMAREQSEL);
if (alternate)
{
@@ -369,11 +369,11 @@ void lpc17_dmaconfigure(uint8_t dmarequest, bool alternate)
regval &= ~(1 << dmarequest);
}
- putreg32(regval, LPC17_SYSCON_DMAREQSEL);
+ putreg32(regval, LPC17_40_SYSCON_DMAREQSEL);
}
/****************************************************************************
- * Name: lpc17_dmachannel
+ * Name: lpc17_40_dmachannel
*
* Description:
* Allocate a DMA channel. This function sets aside a DMA channel and
@@ -386,9 +386,9 @@ void lpc17_dmaconfigure(uint8_t dmarequest, bool alternate)
*
****************************************************************************/
-DMA_HANDLE lpc17_dmachannel(void)
+DMA_HANDLE lpc17_40_dmachannel(void)
{
- struct lpc17_dmach_s *dmach = NULL;
+ struct lpc17_40_dmach_s *dmach = NULL;
int ret;
int i;
@@ -403,7 +403,7 @@ DMA_HANDLE lpc17_dmachannel(void)
/* Find an available DMA channel */
- for (i = 0; i < LPC17_NDMACH; i++)
+ for (i = 0; i < LPC17_40_NDMACH; i++)
{
if (!g_gpdma.dmach[i].inuse)
{
@@ -422,11 +422,11 @@ DMA_HANDLE lpc17_dmachannel(void)
}
/****************************************************************************
- * Name: lpc17_dmafree
+ * Name: lpc17_40_dmafree
*
* Description:
* Release a DMA channel. NOTE: The 'handle' used in this argument must
- * NEVER be used again until lpc17_dmachannel() is called again to re-gain
+ * NEVER be used again until lpc17_40_dmachannel() is called again to re-gain
* a valid handle.
*
* Returned Value:
@@ -434,15 +434,15 @@ DMA_HANDLE lpc17_dmachannel(void)
*
****************************************************************************/
-void lpc17_dmafree(DMA_HANDLE handle)
+void lpc17_40_dmafree(DMA_HANDLE handle)
{
- struct lpc17_dmach_s *dmach = (DMA_HANDLE)handle;
+ struct lpc17_40_dmach_s *dmach = (DMA_HANDLE)handle;
DEBUGASSERT(dmach && dmach->inuse);
/* Make sure that the DMA channel was properly stopped */
- lpc17_dmastop(handle);
+ lpc17_40_dmastop(handle);
/* Mark the channel available. This is an atomic operation and needs no
* special protection.
@@ -452,17 +452,17 @@ void lpc17_dmafree(DMA_HANDLE handle)
}
/****************************************************************************
- * Name: lpc17_dmasetup
+ * Name: lpc17_40_dmasetup
*
* Description:
* Configure DMA for one transfer.
*
****************************************************************************/
-int lpc17_dmasetup(DMA_HANDLE handle, uint32_t control, uint32_t config,
+int lpc17_40_dmasetup(DMA_HANDLE handle, uint32_t control, uint32_t config,
uint32_t srcaddr, uint32_t destaddr, size_t nxfrs)
{
- struct lpc17_dmach_s *dmach = (DMA_HANDLE)handle;
+ struct lpc17_40_dmach_s *dmach = (DMA_HANDLE)handle;
uint32_t chbit;
uint32_t regval;
uint32_t base;
@@ -470,12 +470,12 @@ int lpc17_dmasetup(DMA_HANDLE handle, uint32_t control, uint32_t config,
DEBUGASSERT(dmach && dmach->inuse && nxfrs < 4096);
chbit = DMACH((uint32_t)dmach->chn);
- base = LPC17_DMACH_BASE((uint32_t)dmach->chn);
+ base = LPC17_40_DMACH_BASE((uint32_t)dmach->chn);
/* Put the channel in a known state. Zero disables everything */
- putreg32(0, base + LPC17_DMACH_CONTROL_OFFSET);
- putreg32(0, base + LPC17_DMACH_CONFIG_OFFSET);
+ putreg32(0, base + LPC17_40_DMACH_CONTROL_OFFSET);
+ putreg32(0, base + LPC17_40_DMACH_CONFIG_OFFSET);
/* "Programming a DMA channel
*
@@ -483,7 +483,7 @@ int lpc17_dmasetup(DMA_HANDLE handle, uint32_t control, uint32_t config,
* has the highest priority and DMA channel 7 the lowest priority.
*/
- regval = getreg32(LPC17_DMA_ENBLDCHNS);
+ regval = getreg32(LPC17_40_DMA_ENBLDCHNS);
if ((regval & chbit) != 0)
{
/* There is an active DMA on this channel! */
@@ -496,23 +496,23 @@ int lpc17_dmasetup(DMA_HANDLE handle, uint32_t control, uint32_t config,
* channel operation might have left interrupt active.
*/
- putreg32(chbit, LPC17_DMA_INTTCCLR);
- putreg32(chbit, LPC17_DMA_INTERRCLR);
+ putreg32(chbit, LPC17_40_DMA_INTTCCLR);
+ putreg32(chbit, LPC17_40_DMA_INTERRCLR);
/* 3. "Write the source address into the DMACCxSrcAddr register. */
- putreg32(srcaddr, base + LPC17_DMACH_SRCADDR_OFFSET);
+ putreg32(srcaddr, base + LPC17_40_DMACH_SRCADDR_OFFSET);
/* 4. "Write the destination address into the DMACCxDestAddr register. */
- putreg32(destaddr, base + LPC17_DMACH_DESTADDR_OFFSET);
+ putreg32(destaddr, base + LPC17_40_DMACH_DESTADDR_OFFSET);
/* 5. "Write the address of the next LLI into the DMACCxLLI register. If
* the transfer comprises of a single packet of data then 0 must be
* written into this register.
*/
- putreg32(0, base + LPC17_DMACH_LLI_OFFSET);
+ putreg32(0, base + LPC17_40_DMACH_LLI_OFFSET);
/* 6. "Write the control information into the DMACCxControl register."
*
@@ -523,9 +523,9 @@ int lpc17_dmasetup(DMA_HANDLE handle, uint32_t control, uint32_t config,
regval = control & ~(DMACH_CONTROL_XFRSIZE_MASK | DMACH_CONTROL_I);
regval |= ((uint32_t)nxfrs << DMACH_CONTROL_XFRSIZE_SHIFT);
- putreg32(regval, base + LPC17_DMACH_CONTROL_OFFSET);
+ putreg32(regval, base + LPC17_40_DMACH_CONTROL_OFFSET);
- /* Save the number of transfer to perform for lpc17_dmastart */
+ /* Save the number of transfer to perform for lpc17_40_dmastart */
dmach->nxfrs = (uint16_t)nxfrs;
@@ -539,22 +539,22 @@ int lpc17_dmasetup(DMA_HANDLE handle, uint32_t control, uint32_t config,
regval = config & (DMACH_CONFIG_SRCPER_MASK | DMACH_CONFIG_DSTPER_MASK |
DMACH_CONFIG_XFRTYPE_MASK);
- putreg32(regval, base + LPC17_DMACH_CONFIG_OFFSET);
+ putreg32(regval, base + LPC17_40_DMACH_CONFIG_OFFSET);
return OK;
}
/****************************************************************************
- * Name: lpc17_dmastart
+ * Name: lpc17_40_dmastart
*
* Description:
* Start the DMA transfer
*
****************************************************************************/
-int lpc17_dmastart(DMA_HANDLE handle, dma_callback_t callback, void *arg)
+int lpc17_40_dmastart(DMA_HANDLE handle, dma_callback_t callback, void *arg)
{
- struct lpc17_dmach_s *dmach = (DMA_HANDLE)handle;
+ struct lpc17_40_dmach_s *dmach = (DMA_HANDLE)handle;
uint32_t regval;
uint32_t chbit;
uint32_t base;
@@ -567,59 +567,59 @@ int lpc17_dmastart(DMA_HANDLE handle, dma_callback_t callback, void *arg)
dmach->arg = arg;
/* Increment the count of DMAs in-progress. This count will be
- * decremented when lpc17_dmastop() is called, either by the user,
- * indirectly via lpc17_dmafree(), or from gpdma_interrupt when the
+ * decremented when lpc17_40_dmastop() is called, either by the user,
+ * indirectly via lpc17_40_dmafree(), or from gpdma_interrupt when the
* transfer completes.
*/
- lpc17_dmainprogress(dmach);
+ lpc17_40_dmainprogress(dmach);
/* Clear any pending DMA interrupts */
chbit = DMACH((uint32_t)dmach->chn);
- putreg32(chbit, LPC17_DMA_INTTCCLR);
- putreg32(chbit, LPC17_DMA_INTERRCLR);
+ putreg32(chbit, LPC17_40_DMA_INTTCCLR);
+ putreg32(chbit, LPC17_40_DMA_INTERRCLR);
/* Enable terminal count interrupt. Note that we need to restore the
* number transfers. That is because the value has a different meaning
* when it is read.
*/
- base = LPC17_DMACH_BASE((uint32_t)dmach->chn);
- regval = getreg32(base + LPC17_DMACH_CONTROL_OFFSET);
+ base = LPC17_40_DMACH_BASE((uint32_t)dmach->chn);
+ regval = getreg32(base + LPC17_40_DMACH_CONTROL_OFFSET);
regval &= ~DMACH_CONTROL_XFRSIZE_MASK;
regval |= (DMACH_CONTROL_I | ((uint32_t)dmach->nxfrs << DMACH_CONTROL_XFRSIZE_SHIFT));
- putreg32(regval, base + LPC17_DMACH_CONTROL_OFFSET);
+ putreg32(regval, base + LPC17_40_DMACH_CONTROL_OFFSET);
/* Enable the channel and unmask terminal count and error interrupts.
* According to the user manual, zero masks and one unmasks (hence,
* these are really enables).
*/
- regval = getreg32(base + LPC17_DMACH_CONFIG_OFFSET);
+ regval = getreg32(base + LPC17_40_DMACH_CONFIG_OFFSET);
regval |= (DMACH_CONFIG_E | DMACH_CONFIG_IE | DMACH_CONFIG_ITC);
- putreg32(regval, base + LPC17_DMACH_CONFIG_OFFSET);
+ putreg32(regval, base + LPC17_40_DMACH_CONFIG_OFFSET);
return OK;
}
/****************************************************************************
- * Name: lpc17_dmastop
+ * Name: lpc17_40_dmastop
*
* Description:
- * Cancel the DMA. After lpc17_dmastop() is called, the DMA channel is
- * reset and lpc17_dmasetup() must be called before lpc17_dmastart() can be
+ * Cancel the DMA. After lpc17_40_dmastop() is called, the DMA channel is
+ * reset and lpc17_40_dmasetup() must be called before lpc17_40_dmastart() can be
* called again
*
* This function will be called either by the user directly, by the user
- * indirectly via lpc17_dmafree(), or from gpdma_interrupt when the
+ * indirectly via lpc17_40_dmafree(), or from gpdma_interrupt when the
* transfer completes.
*
****************************************************************************/
-void lpc17_dmastop(DMA_HANDLE handle)
+void lpc17_40_dmastop(DMA_HANDLE handle)
{
- struct lpc17_dmach_s *dmach = (DMA_HANDLE)handle;
+ struct lpc17_40_dmach_s *dmach = (DMA_HANDLE)handle;
uint32_t regaddr;
uint32_t regval;
uint32_t chbit;
@@ -631,7 +631,7 @@ void lpc17_dmastop(DMA_HANDLE handle)
* enable bit. Any outstanding data in the FIFO’s is lost.
*/
- regaddr = LPC17_DMACH_CONFIG((uint32_t)dmach->chn);
+ regaddr = LPC17_40_DMACH_CONFIG((uint32_t)dmach->chn);
regval = getreg32(regaddr);
regval &= ~(DMACH_CONFIG_E | DMACH_CONFIG_IE | DMACH_CONFIG_ITC);
putreg32(regval, regaddr);
@@ -639,16 +639,16 @@ void lpc17_dmastop(DMA_HANDLE handle)
/* Clear any pending interrupts for this channel */
chbit = DMACH((uint32_t)dmach->chn);
- putreg32(chbit, LPC17_DMA_INTTCCLR);
- putreg32(chbit, LPC17_DMA_INTERRCLR);
+ putreg32(chbit, LPC17_40_DMA_INTTCCLR);
+ putreg32(chbit, LPC17_40_DMA_INTERRCLR);
/* Decrement the count of DMAs in progress */
- lpc17_dmadone(dmach);
+ lpc17_40_dmadone(dmach);
}
/****************************************************************************
- * Name: lpc17_dmasample
+ * Name: lpc17_40_dmasample
*
* Description:
* Sample DMA register contents
@@ -656,41 +656,41 @@ void lpc17_dmastop(DMA_HANDLE handle)
****************************************************************************/
#ifdef CONFIG__DEBUG_DMA_INFO
-void lpc17_dmasample(DMA_HANDLE handle, struct lpc17_dmaregs_s *regs)
+void lpc17_40_dmasample(DMA_HANDLE handle, struct lpc17_40_dmaregs_s *regs)
{
- struct lpc17_dmach_s *dmach = (DMA_HANDLE)handle;
+ struct lpc17_40_dmach_s *dmach = (DMA_HANDLE)handle;
uint32_t base;
DEBUGASSERT(dmach);
/* Sample the global DMA registers */
- regs->gbl.intst = getreg32(LPC17_DMA_INTST);
- regs->gbl.inttcst = getreg32(LPC17_DMA_INTTCST);
- regs->gbl.interrst = getreg32(LPC17_DMA_INTERRST);
- regs->gbl.rawinttcst = getreg32(LPC17_DMA_RAWINTTCST);
- regs->gbl.rawinterrst = getreg32(LPC17_DMA_RAWINTERRST);
- regs->gbl.enbldchns = getreg32(LPC17_DMA_ENBLDCHNS);
- regs->gbl.softbreq = getreg32(LPC17_DMA_SOFTBREQ);
- regs->gbl.softsreq = getreg32(LPC17_DMA_SOFTSREQ);
- regs->gbl.softlbreq = getreg32(LPC17_DMA_SOFTLBREQ);
- regs->gbl.softlsreq = getreg32(LPC17_DMA_SOFTLSREQ);
- regs->gbl.config = getreg32(LPC17_DMA_CONFIG);
- regs->gbl.sync = getreg32(LPC17_DMA_SYNC);
+ regs->gbl.intst = getreg32(LPC17_40_DMA_INTST);
+ regs->gbl.inttcst = getreg32(LPC17_40_DMA_INTTCST);
+ regs->gbl.interrst = getreg32(LPC17_40_DMA_INTERRST);
+ regs->gbl.rawinttcst = getreg32(LPC17_40_DMA_RAWINTTCST);
+ regs->gbl.rawinterrst = getreg32(LPC17_40_DMA_RAWINTERRST);
+ regs->gbl.enbldchns = getreg32(LPC17_40_DMA_ENBLDCHNS);
+ regs->gbl.softbreq = getreg32(LPC17_40_DMA_SOFTBREQ);
+ regs->gbl.softsreq = getreg32(LPC17_40_DMA_SOFTSREQ);
+ regs->gbl.softlbreq = getreg32(LPC17_40_DMA_SOFTLBREQ);
+ regs->gbl.softlsreq = getreg32(LPC17_40_DMA_SOFTLSREQ);
+ regs->gbl.config = getreg32(LPC17_40_DMA_CONFIG);
+ regs->gbl.sync = getreg32(LPC17_40_DMA_SYNC);
/* Sample the DMA channel registers */
- base = LPC17_DMACH_BASE((uint32_t)dmach->chn);
- regs->ch.srcaddr = getreg32(base + LPC17_DMACH_SRCADDR_OFFSET);
- regs->ch.destaddr = getreg32(base + LPC17_DMACH_DESTADDR_OFFSET);
- regs->ch.lli = getreg32(base + LPC17_DMACH_LLI_OFFSET);
- regs->ch.control = getreg32(base + LPC17_DMACH_CONTROL_OFFSET);
- regs->ch.config = getreg32(base + LPC17_DMACH_CONFIG_OFFSET);
+ base = LPC17_40_DMACH_BASE((uint32_t)dmach->chn);
+ regs->ch.srcaddr = getreg32(base + LPC17_40_DMACH_SRCADDR_OFFSET);
+ regs->ch.destaddr = getreg32(base + LPC17_40_DMACH_DESTADDR_OFFSET);
+ regs->ch.lli = getreg32(base + LPC17_40_DMACH_LLI_OFFSET);
+ regs->ch.control = getreg32(base + LPC17_40_DMACH_CONTROL_OFFSET);
+ regs->ch.config = getreg32(base + LPC17_40_DMACH_CONFIG_OFFSET);
}
#endif /* CONFIG__DEBUG_DMA_INFO */
/****************************************************************************
- * Name: lpc17_dmadump
+ * Name: lpc17_40_dmadump
*
* Description:
* Dump previously sampled DMA register contents
@@ -698,10 +698,10 @@ void lpc17_dmasample(DMA_HANDLE handle, struct lpc17_dmaregs_s *regs)
****************************************************************************/
#ifdef CONFIG__DEBUG_DMA_INFO
-void lpc17_dmadump(DMA_HANDLE handle, const struct lpc17_dmaregs_s *regs,
+void lpc17_40_dmadump(DMA_HANDLE handle, const struct lpc17_40_dmaregs_s *regs,
const char *msg)
{
- struct lpc17_dmach_s *dmach = (DMA_HANDLE)handle;
+ struct lpc17_40_dmach_s *dmach = (DMA_HANDLE)handle;
uint32_t base;
DEBUGASSERT(dmach);
@@ -710,47 +710,47 @@ void lpc17_dmadump(DMA_HANDLE handle, const struct lpc17_dmaregs_s *regs,
dmainfo("Global GPDMA Registers: %s\n", msg);
dmainfo(" INTST[%08x]: %08x\n",
- LPC17_DMA_INTST, regs->gbl.intst);
+ LPC17_40_DMA_INTST, regs->gbl.intst);
dmainfo(" INTTCST[%08x]: %08x\n",
- LPC17_DMA_INTTCST, regs->gbl.inttcst);
+ LPC17_40_DMA_INTTCST, regs->gbl.inttcst);
dmainfo(" INTERRST[%08x]: %08x\n",
- LPC17_DMA_INTERRST, regs->gbl.interrst);
+ LPC17_40_DMA_INTERRST, regs->gbl.interrst);
dmainfo(" RAWINTTCST[%08x]: %08x\n",
- LPC17_DMA_RAWINTTCST, regs->gbl.rawinttcst);
+ LPC17_40_DMA_RAWINTTCST, regs->gbl.rawinttcst);
dmainfo(" RAWINTERRST[%08x]: %08x\n",
- LPC17_DMA_RAWINTERRST, regs->gbl.rawinterrst);
+ LPC17_40_DMA_RAWINTERRST, regs->gbl.rawinterrst);
dmainfo(" ENBLDCHNS[%08x]: %08x\n",
- LPC17_DMA_ENBLDCHNS, regs->gbl.enbldchns);
+ LPC17_40_DMA_ENBLDCHNS, regs->gbl.enbldchns);
dmainfo(" SOFTBREQ[%08x]: %08x\n",
- LPC17_DMA_SOFTBREQ, regs->gbl.softbreq);
+ LPC17_40_DMA_SOFTBREQ, regs->gbl.softbreq);
dmainfo(" SOFTSREQ[%08x]: %08x\n",
- LPC17_DMA_SOFTSREQ, regs->gbl.softsreq);
+ LPC17_40_DMA_SOFTSREQ, regs->gbl.softsreq);
dmainfo(" SOFTLBREQ[%08x]: %08x\n",
- LPC17_DMA_SOFTLBREQ, regs->gbl.softlbreq);
+ LPC17_40_DMA_SOFTLBREQ, regs->gbl.softlbreq);
dmainfo(" SOFTLSREQ[%08x]: %08x\n",
- LPC17_DMA_SOFTLSREQ, regs->gbl.softlsreq);
+ LPC17_40_DMA_SOFTLSREQ, regs->gbl.softlsreq);
dmainfo(" CONFIG[%08x]: %08x\n",
- LPC17_DMA_CONFIG, regs->gbl.config);
+ LPC17_40_DMA_CONFIG, regs->gbl.config);
dmainfo(" SYNC[%08x]: %08x\n",
- LPC17_DMA_SYNC, regs->gbl.sync);
+ LPC17_40_DMA_SYNC, regs->gbl.sync);
/* Dump the DMA channel registers */
- base = LPC17_DMACH_BASE((uint32_t)dmach->chn);
+ base = LPC17_40_DMACH_BASE((uint32_t)dmach->chn);
dmainfo("Channel GPDMA Registers: %d\n", dmach->chn);
dmainfo(" SRCADDR[%08x]: %08x\n",
- base + LPC17_DMACH_SRCADDR_OFFSET, regs->ch.srcaddr);
+ base + LPC17_40_DMACH_SRCADDR_OFFSET, regs->ch.srcaddr);
dmainfo(" DESTADDR[%08x]: %08x\n",
- base + LPC17_DMACH_DESTADDR_OFFSET, regs->ch.destaddr);
+ base + LPC17_40_DMACH_DESTADDR_OFFSET, regs->ch.destaddr);
dmainfo(" LLI[%08x]: %08x\n",
- base + LPC17_DMACH_LLI_OFFSET, regs->ch.lli);
+ base + LPC17_40_DMACH_LLI_OFFSET, regs->ch.lli);
dmainfo(" CONTROL[%08x]: %08x\n",
- base + LPC17_DMACH_CONTROL_OFFSET, regs->ch.control);
+ base + LPC17_40_DMACH_CONTROL_OFFSET, regs->ch.control);
dmainfo(" CONFIG[%08x]: %08x\n",
- base + LPC17_DMACH_CONFIG_OFFSET, regs->ch.config);
+ base + LPC17_40_DMACH_CONFIG_OFFSET, regs->ch.config);
}
#endif /* CONFIG__DEBUG_DMA_INFO */
-#endif /* CONFIG_LPC17_GPDMA */
+#endif /* CONFIG_LPC17_40_GPDMA */
diff --git a/arch/arm/src/lpc17xx/lpc17_gpdma.h b/arch/arm/src/lpc17xx_40xx/lpc17_40_gpdma.h
similarity index 82%
rename from arch/arm/src/lpc17xx/lpc17_gpdma.h
rename to arch/arm/src/lpc17xx_40xx/lpc17_40_gpdma.h
index 3c93379a9d8..013f8c55731 100644
--- a/arch/arm/src/lpc17xx/lpc17_gpdma.h
+++ b/arch/arm/src/lpc17xx_40xx/lpc17_40_gpdma.h
@@ -1,5 +1,5 @@
/****************************************************************************
- * arch/arm/src/lpc17xx/lpc17_gpdma.h
+ * arch/arm/src/lpc17xx_40xx/lpc17_40_gpdma.h
*
* Copyright (C) 2010, 2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt
@@ -33,15 +33,15 @@
*
****************************************************************************/
-#ifndef __ARCH_ARM_SRC_LPC17XX_LPC17_GPDMA_H
-#define __ARCH_ARM_SRC_LPC17XX_LPC17_GPDMA_H
+#ifndef __ARCH_ARM_SRC_LPC17XX_40XX_LPC17_40_GPDMA_H
+#define __ARCH_ARM_SRC_LPC17XX_40XX_LPC17_40_GPDMA_H
/****************************************************************************
* Included Files
****************************************************************************/
#include
-#include "hardware/lpc17_gpdma.h"
+#include "hardware/lpc17_40_gpdma.h"
/****************************************************************************
* Pre-processor Definitions
@@ -51,14 +51,14 @@
* Public Types
****************************************************************************/
-#ifdef CONFIG_LPC17_GPDMA
+#ifdef CONFIG_LPC17_40_GPDMA
/* DMA_HANDLE is an opaque reference to an allocated DMA channel */
typedef FAR void *DMA_HANDLE;
-/* dma_callback_t a function pointer provided to lpc17_dmastart. This
+/* dma_callback_t a function pointer provided to lpc17_40_dmastart. This
* function is called at the completion of the DMA transfer. 'arg' is the
- * same 'arg' value that was provided when lpc17_dmastart() was called and
+ * same 'arg' value that was provided when lpc17_40_dmastart() was called and
* result indicates the result of the transfer: Zero indicates a successful
* transfers. On failure, a negated errno is returned indicating the general
* nature of the DMA faiure.
@@ -69,7 +69,7 @@ typedef void (*dma_callback_t)(DMA_HANDLE handle, void *arg, int result);
/* The following is used for sampling DMA registers when CONFIG DEBUG_DMA is selected */
#ifdef CONFIG__DEBUG_DMA_INFO
-struct lpc17_dmaglobalregs_s
+struct lpc17_40_dmaglobalregs_s
{
/* Global Registers */
@@ -87,7 +87,7 @@ struct lpc17_dmaglobalregs_s
uint32_t sync; /* DMA Synchronization Register */
};
-struct lpc17_dmachanregs_s
+struct lpc17_40_dmachanregs_s
{
/* Channel Registers */
@@ -98,15 +98,15 @@ struct lpc17_dmachanregs_s
uint32_t config; /* DMA Channel Configuration Register */
};
-struct lpc17_dmaregs_s
+struct lpc17_40_dmaregs_s
{
/* Global Registers */
- struct lpc17_dmaglobalregs_s gbl;
+ struct lpc17_40_dmaglobalregs_s gbl;
/* Channel Registers */
- struct lpc17_dmachanregs_s ch;
+ struct lpc17_40_dmachanregs_s ch;
};
#endif /* CONFIG__DEBUG_DMA_INFO */
@@ -141,7 +141,7 @@ EXTERN volatile uint8_t g_dma_inprogress;
****************************************************************************/
/****************************************************************************
- * Name: lpc17_dmaconfigure
+ * Name: lpc17_40_dmaconfigure
*
* Description:
* Configure a DMA request. Each DMA request may have two different DMA
@@ -152,10 +152,10 @@ EXTERN volatile uint8_t g_dma_inprogress;
*
****************************************************************************/
-void lpc17_dmaconfigure(uint8_t dmarequest, bool alternate);
+void lpc17_40_dmaconfigure(uint8_t dmarequest, bool alternate);
/****************************************************************************
- * Name: lpc17_dmachannel
+ * Name: lpc17_40_dmachannel
*
* Description:
* Allocate a DMA channel. This function sets aside a DMA channel and
@@ -168,14 +168,14 @@ void lpc17_dmaconfigure(uint8_t dmarequest, bool alternate);
*
****************************************************************************/
-DMA_HANDLE lpc17_dmachannel(void);
+DMA_HANDLE lpc17_40_dmachannel(void);
/****************************************************************************
- * Name: lpc17_dmafree
+ * Name: lpc17_40_dmafree
*
* Description:
* Release a DMA channel. NOTE: The 'handle' used in this argument must
- * NEVER be used again until lpc17_dmachannel() is called again to re-gain
+ * NEVER be used again until lpc17_40_dmachannel() is called again to re-gain
* a valid handle.
*
* Returned Value:
@@ -183,43 +183,43 @@ DMA_HANDLE lpc17_dmachannel(void);
*
****************************************************************************/
-void lpc17_dmafree(DMA_HANDLE handle);
+void lpc17_40_dmafree(DMA_HANDLE handle);
/****************************************************************************
- * Name: lpc17_dmasetup
+ * Name: lpc17_40_dmasetup
*
* Description:
* Configure DMA for one transfer.
*
****************************************************************************/
-int lpc17_dmasetup(DMA_HANDLE handle, uint32_t control, uint32_t config,
+int lpc17_40_dmasetup(DMA_HANDLE handle, uint32_t control, uint32_t config,
uint32_t srcaddr, uint32_t destaddr, size_t nxfrs);
/****************************************************************************
- * Name: lpc17_dmastart
+ * Name: lpc17_40_dmastart
*
* Description:
* Start the DMA transfer
*
****************************************************************************/
-int lpc17_dmastart(DMA_HANDLE handle, dma_callback_t callback, void *arg);
+int lpc17_40_dmastart(DMA_HANDLE handle, dma_callback_t callback, void *arg);
/****************************************************************************
- * Name: lpc17_dmastop
+ * Name: lpc17_40_dmastop
*
* Description:
- * Cancel the DMA. After lpc17_dmastop() is called, the DMA channel is
- * reset and lpc17_dmasetup() must be called before lpc17_dmastart() can be
+ * Cancel the DMA. After lpc17_40_dmastop() is called, the DMA channel is
+ * reset and lpc17_40_dmasetup() must be called before lpc17_40_dmastart() can be
* called again
*
****************************************************************************/
-void lpc17_dmastop(DMA_HANDLE handle);
+void lpc17_40_dmastop(DMA_HANDLE handle);
/****************************************************************************
- * Name: lpc17_dmasample
+ * Name: lpc17_40_dmasample
*
* Description:
* Sample DMA register contents
@@ -227,13 +227,13 @@ void lpc17_dmastop(DMA_HANDLE handle);
****************************************************************************/
#ifdef CONFIG__DEBUG_DMA_INFO
-void lpc17_dmasample(DMA_HANDLE handle, struct lpc17_dmaregs_s *regs);
+void lpc17_40_dmasample(DMA_HANDLE handle, struct lpc17_40_dmaregs_s *regs);
#else
-# define lpc17_dmasample(handle,regs)
+# define lpc17_40_dmasample(handle,regs)
#endif
/****************************************************************************
- * Name: lpc17_dmadump
+ * Name: lpc17_40_dmadump
*
* Description:
* Dump previously sampled DMA register contents
@@ -241,10 +241,10 @@ void lpc17_dmasample(DMA_HANDLE handle, struct lpc17_dmaregs_s *regs);
****************************************************************************/
#ifdef CONFIG__DEBUG_DMA_INFO
-void lpc17_dmadump(DMA_HANDLE handle, const struct lpc17_dmaregs_s *regs,
+void lpc17_40_dmadump(DMA_HANDLE handle, const struct lpc17_40_dmaregs_s *regs,
const char *msg);
#else
-# define lpc17_dmadump(handle,regs,msg)
+# define lpc17_40_dmadump(handle,regs,msg)
#endif
#undef EXTERN
@@ -253,5 +253,5 @@ void lpc17_dmadump(DMA_HANDLE handle, const struct lpc17_dmaregs_s *regs,
#endif
#endif /* __ASSEMBLY__ */
-#endif /* CONFIG_LPC17_GPDMA */
-#endif /* __ARCH_ARM_SRC_LPC17XX_LPC17_GPDMA_H */
+#endif /* CONFIG_LPC17_40_GPDMA */
+#endif /* __ARCH_ARM_SRC_LPC17XX_40XX_LPC17_40_GPDMA_H */
diff --git a/arch/arm/src/lpc17xx/lpc17_gpio.c b/arch/arm/src/lpc17xx_40xx/lpc17_40_gpio.c
similarity index 90%
rename from arch/arm/src/lpc17xx/lpc17_gpio.c
rename to arch/arm/src/lpc17xx_40xx/lpc17_40_gpio.c
index 34f0aefcd6a..4a69d487d90 100644
--- a/arch/arm/src/lpc17xx/lpc17_gpio.c
+++ b/arch/arm/src/lpc17xx_40xx/lpc17_40_gpio.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * arch/arm/src/lpc17xx/lpc17_gpio.c
+ * arch/arm/src/lpc17xx_40xx/lpc17_40_gpio.c
*
* Copyright (C) 2010-2011, 2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt
@@ -41,19 +41,19 @@
#include
/* This file is only a thin shell that includes the correct GPIO logic for
- * the selected LPC17xx family. The correct file cannot be selected by the
+ * the selected LPC17xx/LPC40xx family. The correct file cannot be selected by the
* make system because it needs the intelligence that only exists in chip.h
- * that can associate an LPC17xx part number with an LPC17xx family.
+ * that can associate an LPC17xx/LPC40xx part number with an LPC17xx/LPC40xx family.
*/
-#include
+#include
#if defined(LPC176x)
# include "lpc176x_gpio.c"
-#elif defined(LPC178x)
-# include "lpc178x_gpio.c"
+#elif defined(LPC178x_40xx)
+# include "lpc178x_40xx_gpio.c"
#else
-# error "Unrecognized LPC17xx family"
+# error "Unrecognized LPC17xx/LPC40xx family"
#endif
/****************************************************************************
diff --git a/arch/arm/src/lpc17xx/lpc17_gpio.h b/arch/arm/src/lpc17xx_40xx/lpc17_40_gpio.h
similarity index 78%
rename from arch/arm/src/lpc17xx/lpc17_gpio.h
rename to arch/arm/src/lpc17xx_40xx/lpc17_40_gpio.h
index b794c3055b1..53227c606eb 100644
--- a/arch/arm/src/lpc17xx/lpc17_gpio.h
+++ b/arch/arm/src/lpc17xx_40xx/lpc17_40_gpio.h
@@ -1,5 +1,5 @@
/************************************************************************************
- * arch/arm/src/lpc17xx/lpc17_gpio.h
+ * arch/arm/src/lpc17xx_40xx/lpc17_40_gpio.h
*
* Copyright (C) 2010, 2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt
@@ -33,8 +33,8 @@
*
************************************************************************************/
-#ifndef __ARCH_ARM_SRC_LPC17XX_LPC17_GPIO_H
-#define __ARCH_ARM_SRC_LPC17XX_LPC17_GPIO_H
+#ifndef __ARCH_ARM_SRC_LPC17XX_40XX_LPC17_40_GPIO_H
+#define __ARCH_ARM_SRC_LPC17XX_40XX_LPC17_40_GPIO_H
/************************************************************************************
* Included Files
@@ -47,20 +47,20 @@
# include
#endif
-#include
+#include
-#include "hardware/lpc17_gpio.h"
-#include "hardware/lpc17_pinconn.h"
-#include "hardware/lpc17_pinconfig.h"
+#include "hardware/lpc17_40_gpio.h"
+#include "hardware/lpc17_40_pinconn.h"
+#include "hardware/lpc17_40_pinconfig.h"
-/* Include the GPIO definitions for the selected LPC17xx family. */
+/* Include the GPIO definitions for the selected LPC17xx/LPC40xx family. */
#if defined(LPC176x)
# include "lpc176x_gpio.h"
-#elif defined(LPC178x)
-# include "lpc178x_gpio.h"
+#elif defined(LPC178x_40xx)
+# include "lpc178x_40xx_gpio.h"
#else
-# error "Unrecognized LPC17xx family"
+# error "Unrecognized LPC17xx/LPC40xx family"
#endif
/************************************************************************************
@@ -85,11 +85,11 @@ extern "C"
#define EXTERN extern
#endif
-/* These tables have global scope only because they are shared between lpc17_gpio.c,
- * lpc17_gpioint.c, and lpc17_gpiodbg.c
+/* These tables have global scope only because they are shared between lpc17_40_gpio.c,
+ * lpc17_40_gpioint.c, and lpc17_40_gpiodbg.c
*/
-#ifdef CONFIG_LPC17_GPIOIRQ
+#ifdef CONFIG_LPC17_40_GPIOIRQ
EXTERN uint64_t g_intedge0;
EXTERN uint64_t g_intedge2;
#endif
@@ -102,79 +102,79 @@ EXTERN const uint32_t g_intbase[GPIO_NPORTS];
****************************************************************************/
/************************************************************************************
- * Name: lpc17_gpioirqinitialize
+ * Name: lpc17_40_gpioirqinitialize
*
* Description:
* Initialize logic to support a second level of interrupt decoding for GPIO pins.
*
************************************************************************************/
-#ifdef CONFIG_LPC17_GPIOIRQ
-void lpc17_gpioirqinitialize(void);
+#ifdef CONFIG_LPC17_40_GPIOIRQ
+void lpc17_40_gpioirqinitialize(void);
#else
-# define lpc17_gpioirqinitialize()
+# define lpc17_40_gpioirqinitialize()
#endif
/************************************************************************************
- * Name: lpc17_configgpio
+ * Name: lpc17_40_configgpio
*
* Description:
* Configure a GPIO pin based on bit-encoded description of the pin.
*
************************************************************************************/
-int lpc17_configgpio(lpc17_pinset_t cfgset);
+int lpc17_40_configgpio(lpc17_40_pinset_t cfgset);
/************************************************************************************
- * Name: lpc17_gpiowrite
+ * Name: lpc17_40_gpiowrite
*
* Description:
* Write one or zero to the selected GPIO pin
*
************************************************************************************/
-void lpc17_gpiowrite(lpc17_pinset_t pinset, bool value);
+void lpc17_40_gpiowrite(lpc17_40_pinset_t pinset, bool value);
/************************************************************************************
- * Name: lpc17_gpioread
+ * Name: lpc17_40_gpioread
*
* Description:
* Read one or zero from the selected GPIO pin
*
************************************************************************************/
-bool lpc17_gpioread(lpc17_pinset_t pinset);
+bool lpc17_40_gpioread(lpc17_40_pinset_t pinset);
/************************************************************************************
- * Name: lpc17_gpioirqenable
+ * Name: lpc17_40_gpioirqenable
*
* Description:
* Enable the interrupt for specified GPIO IRQ
*
************************************************************************************/
-#ifdef CONFIG_LPC17_GPIOIRQ
-void lpc17_gpioirqenable(int irq);
+#ifdef CONFIG_LPC17_40_GPIOIRQ
+void lpc17_40_gpioirqenable(int irq);
#else
-# define lpc17_gpioirqenable(irq)
+# define lpc17_40_gpioirqenable(irq)
#endif
/************************************************************************************
- * Name: lpc17_gpioirqdisable
+ * Name: lpc17_40_gpioirqdisable
*
* Description:
* Disable the interrupt for specified GPIO IRQ
*
************************************************************************************/
-#ifdef CONFIG_LPC17_GPIOIRQ
-void lpc17_gpioirqdisable(int irq);
+#ifdef CONFIG_LPC17_40_GPIOIRQ
+void lpc17_40_gpioirqdisable(int irq);
#else
-# define lpc17_gpioirqdisable(irq)
+# define lpc17_40_gpioirqdisable(irq)
#endif
/************************************************************************************
- * Function: lpc17_dumpgpio
+ * Function: lpc17_40_dumpgpio
*
* Description:
* Dump all GPIO registers associated with the base address of the provided pinset.
@@ -182,9 +182,9 @@ void lpc17_gpioirqdisable(int irq);
************************************************************************************/
#ifdef CONFIG_DEBUG_GPIO_INFO
-int lpc17_dumpgpio(lpc17_pinset_t pinset, const char *msg);
+int lpc17_40_dumpgpio(lpc17_40_pinset_t pinset, const char *msg);
#else
-# define lpc17_dumpgpio(p,m)
+# define lpc17_40_dumpgpio(p,m)
#endif
#ifdef __cplusplus
@@ -192,4 +192,4 @@ int lpc17_dumpgpio(lpc17_pinset_t pinset, const char *msg);
#endif
#endif /* __ASSEMBLY__ */
-#endif /* __ARCH_ARM_SRC_LPC17XX_LPC17_GPIO_H */
+#endif /* __ARCH_ARM_SRC_LPC17XX_40XX_LPC17_40_GPIO_H */
diff --git a/arch/arm/src/lpc17xx/lpc17_gpiodbg.c b/arch/arm/src/lpc17xx_40xx/lpc17_40_gpiodbg.c
similarity index 79%
rename from arch/arm/src/lpc17xx/lpc17_gpiodbg.c
rename to arch/arm/src/lpc17xx_40xx/lpc17_40_gpiodbg.c
index 00d0f8fade2..a9f9e6e3dc1 100644
--- a/arch/arm/src/lpc17xx/lpc17_gpiodbg.c
+++ b/arch/arm/src/lpc17xx_40xx/lpc17_40_gpiodbg.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * arch/arm/src/lpc17xx/lpc17_gpiodbg.c
+ * arch/arm/src/lpc17xx_40xx/lpc17_40_gpiodbg.c
*
* Copyright (C) 2010-2011, 2013, 2016 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt
@@ -52,7 +52,7 @@
#include "up_arch.h"
#include "chip.h"
-#include "lpc17_gpio.h"
+#include "lpc17_40_gpio.h"
#ifdef CONFIG_DEBUG_GPIO_INFO
@@ -61,7 +61,7 @@
****************************************************************************/
/****************************************************************************
- * Name: lpc17_pinsel
+ * Name: lpc17_40_pinsel
*
* Description:
* Get the address of the PINSEL register corresponding to this port and
@@ -70,7 +70,7 @@
****************************************************************************/
#ifdef LPC176x
-static uint32_t lpc17_pinsel(unsigned int port, unsigned int pin)
+static uint32_t lpc17_40_pinsel(unsigned int port, unsigned int pin)
{
if (pin < 16)
{
@@ -84,7 +84,7 @@ static uint32_t lpc17_pinsel(unsigned int port, unsigned int pin)
#endif /* LPC176x */
/****************************************************************************
- * Name: lpc17_pinmode
+ * Name: lpc17_40_pinmode
*
* Description:
* Get the address of the PINMODE register corresponding to this port and
@@ -93,7 +93,7 @@ static uint32_t lpc17_pinsel(unsigned int port, unsigned int pin)
****************************************************************************/
#ifdef LPC176x
-static uint32_t lpc17_pinmode(unsigned int port, unsigned int pin)
+static uint32_t lpc17_40_pinmode(unsigned int port, unsigned int pin)
{
if (pin < 16)
{
@@ -111,21 +111,21 @@ static uint32_t lpc17_pinmode(unsigned int port, unsigned int pin)
****************************************************************************/
/****************************************************************************
- * Function: lpc17_dumpgpio
+ * Function: lpc17_40_dumpgpio
*
* Description:
* Dump all GPIO registers associated with the provided base address
*
****************************************************************************/
-int lpc17_dumpgpio(lpc17_pinset_t pinset, const char *msg)
+int lpc17_40_dumpgpio(lpc17_40_pinset_t pinset, const char *msg)
{
irqstate_t flags;
uint32_t base;
#if defined(LPC176x)
uint32_t pinsel;
uint32_t pinmode;
-#elif defined(LPC178x)
+#elif defined(LPC178x_40xx)
uint32_t iocon;
#endif /* LPC176x */
unsigned int port;
@@ -137,10 +137,10 @@ int lpc17_dumpgpio(lpc17_pinset_t pinset, const char *msg)
pin = (pinset & GPIO_PIN_MASK) >> GPIO_PIN_SHIFT;
#if defined(LPC176x)
- pinsel = lpc17_pinsel(port, pin);
- pinmode = lpc17_pinmode(port, pin);
-#elif defined(LPC178x)
- iocon = LPC17_IOCON_P(port, pin);
+ pinsel = lpc17_40_pinsel(port, pin);
+ pinmode = lpc17_40_pinmode(port, pin);
+#elif defined(LPC178x_40xx)
+ iocon = LPC17_40_IOCON_P(port, pin);
#endif /* LPC176x */
/* The following requires exclusive access to the GPIO registers */
@@ -155,24 +155,24 @@ int lpc17_dumpgpio(lpc17_pinset_t pinset, const char *msg)
pinsel, pinsel ? getreg32(pinsel) : 0,
pinmode, pinmode ? getreg32(pinmode) : 0,
g_odmode[port], getreg32(g_odmode[port]));
-#elif defined(LPC178x)
+#elif defined(LPC178x_40xx)
gpioinfo(" IOCON[%08x]: %08x\n", iocon, getreg32(iocon));
#endif
base = g_fiobase[port];
gpioinfo(" FIODIR[%08x]: %08x FIOMASK[%08x]: %08x FIOPIN[%08x]: %08x\n",
- base+LPC17_FIO_DIR_OFFSET, getreg32(base+LPC17_FIO_DIR_OFFSET),
- base+LPC17_FIO_MASK_OFFSET, getreg32(base+LPC17_FIO_MASK_OFFSET),
- base+LPC17_FIO_PIN_OFFSET, getreg32(base+LPC17_FIO_PIN_OFFSET));
+ base+LPC17_40_FIO_DIR_OFFSET, getreg32(base+LPC17_40_FIO_DIR_OFFSET),
+ base+LPC17_40_FIO_MASK_OFFSET, getreg32(base+LPC17_40_FIO_MASK_OFFSET),
+ base+LPC17_40_FIO_PIN_OFFSET, getreg32(base+LPC17_40_FIO_PIN_OFFSET));
base = g_intbase[port];
gpioinfo(" IOINTSTATUS[%08x]: %08x INTSTATR[%08x]: %08x INSTATF[%08x]: %08x\n",
- LPC17_GPIOINT_IOINTSTATUS, getreg32(LPC17_GPIOINT_IOINTSTATUS),
- base+LPC17_GPIOINT_INTSTATR_OFFSET, getreg32(base+LPC17_GPIOINT_INTSTATR_OFFSET),
- base+LPC17_GPIOINT_INTSTATF_OFFSET, getreg32(base+LPC17_GPIOINT_INTSTATF_OFFSET));
+ LPC17_40_GPIOINT_IOINTSTATUS, getreg32(LPC17_40_GPIOINT_IOINTSTATUS),
+ base+LPC17_40_GPIOINT_INTSTATR_OFFSET, getreg32(base+LPC17_40_GPIOINT_INTSTATR_OFFSET),
+ base+LPC17_40_GPIOINT_INTSTATF_OFFSET, getreg32(base+LPC17_40_GPIOINT_INTSTATF_OFFSET));
gpioinfo(" INTENR[%08x]: %08x INTENF[%08x]: %08x\n",
- base+LPC17_GPIOINT_INTENR_OFFSET, getreg32(base+LPC17_GPIOINT_INTENR_OFFSET),
- base+LPC17_GPIOINT_INTENF_OFFSET, getreg32(base+LPC17_GPIOINT_INTENF_OFFSET));
+ base+LPC17_40_GPIOINT_INTENR_OFFSET, getreg32(base+LPC17_40_GPIOINT_INTENR_OFFSET),
+ base+LPC17_40_GPIOINT_INTENF_OFFSET, getreg32(base+LPC17_40_GPIOINT_INTENF_OFFSET));
leave_critical_section(flags);
return OK;
diff --git a/arch/arm/src/lpc17xx/lpc17_gpioint.c b/arch/arm/src/lpc17xx_40xx/lpc17_40_gpioint.c
similarity index 64%
rename from arch/arm/src/lpc17xx/lpc17_gpioint.c
rename to arch/arm/src/lpc17xx_40xx/lpc17_40_gpioint.c
index fded5b5b51c..d621052ea8e 100644
--- a/arch/arm/src/lpc17xx/lpc17_gpioint.c
+++ b/arch/arm/src/lpc17xx_40xx/lpc17_40_gpioint.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * arch/arm/src/lpc17xx/lpc17_gpioint.c
+ * arch/arm/src/lpc17xx_40xx/lpc17_40_gpioint.c
*
* Copyright (C) 2010-2011, 2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt
@@ -49,9 +49,9 @@
#include "up_arch.h"
#include "chip.h"
-#include "lpc17_gpio.h"
+#include "lpc17_40_gpio.h"
-#ifdef CONFIG_LPC17_GPIOIRQ
+#ifdef CONFIG_LPC17_40_GPIOIRQ
/****************************************************************************
* Pre-processor Definitions
@@ -74,14 +74,14 @@
****************************************************************************/
/****************************************************************************
- * Name: lpc17_getintedge
+ * Name: lpc17_40_getintedge
*
* Description:
* Get the stored interrupt edge configuration.
*
****************************************************************************/
-static unsigned int lpc17_getintedge(unsigned int port, unsigned int pin)
+static unsigned int lpc17_40_getintedge(unsigned int port, unsigned int pin)
{
uint64_t *intedge;
@@ -106,14 +106,14 @@ static unsigned int lpc17_getintedge(unsigned int port, unsigned int pin)
}
/****************************************************************************
- * Name: lpc17_setintedge
+ * Name: lpc17_40_setintedge
*
* Description:
* Set the edge interrupt enabled bits for this pin.
*
****************************************************************************/
-static void lpc17_setintedge(uint32_t intbase, unsigned int pin,
+static void lpc17_40_setintedge(uint32_t intbase, unsigned int pin,
unsigned int edges)
{
irqstate_t flags;
@@ -125,7 +125,7 @@ static void lpc17_setintedge(uint32_t intbase, unsigned int pin,
/* Set/clear the rising edge enable bit */
- regval = getreg32(intbase + LPC17_GPIOINT_INTENR_OFFSET);
+ regval = getreg32(intbase + LPC17_40_GPIOINT_INTENR_OFFSET);
if ((edges & 2) != 0)
{
regval |= GPIOINT(pin);
@@ -135,11 +135,11 @@ static void lpc17_setintedge(uint32_t intbase, unsigned int pin,
regval &= ~GPIOINT(pin);
}
- putreg32(regval, intbase + LPC17_GPIOINT_INTENR_OFFSET);
+ putreg32(regval, intbase + LPC17_40_GPIOINT_INTENR_OFFSET);
/* Set/clear the falling edge enable bit */
- regval = getreg32(intbase + LPC17_GPIOINT_INTENF_OFFSET);
+ regval = getreg32(intbase + LPC17_40_GPIOINT_INTENF_OFFSET);
if ((edges & 1) != 0)
{
regval |= GPIOINT(pin);
@@ -149,38 +149,38 @@ static void lpc17_setintedge(uint32_t intbase, unsigned int pin,
regval &= ~GPIOINT(pin);
}
- putreg32(regval, intbase + LPC17_GPIOINT_INTENF_OFFSET);
+ putreg32(regval, intbase + LPC17_40_GPIOINT_INTENF_OFFSET);
leave_critical_section(flags);
}
/****************************************************************************
- * Name: lpc17_irq2port
+ * Name: lpc17_40_irq2port
*
* Description:
* Given an IRQ number, return the GPIO port number (0 or 2) of the interrupt.
*
****************************************************************************/
-static int lpc17_irq2port(int irq)
+static int lpc17_40_irq2port(int irq)
{
/* Set 1:
* LPC176x: 12 interrupts p0.0-p0.11
- * LPC178x: 16 interrupts p0.0-p0.15
+ * LPC178x_40xx: 16 interrupts p0.0-p0.15
*/
- if (irq >= LPC17_VALID_FIRST0L &&
- irq < (LPC17_VALID_FIRST0L + LPC17_VALID_NIRQS0L))
+ if (irq >= LPC17_40_VALID_FIRST0L &&
+ irq < (LPC17_40_VALID_FIRST0L + LPC17_40_VALID_NIRQS0L))
{
return 0;
}
/* Set 2:
* LPC176x: 16 interrupts p0.15-p0.30
- * LPC178x: 16 interrupts p0.16-p0.31
+ * LPC178x_40xx: 16 interrupts p0.16-p0.31
*/
- else if (irq >= LPC17_VALID_FIRST0H &&
- irq < (LPC17_VALID_FIRST0H + LPC17_VALID_NIRQS0H))
+ else if (irq >= LPC17_40_VALID_FIRST0H &&
+ irq < (LPC17_40_VALID_FIRST0H + LPC17_40_VALID_NIRQS0H))
{
return 0;
}
@@ -190,29 +190,29 @@ static int lpc17_irq2port(int irq)
* LPC17x: 14 interrupts p2.0-p2.13
*/
- else if (irq >= LPC17_VALID_FIRST2 &&
- irq < (LPC17_VALID_FIRST2 + LPC17_VALID_NIRQS2))
+ else if (irq >= LPC17_40_VALID_FIRST2 &&
+ irq < (LPC17_40_VALID_FIRST2 + LPC17_40_VALID_NIRQS2))
{
return 2;
}
-#elif defined (LPC178x)
+#elif defined (LPC178x_40xx)
/* Set 3:
* LPC18x: 16 interrupts p2.0-p2.15
*/
- else if (irq >= LPC17_VALID_FIRST2L &&
- irq < (LPC17_VALID_FIRST2L + LPC17_VALID_NIRQS2L))
+ else if (irq >= LPC17_40_VALID_FIRST2L &&
+ irq < (LPC17_40_VALID_FIRST2L + LPC17_40_VALID_NIRQS2L))
{
return 2;
}
/* Set 4:
- * LPC178x: 16 interrupts p2.16-p2.31
+ * LPC178x_40xx: 16 interrupts p2.16-p2.31
*/
- else if (irq >= LPC17_VALID_FIRST2H &&
- irq < (LPC17_VALID_FIRST2H + LPC17_VALID_NIRQS2H))
+ else if (irq >= LPC17_40_VALID_FIRST2H &&
+ irq < (LPC17_40_VALID_FIRST2H + LPC17_40_VALID_NIRQS2H))
{
return 2;
}
@@ -223,94 +223,94 @@ static int lpc17_irq2port(int irq)
}
/****************************************************************************
- * Name: lpc17_irq2pin
+ * Name: lpc17_40_irq2pin
*
* Description:
* Given an IRQ number, return the GPIO pin number (0..31) of the interrupt.
*
****************************************************************************/
-static int lpc17_irq2pin(int irq)
+static int lpc17_40_irq2pin(int irq)
{
/* Set 1:
* LPC17x: 12 interrupts p0.0-p0.11
* LPC18x: 16 interrupts p0.0-p0.15
*
- * See arch/arm/include/lpc17xx/irq.h:
- * LPC17_VALID_SHIFT0L 0 - Bit 0 is thre first bit in the group of
+ * See arch/arm/include/lpc17xx_40xx/irq.h:
+ * LPC17_40_VALID_SHIFT0L 0 - Bit 0 is thre first bit in the group of
* 12/16 interrupts
- * LPC17_VALID_FIRST0L irq - IRQ number associated with p0.0
- * LPC17_VALID_NIRQS0L 12/16 - Number of interrupt bits in the group
+ * LPC17_40_VALID_FIRST0L irq - IRQ number associated with p0.0
+ * LPC17_40_VALID_NIRQS0L 12/16 - Number of interrupt bits in the group
*/
- if (irq >= LPC17_VALID_FIRST0L &&
- irq < (LPC17_VALID_FIRST0L + LPC17_VALID_NIRQS0L))
+ if (irq >= LPC17_40_VALID_FIRST0L &&
+ irq < (LPC17_40_VALID_FIRST0L + LPC17_40_VALID_NIRQS0L))
{
- return irq - LPC17_VALID_FIRST0L + LPC17_VALID_SHIFT0L;
+ return irq - LPC17_40_VALID_FIRST0L + LPC17_40_VALID_SHIFT0L;
}
/* Set 2:
* LPC176x: 16 interrupts p0.15-p0.30
- * LPC178x: 16 interrupts p0.16-p0.31
+ * LPC178x_40xx: 16 interrupts p0.16-p0.31
*
- * LPC17_VALID_SHIFT0H 15/16 - Bit number of the first bit in a group
+ * LPC17_40_VALID_SHIFT0H 15/16 - Bit number of the first bit in a group
* of 16 interrupts
- * LPC17_VALID_FIRST0L irq - IRQ number associated with p0.15/16
- * LPC17_VALID_NIRQS0L 16 - 16 interrupt bits in the group
+ * LPC17_40_VALID_FIRST0L irq - IRQ number associated with p0.15/16
+ * LPC17_40_VALID_NIRQS0L 16 - 16 interrupt bits in the group
*/
- else if (irq >= LPC17_VALID_FIRST0H &&
- irq < (LPC17_VALID_FIRST0H + LPC17_VALID_NIRQS0H))
+ else if (irq >= LPC17_40_VALID_FIRST0H &&
+ irq < (LPC17_40_VALID_FIRST0H + LPC17_40_VALID_NIRQS0H))
{
- return irq - LPC17_VALID_FIRST0H + LPC17_VALID_SHIFT0H;
+ return irq - LPC17_40_VALID_FIRST0H + LPC17_40_VALID_SHIFT0H;
}
#if defined(LPC176x)
/* Set 3:
* LPC17x: 14 interrupts p2.0-p2.13
*
- * LPC17_VALID_SHIFT2 0 - Bit 0 is the first bit in a group of 14
+ * LPC17_40_VALID_SHIFT2 0 - Bit 0 is the first bit in a group of 14
* interrupts
- * LPC17_VALID_FIRST2 irq - IRQ number associated with p2.0
- * LPC17_VALID_NIRQS2 14 - 14 interrupt bits in the group
+ * LPC17_40_VALID_FIRST2 irq - IRQ number associated with p2.0
+ * LPC17_40_VALID_NIRQS2 14 - 14 interrupt bits in the group
*/
- else if (irq >= LPC17_VALID_FIRST2 &&
- irq < (LPC17_VALID_FIRST2 + LPC17_VALID_NIRQS2))
+ else if (irq >= LPC17_40_VALID_FIRST2 &&
+ irq < (LPC17_40_VALID_FIRST2 + LPC17_40_VALID_NIRQS2))
{
- return irq - LPC17_VALID_FIRST2 + LPC17_VALID_SHIFT2;
+ return irq - LPC17_40_VALID_FIRST2 + LPC17_40_VALID_SHIFT2;
}
-#elif defined(LPC178x)
+#elif defined(LPC178x_40xx)
/* Set 3:
* LPC18x: 16 interrupts p2.0-p2.15
*
- * LPC17_VALID_SHIFT2L 0 - Bit 0 is the first bit in a group of 16
+ * LPC17_40_VALID_SHIFT2L 0 - Bit 0 is the first bit in a group of 16
* interrupts
- * LPC17_VALID_FIRST2L irq - IRQ number associated with p2.0
- * LPC17_VALID_NIRQS2L 16 - 16 interrupt bits in the group
+ * LPC17_40_VALID_FIRST2L irq - IRQ number associated with p2.0
+ * LPC17_40_VALID_NIRQS2L 16 - 16 interrupt bits in the group
*/
- else if (irq >= LPC17_VALID_FIRST2L &&
- irq < (LPC17_VALID_FIRST2L + LPC17_VALID_NIRQS2L))
+ else if (irq >= LPC17_40_VALID_FIRST2L &&
+ irq < (LPC17_40_VALID_FIRST2L + LPC17_40_VALID_NIRQS2L))
{
- return irq - LPC17_VALID_FIRST2L + LPC17_VALID_SHIFT2L;
+ return irq - LPC17_40_VALID_FIRST2L + LPC17_40_VALID_SHIFT2L;
}
/* Set 3:
* LPC18x: 16 interrupts p2.16-p2.31
*
- * LPC17_VALID_SHIFT2L 16 - Bit 16 is the first bit in a group of 16
+ * LPC17_40_VALID_SHIFT2L 16 - Bit 16 is the first bit in a group of 16
* interrupts
- * LPC17_VALID_FIRST2L irq - IRQ number associated with p2.0
- * LPC17_VALID_NIRQS2L 16 - 16 interrupt bits in the group
+ * LPC17_40_VALID_FIRST2L irq - IRQ number associated with p2.0
+ * LPC17_40_VALID_NIRQS2L 16 - 16 interrupt bits in the group
*/
- else if (irq >= LPC17_VALID_FIRST2H &&
- irq < (LPC17_VALID_FIRST2H + LPC17_VALID_NIRQS2H))
+ else if (irq >= LPC17_40_VALID_FIRST2H &&
+ irq < (LPC17_40_VALID_FIRST2H + LPC17_40_VALID_NIRQS2H))
{
- return irq - LPC17_VALID_FIRST2H + LPC17_VALID_SHIFT2H;
+ return irq - LPC17_40_VALID_FIRST2H + LPC17_40_VALID_SHIFT2H;
}
#endif
@@ -319,14 +319,14 @@ static int lpc17_irq2pin(int irq)
}
/****************************************************************************
- * Name: lpc17_gpiodemux
+ * Name: lpc17_40_gpiodemux
*
* Description:
* Demux all interrupts on one GPIO interrupt status register.
*
****************************************************************************/
-static void lpc17_gpiodemux(uint32_t intbase, uint32_t intmask,
+static void lpc17_40_gpiodemux(uint32_t intbase, uint32_t intmask,
int irqbase, void *context)
{
uint32_t intstatr;
@@ -339,11 +339,11 @@ static void lpc17_gpiodemux(uint32_t intbase, uint32_t intmask,
* interrupts that are enabled.
*/
- intstatr = getreg32(intbase + LPC17_GPIOINT_INTSTATR_OFFSET);
- intstatr &= getreg32(intbase + LPC17_GPIOINT_INTENR_OFFSET);
+ intstatr = getreg32(intbase + LPC17_40_GPIOINT_INTSTATR_OFFSET);
+ intstatr &= getreg32(intbase + LPC17_40_GPIOINT_INTENR_OFFSET);
- intstatf = getreg32(intbase + LPC17_GPIOINT_INTSTATF_OFFSET);
- intstatf &= getreg32(intbase + LPC17_GPIOINT_INTENF_OFFSET);
+ intstatf = getreg32(intbase + LPC17_40_GPIOINT_INTSTATF_OFFSET);
+ intstatf &= getreg32(intbase + LPC17_40_GPIOINT_INTENF_OFFSET);
/* And get the OR of the enabled interrupt sources. We do not make any
* distinction between rising and falling edges (but the hardware does support
@@ -372,7 +372,7 @@ static void lpc17_gpiodemux(uint32_t intbase, uint32_t intmask,
{
/* Clear the interrupt status */
- putreg32(bit, intbase + LPC17_GPIOINT_INTCLR_OFFSET);
+ putreg32(bit, intbase + LPC17_40_GPIOINT_INTCLR_OFFSET);
/* And dispatch the interrupt */
@@ -392,7 +392,7 @@ static void lpc17_gpiodemux(uint32_t intbase, uint32_t intmask,
}
/****************************************************************************
- * Name: lpc17_gpiointerrupt
+ * Name: lpc17_40_gpiointerrupt
*
* Description:
* Handle the GPIO interrupt. For the LPC176x family, that interrupt could
@@ -402,18 +402,18 @@ static void lpc17_gpiodemux(uint32_t intbase, uint32_t intmask,
*
****************************************************************************/
-static int lpc17_gpiointerrupt(int irq, void *context, FAR void *arg)
+static int lpc17_40_gpiointerrupt(int irq, void *context, FAR void *arg)
{
/* Get the GPIO interrupt status */
- uint32_t intstatus = getreg32(LPC17_GPIOINT_IOINTSTATUS);
+ uint32_t intstatus = getreg32(LPC17_40_GPIOINT_IOINTSTATUS);
/* Check for an interrupt on GPIO0 */
if ((intstatus & GPIOINT_IOINTSTATUS_P0INT) != 0)
{
- lpc17_gpiodemux(LPC17_GPIOINT0_BASE, LPC17_VALID_GPIOINT0,
- LPC17_VALID_FIRST0L, context);
+ lpc17_40_gpiodemux(LPC17_40_GPIOINT0_BASE, LPC17_40_VALID_GPIOINT0,
+ LPC17_40_VALID_FIRST0L, context);
}
#if defined(LPC176x)
@@ -421,17 +421,17 @@ static int lpc17_gpiointerrupt(int irq, void *context, FAR void *arg)
if ((intstatus & GPIOINT_IOINTSTATUS_P2INT) != 0)
{
- lpc17_gpiodemux(LPC17_GPIOINT2_BASE, LPC17_VALID_GPIOINT2,
- LPC17_VALID_FIRST2, context);
+ lpc17_40_gpiodemux(LPC17_40_GPIOINT2_BASE, LPC17_40_VALID_GPIOINT2,
+ LPC17_40_VALID_FIRST2, context);
}
-#elif defined(LPC178x)
+#elif defined(LPC178x_40xx)
/* Check for an interrupt on GPIO2 */
if ((intstatus & GPIOINT_IOINTSTATUS_P2INT) != 0)
{
- lpc17_gpiodemux(LPC17_GPIOINT2_BASE, LPC17_VALID_GPIOINT2,
- LPC17_VALID_FIRST2L, context);
+ lpc17_40_gpiodemux(LPC17_40_GPIOINT2_BASE, LPC17_40_VALID_GPIOINT2,
+ LPC17_40_VALID_FIRST2L, context);
}
#endif
@@ -444,7 +444,7 @@ static int lpc17_gpiointerrupt(int irq, void *context, FAR void *arg)
****************************************************************************/
/****************************************************************************
- * Name: lpc17_gpioirqinitialize
+ * Name: lpc17_40_gpioirqinitialize
*
* Description:
* Initialize logic to support a second level of interrupt decoding for
@@ -452,14 +452,14 @@ static int lpc17_gpiointerrupt(int irq, void *context, FAR void *arg)
*
****************************************************************************/
-void lpc17_gpioirqinitialize(void)
+void lpc17_40_gpioirqinitialize(void)
{
/* Disable all GPIO interrupts */
- putreg32(0, LPC17_GPIOINT0_INTENR);
- putreg32(0, LPC17_GPIOINT0_INTENF);
- putreg32(0, LPC17_GPIOINT2_INTENR);
- putreg32(0, LPC17_GPIOINT2_INTENF);
+ putreg32(0, LPC17_40_GPIOINT0_INTENR);
+ putreg32(0, LPC17_40_GPIOINT0_INTENF);
+ putreg32(0, LPC17_40_GPIOINT2_INTENR);
+ putreg32(0, LPC17_40_GPIOINT2_INTENF);
/* Attach and enable the GPIO IRQ. */
@@ -468,33 +468,33 @@ void lpc17_gpioirqinitialize(void)
* position in the NVIC with External Interrupt 3
*/
- (void)irq_attach(LPC17_IRQ_EINT3, lpc17_gpiointerrupt, NULL);
- up_enable_irq(LPC17_IRQ_EINT3);
+ (void)irq_attach(LPC17_40_IRQ_EINT3, lpc17_40_gpiointerrupt, NULL);
+ up_enable_irq(LPC17_40_IRQ_EINT3);
-#elif defined(LPC178x)
- /* the LPC178x family has a single, dedicated interrupt for GPIO0 and
+#elif defined(LPC178x_40xx)
+ /* the LPC178x/40xx family has a single, dedicated interrupt for GPIO0 and
* GPIO2.
*/
- (void)irq_attach(LPC17_IRQ_GPIO, lpc17_gpiointerrupt, NULL);
- up_enable_irq(LPC17_IRQ_GPIO);
+ (void)irq_attach(LPC17_40_IRQ_GPIO, lpc17_40_gpiointerrupt, NULL);
+ up_enable_irq(LPC17_40_IRQ_GPIO);
#endif
}
/****************************************************************************
- * Name: lpc17_gpioirqenable
+ * Name: lpc17_40_gpioirqenable
*
* Description:
* Enable the interrupt for specified GPIO IRQ
*
****************************************************************************/
-void lpc17_gpioirqenable(int irq)
+void lpc17_40_gpioirqenable(int irq)
{
/* Map the IRQ number to a port number */
- int port = lpc17_irq2port(irq);
+ int port = lpc17_40_irq2port(irq);
if (port >= 0)
{
/* The IRQ number does correspond to an interrupt port. Now get the base
@@ -506,26 +506,26 @@ void lpc17_gpioirqenable(int irq)
{
/* And get the pin number associated with the port */
- unsigned int pin = lpc17_irq2pin(irq);
- unsigned int edges = lpc17_getintedge(port, pin);
- lpc17_setintedge(intbase, pin, edges);
+ unsigned int pin = lpc17_40_irq2pin(irq);
+ unsigned int edges = lpc17_40_getintedge(port, pin);
+ lpc17_40_setintedge(intbase, pin, edges);
}
}
}
/****************************************************************************
- * Name: lpc17_gpioirqdisable
+ * Name: lpc17_40_gpioirqdisable
*
* Description:
* Disable the interrupt for specified GPIO IRQ
*
****************************************************************************/
-void lpc17_gpioirqdisable(int irq)
+void lpc17_40_gpioirqdisable(int irq)
{
/* Map the IRQ number to a port number */
- int port = lpc17_irq2port(irq);
+ int port = lpc17_40_irq2port(irq);
if (port >= 0)
{
/* The IRQ number does correspond to an interrupt port. Now get the base
@@ -537,10 +537,10 @@ void lpc17_gpioirqdisable(int irq)
{
/* And get the pin number associated with the port */
- unsigned int pin = lpc17_irq2pin(irq);
- lpc17_setintedge(intbase, pin, 0);
+ unsigned int pin = lpc17_40_irq2pin(irq);
+ lpc17_40_setintedge(intbase, pin, 0);
}
}
}
-#endif /* CONFIG_LPC17_GPIOIRQ */
+#endif /* CONFIG_LPC17_40_GPIOIRQ */
diff --git a/arch/arm/src/lpc17xx/lpc17_i2c.c b/arch/arm/src/lpc17xx_40xx/lpc17_40_i2c.c
similarity index 66%
rename from arch/arm/src/lpc17xx/lpc17_i2c.c
rename to arch/arm/src/lpc17xx_40xx/lpc17_40_i2c.c
index d89c2c7f60b..be28ac617a1 100644
--- a/arch/arm/src/lpc17xx/lpc17_i2c.c
+++ b/arch/arm/src/lpc17xx_40xx/lpc17_40_i2c.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * arch/arm/src/lpc17xx/lpc17_i2c.c
+ * arch/arm/src/lpc17xx_40xx/lpc17_40_i2c.c
*
* Copyright (C) 2012, 2014-2016 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt
@@ -70,11 +70,11 @@
#include "up_internal.h"
#include "chip.h"
-#include "hardware/lpc17_syscon.h"
-#include "lpc17_gpio.h"
-#include "lpc17_i2c.h"
+#include "hardware/lpc17_40_syscon.h"
+#include "lpc17_40_gpio.h"
+#include "lpc17_40_i2c.h"
-#if defined(CONFIG_LPC17_I2C0) || defined(CONFIG_LPC17_I2C1) || defined(CONFIG_LPC17_I2C2)
+#if defined(CONFIG_LPC17_40_I2C0) || defined(CONFIG_LPC17_40_I2C1) || defined(CONFIG_LPC17_40_I2C2)
/****************************************************************************
* Pre-processor Definitions
@@ -85,26 +85,26 @@
# define GPIO_I2C1_SDA GPIO_I2C1_SDA_1
#endif
-#ifndef CONFIG_LPC17_I2C0_FREQUENCY
-# define CONFIG_LPC17_I2C0_FREQUENCY 100000
+#ifndef CONFIG_LPC17_40_I2C0_FREQUENCY
+# define CONFIG_LPC17_40_I2C0_FREQUENCY 100000
#endif
-#ifndef CONFIG_LPC17_I2C1_FREQUENCY
-# define CONFIG_LPC17_I2C1_FREQUENCY 100000
+#ifndef CONFIG_LPC17_40_I2C1_FREQUENCY
+# define CONFIG_LPC17_40_I2C1_FREQUENCY 100000
#endif
-#ifndef CONFIG_LPC17_I2C2_FREQUENCY
-# define CONFIG_LPC17_I2C2_FREQUENCY 100000
+#ifndef CONFIG_LPC17_40_I2C2_FREQUENCY
+# define CONFIG_LPC17_40_I2C2_FREQUENCY 100000
#endif
#define I2C_TIMEOUT (20 * 1000/CONFIG_USEC_PER_TICK) /* 20 mS */
-#define LPC17_I2C1_FREQUENCY 400000
+#define LPC17_40_I2C1_FREQUENCY 400000
/****************************************************************************
* Private Types
****************************************************************************/
-struct lpc17_i2cdev_s
+struct lpc17_40_i2cdev_s
{
struct i2c_master_s dev; /* Generic I2C device */
unsigned int base; /* Base address of registers */
@@ -127,53 +127,53 @@ struct lpc17_i2cdev_s
* Private Function Prototypes
****************************************************************************/
-static int lpc17_i2c_start(struct lpc17_i2cdev_s *priv);
-static void lpc17_i2c_stop(struct lpc17_i2cdev_s *priv);
-static int lpc17_i2c_interrupt(int irq, FAR void *context, void *arg);
-static void lpc17_i2c_timeout(int argc, uint32_t arg, ...);
-static void lpc17_i2c_setfrequency(struct lpc17_i2cdev_s *priv,
+static int lpc17_40_i2c_start(struct lpc17_40_i2cdev_s *priv);
+static void lpc17_40_i2c_stop(struct lpc17_40_i2cdev_s *priv);
+static int lpc17_40_i2c_interrupt(int irq, FAR void *context, void *arg);
+static void lpc17_40_i2c_timeout(int argc, uint32_t arg, ...);
+static void lpc17_40_i2c_setfrequency(struct lpc17_40_i2cdev_s *priv,
uint32_t frequency);
-static void lpc17_stopnext(struct lpc17_i2cdev_s *priv);
+static void lpc17_40_stopnext(struct lpc17_40_i2cdev_s *priv);
/* I2C device operations */
-static int lpc17_i2c_transfer(FAR struct i2c_master_s *dev,
+static int lpc17_40_i2c_transfer(FAR struct i2c_master_s *dev,
FAR struct i2c_msg_s *msgs, int count);
#ifdef CONFIG_I2C_RESET
-static int lpc17_i2c_reset(FAR struct i2c_master_s * dev);
+static int lpc17_40_i2c_reset(FAR struct i2c_master_s * dev);
#endif
/****************************************************************************
* Private Data
****************************************************************************/
-#ifdef CONFIG_LPC17_I2C0
-static struct lpc17_i2cdev_s g_i2c0dev;
+#ifdef CONFIG_LPC17_40_I2C0
+static struct lpc17_40_i2cdev_s g_i2c0dev;
#endif
-#ifdef CONFIG_LPC17_I2C1
-static struct lpc17_i2cdev_s g_i2c1dev;
+#ifdef CONFIG_LPC17_40_I2C1
+static struct lpc17_40_i2cdev_s g_i2c1dev;
#endif
-#ifdef CONFIG_LPC17_I2C2
-static struct lpc17_i2cdev_s g_i2c2dev;
+#ifdef CONFIG_LPC17_40_I2C2
+static struct lpc17_40_i2cdev_s g_i2c2dev;
#endif
-struct i2c_ops_s lpc17_i2c_ops =
+struct i2c_ops_s lpc17_40_i2c_ops =
{
- .transfer = lpc17_i2c_transfer
+ .transfer = lpc17_40_i2c_transfer
#ifdef CONFIG_I2C_RESET
- , .reset = lpc17_i2c_reset
+ , .reset = lpc17_40_i2c_reset
#endif
};
/****************************************************************************
- * Name: lpc17_i2c_setfrequency
+ * Name: lpc17_40_i2c_setfrequency
*
* Description:
* Set the frequency for the next transfer
*
****************************************************************************/
-static void lpc17_i2c_setfrequency(struct lpc17_i2cdev_s *priv,
+static void lpc17_40_i2c_setfrequency(struct lpc17_40_i2cdev_s *priv,
uint32_t frequency)
{
if (frequency != priv->frequency)
@@ -182,19 +182,19 @@ static void lpc17_i2c_setfrequency(struct lpc17_i2cdev_s *priv,
{
/* Asymetric per 400Khz I2C spec */
- putreg32(LPC17_CCLK / (83 + 47) * 47 / frequency,
- priv->base + LPC17_I2C_SCLH_OFFSET);
- putreg32(LPC17_CCLK / (83 + 47) * 83 / frequency,
- priv->base + LPC17_I2C_SCLL_OFFSET);
+ putreg32(LPC17_40_CCLK / (83 + 47) * 47 / frequency,
+ priv->base + LPC17_40_I2C_SCLH_OFFSET);
+ putreg32(LPC17_40_CCLK / (83 + 47) * 83 / frequency,
+ priv->base + LPC17_40_I2C_SCLL_OFFSET);
}
else
{
/* 50/50 mark space ratio */
- putreg32(LPC17_CCLK / 100 * 50 / frequency,
- priv->base + LPC17_I2C_SCLH_OFFSET);
- putreg32(LPC17_CCLK / 100 * 50 / frequency,
- priv->base + LPC17_I2C_SCLL_OFFSET);
+ putreg32(LPC17_40_CCLK / 100 * 50 / frequency,
+ priv->base + LPC17_40_I2C_SCLH_OFFSET);
+ putreg32(LPC17_40_CCLK / 100 * 50 / frequency,
+ priv->base + LPC17_40_I2C_SCLL_OFFSET);
}
priv->frequency = frequency;
@@ -202,20 +202,20 @@ static void lpc17_i2c_setfrequency(struct lpc17_i2cdev_s *priv,
}
/****************************************************************************
- * Name: lpc17_i2c_start
+ * Name: lpc17_40_i2c_start
*
* Description:
* Perform a I2C transfer start
*
****************************************************************************/
-static int lpc17_i2c_start(struct lpc17_i2cdev_s *priv)
+static int lpc17_40_i2c_start(struct lpc17_40_i2cdev_s *priv)
{
putreg32(I2C_CONCLR_STAC | I2C_CONCLR_SIC,
- priv->base + LPC17_I2C_CONCLR_OFFSET);
- putreg32(I2C_CONSET_STA, priv->base + LPC17_I2C_CONSET_OFFSET);
+ priv->base + LPC17_40_I2C_CONCLR_OFFSET);
+ putreg32(I2C_CONSET_STA, priv->base + LPC17_40_I2C_CONSET_OFFSET);
- (void)wd_start(priv->timeout, I2C_TIMEOUT, lpc17_i2c_timeout, 1,
+ (void)wd_start(priv->timeout, I2C_TIMEOUT, lpc17_40_i2c_timeout, 1,
(uint32_t)priv);
nxsem_wait(&priv->wait);
@@ -225,35 +225,35 @@ static int lpc17_i2c_start(struct lpc17_i2cdev_s *priv)
}
/****************************************************************************
- * Name: lpc17_i2c_stop
+ * Name: lpc17_40_i2c_stop
*
* Description:
* Perform a I2C transfer stop
*
****************************************************************************/
-static void lpc17_i2c_stop(struct lpc17_i2cdev_s *priv)
+static void lpc17_40_i2c_stop(struct lpc17_40_i2cdev_s *priv)
{
if (priv->state != 0x38)
{
putreg32(I2C_CONSET_STO | I2C_CONSET_AA,
- priv->base + LPC17_I2C_CONSET_OFFSET);
+ priv->base + LPC17_40_I2C_CONSET_OFFSET);
}
nxsem_post(&priv->wait);
}
/****************************************************************************
- * Name: lpc17_i2c_timeout
+ * Name: lpc17_40_i2c_timeout
*
* Description:
* Watchdog timer for timeout of I2C operation
*
****************************************************************************/
-static void lpc17_i2c_timeout(int argc, uint32_t arg, ...)
+static void lpc17_40_i2c_timeout(int argc, uint32_t arg, ...)
{
- struct lpc17_i2cdev_s *priv = (struct lpc17_i2cdev_s *)arg;
+ struct lpc17_40_i2cdev_s *priv = (struct lpc17_40_i2cdev_s *)arg;
irqstate_t flags = enter_critical_section();
priv->state = 0xff;
@@ -262,17 +262,17 @@ static void lpc17_i2c_timeout(int argc, uint32_t arg, ...)
}
/****************************************************************************
- * Name: lpc17_i2c_transfer
+ * Name: lpc17_40_i2c_transfer
*
* Description:
* Perform a sequence of I2C transfers
*
****************************************************************************/
-static int lpc17_i2c_transfer(FAR struct i2c_master_s *dev,
+static int lpc17_40_i2c_transfer(FAR struct i2c_master_s *dev,
FAR struct i2c_msg_s *msgs, int count)
{
- struct lpc17_i2cdev_s *priv = (struct lpc17_i2cdev_s *)dev;
+ struct lpc17_40_i2cdev_s *priv = (struct lpc17_40_i2cdev_s *)dev;
int ret;
DEBUGASSERT(dev != NULL && msgs != NULL && count > 0);
@@ -294,50 +294,50 @@ static int lpc17_i2c_transfer(FAR struct i2c_master_s *dev,
* each message segment.
*/
- lpc17_i2c_setfrequency(priv, msgs->frequency);
+ lpc17_40_i2c_setfrequency(priv, msgs->frequency);
/* Perform the transfer */
- ret = lpc17_i2c_start(priv);
+ ret = lpc17_40_i2c_start(priv);
nxsem_post(&priv->mutex);
return ret;
}
/****************************************************************************
- * Name: lpc17_stopnext
+ * Name: lpc17_40_stopnext
*
* Description:
* Check if we need to issue STOP at the next message
*
****************************************************************************/
-static void lpc17_stopnext(struct lpc17_i2cdev_s *priv)
+static void lpc17_40_stopnext(struct lpc17_40_i2cdev_s *priv)
{
priv->nmsg--;
if (priv->nmsg > 0)
{
priv->msgs++;
- putreg32(I2C_CONSET_STA, priv->base + LPC17_I2C_CONSET_OFFSET);
+ putreg32(I2C_CONSET_STA, priv->base + LPC17_40_I2C_CONSET_OFFSET);
}
else
{
- lpc17_i2c_stop(priv);
+ lpc17_40_i2c_stop(priv);
}
}
/****************************************************************************
- * Name: lpc17_i2c_interrupt
+ * Name: lpc17_40_i2c_interrupt
*
* Description:
* The I2C Interrupt Handler
*
****************************************************************************/
-static int lpc17_i2c_interrupt(int irq, FAR void *context, void *arg)
+static int lpc17_40_i2c_interrupt(int irq, FAR void *context, void *arg)
{
- struct lpc17_i2cdev_s *priv = (struct lpc17_i2cdev_s *)arg;
+ struct lpc17_40_i2cdev_s *priv = (struct lpc17_40_i2cdev_s *)arg;
struct i2c_msg_s *msg;
uint32_t state;
@@ -345,7 +345,7 @@ static int lpc17_i2c_interrupt(int irq, FAR void *context, void *arg)
/* Reference UM10360 19.10.5 */
- state = getreg32(priv->base + LPC17_I2C_STAT_OFFSET);
+ state = getreg32(priv->base + LPC17_40_I2C_STAT_OFFSET);
msg = priv->msgs;
priv->state = state;
@@ -359,18 +359,18 @@ static int lpc17_i2c_interrupt(int irq, FAR void *context, void *arg)
putreg32(((I2C_M_READ & msg->flags) == I2C_M_READ) ?
I2C_READADDR8(msg->addr) :
- I2C_WRITEADDR8(msg->addr), priv->base + LPC17_I2C_DAT_OFFSET);
+ I2C_WRITEADDR8(msg->addr), priv->base + LPC17_40_I2C_DAT_OFFSET);
/* Clear start bit */
- putreg32(I2C_CONCLR_STAC, priv->base + LPC17_I2C_CONCLR_OFFSET);
+ putreg32(I2C_CONCLR_STAC, priv->base + LPC17_40_I2C_CONCLR_OFFSET);
break;
/* Write cases */
case 0x18: /* SLA+W has been transmitted; ACK has been received */
priv->wrcnt = 0;
- putreg32(msg->buffer[0], priv->base + LPC17_I2C_DAT_OFFSET); /* put first byte */
+ putreg32(msg->buffer[0], priv->base + LPC17_40_I2C_DAT_OFFSET); /* put first byte */
break;
case 0x28: /* Data byte in DAT has been transmitted; ACK has been received. */
@@ -378,11 +378,11 @@ static int lpc17_i2c_interrupt(int irq, FAR void *context, void *arg)
if (priv->wrcnt < msg->length)
{
- putreg32(msg->buffer[priv->wrcnt], priv->base + LPC17_I2C_DAT_OFFSET); /* Put next byte */
+ putreg32(msg->buffer[priv->wrcnt], priv->base + LPC17_40_I2C_DAT_OFFSET); /* Put next byte */
}
else
{
- lpc17_stopnext(priv);
+ lpc17_40_stopnext(priv);
}
break;
@@ -392,41 +392,41 @@ static int lpc17_i2c_interrupt(int irq, FAR void *context, void *arg)
priv->rdcnt = 0;
if (msg->length > 1)
{
- putreg32(I2C_CONSET_AA, priv->base + LPC17_I2C_CONSET_OFFSET); /* Set ACK next read */
+ putreg32(I2C_CONSET_AA, priv->base + LPC17_40_I2C_CONSET_OFFSET); /* Set ACK next read */
}
else
{
- putreg32(I2C_CONCLR_AAC, priv->base + LPC17_I2C_CONCLR_OFFSET); /* Do not ACK because only one byte */
+ putreg32(I2C_CONCLR_AAC, priv->base + LPC17_40_I2C_CONCLR_OFFSET); /* Do not ACK because only one byte */
}
break;
case 0x50: /* Data byte has been received; ACK has been returned. */
priv->rdcnt++;
- msg->buffer[priv->rdcnt - 1] = getreg32(priv->base + LPC17_I2C_BUFR_OFFSET);
+ msg->buffer[priv->rdcnt - 1] = getreg32(priv->base + LPC17_40_I2C_BUFR_OFFSET);
if (priv->rdcnt >= (msg->length - 1))
{
- putreg32(I2C_CONCLR_AAC, priv->base + LPC17_I2C_CONCLR_OFFSET); /* Do not ACK any more */
+ putreg32(I2C_CONCLR_AAC, priv->base + LPC17_40_I2C_CONCLR_OFFSET); /* Do not ACK any more */
}
break;
case 0x58: /* Data byte has been received; NACK has been returned. */
- msg->buffer[priv->rdcnt] = getreg32(priv->base + LPC17_I2C_BUFR_OFFSET);
- lpc17_stopnext(priv);
+ msg->buffer[priv->rdcnt] = getreg32(priv->base + LPC17_40_I2C_BUFR_OFFSET);
+ lpc17_40_stopnext(priv);
break;
default:
- lpc17_i2c_stop(priv);
+ lpc17_40_i2c_stop(priv);
break;
}
- putreg32(I2C_CONCLR_SIC, priv->base + LPC17_I2C_CONCLR_OFFSET); /* clear interrupt */
+ putreg32(I2C_CONCLR_SIC, priv->base + LPC17_40_I2C_CONCLR_OFFSET); /* clear interrupt */
return OK;
}
/************************************************************************************
- * Name: lpc17_i2c_reset
+ * Name: lpc17_40_i2c_reset
*
* Description:
* Perform an I2C bus reset in an attempt to break loose stuck I2C devices.
@@ -440,7 +440,7 @@ static int lpc17_i2c_interrupt(int irq, FAR void *context, void *arg)
************************************************************************************/
#ifdef CONFIG_I2C_RESET
-static int lpc17_i2c_reset(FAR struct i2c_master_s * dev)
+static int lpc17_40_i2c_reset(FAR struct i2c_master_s * dev)
{
return OK;
}
@@ -451,16 +451,16 @@ static int lpc17_i2c_reset(FAR struct i2c_master_s * dev)
****************************************************************************/
/****************************************************************************
- * Name: lpc17_i2cbus_initialize
+ * Name: lpc17_40_i2cbus_initialize
*
* Description:
* Initialise an I2C device
*
****************************************************************************/
-struct i2c_master_s *lpc17_i2cbus_initialize(int port)
+struct i2c_master_s *lpc17_40_i2cbus_initialize(int port)
{
- struct lpc17_i2cdev_s *priv;
+ struct lpc17_40_i2cdev_s *priv;
if (port > 1)
{
@@ -473,90 +473,90 @@ struct i2c_master_s *lpc17_i2cbus_initialize(int port)
flags = enter_critical_section();
-#ifdef CONFIG_LPC17_I2C0
+#ifdef CONFIG_LPC17_40_I2C0
if (port == 0)
{
priv = &g_i2c0dev;
- priv->base = LPC17_I2C0_BASE;
- priv->irqid = LPC17_IRQ_I2C0;
+ priv->base = LPC17_40_I2C0_BASE;
+ priv->irqid = LPC17_40_IRQ_I2C0;
/* Enable clocking */
- regval = getreg32(LPC17_SYSCON_PCONP);
+ regval = getreg32(LPC17_40_SYSCON_PCONP);
regval |= SYSCON_PCONP_PCI2C0;
- putreg32(regval, LPC17_SYSCON_PCONP);
+ putreg32(regval, LPC17_40_SYSCON_PCONP);
- regval = getreg32(LPC17_SYSCON_PCLKSEL0);
+ regval = getreg32(LPC17_40_SYSCON_PCLKSEL0);
regval &= ~SYSCON_PCLKSEL0_I2C0_MASK;
regval |= (SYSCON_PCLKSEL_CCLK << SYSCON_PCLKSEL0_I2C0_SHIFT);
- putreg32(regval, LPC17_SYSCON_PCLKSEL0);
+ putreg32(regval, LPC17_40_SYSCON_PCLKSEL0);
/* Pin configuration */
- lpc17_configgpio(GPIO_I2C0_SCL);
- lpc17_configgpio(GPIO_I2C0_SDA);
+ lpc17_40_configgpio(GPIO_I2C0_SCL);
+ lpc17_40_configgpio(GPIO_I2C0_SDA);
/* Set default frequency */
- lpc17_i2c_setfrequency(priv, CONFIG_LPC17_I2C0_FREQUENCY);
+ lpc17_40_i2c_setfrequency(priv, CONFIG_LPC17_40_I2C0_FREQUENCY);
}
else
#endif
-#ifdef CONFIG_LPC17_I2C1
+#ifdef CONFIG_LPC17_40_I2C1
if (port == 1)
{
priv = &g_i2c1dev;
- priv->base = LPC17_I2C1_BASE;
- priv->irqid = LPC17_IRQ_I2C1;
+ priv->base = LPC17_40_I2C1_BASE;
+ priv->irqid = LPC17_40_IRQ_I2C1;
/* Enable clocking */
- regval = getreg32(LPC17_SYSCON_PCONP);
+ regval = getreg32(LPC17_40_SYSCON_PCONP);
regval |= SYSCON_PCONP_PCI2C1;
- putreg32(regval, LPC17_SYSCON_PCONP);
+ putreg32(regval, LPC17_40_SYSCON_PCONP);
- regval = getreg32(LPC17_SYSCON_PCLKSEL1);
+ regval = getreg32(LPC17_40_SYSCON_PCLKSEL1);
regval &= ~SYSCON_PCLKSEL1_I2C1_MASK;
regval |= (SYSCON_PCLKSEL_CCLK << SYSCON_PCLKSEL1_I2C1_SHIFT);
- putreg32(regval, LPC17_SYSCON_PCLKSEL1);
+ putreg32(regval, LPC17_40_SYSCON_PCLKSEL1);
/* Pin configuration */
- lpc17_configgpio(GPIO_I2C1_SCL);
- lpc17_configgpio(GPIO_I2C1_SDA);
+ lpc17_40_configgpio(GPIO_I2C1_SCL);
+ lpc17_40_configgpio(GPIO_I2C1_SDA);
/* Set default frequency */
- lpc17_i2c_setfrequency(priv, CONFIG_LPC17_I2C1_FREQUENCY);
+ lpc17_40_i2c_setfrequency(priv, CONFIG_LPC17_40_I2C1_FREQUENCY);
}
else
#endif
-#ifdef CONFIG_LPC17_I2C2
+#ifdef CONFIG_LPC17_40_I2C2
if (port == 2)
{
priv = &g_i2c2dev;
- priv->base = LPC17_I2C2_BASE;
- priv->irqid = LPC17_IRQ_I2C2;
+ priv->base = LPC17_40_I2C2_BASE;
+ priv->irqid = LPC17_40_IRQ_I2C2;
/* Enable clocking */
- regval = getreg32(LPC17_SYSCON_PCONP);
+ regval = getreg32(LPC17_40_SYSCON_PCONP);
regval |= SYSCON_PCONP_PCI2C2;
- putreg32(regval, LPC17_SYSCON_PCONP);
+ putreg32(regval, LPC17_40_SYSCON_PCONP);
- regval = getreg32(LPC17_SYSCON_PCLKSEL1);
+ regval = getreg32(LPC17_40_SYSCON_PCLKSEL1);
regval &= ~SYSCON_PCLKSEL1_I2C2_MASK;
regval |= (SYSCON_PCLKSEL_CCLK << SYSCON_PCLKSEL1_I2C2_SHIFT);
- putreg32(regval, LPC17_SYSCON_PCLKSEL1);
+ putreg32(regval, LPC17_40_SYSCON_PCLKSEL1);
/* Pin configuration */
- lpc17_configgpio(GPIO_I2C2_SCL);
- lpc17_configgpio(GPIO_I2C2_SDA);
+ lpc17_40_configgpio(GPIO_I2C2_SCL);
+ lpc17_40_configgpio(GPIO_I2C2_SDA);
/* Set default frequency */
- lpc17_i2c_setfrequency(priv, CONFIG_LPC17_I2C2_FREQUENCY);
+ lpc17_40_i2c_setfrequency(priv, CONFIG_LPC17_40_I2C2_FREQUENCY);
}
else
#endif
@@ -566,7 +566,7 @@ struct i2c_master_s *lpc17_i2cbus_initialize(int port)
leave_critical_section(flags);
- putreg32(I2C_CONSET_I2EN, priv->base + LPC17_I2C_CONSET_OFFSET);
+ putreg32(I2C_CONSET_I2EN, priv->base + LPC17_40_I2C_CONSET_OFFSET);
/* Initialize semaphores */
@@ -586,7 +586,7 @@ struct i2c_master_s *lpc17_i2cbus_initialize(int port)
/* Attach Interrupt Handler */
- irq_attach(priv->irqid, lpc17_i2c_interrupt, priv);
+ irq_attach(priv->irqid, lpc17_40_i2c_interrupt, priv);
/* Enable Interrupt Handler */
@@ -594,25 +594,25 @@ struct i2c_master_s *lpc17_i2cbus_initialize(int port)
/* Install our operations */
- priv->dev.ops = &lpc17_i2c_ops;
+ priv->dev.ops = &lpc17_40_i2c_ops;
return &priv->dev;
}
/****************************************************************************
- * Name: lpc17_i2cbus_uninitialize
+ * Name: lpc17_40_i2cbus_uninitialize
*
* Description:
* Uninitialise an I2C device
*
****************************************************************************/
-int lpc17_i2cbus_uninitialize(FAR struct i2c_master_s * dev)
+int lpc17_40_i2cbus_uninitialize(FAR struct i2c_master_s * dev)
{
- struct lpc17_i2cdev_s *priv = (struct lpc17_i2cdev_s *) dev;
+ struct lpc17_40_i2cdev_s *priv = (struct lpc17_40_i2cdev_s *) dev;
/* Disable I2C */
- putreg32(I2C_CONCLRT_I2ENC, priv->base + LPC17_I2C_CONCLR_OFFSET);
+ putreg32(I2C_CONCLRT_I2ENC, priv->base + LPC17_40_I2C_CONCLR_OFFSET);
/* Reset data structures */
@@ -634,4 +634,4 @@ int lpc17_i2cbus_uninitialize(FAR struct i2c_master_s * dev)
return OK;
}
-#endif /* CONFIG_LPC17_I2C0 || CONFIG_LPC17_I2C1 || CONFIG_LPC17_I2C2 */
+#endif /* CONFIG_LPC17_40_I2C0 || CONFIG_LPC17_40_I2C1 || CONFIG_LPC17_40_I2C2 */
diff --git a/arch/arm/src/lpc17xx/lpc17_i2c.h b/arch/arm/src/lpc17xx_40xx/lpc17_40_i2c.h
similarity index 86%
rename from arch/arm/src/lpc17xx/lpc17_i2c.h
rename to arch/arm/src/lpc17xx_40xx/lpc17_40_i2c.h
index 3595c880dbf..e900c6e7e17 100644
--- a/arch/arm/src/lpc17xx/lpc17_i2c.h
+++ b/arch/arm/src/lpc17xx_40xx/lpc17_40_i2c.h
@@ -1,5 +1,5 @@
/****************************************************************************
- * arch/arm/src/lpc17xx/lpc17_i2c.h
+ * arch/arm/src/lpc17xx_40xx/lpc17_40_i2c.h
*
* Copyright (C) 2010, 2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt
@@ -33,8 +33,8 @@
*
****************************************************************************/
-#ifndef __ARCH_ARM_SRC_LPC17XX_LPC17_I2C_H
-#define __ARCH_ARM_SRC_LPC17XX_LPC17_I2C_H
+#ifndef __ARCH_ARM_SRC_LPC17XX_40XX_LPC17_40_I2C_H
+#define __ARCH_ARM_SRC_LPC17XX_40XX_LPC17_40_I2C_H
/****************************************************************************
* Included Files
@@ -42,14 +42,14 @@
#include
#include
-#include "hardware/lpc17_i2c.h"
+#include "hardware/lpc17_40_i2c.h"
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
/****************************************************************************
- * Name: lpc17_i2cbus_initialize
+ * Name: lpc17_40_i2cbus_initialize
*
* Description:
* Initialize the selected I2C port. And return a unique instance of struct
@@ -65,16 +65,16 @@
*
****************************************************************************/
-FAR struct i2c_master_s *lpc17_i2cbus_initialize(int port);
+FAR struct i2c_master_s *lpc17_40_i2cbus_initialize(int port);
/****************************************************************************
- * Name: lpc17_i2cbus_uninitialize
+ * Name: lpc17_40_i2cbus_uninitialize
*
* Description:
* De-initialize the selected I2C port, and power down the device.
*
* Input Parameters:
- * Device structure as returned by the lpc17_i2cbus_initialize()
+ * Device structure as returned by the lpc17_40_i2cbus_initialize()
*
* Returned Value:
* OK on success, ERROR when internal reference count mismatch or dev
@@ -82,6 +82,6 @@ FAR struct i2c_master_s *lpc17_i2cbus_initialize(int port);
*
****************************************************************************/
-int lpc17_i2cbus_uninitialize(FAR struct i2c_master_s *dev);
+int lpc17_40_i2cbus_uninitialize(FAR struct i2c_master_s *dev);
-#endif /* __ARCH_ARM_SRC_LPC17XX_LPC17_I2C_H */
+#endif /* __ARCH_ARM_SRC_LPC17XX_40XX_LPC17_40_I2C_H */
diff --git a/arch/arm/src/lpc17xx/lpc17_i2s.h b/arch/arm/src/lpc17xx_40xx/lpc17_40_i2s.h
similarity index 91%
rename from arch/arm/src/lpc17xx/lpc17_i2s.h
rename to arch/arm/src/lpc17xx_40xx/lpc17_40_i2s.h
index 49a02dbec5d..033a022a4c8 100644
--- a/arch/arm/src/lpc17xx/lpc17_i2s.h
+++ b/arch/arm/src/lpc17xx_40xx/lpc17_40_i2s.h
@@ -1,5 +1,5 @@
/****************************************************************************
- * arch/arm/src/lpc17xx/lpc17_i2s.h
+ * arch/arm/src/lpc17xx_40xx/lpc17_40_i2s.h
*
* Copyright (C) 2010, 2012-2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt
@@ -33,15 +33,15 @@
*
****************************************************************************/
-#ifndef __ARCH_ARM_SRC_LPC17XX_CHIP_LPC17_I2S_H
-#define __ARCH_ARM_SRC_LPC17XX_CHIP_LPC17_I2S_H
+#ifndef __ARCH_ARM_SRC_LPC17XX_40XX_CHIP_LPC17_40_I2S_H
+#define __ARCH_ARM_SRC_LPC17XX_40XX_CHIP_LPC17_40_I2S_H
/****************************************************************************
* Included Files
****************************************************************************/
#include
-#include "hardware/lpc17_i2s.h"
+#include "hardware/lpc17_40_i2s.h"
/****************************************************************************
* Pre-processor Definitions
@@ -59,4 +59,4 @@
* Public Functions
****************************************************************************/
-#endif /* __ARCH_ARM_SRC_LPC17XX_CHIP_LPC17_I2S_H */
+#endif /* __ARCH_ARM_SRC_LPC17XX_40XX_CHIP_LPC17_40_I2S_H */
diff --git a/arch/arm/src/lpc17xx/lpc17_idle.c b/arch/arm/src/lpc17xx_40xx/lpc17_40_idle.c
similarity index 97%
rename from arch/arm/src/lpc17xx/lpc17_idle.c
rename to arch/arm/src/lpc17xx_40xx/lpc17_40_idle.c
index 5600ed9367f..7a4a59c27ed 100644
--- a/arch/arm/src/lpc17xx/lpc17_idle.c
+++ b/arch/arm/src/lpc17xx_40xx/lpc17_40_idle.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * arch/arm/src/lpc17/lpc17_idle.c
+ * arch/arm/src/lpc17/lpc17_40_idle.c
*
* Copyright (C) 2011-2012, 2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt
@@ -44,7 +44,7 @@
#include
#include "up_internal.h"
-#include "lpc17_gpdma.h"
+#include "lpc17_40_gpdma.h"
/****************************************************************************
* Pre-processor Definitions
@@ -106,7 +106,7 @@ void up_idle(void)
* disabled in order to save power."
*/
-#ifdef CONFIG_LPC17_GPDMA
+#ifdef CONFIG_LPC17_40_GPDMA
if (g_dma_inprogress == 0)
#endif
{
diff --git a/arch/arm/src/lpc17xx/lpc17_irq.c b/arch/arm/src/lpc17xx_40xx/lpc17_40_irq.c
similarity index 82%
rename from arch/arm/src/lpc17xx/lpc17_irq.c
rename to arch/arm/src/lpc17xx_40xx/lpc17_40_irq.c
index c15d33baf9b..a6bbdb41548 100644
--- a/arch/arm/src/lpc17xx/lpc17_irq.c
+++ b/arch/arm/src/lpc17xx_40xx/lpc17_40_irq.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * arch/arm/src/lpc17/lpc17_irq.c
+ * arch/arm/src/lpc17/lpc17_40_irq.c
*
* Copyright (C) 2010-2011, 2013-2016 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt
@@ -52,8 +52,8 @@
#include "up_arch.h"
#include "up_internal.h"
-#include "lpc17_gpio.h"
-#include "lpc17_clrpend.h"
+#include "lpc17_40_gpio.h"
+#include "lpc17_40_clrpend.h"
/****************************************************************************
* Pre-processor Definitions
@@ -96,7 +96,7 @@ extern uint32_t _vectors[];
****************************************************************************/
/****************************************************************************
- * Name: lpc17_dumpnvic
+ * Name: lpc17_40_dumpnvic
*
* Description:
* Dump some interesting NVIC registers
@@ -104,7 +104,7 @@ extern uint32_t _vectors[];
****************************************************************************/
#if defined(CONFIG_DEBUG_IRQ_INFO)
-static void lpc17_dumpnvic(const char *msg, int irq)
+static void lpc17_40_dumpnvic(const char *msg, int irq)
{
irqstate_t flags;
@@ -135,12 +135,12 @@ static void lpc17_dumpnvic(const char *msg, int irq)
leave_critical_section(flags);
}
#else
-# define lpc17_dumpnvic(msg, irq)
+# define lpc17_40_dumpnvic(msg, irq)
#endif
/****************************************************************************
- * Name: lpc17_nmi, lpc17_busfault, lpc17_usagefault, lpc17_pendsv,
- * lpc17_dbgmonitor, lpc17_pendsv, lpc17_reserved
+ * Name: lpc17_40_nmi, lpc17_40_busfault, lpc17_40_usagefault, lpc17_40_pendsv,
+ * lpc17_40_dbgmonitor, lpc17_40_pendsv, lpc17_40_reserved
*
* Description:
* Handlers for various execptions. None are handled and all are fatal
@@ -150,7 +150,7 @@ static void lpc17_dumpnvic(const char *msg, int irq)
****************************************************************************/
#ifdef CONFIG_DEBUG_FEATURES
-static int lpc17_nmi(int irq, FAR void *context, FAR void *arg)
+static int lpc17_40_nmi(int irq, FAR void *context, FAR void *arg)
{
(void)up_irq_save();
_err("PANIC!!! NMI received\n");
@@ -158,7 +158,7 @@ static int lpc17_nmi(int irq, FAR void *context, FAR void *arg)
return 0;
}
-static int lpc17_busfault(int irq, FAR void *context, FAR void *arg)
+static int lpc17_40_busfault(int irq, FAR void *context, FAR void *arg)
{
(void)up_irq_save();
_err("PANIC!!! Bus fault recived\n");
@@ -166,7 +166,7 @@ static int lpc17_busfault(int irq, FAR void *context, FAR void *arg)
return 0;
}
-static int lpc17_usagefault(int irq, FAR void *context, FAR void *arg)
+static int lpc17_40_usagefault(int irq, FAR void *context, FAR void *arg)
{
(void)up_irq_save();
_err("PANIC!!! Usage fault received\n");
@@ -174,7 +174,7 @@ static int lpc17_usagefault(int irq, FAR void *context, FAR void *arg)
return 0;
}
-static int lpc17_pendsv(int irq, FAR void *context, FAR void *arg)
+static int lpc17_40_pendsv(int irq, FAR void *context, FAR void *arg)
{
(void)up_irq_save();
_err("PANIC!!! PendSV received\n");
@@ -182,7 +182,7 @@ static int lpc17_pendsv(int irq, FAR void *context, FAR void *arg)
return 0;
}
-static int lpc17_dbgmonitor(int irq, FAR void *context, FAR void *arg)
+static int lpc17_40_dbgmonitor(int irq, FAR void *context, FAR void *arg)
{
(void)up_irq_save();
_err("PANIC!!! Debug Monitor received\n");
@@ -190,7 +190,7 @@ static int lpc17_dbgmonitor(int irq, FAR void *context, FAR void *arg)
return 0;
}
-static int lpc17_reserved(int irq, FAR void *context, FAR void *arg)
+static int lpc17_40_reserved(int irq, FAR void *context, FAR void *arg)
{
(void)up_irq_save();
_err("PANIC!!! Reserved interrupt\n");
@@ -200,7 +200,7 @@ static int lpc17_reserved(int irq, FAR void *context, FAR void *arg)
#endif
/****************************************************************************
- * Name: lpc17_prioritize_syscall
+ * Name: lpc17_40_prioritize_syscall
*
* Description:
* Set the priority of an exception. This function may be needed
@@ -209,7 +209,7 @@ static int lpc17_reserved(int irq, FAR void *context, FAR void *arg)
****************************************************************************/
#ifdef CONFIG_ARMV7M_USEBASEPRI
-static inline void lpc17_prioritize_syscall(int priority)
+static inline void lpc17_40_prioritize_syscall(int priority)
{
uint32_t regval;
@@ -223,7 +223,7 @@ static inline void lpc17_prioritize_syscall(int priority)
#endif
/****************************************************************************
- * Name: lpc17_irqinfo
+ * Name: lpc17_40_irqinfo
*
* Description:
* Given an IRQ number, provide the register and bit setting to enable or
@@ -231,24 +231,24 @@ static inline void lpc17_prioritize_syscall(int priority)
*
****************************************************************************/
-static int lpc17_irqinfo(int irq, uintptr_t *regaddr, uint32_t *bit,
+static int lpc17_40_irqinfo(int irq, uintptr_t *regaddr, uint32_t *bit,
uintptr_t offset)
{
- DEBUGASSERT(irq >= LPC17_IRQ_NMI && irq < NR_IRQS);
+ DEBUGASSERT(irq >= LPC17_40_IRQ_NMI && irq < NR_IRQS);
/* Check for external interrupt */
- if (irq >= LPC17_IRQ_EXTINT)
+ if (irq >= LPC17_40_IRQ_EXTINT)
{
- if (irq < (LPC17_IRQ_EXTINT+32))
+ if (irq < (LPC17_40_IRQ_EXTINT+32))
{
*regaddr = (NVIC_IRQ0_31_ENABLE + offset);
- *bit = 1 << (irq - LPC17_IRQ_EXTINT);
+ *bit = 1 << (irq - LPC17_40_IRQ_EXTINT);
}
- else if (irq < LPC17_IRQ_NIRQS)
+ else if (irq < LPC17_40_IRQ_NIRQS)
{
*regaddr = (NVIC_IRQ32_63_ENABLE + offset);
- *bit = 1 << (irq - LPC17_IRQ_EXTINT - 32);
+ *bit = 1 << (irq - LPC17_40_IRQ_EXTINT - 32);
}
else
{
@@ -261,19 +261,19 @@ static int lpc17_irqinfo(int irq, uintptr_t *regaddr, uint32_t *bit,
else
{
*regaddr = NVIC_SYSHCON;
- if (irq == LPC17_IRQ_MEMFAULT)
+ if (irq == LPC17_40_IRQ_MEMFAULT)
{
*bit = NVIC_SYSHCON_MEMFAULTENA;
}
- else if (irq == LPC17_IRQ_BUSFAULT)
+ else if (irq == LPC17_40_IRQ_BUSFAULT)
{
*bit = NVIC_SYSHCON_BUSFAULTENA;
}
- else if (irq == LPC17_IRQ_USAGEFAULT)
+ else if (irq == LPC17_40_IRQ_USAGEFAULT)
{
*bit = NVIC_SYSHCON_USGFAULTENA;
}
- else if (irq == LPC17_IRQ_SYSTICK)
+ else if (irq == LPC17_40_IRQ_SYSTICK)
{
*regaddr = NVIC_SYSTICK_CTRL;
*bit = NVIC_SYSTICK_CTRL_ENABLE;
@@ -372,16 +372,16 @@ void up_irqinitialize(void)
* under certain conditions.
*/
- irq_attach(LPC17_IRQ_SVCALL, up_svcall, NULL);
- irq_attach(LPC17_IRQ_HARDFAULT, up_hardfault, NULL);
+ irq_attach(LPC17_40_IRQ_SVCALL, up_svcall, NULL);
+ irq_attach(LPC17_40_IRQ_HARDFAULT, up_hardfault, NULL);
/* Set the priority of the SVCall interrupt */
#ifdef CONFIG_ARCH_IRQPRIO
- /* up_prioritize_irq(LPC17_IRQ_PENDSV, NVIC_SYSH_PRIORITY_MIN); */
+ /* up_prioritize_irq(LPC17_40_IRQ_PENDSV, NVIC_SYSH_PRIORITY_MIN); */
#endif
#ifdef CONFIG_ARMV7M_USEBASEPRI
- lpc17_prioritize_syscall(NVIC_SYSH_SVCALL_PRIORITY);
+ lpc17_40_prioritize_syscall(NVIC_SYSH_SVCALL_PRIORITY);
#endif
/* If the MPU is enabled, then attach and enable the Memory Management
@@ -389,32 +389,32 @@ void up_irqinitialize(void)
*/
#ifdef CONFIG_ARM_MPU
- irq_attach(LPC17_IRQ_MEMFAULT, up_memfault, NULL);
- up_enable_irq(LPC17_IRQ_MEMFAULT);
+ irq_attach(LPC17_40_IRQ_MEMFAULT, up_memfault, NULL);
+ up_enable_irq(LPC17_40_IRQ_MEMFAULT);
#endif
/* Attach all other processor exceptions (except reset and sys tick) */
#ifdef CONFIG_DEBUG_FEATURES
- irq_attach(LPC17_IRQ_NMI, lpc17_nmi, NULL);
+ irq_attach(LPC17_40_IRQ_NMI, lpc17_40_nmi, NULL);
#ifndef CONFIG_ARM_MPU
- irq_attach(LPC17_IRQ_MEMFAULT, up_memfault, NULL);
+ irq_attach(LPC17_40_IRQ_MEMFAULT, up_memfault, NULL);
#endif
- irq_attach(LPC17_IRQ_BUSFAULT, lpc17_busfault, NULL);
- irq_attach(LPC17_IRQ_USAGEFAULT, lpc17_usagefault, NULL);
- irq_attach(LPC17_IRQ_PENDSV, lpc17_pendsv, NULL);
- irq_attach(LPC17_IRQ_DBGMONITOR, lpc17_dbgmonitor, NULL);
- irq_attach(LPC17_IRQ_RESERVED, lpc17_reserved, NULL);
+ irq_attach(LPC17_40_IRQ_BUSFAULT, lpc17_40_busfault, NULL);
+ irq_attach(LPC17_40_IRQ_USAGEFAULT, lpc17_40_usagefault, NULL);
+ irq_attach(LPC17_40_IRQ_PENDSV, lpc17_40_pendsv, NULL);
+ irq_attach(LPC17_40_IRQ_DBGMONITOR, lpc17_40_dbgmonitor, NULL);
+ irq_attach(LPC17_40_IRQ_RESERVED, lpc17_40_reserved, NULL);
#endif
- lpc17_dumpnvic("initial", LPC17_IRQ_NIRQS);
+ lpc17_40_dumpnvic("initial", LPC17_40_IRQ_NIRQS);
/* Initialize logic to support a second level of interrupt decoding for
* GPIO pins.
*/
-#ifdef CONFIG_LPC17_GPIOIRQ
- lpc17_gpioirqinitialize();
+#ifdef CONFIG_LPC17_40_GPIOIRQ
+ lpc17_40_gpioirqinitialize();
#endif
/* And finally, enable interrupts */
@@ -438,7 +438,7 @@ void up_disable_irq(int irq)
uint32_t regval;
uint32_t bit;
- if (lpc17_irqinfo(irq, ®addr, &bit, NVIC_CLRENA_OFFSET) == 0)
+ if (lpc17_40_irqinfo(irq, ®addr, &bit, NVIC_CLRENA_OFFSET) == 0)
{
/* Modify the appropriate bit in the register to disable the interrupt.
* For normal interrupts, we need to set the bit in the associated
@@ -446,7 +446,7 @@ void up_disable_irq(int irq)
* clear the bit in the System Handler Control and State Register.
*/
- if (irq >= LPC17_IRQ_EXTINT)
+ if (irq >= LPC17_40_IRQ_EXTINT)
{
putreg32(bit, regaddr);
}
@@ -457,16 +457,16 @@ void up_disable_irq(int irq)
putreg32(regval, regaddr);
}
}
-#ifdef CONFIG_LPC17_GPIOIRQ
- else if (irq >= LPC17_VALID_FIRST0L)
+#ifdef CONFIG_LPC17_40_GPIOIRQ
+ else if (irq >= LPC17_40_VALID_FIRST0L)
{
/* Maybe it is a (derived) GPIO IRQ */
- lpc17_gpioirqdisable(irq);
+ lpc17_40_gpioirqdisable(irq);
}
#endif
- lpc17_dumpnvic("disable", irq);
+ lpc17_40_dumpnvic("disable", irq);
}
/****************************************************************************
@@ -483,7 +483,7 @@ void up_enable_irq(int irq)
uint32_t regval;
uint32_t bit;
- if (lpc17_irqinfo(irq, ®addr, &bit, NVIC_ENA_OFFSET) == 0)
+ if (lpc17_40_irqinfo(irq, ®addr, &bit, NVIC_ENA_OFFSET) == 0)
{
/* Modify the appropriate bit in the register to enable the interrupt.
* For normal interrupts, we need to set the bit in the associated
@@ -491,7 +491,7 @@ void up_enable_irq(int irq)
* set the bit in the System Handler Control and State Register.
*/
- if (irq >= LPC17_IRQ_EXTINT)
+ if (irq >= LPC17_40_IRQ_EXTINT)
{
putreg32(bit, regaddr);
}
@@ -502,16 +502,16 @@ void up_enable_irq(int irq)
putreg32(regval, regaddr);
}
}
-#ifdef CONFIG_LPC17_GPIOIRQ
- else if (irq >= LPC17_VALID_FIRST0L)
+#ifdef CONFIG_LPC17_40_GPIOIRQ
+ else if (irq >= LPC17_40_VALID_FIRST0L)
{
/* Maybe it is a (derived) GPIO IRQ */
- lpc17_gpioirqenable(irq);
+ lpc17_40_gpioirqenable(irq);
}
#endif
- lpc17_dumpnvic("enable", irq);
+ lpc17_40_dumpnvic("enable", irq);
}
/****************************************************************************
@@ -525,7 +525,7 @@ void up_enable_irq(int irq)
void up_ack_irq(int irq)
{
#if 0 /* Does not appear to be necessary in most cases */
- lpc17_clrpend(irq);
+ lpc17_40_clrpend(irq);
#endif
}
@@ -547,10 +547,10 @@ int up_prioritize_irq(int irq, int priority)
uint32_t regval;
int shift;
- DEBUGASSERT(irq >= LPC17_IRQ_MEMFAULT && irq < LPC17_IRQ_NIRQS &&
+ DEBUGASSERT(irq >= LPC17_40_IRQ_MEMFAULT && irq < LPC17_40_IRQ_NIRQS &&
(unsigned)priority <= NVIC_SYSH_PRIORITY_MIN);
- if (irq < LPC17_IRQ_EXTINT)
+ if (irq < LPC17_40_IRQ_EXTINT)
{
/* NVIC_SYSH_PRIORITY() maps {0..15} to one of three priority
* registers (0-3 are invalid)
@@ -563,7 +563,7 @@ int up_prioritize_irq(int irq, int priority)
{
/* NVIC_IRQ_PRIORITY() maps {0..} to one of many priority registers */
- irq -= LPC17_IRQ_EXTINT;
+ irq -= LPC17_40_IRQ_EXTINT;
regaddr = NVIC_IRQ_PRIORITY(irq);
}
@@ -573,7 +573,7 @@ int up_prioritize_irq(int irq, int priority)
regval |= (priority << shift);
putreg32(regval, regaddr);
- lpc17_dumpnvic("prioritize", irq);
+ lpc17_40_dumpnvic("prioritize", irq);
return OK;
}
#endif
diff --git a/arch/arm/src/lpc17xx/lpc17_lcd.c b/arch/arm/src/lpc17xx_40xx/lpc17_40_lcd.c
similarity index 68%
rename from arch/arm/src/lpc17xx/lpc17_lcd.c
rename to arch/arm/src/lpc17xx_40xx/lpc17_40_lcd.c
index 9894e05f6cb..1e9c9621299 100644
--- a/arch/arm/src/lpc17xx/lpc17_lcd.c
+++ b/arch/arm/src/lpc17xx_40xx/lpc17_40_lcd.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * arch/arm/src//lpc17xx/lpc17_lcd.c
+ * arch/arm/src/lpc17xx_40xx/lpc17_40_lcd.c
*
* Copyright (C) 2013, 2016 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt
@@ -48,50 +48,50 @@
#include
#include "up_arch.h"
-#include "hardware/lpc17_syscon.h"
-#include "lpc17_gpio.h"
-#include "lpc17_lcd.h"
+#include "hardware/lpc17_40_syscon.h"
+#include "lpc17_40_gpio.h"
+#include "lpc17_40_lcd.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
-#define LPC17_LCD_CLK_PER_LINE \
- (CONFIG_LPC17_LCD_HWIDTH + CONFIG_LPC17_LCD_HPULSE + \
- CONFIG_LPC17_LCD_HFRONTPORCH + CONFIG_LPC17_LCD_HBACKPORCH)
-#define LPC17_LCD_LINES_PER_FRAME \
- (CONFIG_LPC17_LCD_VHEIGHT + CONFIG_LPC17_LCD_VPULSE + \
- CONFIG_LPC17_LCD_VFRONTPORCH + CONFIG_LPC17_LCD_VBACKPORCH)
-#define LPC17_LCD_PIXEL_CLOCK \
- (LPC17_LCD_CLK_PER_LINE * LPC17_LCD_LINES_PER_FRAME * \
- CONFIG_LPC17_LCD_REFRESH_FREQ)
+#define LPC17_40_LCD_CLK_PER_LINE \
+ (CONFIG_LPC17_40_LCD_HWIDTH + CONFIG_LPC17_40_LCD_HPULSE + \
+ CONFIG_LPC17_40_LCD_HFRONTPORCH + CONFIG_LPC17_40_LCD_HBACKPORCH)
+#define LPC17_40_LCD_LINES_PER_FRAME \
+ (CONFIG_LPC17_40_LCD_VHEIGHT + CONFIG_LPC17_40_LCD_VPULSE + \
+ CONFIG_LPC17_40_LCD_VFRONTPORCH + CONFIG_LPC17_40_LCD_VBACKPORCH)
+#define LPC17_40_LCD_PIXEL_CLOCK \
+ (LPC17_40_LCD_CLK_PER_LINE * LPC17_40_LCD_LINES_PER_FRAME * \
+ CONFIG_LPC17_40_LCD_REFRESH_FREQ)
/* Framebuffer characteristics in bytes */
-#if defined(CONFIG_LPC17_LCD_BPP1)
-# define LPC17_STRIDE ((CONFIG_LPC17_LCD_HWIDTH * 1 + 7) / 8)
-#elif defined(CONFIG_LPC17_LCD_BPP2)
-# define LPC17_STRIDE ((CONFIG_LPC17_LCD_HWIDTH * 2 + 7) / 8)
-#elif defined(CONFIG_LPC17_LCD_BPP4)
-# define LPC17_STRIDE ((CONFIG_LPC17_LCD_HWIDTH * 4 + 7) / 8)
-#elif defined(CONFIG_LPC17_LCD_BPP8)
-# define LPC17_STRIDE ((CONFIG_LPC17_LCD_HWIDTH * 8 + 7) / 8)
-#elif defined(CONFIG_LPC17_LCD_BPP16)
-# define LPC17_STRIDE ((CONFIG_LPC17_LCD_HWIDTH * 16 + 7) / 8)
-#elif defined(CONFIG_LPC17_LCD_BPP24)
-# define LPC17_STRIDE ((CONFIG_LPC17_LCD_HWIDTH * 32 + 7) / 8)
-#elif defined(CONFIG_LPC17_LCD_BPP16_565)
-# define LPC17_STRIDE ((CONFIG_LPC17_LCD_HWIDTH * 16 + 7) / 8)
-#else /* defined(CONFIG_LPC17_LCD_BPP12_444) */
-# define LPC17_STRIDE ((CONFIG_LPC17_LCD_HWIDTH * 16 + 7) / 8)
+#if defined(CONFIG_LPC17_40_LCD_BPP1)
+# define LPC17_40_STRIDE ((CONFIG_LPC17_40_LCD_HWIDTH * 1 + 7) / 8)
+#elif defined(CONFIG_LPC17_40_LCD_BPP2)
+# define LPC17_40_STRIDE ((CONFIG_LPC17_40_LCD_HWIDTH * 2 + 7) / 8)
+#elif defined(CONFIG_LPC17_40_LCD_BPP4)
+# define LPC17_40_STRIDE ((CONFIG_LPC17_40_LCD_HWIDTH * 4 + 7) / 8)
+#elif defined(CONFIG_LPC17_40_LCD_BPP8)
+# define LPC17_40_STRIDE ((CONFIG_LPC17_40_LCD_HWIDTH * 8 + 7) / 8)
+#elif defined(CONFIG_LPC17_40_LCD_BPP16)
+# define LPC17_40_STRIDE ((CONFIG_LPC17_40_LCD_HWIDTH * 16 + 7) / 8)
+#elif defined(CONFIG_LPC17_40_LCD_BPP24)
+# define LPC17_40_STRIDE ((CONFIG_LPC17_40_LCD_HWIDTH * 32 + 7) / 8)
+#elif defined(CONFIG_LPC17_40_LCD_BPP16_565)
+# define LPC17_40_STRIDE ((CONFIG_LPC17_40_LCD_HWIDTH * 16 + 7) / 8)
+#else /* defined(CONFIG_LPC17_40_LCD_BPP12_444) */
+# define LPC17_40_STRIDE ((CONFIG_LPC17_40_LCD_HWIDTH * 16 + 7) / 8)
#endif
-#define LPC17_FBSIZE (LPC17_STRIDE * CONFIG_LPC17_LCD_VHEIGHT)
+#define LPC17_40_FBSIZE (LPC17_40_STRIDE * CONFIG_LPC17_40_LCD_VHEIGHT)
/* Delays */
-#define LPC17_LCD_PWRDIS_DELAY 10000
-#define LPC17_LCD_PWREN_DELAY 10000
+#define LPC17_40_LCD_PWRDIS_DELAY 10000
+#define LPC17_40_LCD_PWREN_DELAY 10000
/****************************************************************************
* Private Types
@@ -105,9 +105,9 @@
* configuration of each color plane.
*/
-static int lpc17_getvideoinfo(FAR struct fb_vtable_s *vtable,
+static int lpc17_40_getvideoinfo(FAR struct fb_vtable_s *vtable,
FAR struct fb_videoinfo_s *vinfo);
-static int lpc17_getplaneinfo(FAR struct fb_vtable_s *vtable, int planeno,
+static int lpc17_40_getplaneinfo(FAR struct fb_vtable_s *vtable, int planeno,
FAR struct fb_planeinfo_s *pinfo);
/* The following is provided only if the video hardware supports RGB color
@@ -115,9 +115,9 @@ static int lpc17_getplaneinfo(FAR struct fb_vtable_s *vtable, int planeno,
*/
#ifdef CONFIG_FB_CMAP
-static int lpc17_getcmap(FAR struct fb_vtable_s *vtable,
+static int lpc17_40_getcmap(FAR struct fb_vtable_s *vtable,
FAR struct fb_cmap_s *cmap);
-static int lpc17_putcmap(FAR struct fb_vtable_s *vtable,
+static int lpc17_40_putcmap(FAR struct fb_vtable_s *vtable,
FAR const struct fb_cmap_s *cmap);
#endif
@@ -126,9 +126,9 @@ static int lpc17_putcmap(FAR struct fb_vtable_s *vtable,
*/
#ifdef CONFIG_FB_HWCURSOR
-static int lpc17_getcursor(FAR struct fb_vtable_s *vtable,
+static int lpc17_40_getcursor(FAR struct fb_vtable_s *vtable,
FAR struct fb_cursorattrib_s *attrib);
-static int lpc17_setcursor(FAR struct fb_vtable_s *vtable,
+static int lpc17_40_setcursor(FAR struct fb_vtable_s *vtable,
FAR struct fb_setcursor_s *settings);
#endif
@@ -140,9 +140,9 @@ static int lpc17_setcursor(FAR struct fb_vtable_s *vtable,
static const struct fb_videoinfo_s g_videoinfo =
{
- .fmt = LPC17_COLOR_FMT,
- .xres = CONFIG_LPC17_LCD_HWIDTH,
- .yres = CONFIG_LPC17_LCD_VHEIGHT,
+ .fmt = LPC17_40_COLOR_FMT,
+ .xres = CONFIG_LPC17_40_LCD_HWIDTH,
+ .yres = CONFIG_LPC17_40_LCD_VHEIGHT,
.nplanes = 1,
};
@@ -150,11 +150,11 @@ static const struct fb_videoinfo_s g_videoinfo =
static const struct fb_planeinfo_s g_planeinfo =
{
- .fbmem = (FAR void *)CONFIG_LPC17_LCD_VRAMBASE,
- .fblen = LPC17_FBSIZE,
- .stride = LPC17_STRIDE,
+ .fbmem = (FAR void *)CONFIG_LPC17_40_LCD_VRAMBASE,
+ .fblen = LPC17_40_FBSIZE,
+ .stride = LPC17_40_STRIDE,
.display = 0,
- .bpp = LPC17_BPP,
+ .bpp = LPC17_40_BPP,
};
/* Current cursor position */
@@ -175,15 +175,15 @@ static struct fb_cursorsize_s g_csize;
struct fb_vtable_s g_fbobject =
{
- .getvideoinfo = lpc17_getvideoinfo,
- .getplaneinfo = lpc17_getplaneinfo,
+ .getvideoinfo = lpc17_40_getvideoinfo,
+ .getplaneinfo = lpc17_40_getplaneinfo,
#ifdef CONFIG_FB_CMAP
- .getcmap = lpc17_getcmap,
- .putcmap = lpc17_putcmap,
+ .getcmap = lpc17_40_getcmap,
+ .putcmap = lpc17_40_putcmap,
#endif
#ifdef CONFIG_FB_HWCURSOR
- .getcursor = lpc17_getcursor,
- .setcursor = lpc17_setcursor,
+ .getcursor = lpc17_40_getcursor,
+ .setcursor = lpc17_40_setcursor,
#endif
};
@@ -196,10 +196,10 @@ struct fb_vtable_s g_fbobject =
****************************************************************************/
/****************************************************************************
- * Name: lpc17_getvideoinfo
+ * Name: lpc17_40_getvideoinfo
****************************************************************************/
-static int lpc17_getvideoinfo(FAR struct fb_vtable_s *vtable,
+static int lpc17_40_getvideoinfo(FAR struct fb_vtable_s *vtable,
FAR struct fb_videoinfo_s *vinfo)
{
lcdinfo("vtable=%p vinfo=%p\n", vtable, vinfo);
@@ -214,10 +214,10 @@ static int lpc17_getvideoinfo(FAR struct fb_vtable_s *vtable,
}
/****************************************************************************
- * Name: lpc17_getplaneinfo
+ * Name: lpc17_40_getplaneinfo
****************************************************************************/
-static int lpc17_getplaneinfo(FAR struct fb_vtable_s *vtable, int planeno,
+static int lpc17_40_getplaneinfo(FAR struct fb_vtable_s *vtable, int planeno,
FAR struct fb_planeinfo_s *pinfo)
{
lcdinfo("vtable=%p planeno=%d pinfo=%p\n", vtable, planeno, pinfo);
@@ -232,11 +232,11 @@ static int lpc17_getplaneinfo(FAR struct fb_vtable_s *vtable, int planeno,
}
/****************************************************************************
- * Name: lpc17_getcmap
+ * Name: lpc17_40_getcmap
****************************************************************************/
#ifdef CONFIG_FB_CMAP
-static int lpc17_getcmap(FAR struct fb_vtable_s *vtable,
+static int lpc17_40_getcmap(FAR struct fb_vtable_s *vtable,
FAR struct fb_cmap_s *cmap)
{
uint32_t *pal;
@@ -250,7 +250,7 @@ static int lpc17_getcmap(FAR struct fb_vtable_s *vtable,
DEBUGASSERT(vtable && cmap &&
cmap->first < 256 && (cmap->first + cmap->len) < 256);
- pal = (uint32_t *)LPC17_LCD_PAL(cmap->first >> 1);
+ pal = (uint32_t *)LPC17_40_LCD_PAL(cmap->first >> 1);
last = cmap->first + cmap->len;
/* Handle the case where the first color starts on an odd boundary */
@@ -306,11 +306,11 @@ static int lpc17_getcmap(FAR struct fb_vtable_s *vtable,
#endif
/****************************************************************************
- * Name: lpc17_putcmap
+ * Name: lpc17_40_putcmap
****************************************************************************/
#ifdef CONFIG_FB_CMAP
-static int lpc17_putcmap(FAR struct fb_vtable_s *vtable,
+static int lpc17_40_putcmap(FAR struct fb_vtable_s *vtable,
FAR const struct fb_cmap_s *cmap)
{
uint32_t *pal;
@@ -324,7 +324,7 @@ static int lpc17_putcmap(FAR struct fb_vtable_s *vtable,
DEBUGASSERT(vtable && cmap);
- pal = (uint32_t *)LPC17_LCD_PAL(cmap->first >> 1);
+ pal = (uint32_t *)LPC17_40_LCD_PAL(cmap->first >> 1);
last = cmap->first + cmap->len;
/* Handle the case where the first color starts on an odd boundary */
@@ -376,26 +376,26 @@ static int lpc17_putcmap(FAR struct fb_vtable_s *vtable,
#endif
/****************************************************************************
- * Name: lpc17_getcursor
+ * Name: lpc17_40_getcursor
****************************************************************************/
#ifdef CONFIG_FB_HWCURSOR
-static int lpc17_getcursor(FAR struct fb_vtable_s *vtable,
+static int lpc17_40_getcursor(FAR struct fb_vtable_s *vtable,
FAR struct fb_cursorattrib_s *attrib)
{
lcdinfo("vtable=%p attrib=%p\n", vtable, attrib);
if (vtable && attrib)
{
#ifdef CONFIG_FB_HWCURSORIMAGE
- attrib->fmt = LPC17_COLOR_FMT;
+ attrib->fmt = LPC17_40_COLOR_FMT;
#endif
lcdinfo("pos: (x=%d, y=%d)\n", g_cpos.x, g_cpos.y);
attrib->pos = g_cpos;
#ifdef CONFIG_FB_HWCURSORSIZE
- attrib->mxsize.h = CONFIG_LPC17_LCD_VHEIGHT;
- attrib->mxsize.w = CONFIG_LPC17_LCD_HWIDTH;
+ attrib->mxsize.h = CONFIG_LPC17_40_LCD_VHEIGHT;
+ attrib->mxsize.w = CONFIG_LPC17_40_LCD_HWIDTH;
lcdinfo("size: (h=%d, w=%d)\n", g_csize.h, g_csize.w);
attrib->size = g_csize;
@@ -409,11 +409,11 @@ static int lpc17_getcursor(FAR struct fb_vtable_s *vtable,
#endif
/****************************************************************************
- * Name: lpc17_setcursor
+ * Name: lpc17_40_setcursor
****************************************************************************/
#ifdef CONFIG_FB_HWCURSOR
-static int lpc17_setcursor(FAR struct fb_vtable_s *vtable,
+static int lpc17_40_setcursor(FAR struct fb_vtable_s *vtable,
FAR struct fb_setcursor_s *settings)
{
lcdinfo("vtable=%p settings=%p\n", vtable, settings);
@@ -480,7 +480,7 @@ int up_fbinitialize(int display)
regval = ((SYSCON_MATRIXARB_PRI_ICODE(SYSCON_MATRIXARB_PRI_LOW)) |
(SYSCON_MATRIXARB_PRI_DCODE(SYSCON_MATRIXARB_PRI_HIGHEST)) |
(SYSCON_MATRIXARB_PRI_LCD(SYSCON_MATRIXARB_PRI_HIGHEST)));
- putreg32(regval, LPC17_SYSCON_MATRIXARB);
+ putreg32(regval, LPC17_40_SYSCON_MATRIXARB);
/* Configure pins */
/* Video data:
@@ -490,94 +490,94 @@ int up_fbinitialize(int display)
lcdinfo("Configuring pins\n");
- lpc17_configgpio(GPIO_LCD_VD0);
- lpc17_configgpio(GPIO_LCD_VD1);
- lpc17_configgpio(GPIO_LCD_VD2);
- lpc17_configgpio(GPIO_LCD_VD3);
- lpc17_configgpio(GPIO_LCD_VD4);
- lpc17_configgpio(GPIO_LCD_VD5);
- lpc17_configgpio(GPIO_LCD_VD6);
- lpc17_configgpio(GPIO_LCD_VD7);
+ lpc17_40_configgpio(GPIO_LCD_VD0);
+ lpc17_40_configgpio(GPIO_LCD_VD1);
+ lpc17_40_configgpio(GPIO_LCD_VD2);
+ lpc17_40_configgpio(GPIO_LCD_VD3);
+ lpc17_40_configgpio(GPIO_LCD_VD4);
+ lpc17_40_configgpio(GPIO_LCD_VD5);
+ lpc17_40_configgpio(GPIO_LCD_VD6);
+ lpc17_40_configgpio(GPIO_LCD_VD7);
- lpc17_configgpio(GPIO_LCD_VD8);
- lpc17_configgpio(GPIO_LCD_VD9);
- lpc17_configgpio(GPIO_LCD_VD10);
- lpc17_configgpio(GPIO_LCD_VD11);
- lpc17_configgpio(GPIO_LCD_VD12);
- lpc17_configgpio(GPIO_LCD_VD13);
- lpc17_configgpio(GPIO_LCD_VD14);
- lpc17_configgpio(GPIO_LCD_VD15);
+ lpc17_40_configgpio(GPIO_LCD_VD8);
+ lpc17_40_configgpio(GPIO_LCD_VD9);
+ lpc17_40_configgpio(GPIO_LCD_VD10);
+ lpc17_40_configgpio(GPIO_LCD_VD11);
+ lpc17_40_configgpio(GPIO_LCD_VD12);
+ lpc17_40_configgpio(GPIO_LCD_VD13);
+ lpc17_40_configgpio(GPIO_LCD_VD14);
+ lpc17_40_configgpio(GPIO_LCD_VD15);
-#if LPC17_BPP > 16
- lpc17_configgpio(GPIO_LCD_VD16);
- lpc17_configgpio(GPIO_LCD_VD17);
- lpc17_configgpio(GPIO_LCD_VD18);
- lpc17_configgpio(GPIO_LCD_VD19);
- lpc17_configgpio(GPIO_LCD_VD20);
- lpc17_configgpio(GPIO_LCD_VD21);
- lpc17_configgpio(GPIO_LCD_VD22);
- lpc17_configgpio(GPIO_LCD_VD23);
+#if LPC17_40_BPP > 16
+ lpc17_40_configgpio(GPIO_LCD_VD16);
+ lpc17_40_configgpio(GPIO_LCD_VD17);
+ lpc17_40_configgpio(GPIO_LCD_VD18);
+ lpc17_40_configgpio(GPIO_LCD_VD19);
+ lpc17_40_configgpio(GPIO_LCD_VD20);
+ lpc17_40_configgpio(GPIO_LCD_VD21);
+ lpc17_40_configgpio(GPIO_LCD_VD22);
+ lpc17_40_configgpio(GPIO_LCD_VD23);
#endif
/* Other pins */
- lpc17_configgpio(GPIO_LCD_DCLK);
- lpc17_configgpio(GPIO_LCD_LP);
- lpc17_configgpio(GPIO_LCD_FP);
- lpc17_configgpio(GPIO_LCD_ENABM);
- lpc17_configgpio(GPIO_LCD_PWR);
+ lpc17_40_configgpio(GPIO_LCD_DCLK);
+ lpc17_40_configgpio(GPIO_LCD_LP);
+ lpc17_40_configgpio(GPIO_LCD_FP);
+ lpc17_40_configgpio(GPIO_LCD_ENABM);
+ lpc17_40_configgpio(GPIO_LCD_PWR);
/* Turn on LCD clock */
- modifyreg32(LPC17_SYSCON_PCONP, 0, SYSCON_PCONP_PCLCD);
+ modifyreg32(LPC17_40_SYSCON_PCONP, 0, SYSCON_PCONP_PCLCD);
lcdinfo("Configuring the LCD controller\n");
/* Disable the cursor */
- regval = getreg32(LPC17_LCD_CRSR_CRTL);
+ regval = getreg32(LPC17_40_LCD_CRSR_CRTL);
regval &= ~LCD_CRSR_CTRL_CRSON;
- putreg32(regval, LPC17_LCD_CRSR_CRTL);
+ putreg32(regval, LPC17_40_LCD_CRSR_CRTL);
/* Clear any pending interrupts */
- putreg32(LCD_INTCLR_ALL, LPC17_LCD_INTCLR);
+ putreg32(LCD_INTCLR_ALL, LPC17_40_LCD_INTCLR);
/* Disable GLCD controller */
- putreg32(0, LPC17_LCD_CTRL);
+ putreg32(0, LPC17_40_LCD_CTRL);
/* Initialize pixel clock (assuming clock source is the peripheral clock) */
- putreg32(((uint32_t)BOARD_PCLK_FREQUENCY / (uint32_t)LPC17_LCD_PIXEL_CLOCK)+1,
- LPC17_SYSCON_LCDCFG);
+ putreg32(((uint32_t)BOARD_PCLK_FREQUENCY / (uint32_t)LPC17_40_LCD_PIXEL_CLOCK)+1,
+ LPC17_40_SYSCON_LCDCFG);
/* Set the bits per pixel */
- regval = getreg32(LPC17_LCD_CTRL);
+ regval = getreg32(LPC17_40_LCD_CTRL);
regval &= ~LCD_CTRL_LCDBPP_MASK;
-#if defined(CONFIG_LPC17_LCD_BPP1)
+#if defined(CONFIG_LPC17_40_LCD_BPP1)
regval |= LCD_CTRL_LCDBPP_1; /* 1 bpp */
-#elif defined(CONFIG_LPC17_LCD_BPP2)
+#elif defined(CONFIG_LPC17_40_LCD_BPP2)
regval |= LCD_CTRL_LCDBPP_2; /* 2 bpp */
-#elif defined(CONFIG_LPC17_LCD_BPP4)
+#elif defined(CONFIG_LPC17_40_LCD_BPP4)
regval |= LCD_CTRL_LCDBPP_4; /* 4 bpp */
-#elif defined(CONFIG_LPC17_LCD_BPP8)
+#elif defined(CONFIG_LPC17_40_LCD_BPP8)
regval |= LCD_CTRL_LCDBPP_8; /* 8 bpp */
-#elif defined(CONFIG_LPC17_LCD_BPP16)
+#elif defined(CONFIG_LPC17_40_LCD_BPP16)
regval |= LCD_CTRL_LCDBPP_16; /* 16 bpp */
-#elif defined(CONFIG_LPC17_LCD_BPP24)
+#elif defined(CONFIG_LPC17_40_LCD_BPP24)
regval |= LCD_CTRL_LCDBPP_24; /* 24-bit TFT panel only */
-#elif defined(CONFIG_LPC17_LCD_BPP16_565)
+#elif defined(CONFIG_LPC17_40_LCD_BPP16_565)
regval |= LCD_CTRL_LCDBPP_565; /* 16 bpp, 5:6:5 mode */
-#else /* defined(CONFIG_LPC17_LCD_BPP12_444) */
+#else /* defined(CONFIG_LPC17_40_LCD_BPP12_444) */
regval |= LCD_CTRL_LCDBPP_444; /* 12 bpp, 4:4:4 mode */
#endif
/* TFT panel */
-#ifdef CONFIG_LPC17_LCD_TFTPANEL
+#ifdef CONFIG_LPC17_40_LCD_TFTPANEL
regval |= LCD_CTRL_LCDTFT;
#endif
@@ -591,14 +591,14 @@ int up_fbinitialize(int display)
/* Select monochrome or color LCD */
-#ifdef CONFIG_LPC17_LCD_MONOCHROME
+#ifdef CONFIG_LPC17_40_LCD_MONOCHROME
/* Select monochrome LCD */
regval &= ~LCD_CTRL_BGR;
/* Select 4- or 8-bit monochrome interface */
-# if LPC17_BPP > 4
+# if LPC17_40_BPP > 4
regval |= LCD_CTRL_LCDMONO8;
# else
regval &= ~LCD_CTRL_LCDMONO8;
@@ -609,7 +609,7 @@ int up_fbinitialize(int display)
regval &= ~(LCD_CTRL_LCDBW | LCD_CTRL_LCDMONO8);
-#endif /* CONFIG_LPC17_LCD_MONOCHROME */
+#endif /* CONFIG_LPC17_40_LCD_MONOCHROME */
/* Little endian byte order */
@@ -618,31 +618,31 @@ int up_fbinitialize(int display)
/* Little endian pixel order */
regval &= ~LCD_CTRL_BEPO;
- putreg32(regval, LPC17_LCD_CTRL);
+ putreg32(regval, LPC17_40_LCD_CTRL);
/* Initialize horizontal timing */
- putreg32(0, LPC17_LCD_TIMH);
+ putreg32(0, LPC17_40_LCD_TIMH);
- regval = (((CONFIG_LPC17_LCD_HWIDTH/16) - 1) << LCD_TIMH_PPL_SHIFT |
- (CONFIG_LPC17_LCD_HPULSE - 1) << LCD_TIMH_HSW_SHIFT |
- (CONFIG_LPC17_LCD_HFRONTPORCH - 1) << LCD_TIMH_HFP_SHIFT |
- (CONFIG_LPC17_LCD_HBACKPORCH - 1) << LCD_TIMH_HBP_SHIFT);
- putreg32(regval, LPC17_LCD_TIMH);
+ regval = (((CONFIG_LPC17_40_LCD_HWIDTH/16) - 1) << LCD_TIMH_PPL_SHIFT |
+ (CONFIG_LPC17_40_LCD_HPULSE - 1) << LCD_TIMH_HSW_SHIFT |
+ (CONFIG_LPC17_40_LCD_HFRONTPORCH - 1) << LCD_TIMH_HFP_SHIFT |
+ (CONFIG_LPC17_40_LCD_HBACKPORCH - 1) << LCD_TIMH_HBP_SHIFT);
+ putreg32(regval, LPC17_40_LCD_TIMH);
/* Initialize vertical timing */
- putreg32(0, LPC17_LCD_TIMV);
+ putreg32(0, LPC17_40_LCD_TIMV);
- regval = ((CONFIG_LPC17_LCD_VHEIGHT - 1) << LCD_TIMV_LPP_SHIFT |
- (CONFIG_LPC17_LCD_VPULSE - 1) << LCD_TIMV_VSW_SHIFT |
- (CONFIG_LPC17_LCD_VFRONTPORCH) << LCD_TIMV_VFP_SHIFT |
- (CONFIG_LPC17_LCD_VBACKPORCH) << LCD_TIMV_VBP_SHIFT);
- putreg32(regval, LPC17_LCD_TIMV);
+ regval = ((CONFIG_LPC17_40_LCD_VHEIGHT - 1) << LCD_TIMV_LPP_SHIFT |
+ (CONFIG_LPC17_40_LCD_VPULSE - 1) << LCD_TIMV_VSW_SHIFT |
+ (CONFIG_LPC17_40_LCD_VFRONTPORCH) << LCD_TIMV_VFP_SHIFT |
+ (CONFIG_LPC17_40_LCD_VBACKPORCH) << LCD_TIMV_VBP_SHIFT);
+ putreg32(regval, LPC17_40_LCD_TIMV);
/* Initialize clock and signal polarity */
- regval = getreg32(LPC17_LCD_POL);
+ regval = getreg32(LPC17_40_LCD_POL);
/* LCDFP pin is active LOW and inactive HIGH */
@@ -658,7 +658,7 @@ int up_fbinitialize(int display)
/* Set number of clocks per line */
- regval |= ((CONFIG_LPC17_LCD_HWIDTH-1) << LCD_POL_CPL_SHIFT);
+ regval |= ((CONFIG_LPC17_40_LCD_HWIDTH-1) << LCD_POL_CPL_SHIFT);
/* Bypass internal pixel clock divider */
@@ -671,41 +671,41 @@ int up_fbinitialize(int display)
/* Select CCLK for the LCD block clock source */
regval &= ~LCD_POL_CLKSEL;
- putreg32(regval, LPC17_LCD_POL);
+ putreg32(regval, LPC17_40_LCD_POL);
/* Frame base address doubleword aligned */
- putreg32(CONFIG_LPC17_LCD_VRAMBASE & ~7, LPC17_LCD_UPBASE);
- putreg32(CONFIG_LPC17_LCD_VRAMBASE & ~7, LPC17_LCD_LPBASE);
+ putreg32(CONFIG_LPC17_40_LCD_VRAMBASE & ~7, LPC17_40_LCD_UPBASE);
+ putreg32(CONFIG_LPC17_40_LCD_VRAMBASE & ~7, LPC17_40_LCD_LPBASE);
/* Clear the display */
- lpc17_lcdclear(CONFIG_LPC17_LCD_BACKCOLOR);
+ lpc17_40_lcdclear(CONFIG_LPC17_40_LCD_BACKCOLOR);
-#ifdef CONFIG_LPC17_LCD_BACKLIGHT
+#ifdef CONFIG_LPC17_40_LCD_BACKLIGHT
/* Turn on the back light */
- lpc17_backlight(true);
+ lpc17_40_backlight(true);
#endif
- putreg32(0, LPC17_LCD_INTMSK);
+ putreg32(0, LPC17_40_LCD_INTMSK);
lcdinfo("Enabling the display\n");
- for (i = LPC17_LCD_PWREN_DELAY; i; i--);
+ for (i = LPC17_40_LCD_PWREN_DELAY; i; i--);
/* Enable LCD */
- regval = getreg32(LPC17_LCD_CTRL);
+ regval = getreg32(LPC17_40_LCD_CTRL);
regval |= LCD_CTRL_LCDEN;
- putreg32(regval, LPC17_LCD_CTRL);
+ putreg32(regval, LPC17_40_LCD_CTRL);
/* Enable LCD power */
- for (i = LPC17_LCD_PWREN_DELAY; i; i--);
+ for (i = LPC17_40_LCD_PWREN_DELAY; i; i--);
- regval = getreg32(LPC17_LCD_CTRL);
+ regval = getreg32(LPC17_40_LCD_CTRL);
regval |= LCD_CTRL_LCDPWR;
- putreg32(regval, LPC17_LCD_CTRL);
+ putreg32(regval, LPC17_40_LCD_CTRL);
return OK;
}
@@ -765,58 +765,58 @@ void up_fbuninitialize(int display)
* worry about mutually exclusive access to the LCD hardware.
*/
-#ifdef CONFIG_LPC17_LCD_BACKLIGHT
+#ifdef CONFIG_LPC17_40_LCD_BACKLIGHT
/* Turn off the back light */
- lpc17_backlight(false);
+ lpc17_40_backlight(false);
#endif
/* Disable the LCD controller */
- regval = getreg32(LPC17_LCD_CTRL);
+ regval = getreg32(LPC17_40_LCD_CTRL);
regval &= ~LCD_CTRL_LCDPWR;
- putreg32(regval, LPC17_LCD_CTRL);
+ putreg32(regval, LPC17_40_LCD_CTRL);
- for (i = LPC17_LCD_PWRDIS_DELAY; i; i--);
+ for (i = LPC17_40_LCD_PWRDIS_DELAY; i; i--);
regval &= ~LCD_CTRL_LCDEN;
- putreg32(regval, LPC17_LCD_CTRL);
+ putreg32(regval, LPC17_40_LCD_CTRL);
/* Turn off clocking to the LCD. modifyreg32() can do this atomically. */
- modifyreg32(LPC17_SYSCON_PCONP, SYSCON_PCONP_PCLCD, 0);
+ modifyreg32(LPC17_40_SYSCON_PCONP, SYSCON_PCONP_PCLCD, 0);
}
/************************************************************************************
- * Name: lpc17_lcdclear
+ * Name: lpc17_40_lcdclear
*
* Description:
- * This is a non-standard LCD interface just for the LPC17xx. Clearing the display
+ * This is a non-standard LCD interface just for the LPC17xx/LPC40xx. Clearing the display
* in the normal way by writing a sequences of runs that covers the entire display
* can be slow. Here the display is cleared by simply setting all VRAM memory to
* the specified color.
*
************************************************************************************/
-void lpc17_lcdclear(nxgl_mxpixel_t color)
+void lpc17_40_lcdclear(nxgl_mxpixel_t color)
{
int i;
-#if LPC17_BPP > 16
- uint32_t *dest = (uint32_t *)CONFIG_LPC17_LCD_VRAMBASE;
+#if LPC17_40_BPP > 16
+ uint32_t *dest = (uint32_t *)CONFIG_LPC17_40_LCD_VRAMBASE;
lcdinfo("Clearing display: color=%08x VRAM=%08x size=%d\n",
- color, CONFIG_LPC17_LCD_VRAMBASE,
- CONFIG_LPC17_LCD_HWIDTH * CONFIG_LPC17_LCD_VHEIGHT * sizeof(uint32_t));
+ color, CONFIG_LPC17_40_LCD_VRAMBASE,
+ CONFIG_LPC17_40_LCD_HWIDTH * CONFIG_LPC17_40_LCD_VHEIGHT * sizeof(uint32_t));
#else
- uint16_t *dest = (uint16_t *)CONFIG_LPC17_LCD_VRAMBASE;
+ uint16_t *dest = (uint16_t *)CONFIG_LPC17_40_LCD_VRAMBASE;
lcdinfo("Clearing display: color=%08x VRAM=%08x size=%d\n",
- color, CONFIG_LPC17_LCD_VRAMBASE,
- CONFIG_LPC17_LCD_HWIDTH * CONFIG_LPC17_LCD_VHEIGHT * sizeof(uint16_t));
+ color, CONFIG_LPC17_40_LCD_VRAMBASE,
+ CONFIG_LPC17_40_LCD_HWIDTH * CONFIG_LPC17_40_LCD_VHEIGHT * sizeof(uint16_t));
#endif
- for (i = 0; i < (CONFIG_LPC17_LCD_HWIDTH * CONFIG_LPC17_LCD_VHEIGHT); i++)
+ for (i = 0; i < (CONFIG_LPC17_40_LCD_HWIDTH * CONFIG_LPC17_40_LCD_VHEIGHT); i++)
{
*dest++ = color;
}
diff --git a/arch/arm/src/lpc17xx/lpc17_lcd.h b/arch/arm/src/lpc17xx_40xx/lpc17_40_lcd.h
similarity index 56%
rename from arch/arm/src/lpc17xx/lpc17_lcd.h
rename to arch/arm/src/lpc17xx_40xx/lpc17_40_lcd.h
index 103cf81bca1..9fb70859943 100644
--- a/arch/arm/src/lpc17xx/lpc17_lcd.h
+++ b/arch/arm/src/lpc17xx_40xx/lpc17_40_lcd.h
@@ -1,5 +1,5 @@
/************************************************************************************
- * arch/arm/src/lpc17xx/lpc17_lcd.h
+ * arch/arm/src/lpc17xx_40xx/lpc17_40_lcd.h
*
* Copyright (C) 2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt
@@ -33,8 +33,8 @@
*
************************************************************************************/
-#ifndef __ARCH_ARM_SRC_LPC17XX_LPC17_LCD_H
-#define __ARCH_ARM_SRC_LPC17XX_LPC17_LCD_H
+#ifndef __ARCH_ARM_SRC_LPC17XX_40XX_LPC17_40_LCD_H
+#define __ARCH_ARM_SRC_LPC17XX_40XX_LPC17_40_LCD_H
/************************************************************************************
* Included Files
@@ -46,7 +46,7 @@
#include
-#include "hardware/lpc17_lcd.h"
+#include "hardware/lpc17_40_lcd.h"
/************************************************************************************
* Pre-processor Definitions
@@ -55,100 +55,100 @@
/* Base address of the video RAM frame buffer */
-#ifndef CONFIG_LPC17_LCD_VRAMBASE
-# define CONFIG_LPC17_LCD_VRAMBASE ((uint32_t)LPC17_EXTDRAM_CS0 + 0x00010000)
+#ifndef CONFIG_LPC17_40_LCD_VRAMBASE
+# define CONFIG_LPC17_40_LCD_VRAMBASE ((uint32_t)LPC17_40_EXTDRAM_CS0 + 0x00010000)
#endif
/* LCD refresh rate */
-#ifndef CONFIG_LPC17_LCD_REFRESH_FREQ
-# define CONFIG_LPC17_LCD_REFRESH_FREQ (50) /* Hz */
+#ifndef CONFIG_LPC17_40_LCD_REFRESH_FREQ
+# define CONFIG_LPC17_40_LCD_REFRESH_FREQ (50) /* Hz */
#endif
/* Bits per pixel / color format */
-#undef LPC17_COLOR_FMT
-#if defined(CONFIG_LPC17_LCD_BPP1)
-# define LPC17_BPP 1
-# define LPC17_COLOR_FMT FB_FMT_Y1
-#elif defined(CONFIG_LPC17_LCD_BPP2)
-# define LPC17_BPP 2
-# define LPC17_COLOR_FMT FB_FMT_Y2
-#elif defined(CONFIG_LPC17_LCD_BPP4)
-# define LPC17_BPP 4
-# define LPC17_COLOR_FMT FB_FMT_Y4
-#elif defined(CONFIG_LPC17_LCD_BPP8)
-# define LPC17_BPP 8
-# define LPC17_COLOR_FMT FB_FMT_Y8
-#elif defined(CONFIG_LPC17_LCD_BPP16)
-# define LPC17_BPP 16
-# define LPC17_COLOR_FMT FB_FMT_Y16
-#elif defined(CONFIG_LPC17_LCD_BPP24)
-# define LPC17_BPP 32 /* Only 24 of 32 bits used for RGB */
-# define LPC17_COLOR_FMT FB_FMT_RGB24
-# ifndef CONFIG_LPC17_LCD_TFTPANEL
+#undef LPC17_40_COLOR_FMT
+#if defined(CONFIG_LPC17_40_LCD_BPP1)
+# define LPC17_40_BPP 1
+# define LPC17_40_COLOR_FMT FB_FMT_Y1
+#elif defined(CONFIG_LPC17_40_LCD_BPP2)
+# define LPC17_40_BPP 2
+# define LPC17_40_COLOR_FMT FB_FMT_Y2
+#elif defined(CONFIG_LPC17_40_LCD_BPP4)
+# define LPC17_40_BPP 4
+# define LPC17_40_COLOR_FMT FB_FMT_Y4
+#elif defined(CONFIG_LPC17_40_LCD_BPP8)
+# define LPC17_40_BPP 8
+# define LPC17_40_COLOR_FMT FB_FMT_Y8
+#elif defined(CONFIG_LPC17_40_LCD_BPP16)
+# define LPC17_40_BPP 16
+# define LPC17_40_COLOR_FMT FB_FMT_Y16
+#elif defined(CONFIG_LPC17_40_LCD_BPP24)
+# define LPC17_40_BPP 32 /* Only 24 of 32 bits used for RGB */
+# define LPC17_40_COLOR_FMT FB_FMT_RGB24
+# ifndef CONFIG_LPC17_40_LCD_TFTPANEL
# error "24 BPP is only available for a TFT panel"
# endif
-#elif defined(CONFIG_LPC17_LCD_BPP16_565)
-# define LPC17_BPP 16
-# define LPC17_COLOR_FMT FB_FMT_RGB16_565
-#elif defined(CONFIG_LPC17_LCD_BPP12_444)
-# define LPC17_BPP 1 2
-# define LPC17_COLOR_FMT FB_FMT_RGB12_444
+#elif defined(CONFIG_LPC17_40_LCD_BPP16_565)
+# define LPC17_40_BPP 16
+# define LPC17_40_COLOR_FMT FB_FMT_RGB16_565
+#elif defined(CONFIG_LPC17_40_LCD_BPP12_444)
+# define LPC17_40_BPP 1 2
+# define LPC17_40_COLOR_FMT FB_FMT_RGB12_444
#else
-# ifndef CONFIG_LPC17_LCD_TFTPANEL
+# ifndef CONFIG_LPC17_40_LCD_TFTPANEL
# warning "Assuming 24 BPP"
-# define LPC17_BPP 24
-# define CONFIG_LPC17_LCD_BPP24 1
-# define LPC17_COLOR_FMT FB_FMT_RGB24
+# define LPC17_40_BPP 24
+# define CONFIG_LPC17_40_LCD_BPP24 1
+# define LPC17_40_COLOR_FMT FB_FMT_RGB24
# else
# warning "Assuming 16 BPP 5:6:5"
-# define LPC17_BPP 16
-# define CONFIG_LPC17_LCD_BPP16_565 1
-# define LPC17_COLOR_FMT FB_FMT_RGB16_565
+# define LPC17_40_BPP 16
+# define CONFIG_LPC17_40_LCD_BPP16_565 1
+# define LPC17_40_COLOR_FMT FB_FMT_RGB16_565
# endif
#endif
/* Background color */
-#ifndef CONFIG_LPC17_LCD_BACKCOLOR
-# define CONFIG_LPC17_LCD_BACKCOLOR 0 /* Initial background color */
+#ifndef CONFIG_LPC17_40_LCD_BACKCOLOR
+# define CONFIG_LPC17_40_LCD_BACKCOLOR 0 /* Initial background color */
#endif
/* Horizontal video characteristics */
-#ifndef CONFIG_LPC17_LCD_HWIDTH
-# define CONFIG_LPC17_LCD_HWIDTH 480 /* Width in pixels */
+#ifndef CONFIG_LPC17_40_LCD_HWIDTH
+# define CONFIG_LPC17_40_LCD_HWIDTH 480 /* Width in pixels */
#endif
-#ifndef CONFIG_LPC17_LCD_HPULSE
-# define CONFIG_LPC17_LCD_HPULSE 2
+#ifndef CONFIG_LPC17_40_LCD_HPULSE
+# define CONFIG_LPC17_40_LCD_HPULSE 2
#endif
-#ifndef CONFIG_LPC17_LCD_HFRONTPORCH
-# define CONFIG_LPC17_LCD_HFRONTPORCH 5
+#ifndef CONFIG_LPC17_40_LCD_HFRONTPORCH
+# define CONFIG_LPC17_40_LCD_HFRONTPORCH 5
#endif
-#ifndef CONFIG_LPC17_LCD_HBACKPORCH
-# define CONFIG_LPC17_LCD_HBACKPORCH 40
+#ifndef CONFIG_LPC17_40_LCD_HBACKPORCH
+# define CONFIG_LPC17_40_LCD_HBACKPORCH 40
#endif
/* Vertical video characteristics */
-#ifndef CONFIG_LPC17_LCD_VHEIGHT
-# define CONFIG_LPC17_LCD_VHEIGHT 272 /* Height in rows */
+#ifndef CONFIG_LPC17_40_LCD_VHEIGHT
+# define CONFIG_LPC17_40_LCD_VHEIGHT 272 /* Height in rows */
#endif
-#ifndef CONFIG_LPC17_LCD_VPULSE
-# define CONFIG_LPC17_LCD_VPULSE 2
+#ifndef CONFIG_LPC17_40_LCD_VPULSE
+# define CONFIG_LPC17_40_LCD_VPULSE 2
#endif
-#ifndef CONFIG_LPC17_LCD_VFRONTPORCH
-# define CONFIG_LPC17_LCD_VFRONTPORCH 8
+#ifndef CONFIG_LPC17_40_LCD_VFRONTPORCH
+# define CONFIG_LPC17_40_LCD_VFRONTPORCH 8
#endif
-#ifndef CONFIG_LPC17_LCD_VBACKPORCH
-# define CONFIG_LPC17_LCD_VBACKPORCH 8
+#ifndef CONFIG_LPC17_40_LCD_VBACKPORCH
+# define CONFIG_LPC17_40_LCD_VBACKPORCH 8
#endif
/************************************************************************************
@@ -167,29 +167,29 @@
*/
/************************************************************************************
- * Name: lpc17_lcdclear
+ * Name: lpc17_40_lcdclear
*
* Description:
- * This is a non-standard LCD interface just for the LPC17xx. Clearing the display
+ * This is a non-standard LCD interface just for the LPC17xx/LPC40xx. Clearing the display
* in the normal way by writing a sequences of runs that covers the entire display
* can be slow. Here the dispaly is cleared by simply setting all VRAM memory to
* the specified color.
*
************************************************************************************/
-void lpc17_lcdclear(nxgl_mxpixel_t color);
+void lpc17_40_lcdclear(nxgl_mxpixel_t color);
/************************************************************************************
- * Name: lpc17_backlight
+ * Name: lpc17_40_backlight
*
* Description:
- * If CONFIG_LPC17_LCD_BACKLIGHT is defined, then the board-specific logic must
+ * If CONFIG_LPC17_40_LCD_BACKLIGHT is defined, then the board-specific logic must
* provide this interface to turn the backlight on and off.
*
************************************************************************************/
-#ifdef CONFIG_LPC17_LCD_BACKLIGHT
-void lpc17_backlight(bool blon);
+#ifdef CONFIG_LPC17_40_LCD_BACKLIGHT
+void lpc17_40_backlight(bool blon);
#endif
-#endif /* __ARCH_ARM_SRC_LPC17XX_LPC17_LCD_H */
+#endif /* __ARCH_ARM_SRC_LPC17XX_40XX_LPC17_40_LCD_H */
diff --git a/arch/arm/src/lpc17xx/lpc17_lowputc.c b/arch/arm/src/lpc17xx_40xx/lpc17_40_lowputc.c
similarity index 83%
rename from arch/arm/src/lpc17xx/lpc17_lowputc.c
rename to arch/arm/src/lpc17xx_40xx/lpc17_40_lowputc.c
index 218d1d62574..26915e5717e 100644
--- a/arch/arm/src/lpc17xx/lpc17_lowputc.c
+++ b/arch/arm/src/lpc17xx_40xx/lpc17_40_lowputc.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * arch/arm/src/lpc17xx/lpc17_lowputc.c
+ * arch/arm/src/lpc17xx_40xx/lpc17_40_lowputc.c
*
* Copyright (C) 2010-2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt
@@ -47,12 +47,12 @@
#include "up_internal.h"
#include "up_arch.h"
-#include "hardware/lpc17_syscon.h"
-#include "hardware/lpc17_uart.h"
+#include "hardware/lpc17_40_syscon.h"
+#include "hardware/lpc17_40_uart.h"
-#include "lpc17_gpio.h"
-#include "lpc17_lowputc.h"
-#include "lpc17_serial.h"
+#include "lpc17_40_gpio.h"
+#include "lpc17_40_lowputc.h"
+#include "lpc17_40_serial.h"
/****************************************************************************
* Pre-processor Definitions
@@ -61,25 +61,25 @@
/* Select UART parameters for the selected console */
#if defined(CONFIG_UART0_SERIAL_CONSOLE)
-# define CONSOLE_BASE LPC17_UART0_BASE
+# define CONSOLE_BASE LPC17_40_UART0_BASE
# define CONSOLE_BAUD CONFIG_UART0_BAUD
# define CONSOLE_BITS CONFIG_UART0_BITS
# define CONSOLE_PARITY CONFIG_UART0_PARITY
# define CONSOLE_2STOP CONFIG_UART0_2STOP
#elif defined(CONFIG_UART1_SERIAL_CONSOLE)
-# define CONSOLE_BASE LPC17_UART1_BASE
+# define CONSOLE_BASE LPC17_40_UART1_BASE
# define CONSOLE_BAUD CONFIG_UART1_BAUD
# define CONSOLE_BITS CONFIG_UART1_BITS
# define CONSOLE_PARITY CONFIG_UART1_PARITY
# define CONSOLE_2STOP CONFIG_UART1_2STOP
#elif defined(CONFIG_UART2_SERIAL_CONSOLE)
-# define CONSOLE_BASE LPC17_UART2_BASE
+# define CONSOLE_BASE LPC17_40_UART2_BASE
# define CONSOLE_BAUD CONFIG_UART2_BAUD
# define CONSOLE_BITS CONFIG_UART2_BITS
# define CONSOLE_PARITY CONFIG_UART2_PARITY
# define CONSOLE_2STOP CONFIG_UART2_2STOP
#elif defined(CONFIG_UART3_SERIAL_CONSOLE)
-# define CONSOLE_BASE LPC17_UART3_BASE
+# define CONSOLE_BASE LPC17_40_UART3_BASE
# define CONSOLE_BAUD CONFIG_UART3_BAUD
# define CONSOLE_BITS CONFIG_UART3_BITS
# define CONSOLE_PARITY CONFIG_UART3_PARITY
@@ -88,7 +88,7 @@
# if defined(HAVE_CONSOLE)
# error "No CONFIG_UARTn_SERIAL_CONSOLE Setting"
# endif
-# define CONSOLE_BASE LPC17_UART0_BASE
+# define CONSOLE_BASE LPC17_40_UART0_BASE
# define CONSOLE_BAUD 115200
# define CONSOLE_BITS 8
# define CONSOLE_PARITY 0
@@ -151,7 +151,7 @@
*
* PCLK = CCLK / divisor
*
- * And for the LPC178x, the PCLK is determined by the global divisor setting in
+ * And for the LPC178x/40xx, the PCLK is determined by the global divisor setting in
* the PLKSEL register.
*
* Ignoring the fractional divider for now. (If you want to extend this driver
@@ -159,7 +159,7 @@
* the same peripheral and that logic could easily leveraged here).
*/
-#ifdef LPC178x
+#ifdef LPC178x_40xx
/* Use the global PCLK frequency */
# define CONSOLE_NUMERATOR BOARD_PCLK_FREQUENCY
@@ -181,9 +181,9 @@
* BAUD <= CCLK / 16 / MinDL
*/
-# if CONSOLE_BAUD < (LPC17_CCLK / 16 / UART_MINDL)
+# if CONSOLE_BAUD < (LPC17_40_CCLK / 16 / UART_MINDL)
# define CONSOLE_CCLKDIV SYSCON_PCLKSEL_CCLK
-# define CONSOLE_NUMERATOR (LPC17_CCLK)
+# define CONSOLE_NUMERATOR (LPC17_40_CCLK)
/* Check divisor == 2. This works if:
*
@@ -196,9 +196,9 @@
* BAUD <= CCLK / 8 / MinDL
*/
-# elif CONSOLE_BAUD < (LPC17_CCLK / 8 / UART_MINDL)
+# elif CONSOLE_BAUD < (LPC17_40_CCLK / 8 / UART_MINDL)
# define CONSOLE_CCLKDIV SYSCON_PCLKSEL_CCLK2
-# define CONSOLE_NUMERATOR (LPC17_CCLK / 2)
+# define CONSOLE_NUMERATOR (LPC17_40_CCLK / 2)
/* Check divisor == 4. This works if:
*
@@ -211,9 +211,9 @@
* BAUD <= CCLK / 4 / MinDL
*/
-# elif CONSOLE_BAUD < (LPC17_CCLK / 4 / UART_MINDL)
+# elif CONSOLE_BAUD < (LPC17_40_CCLK / 4 / UART_MINDL)
# define CONSOLE_CCLKDIV SYSCON_PCLKSEL_CCLK4
-# define CONSOLE_NUMERATOR (LPC17_CCLK / 4)
+# define CONSOLE_NUMERATOR (LPC17_40_CCLK / 4)
/* Check divisor == 8. This works if:
*
@@ -226,11 +226,11 @@
* BAUD <= CCLK / 2 / MinDL
*/
-# else /* if CONSOLE_BAUD < (LPC17_CCLK / 2 / UART_MINDL) */
+# else /* if CONSOLE_BAUD < (LPC17_40_CCLK / 2 / UART_MINDL) */
# define CONSOLE_CCLKDIV SYSCON_PCLKSEL_CCLK8
-# define CONSOLE_NUMERATOR (LPC17_CCLK / 8)
+# define CONSOLE_NUMERATOR (LPC17_40_CCLK / 8)
# endif
-#endif /* LPC178x */
+#endif /* LPC178x_40xx */
/* Then this is the value to use for the DLM and DLL registers */
@@ -273,16 +273,16 @@ void up_lowputc(char ch)
#if defined HAVE_UART && defined HAVE_CONSOLE
/* Wait for the transmitter to be available */
- while ((getreg32(CONSOLE_BASE+LPC17_UART_LSR_OFFSET) & UART_LSR_THRE) == 0);
+ while ((getreg32(CONSOLE_BASE+LPC17_40_UART_LSR_OFFSET) & UART_LSR_THRE) == 0);
/* Send the character */
- putreg32((uint32_t)ch, CONSOLE_BASE+LPC17_UART_THR_OFFSET);
+ putreg32((uint32_t)ch, CONSOLE_BASE+LPC17_40_UART_THR_OFFSET);
#endif
}
/****************************************************************************
- * Name: lpc17_lowsetup
+ * Name: lpc17_40_lowsetup
*
* Description:
* This performs basic initialization of the UART used for the serial
@@ -311,7 +311,7 @@ void up_lowputc(char ch)
*
****************************************************************************/
-void lpc17_lowsetup(void)
+void lpc17_40_lowsetup(void)
{
#ifdef HAVE_UART
uint32_t regval;
@@ -320,7 +320,7 @@ void lpc17_lowsetup(void)
* other UARTs
*/
- regval = getreg32(LPC17_SYSCON_PCONP);
+ regval = getreg32(LPC17_40_SYSCON_PCONP);
regval &= ~(SYSCON_PCONP_PCUART0 | SYSCON_PCONP_PCUART1 |
SYSCON_PCONP_PCUART2 | SYSCON_PCONP_PCUART3);
#if defined(CONFIG_UART0_SERIAL_CONSOLE)
@@ -332,54 +332,54 @@ void lpc17_lowsetup(void)
#elif defined(CONFIG_UART3_SERIAL_CONSOLE)
regval |= SYSCON_PCONP_PCUART3;
#endif
- putreg32(regval, LPC17_SYSCON_PCONP);
+ putreg32(regval, LPC17_40_SYSCON_PCONP);
/* Step 2: Enable peripheral clocking for the console UART and disable
* clocking for all other UARTs
*/
#ifdef LPC176x
- regval = getreg32(LPC17_SYSCON_PCLKSEL0);
+ regval = getreg32(LPC17_40_SYSCON_PCLKSEL0);
regval &= ~(SYSCON_PCLKSEL0_UART0_MASK | SYSCON_PCLKSEL0_UART1_MASK);
#if defined(CONFIG_UART0_SERIAL_CONSOLE)
regval |= (CONSOLE_CCLKDIV << SYSCON_PCLKSEL0_UART0_SHIFT);
#elif defined(CONFIG_UART1_SERIAL_CONSOLE)
regval |= (CONSOLE_CCLKDIV << SYSCON_PCLKSEL0_UART1_SHIFT);
#endif
- putreg32(regval, LPC17_SYSCON_PCLKSEL0);
+ putreg32(regval, LPC17_40_SYSCON_PCLKSEL0);
- regval = getreg32(LPC17_SYSCON_PCLKSEL1);
+ regval = getreg32(LPC17_40_SYSCON_PCLKSEL1);
regval &= ~(SYSCON_PCLKSEL1_UART2_MASK | SYSCON_PCLKSEL1_UART3_MASK);
#if defined(CONFIG_UART2_SERIAL_CONSOLE)
regval |= (CONSOLE_CCLKDIV << SYSCON_PCLKSEL1_UART2_SHIFT);
#elif defined(CONFIG_UART3_SERIAL_CONSOLE)
regval |= (CONSOLE_CCLKDIV << SYSCON_PCLKSEL1_UART3_SHIFT);
#endif
- putreg32(regval, LPC17_SYSCON_PCLKSEL1);
+ putreg32(regval, LPC17_40_SYSCON_PCLKSEL1);
#endif
/* Configure UART pins for the selected CONSOLE */
#if defined(CONFIG_UART0_SERIAL_CONSOLE)
- lpc17_configgpio(GPIO_UART0_TXD);
- lpc17_configgpio(GPIO_UART0_RXD);
+ lpc17_40_configgpio(GPIO_UART0_TXD);
+ lpc17_40_configgpio(GPIO_UART0_RXD);
#elif defined(CONFIG_UART1_SERIAL_CONSOLE)
- lpc17_configgpio(GPIO_UART1_TXD);
- lpc17_configgpio(GPIO_UART1_RXD);
+ lpc17_40_configgpio(GPIO_UART1_TXD);
+ lpc17_40_configgpio(GPIO_UART1_RXD);
#if defined(CONFIG_UART1_IFLOWCONTROL) || defined(CONFIG_UART1_OFLOWCONTROL)
- lpc17_configgpio(GPIO_UART1_CTS);
- lpc17_configgpio(GPIO_UART1_DCD);
- lpc17_configgpio(GPIO_UART1_DSR);
- lpc17_configgpio(GPIO_UART1_DTR);
- lpc17_configgpio(GPIO_UART1_RI);
- lpc17_configgpio(GPIO_UART1_RTS);
+ lpc17_40_configgpio(GPIO_UART1_CTS);
+ lpc17_40_configgpio(GPIO_UART1_DCD);
+ lpc17_40_configgpio(GPIO_UART1_DSR);
+ lpc17_40_configgpio(GPIO_UART1_DTR);
+ lpc17_40_configgpio(GPIO_UART1_RI);
+ lpc17_40_configgpio(GPIO_UART1_RTS);
#endif
#elif defined(CONFIG_UART2_SERIAL_CONSOLE)
- lpc17_configgpio(GPIO_UART2_TXD);
- lpc17_configgpio(GPIO_UART2_RXD);
+ lpc17_40_configgpio(GPIO_UART2_TXD);
+ lpc17_40_configgpio(GPIO_UART2_RXD);
#elif defined(CONFIG_UART3_SERIAL_CONSOLE)
- lpc17_configgpio(GPIO_UART3_TXD);
- lpc17_configgpio(GPIO_UART3_RXD);
+ lpc17_40_configgpio(GPIO_UART3_TXD);
+ lpc17_40_configgpio(GPIO_UART3_RXD);
#endif
/* Configure the console (only) */
@@ -389,39 +389,39 @@ void lpc17_lowsetup(void)
/* Clear fifos */
putreg32(UART_FCR_RXRST | UART_FCR_TXRST,
- CONSOLE_BASE + LPC17_UART_FCR_OFFSET);
+ CONSOLE_BASE + LPC17_40_UART_FCR_OFFSET);
/* Set trigger */
putreg32(UART_FCR_FIFOEN | UART_FCR_RXTRIGGER_8,
- CONSOLE_BASE + LPC17_UART_FCR_OFFSET);
+ CONSOLE_BASE + LPC17_40_UART_FCR_OFFSET);
/* Disable FDR (fractional divider),
* ignored by baudrate calculation => has to be disabled
*/
putreg32((1 << UART_FDR_MULVAL_SHIFT) + (0 << UART_FDR_DIVADDVAL_SHIFT),
- CONSOLE_BASE + LPC17_UART_FDR_OFFSET);
+ CONSOLE_BASE + LPC17_40_UART_FDR_OFFSET);
/* Set up the LCR and set DLAB=1 */
putreg32(CONSOLE_LCR_VALUE | UART_LCR_DLAB,
- CONSOLE_BASE + LPC17_UART_LCR_OFFSET);
+ CONSOLE_BASE + LPC17_40_UART_LCR_OFFSET);
/* Set the BAUD divisor */
- putreg32(CONSOLE_DL >> 8, CONSOLE_BASE + LPC17_UART_DLM_OFFSET);
- putreg32(CONSOLE_DL & 0xff, CONSOLE_BASE + LPC17_UART_DLL_OFFSET);
+ putreg32(CONSOLE_DL >> 8, CONSOLE_BASE + LPC17_40_UART_DLM_OFFSET);
+ putreg32(CONSOLE_DL & 0xff, CONSOLE_BASE + LPC17_40_UART_DLL_OFFSET);
/* Clear DLAB */
- putreg32(CONSOLE_LCR_VALUE, CONSOLE_BASE + LPC17_UART_LCR_OFFSET);
+ putreg32(CONSOLE_LCR_VALUE, CONSOLE_BASE + LPC17_40_UART_LCR_OFFSET);
/* Configure the FIFOs */
putreg32(UART_FCR_RXTRIGGER_8 | UART_FCR_TXRST | UART_FCR_RXRST |
UART_FCR_FIFOEN,
- CONSOLE_BASE + LPC17_UART_FCR_OFFSET);
+ CONSOLE_BASE + LPC17_40_UART_FCR_OFFSET);
#endif
#endif /* HAVE_UART */
}
diff --git a/arch/arm/src/lpc17xx/lpc17_lowputc.h b/arch/arm/src/lpc17xx_40xx/lpc17_40_lowputc.h
similarity index 92%
rename from arch/arm/src/lpc17xx/lpc17_lowputc.h
rename to arch/arm/src/lpc17xx_40xx/lpc17_40_lowputc.h
index b1b226e0353..e93414bf678 100644
--- a/arch/arm/src/lpc17xx/lpc17_lowputc.h
+++ b/arch/arm/src/lpc17xx_40xx/lpc17_40_lowputc.h
@@ -1,5 +1,5 @@
/************************************************************************************
- * arch/arm/src/lpc17xx/lpc17_lowputc.h
+ * arch/arm/src/lpc17xx_40xx/lpc17_40_lowputc.h
*
* Copyright (C) 2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt
@@ -33,8 +33,8 @@
*
************************************************************************************/
-#ifndef __ARCH_ARM_SRC_LPC17XX_LPC17_LOWPUTC_H
-#define __ARCH_ARM_SRC_LPC17XX_LPC17_LOWPUTC_H
+#ifndef __ARCH_ARM_SRC_LPC17XX_40XX_LPC17_40_LOWPUTC_H
+#define __ARCH_ARM_SRC_LPC17XX_40XX_LPC17_40_LOWPUTC_H
/************************************************************************************
* Included Files
@@ -65,7 +65,7 @@ extern "C"
************************************************************************************/
/************************************************************************************
- * Name: lpc17_lowsetup
+ * Name: lpc17_40_lowsetup
*
* Description:
* Called at the very beginning of _start. Performs low level initialization
@@ -74,11 +74,11 @@ extern "C"
*
************************************************************************************/
-void lpc17_lowsetup(void);
+void lpc17_40_lowsetup(void);
#ifdef __cplusplus
}
#endif
#endif /* __ASSEMBLY__ */
-#endif /* __ARCH_ARM_SRC_LPC17XX_LPC17_LOWPUTC_H */
+#endif /* __ARCH_ARM_SRC_LPC17XX_40XX_LPC17_40_LOWPUTC_H */
diff --git a/arch/arm/src/lpc17xx/lpc17_mcpwm.c b/arch/arm/src/lpc17xx_40xx/lpc17_40_mcpwm.c
similarity index 74%
rename from arch/arm/src/lpc17xx/lpc17_mcpwm.c
rename to arch/arm/src/lpc17xx_40xx/lpc17_40_mcpwm.c
index 997a1b46fac..1fd9a14c5b1 100644
--- a/arch/arm/src/lpc17xx/lpc17_mcpwm.c
+++ b/arch/arm/src/lpc17xx_40xx/lpc17_40_mcpwm.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * arch/arm/src/lpc17xx/lpc17_mcpwm.c
+ * arch/arm/src/lpc17xx_40xx/lpc17_40_mcpwm.c
*
* Copyright (C) 2014, 2016 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt
@@ -54,17 +54,17 @@
#include "up_arch.h"
#include "chip.h"
-#include "hardware/lpc17_syscon.h"
-#include "lpc17_pwm.h"
+#include "hardware/lpc17_40_syscon.h"
+#include "lpc17_40_pwm.h"
#include "hardware/lpc176x_pinconfig.h"
-#include "lpc17_gpio.h"
+#include "lpc17_40_gpio.h"
#include "lpc176x_gpio.h"
/* This module then only compiles if there is at least one enabled timer
* intended for use with the PWM upper half driver.
*/
-#if defined(CONFIG_LPC17_MCPWM)
+#if defined(CONFIG_LPC17_40_MCPWM)
/****************************************************************************
* Pre-processor Definitions
@@ -93,7 +93,7 @@
****************************************************************************/
/* This structure represents the state of one PWM timer */
-struct lpc17_mcpwmtimer_s
+struct lpc17_40_mcpwmtimer_s
{
FAR const struct pwm_ops_s *ops; /* PWM operations */
uint8_t timid; /* Timer ID {0,...,7} */
@@ -110,18 +110,18 @@ struct lpc17_mcpwmtimer_s
****************************************************************************/
/* Register access */
-static uint32_t mcpwm_getreg(struct lpc17_mcpwmtimer_s *priv, int offset);
-static void mcpwm_putreg(struct lpc17_mcpwmtimer_s *priv, int offset, uint32_t value);
+static uint32_t mcpwm_getreg(struct lpc17_40_mcpwmtimer_s *priv, int offset);
+static void mcpwm_putreg(struct lpc17_40_mcpwmtimer_s *priv, int offset, uint32_t value);
#ifdef CONFIG_DEBUG_PWM_INFO
-static void mcpwm_dumpregs(struct lpc17_mcpwmtimer_s *priv, FAR const char *msg);
+static void mcpwm_dumpregs(struct lpc17_40_mcpwmtimer_s *priv, FAR const char *msg);
#else
# define mcpwm_dumpregs(priv,msg)
#endif
/* Timer management */
-static int mcpwm_timer(FAR struct lpc17_mcpwmtimer_s *priv,
+static int mcpwm_timer(FAR struct lpc17_40_mcpwmtimer_s *priv,
FAR const struct pwm_info_s *info);
/* PWM driver methods */
@@ -152,14 +152,14 @@ static const struct pwm_ops_s g_pwmops =
.ioctl = mcpwm_ioctl,
};
-#ifdef CONFIG_LPC17_MCPWM
-static struct lpc17_mcpwmtimer_s g_pwm1dev =
+#ifdef CONFIG_LPC17_40_MCPWM
+static struct lpc17_40_mcpwmtimer_s g_pwm1dev =
{
.ops = &g_pwmops,
.timid = 1,
- .channel = CONFIG_LPC17_MCPWM1_PIN,
+ .channel = CONFIG_LPC17_40_MCPWM1_PIN,
.timtype = TIMTYPE_TIM1,
- .base = LPC17_MCPWM_BASE,
+ .base = LPC17_40_MCPWM_BASE,
.pincfg = GPIO_MCPWM_MCOA0,
.pclk = (1 << 12),
};
@@ -184,7 +184,7 @@ static struct lpc17_mcpwmtimer_s g_pwm1dev =
*
****************************************************************************/
-static uint32_t mcpwm_getreg(struct lpc17_mcpwmtimer_s *priv, int offset)
+static uint32_t mcpwm_getreg(struct lpc17_40_mcpwmtimer_s *priv, int offset)
{
return getreg32(priv->base + offset);
}
@@ -204,7 +204,7 @@ static uint32_t mcpwm_getreg(struct lpc17_mcpwmtimer_s *priv, int offset)
*
****************************************************************************/
-static void mcpwm_putreg(struct lpc17_mcpwmtimer_s *priv, int offset, uint32_t value)
+static void mcpwm_putreg(struct lpc17_40_mcpwmtimer_s *priv, int offset, uint32_t value)
{
putreg32(value, priv->base + offset);
}
@@ -224,30 +224,30 @@ static void mcpwm_putreg(struct lpc17_mcpwmtimer_s *priv, int offset, uint32_t v
****************************************************************************/
#ifdef CONFIG_DEBUG_PWM_INFO
-static void mcpwm_dumpregs(FAR struct lpc17_mcpwmtimer_s *priv,
+static void mcpwm_dumpregs(FAR struct lpc17_40_mcpwmtimer_s *priv,
FAR const char *msg)
{
pwminfo("%s:\n", msg);
pwminfo(" CR1: %04x CR2: %04x SMCR: %04x DIER: %04x\n",
- mcpwm_getreg(priv, LPC17_PWM_MR0_OFFSET),
- mcpwm_getreg(priv, LPC17_PWM_MR1_OFFSET),
- mcpwm_getreg(priv, LPC17_PWM_MR2_OFFSET),
- mcpwm_getreg(priv, LPC17_PWM_MR3_OFFSET));
-#if defined(CONFIG_LPC17_MCPWM)
+ mcpwm_getreg(priv, LPC17_40_PWM_MR0_OFFSET),
+ mcpwm_getreg(priv, LPC17_40_PWM_MR1_OFFSET),
+ mcpwm_getreg(priv, LPC17_40_PWM_MR2_OFFSET),
+ mcpwm_getreg(priv, LPC17_40_PWM_MR3_OFFSET));
+#if defined(CONFIG_LPC17_40_MCPWM)
if (priv->timtype == TIMTYPE_ADVANCED)
{
pwminfo(" RCR: %04x BDTR: %04x DCR: %04x DMAR: %04x\n",
- mcpwm_getreg(priv, LPC17_PWM_MR0_OFFSET),
- mcpwm_getreg(priv, LPC17_PWM_MR1_OFFSET),
- mcpwm_getreg(priv, LPC17_PWM_MR2_OFFSET),
- mcpwm_getreg(priv, LPC17_PWM_MR3_OFFSET));
+ mcpwm_getreg(priv, LPC17_40_PWM_MR0_OFFSET),
+ mcpwm_getreg(priv, LPC17_40_PWM_MR1_OFFSET),
+ mcpwm_getreg(priv, LPC17_40_PWM_MR2_OFFSET),
+ mcpwm_getreg(priv, LPC17_40_PWM_MR3_OFFSET));
}
else
#endif
{
pwminfo(" DCR: %04x DMAR: %04x\n",
- mcpwm_getreg(priv, LPC17_PWM_MR2_OFFSET),
- mcpwm_getreg(priv, LPC17_PWM_MR3_OFFSET));
+ mcpwm_getreg(priv, LPC17_40_PWM_MR2_OFFSET),
+ mcpwm_getreg(priv, LPC17_40_PWM_MR3_OFFSET));
}
}
#endif
@@ -267,7 +267,7 @@ static void mcpwm_dumpregs(FAR struct lpc17_mcpwmtimer_s *priv,
*
****************************************************************************/
-static int mcpwm_timer(FAR struct lpc17_mcpwmtimer_s *priv,
+static int mcpwm_timer(FAR struct lpc17_40_mcpwmtimer_s *priv,
FAR const struct pwm_info_s *info)
{
irqstate_t flags;
@@ -275,8 +275,8 @@ static int mcpwm_timer(FAR struct lpc17_mcpwmtimer_s *priv,
flags = enter_critical_section();
- putreg32(info->frequency, LPC17_MCPWM_LIM0); /* Set PWMMR0 = number of counts */
- putreg32(info->duty, LPC17_MCPWM_MAT0); /* Set PWM cycle */
+ putreg32(info->frequency, LPC17_40_MCPWM_LIM0); /* Set PWMMR0 = number of counts */
+ putreg32(info->duty, LPC17_40_MCPWM_MAT0); /* Set PWM cycle */
leave_critical_section(flags);
mcpwm_dumpregs(priv, "After starting");
@@ -298,7 +298,7 @@ static int mcpwm_timer(FAR struct lpc17_mcpwmtimer_s *priv,
*
****************************************************************************/
-static int mcpwm_interrupt(struct lpc17_mcpwmtimer_s *priv)
+static int mcpwm_interrupt(struct lpc17_40_mcpwmtimer_s *priv)
{
uint16_t regval;
@@ -349,7 +349,7 @@ static int mcpwm_tim1interrupt(int irq, void *context)
*
****************************************************************************/
-static void mcpwm_set_apb_clock(FAR struct lpc17_mcpwmtimer_s *priv, bool on)
+static void mcpwm_set_apb_clock(FAR struct lpc17_40_mcpwmtimer_s *priv, bool on)
{
uint32_t en_bit;
uint32_t regaddr;
@@ -358,7 +358,7 @@ static void mcpwm_set_apb_clock(FAR struct lpc17_mcpwmtimer_s *priv, bool on)
switch (priv->timid)
{
-#ifdef CONFIG_LPC17_MCPWM
+#ifdef CONFIG_LPC17_40_MCPWM
case 1:
regaddr = STM32_RCC_APB2ENR;
en_bit = RCC_APB2ENR_TIM1EN;
@@ -401,7 +401,7 @@ static void mcpwm_set_apb_clock(FAR struct lpc17_mcpwmtimer_s *priv, bool on)
static int mcpwm_setup(FAR struct pwm_lowerhalf_s *dev)
{
- FAR struct lpc17_mcpwmtimer_s *priv = (FAR struct lpc17_mcpwmtimer_s *)dev;
+ FAR struct lpc17_40_mcpwmtimer_s *priv = (FAR struct lpc17_40_mcpwmtimer_s *)dev;
irqstate_t flags;
uint32_t regval;
@@ -409,71 +409,71 @@ static int mcpwm_setup(FAR struct pwm_lowerhalf_s *dev)
/* Power on the mcpwm peripheral */
- regval = getreg32(LPC17_SYSCON_PCONP);
+ regval = getreg32(LPC17_40_SYSCON_PCONP);
regval |= SYSCON_PCONP_PCMCPWM;
- putreg32(regval, LPC17_SYSCON_PCONP);
+ putreg32(regval, LPC17_40_SYSCON_PCONP);
/* Select clock for the mcpwm peripheral */
- regval = getreg32(LPC17_SYSCON_PCLKSEL1);
+ regval = getreg32(LPC17_40_SYSCON_PCLKSEL1);
regval &= ~(0x3 << 30);
regval |= (0x2 << 30); /* PCLK_MC peripheral clk = CCLK/2 = 50 MHz */
- putreg32(regval, LPC17_SYSCON_PCLKSEL1);
+ putreg32(regval, LPC17_40_SYSCON_PCLKSEL1);
priv->pclk = (0x1 << 12) | (0x1 << 4);
- putreg32((1 << 15), LPC17_MCPWM_INTENCLR); /* Disable MCABORT pin interrupt */
- putreg32((1 << 0), LPC17_MCPWM_INTENCLR); /* Disable ILIM0 interrupt */
- putreg32((1 << 1), LPC17_MCPWM_INTENCLR); /* Disable IMAT0 interrupt */
- putreg32((1 << 2), LPC17_MCPWM_INTENCLR); /* Disable ICAP0 interrupt */
- putreg32((1 << 4), LPC17_MCPWM_INTENCLR); /* Disable ILIM1 interrupt */
- putreg32((1 << 5), LPC17_MCPWM_INTENCLR); /* Disable IMAT1 interrupt */
- putreg32((1 << 6), LPC17_MCPWM_INTENCLR); /* Disable ICAP1 interrupt */
- putreg32((1 << 8), LPC17_MCPWM_INTENCLR); /* Disable ILIM2 interrupt */
- putreg32((1 << 9), LPC17_MCPWM_INTENCLR); /* Disable IMAT2 interrupt */
- putreg32((1 << 10), LPC17_MCPWM_INTENCLR); /* Disable ICAP2 interrupt */
+ putreg32((1 << 15), LPC17_40_MCPWM_INTENCLR); /* Disable MCABORT pin interrupt */
+ putreg32((1 << 0), LPC17_40_MCPWM_INTENCLR); /* Disable ILIM0 interrupt */
+ putreg32((1 << 1), LPC17_40_MCPWM_INTENCLR); /* Disable IMAT0 interrupt */
+ putreg32((1 << 2), LPC17_40_MCPWM_INTENCLR); /* Disable ICAP0 interrupt */
+ putreg32((1 << 4), LPC17_40_MCPWM_INTENCLR); /* Disable ILIM1 interrupt */
+ putreg32((1 << 5), LPC17_40_MCPWM_INTENCLR); /* Disable IMAT1 interrupt */
+ putreg32((1 << 6), LPC17_40_MCPWM_INTENCLR); /* Disable ICAP1 interrupt */
+ putreg32((1 << 8), LPC17_40_MCPWM_INTENCLR); /* Disable ILIM2 interrupt */
+ putreg32((1 << 9), LPC17_40_MCPWM_INTENCLR); /* Disable IMAT2 interrupt */
+ putreg32((1 << 10), LPC17_40_MCPWM_INTENCLR); /* Disable ICAP2 interrupt */
- putreg32((0xFFFFFFFF), LPC17_MCPWM_CAPCLR); /* Clear all event capture */
+ putreg32((0xFFFFFFFF), LPC17_40_MCPWM_CAPCLR); /* Clear all event capture */
/* Configure the output pins */
- lpc17_configgpio(GPIO_MCPWM_MCOA0);
- lpc17_configgpio(GPIO_MCPWM_MCOB0);
+ lpc17_40_configgpio(GPIO_MCPWM_MCOA0);
+ lpc17_40_configgpio(GPIO_MCPWM_MCOB0);
/* Program the timing registers */
- putreg32((1 << 0), LPC17_MCPWM_CONCLR); /* Stop MCPWM timer0 */
- putreg32((1 << 8), LPC17_MCPWM_CONCLR); /* Stop MCPWM timer1 */
- putreg32((1 << 16), LPC17_MCPWM_CONCLR); /* Stop MCPWM timer2 */
+ putreg32((1 << 0), LPC17_40_MCPWM_CONCLR); /* Stop MCPWM timer0 */
+ putreg32((1 << 8), LPC17_40_MCPWM_CONCLR); /* Stop MCPWM timer1 */
+ putreg32((1 << 16), LPC17_40_MCPWM_CONCLR); /* Stop MCPWM timer2 */
- putreg32((1 << 30), LPC17_MCPWM_CONCLR); /* MCPWM not in AC mode */
+ putreg32((1 << 30), LPC17_40_MCPWM_CONCLR); /* MCPWM not in AC mode */
- putreg32(1000, LPC17_MCPWM_TC0); /* Count frequency: Fpclk/1000 = 50 MHz/1000 = 50 KHz */
- putreg32(400, LPC17_MCPWM_LIM0); /* Set the starting duty cycle to 0.25 */
- putreg32(0, LPC17_MCPWM_MAT0); /* Reset the timer */
+ putreg32(1000, LPC17_40_MCPWM_TC0); /* Count frequency: Fpclk/1000 = 50 MHz/1000 = 50 KHz */
+ putreg32(400, LPC17_40_MCPWM_LIM0); /* Set the starting duty cycle to 0.25 */
+ putreg32(0, LPC17_40_MCPWM_MAT0); /* Reset the timer */
- putreg32(100000, LPC17_MCPWM_TC1); /* Count frequency:Fpclk/100000 = 50 MHz/100000 = 500 Hz */
- putreg32(50000, LPC17_MCPWM_LIM1); /* Set the starting duty cycle to 0.5 */
- putreg32(0, LPC17_MCPWM_MAT1); /* Reset the timer */
+ putreg32(100000, LPC17_40_MCPWM_TC1); /* Count frequency:Fpclk/100000 = 50 MHz/100000 = 500 Hz */
+ putreg32(50000, LPC17_40_MCPWM_LIM1); /* Set the starting duty cycle to 0.5 */
+ putreg32(0, LPC17_40_MCPWM_MAT1); /* Reset the timer */
- putreg32(1000, LPC17_MCPWM_TC2); /* Count frequency:Fpclk/1000 = 50 MHz/1000 = 50 KHz */
- putreg32(400, LPC17_MCPWM_LIM2); /* Set the starting duty cycle to 0.25 */
- putreg32(0, LPC17_MCPWM_MAT2); /* Reset the timer */
+ putreg32(1000, LPC17_40_MCPWM_TC2); /* Count frequency:Fpclk/1000 = 50 MHz/1000 = 50 KHz */
+ putreg32(400, LPC17_40_MCPWM_LIM2); /* Set the starting duty cycle to 0.25 */
+ putreg32(0, LPC17_40_MCPWM_MAT2); /* Reset the timer */
- putreg32((1 << 2), LPC17_MCPWM_CONCLR); /* Channel 0 polarity set to default */
- putreg32((1 << 10), LPC17_MCPWM_CONCLR); /* Channel 1 polarity set to default */
- putreg32((1 << 18), LPC17_MCPWM_CONCLR); /* Channel 2 polarity set to default */
+ putreg32((1 << 2), LPC17_40_MCPWM_CONCLR); /* Channel 0 polarity set to default */
+ putreg32((1 << 10), LPC17_40_MCPWM_CONCLR); /* Channel 1 polarity set to default */
+ putreg32((1 << 18), LPC17_40_MCPWM_CONCLR); /* Channel 2 polarity set to default */
- putreg32((1 << 3), LPC17_MCPWM_CONCLR); /* Channel 0 dead time disabled */
- putreg32((1 << 11), LPC17_MCPWM_CONCLR); /* Channel 1 dead time disabled */
- putreg32((1 << 19), LPC17_MCPWM_CONCLR); /* Channel 2 dead time disabled */
+ putreg32((1 << 3), LPC17_40_MCPWM_CONCLR); /* Channel 0 dead time disabled */
+ putreg32((1 << 11), LPC17_40_MCPWM_CONCLR); /* Channel 1 dead time disabled */
+ putreg32((1 << 19), LPC17_40_MCPWM_CONCLR); /* Channel 2 dead time disabled */
- putreg32((1 << 1), LPC17_MCPWM_CONCLR); /* Channel 0 edge aligned */
- putreg32((1 << 9), LPC17_MCPWM_CONCLR); /* Channel 1 edge aligned */
- putreg32((1 << 17), LPC17_MCPWM_CONCLR); /* Channel 2 edge aligned */
+ putreg32((1 << 1), LPC17_40_MCPWM_CONCLR); /* Channel 0 edge aligned */
+ putreg32((1 << 9), LPC17_40_MCPWM_CONCLR); /* Channel 1 edge aligned */
+ putreg32((1 << 17), LPC17_40_MCPWM_CONCLR); /* Channel 2 edge aligned */
- putreg32((0xFFFFFFFF), LPC17_MCPWM_CNTCONCLR); /* All channels in counter mode on PCLK */
+ putreg32((0xFFFFFFFF), LPC17_40_MCPWM_CNTCONCLR); /* All channels in counter mode on PCLK */
- putreg32((1 << 0), LPC17_MCPWM_CONSET); /* Start MCPWM timer0 */
+ putreg32((1 << 0), LPC17_40_MCPWM_CONSET); /* Start MCPWM timer0 */
leave_critical_section(flags);
pwm_dumpgpio(priv->pincfg, "PWM setup");
@@ -498,7 +498,7 @@ static int mcpwm_setup(FAR struct pwm_lowerhalf_s *dev)
static int mcpwm_shutdown(FAR struct pwm_lowerhalf_s *dev)
{
- FAR struct lpc17_mcpwmtimer_s *priv = (FAR struct lpc17_mcpwmtimer_s *)dev;
+ FAR struct lpc17_40_mcpwmtimer_s *priv = (FAR struct lpc17_40_mcpwmtimer_s *)dev;
uint32_t pincfg;
pwminfo("TIM%d pincfg: %08x\n", priv->timid, priv->pincfg);
@@ -526,7 +526,7 @@ static int mcpwm_shutdown(FAR struct pwm_lowerhalf_s *dev)
static int mcpwm_start(FAR struct pwm_lowerhalf_s *dev,
FAR const struct pwm_info_s *info)
{
- FAR struct lpc17_mcpwmtimer_s *priv = (FAR struct lpc17_mcpwmtimer_s *)dev;
+ FAR struct lpc17_40_mcpwmtimer_s *priv = (FAR struct lpc17_40_mcpwmtimer_s *)dev;
return mcpwm_timer(priv, info);
}
@@ -551,7 +551,7 @@ static int mcpwm_start(FAR struct pwm_lowerhalf_s *dev,
static int mcpwm_stop(FAR struct pwm_lowerhalf_s *dev)
{
- FAR struct lpc17_mcpwmtimer_s *priv = (FAR struct lpc17_mcpwmtimer_s *)dev;
+ FAR struct lpc17_40_mcpwmtimer_s *priv = (FAR struct lpc17_40_mcpwmtimer_s *)dev;
uint32_t resetbit;
uint32_t regaddr;
uint32_t regval;
@@ -571,7 +571,7 @@ static int mcpwm_stop(FAR struct pwm_lowerhalf_s *dev)
switch (priv->timid)
{
-#ifdef CONFIG_LPC17_MCPWM
+#ifdef CONFIG_LPC17_40_MCPWM
case 1:
break;
#endif
@@ -607,7 +607,7 @@ static int mcpwm_stop(FAR struct pwm_lowerhalf_s *dev)
static int mcpwm_ioctl(FAR struct pwm_lowerhalf_s *dev, int cmd, unsigned long arg)
{
#ifdef CONFIG_DEBUG_PWM_INFO
- FAR struct lpc17_mcpwmtimer_s *priv = (FAR struct lpc17_mcpwmtimer_s *)dev;
+ FAR struct lpc17_40_mcpwmtimer_s *priv = (FAR struct lpc17_40_mcpwmtimer_s *)dev;
/* There are no platform-specific ioctl commands */
@@ -621,7 +621,7 @@ static int mcpwm_ioctl(FAR struct pwm_lowerhalf_s *dev, int cmd, unsigned long a
****************************************************************************/
/****************************************************************************
- * Name: lpc17_mcpwminitialize
+ * Name: lpc17_40_mcpwminitialize
*
* Description:
* Initialize one timer for use with the upper_level PWM driver.
@@ -637,15 +637,15 @@ static int mcpwm_ioctl(FAR struct pwm_lowerhalf_s *dev, int cmd, unsigned long a
*
****************************************************************************/
-FAR struct pwm_lowerhalf_s *lpc17_mcpwminitialize(int timer)
+FAR struct pwm_lowerhalf_s *lpc17_40_mcpwminitialize(int timer)
{
- FAR struct lpc17_mcpwmtimer_s *lower;
+ FAR struct lpc17_40_mcpwmtimer_s *lower;
pwminfo("TIM%d\n", timer);
switch (timer)
{
-#ifdef CONFIG_LPC17_MCPWM
+#ifdef CONFIG_LPC17_40_MCPWM
case 0:
lower = &g_pwm1dev;
@@ -662,4 +662,4 @@ FAR struct pwm_lowerhalf_s *lpc17_mcpwminitialize(int timer)
return (FAR struct pwm_lowerhalf_s *)lower;
}
-#endif /* CONFIG_LPC17_TIMn_PWM, n = 1,...,14 */
+#endif /* CONFIG_LPC17_40_TIMn_PWM, n = 1,...,14 */
diff --git a/arch/arm/src/lpc17xx/lpc17_mpuinit.c b/arch/arm/src/lpc17xx_40xx/lpc17_40_mpuinit.c
similarity index 94%
rename from arch/arm/src/lpc17xx/lpc17_mpuinit.c
rename to arch/arm/src/lpc17xx_40xx/lpc17_40_mpuinit.c
index 46311393c77..33cad4f119b 100644
--- a/arch/arm/src/lpc17xx/lpc17_mpuinit.c
+++ b/arch/arm/src/lpc17xx_40xx/lpc17_40_mpuinit.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * arch/arm/src/lpc17xx/lpc17_mpuinit.c
+ * arch/arm/src/lpc17xx_40xx/lpc17_40_mpuinit.c
*
* Copyright (C) 2011, 2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt
@@ -44,7 +44,7 @@
#include
#include "mpu.h"
-#include "lpc17_mpuinit.h"
+#include "lpc17_40_mpuinit.h"
#if defined(CONFIG_BUILD_PROTECTED) && defined(CONFIG_ARM_MPU)
@@ -65,7 +65,7 @@
****************************************************************************/
/****************************************************************************
- * Name: lpc17_mpuinitialize
+ * Name: lpc17_40_mpuinitialize
*
* Description:
* Configure the MPU to permit user-space access to only restricted SAM3U
@@ -73,7 +73,7 @@
*
****************************************************************************/
-void lpc17_mpuinitialize(void)
+void lpc17_40_mpuinitialize(void)
{
uintptr_t datastart = MIN(USERSPACE->us_datastart, USERSPACE->us_bssstart);
uintptr_t dataend = MAX(USERSPACE->us_dataend, USERSPACE->us_bssend);
@@ -98,7 +98,7 @@ void lpc17_mpuinitialize(void)
}
/****************************************************************************
- * Name: lpc17_mpu_uheap
+ * Name: lpc17_40_mpu_uheap
*
* Description:
* Map the user-heap region.
@@ -107,7 +107,7 @@ void lpc17_mpuinitialize(void)
*
****************************************************************************/
-void lpc17_mpu_uheap(uintptr_t start, size_t size)
+void lpc17_40_mpu_uheap(uintptr_t start, size_t size)
{
mpu_user_intsram(start, size);
}
diff --git a/arch/arm/src/lpc17xx/lpc17_mpuinit.h b/arch/arm/src/lpc17xx_40xx/lpc17_40_mpuinit.h
similarity index 88%
rename from arch/arm/src/lpc17xx/lpc17_mpuinit.h
rename to arch/arm/src/lpc17xx_40xx/lpc17_40_mpuinit.h
index 145789532da..98c4f918501 100644
--- a/arch/arm/src/lpc17xx/lpc17_mpuinit.h
+++ b/arch/arm/src/lpc17xx_40xx/lpc17_40_mpuinit.h
@@ -1,5 +1,5 @@
/************************************************************************************
- * arch/arm/src/lpc17xx/lpc17_mpuinit.h
+ * arch/arm/src/lpc17xx_40xx/lpc17_40_mpuinit.h
*
* Copyright (C) 2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt
@@ -33,8 +33,8 @@
*
************************************************************************************/
-#ifndef __ARCH_ARM_SRC_LPC17XX_LPC17_MPUINIT_H
-#define __ARCH_ARM_SRC_LPC17XX_LPC17_MPUINIT_H
+#ifndef __ARCH_ARM_SRC_LPC17XX_40XX_LPC17_40_MPUINIT_H
+#define __ARCH_ARM_SRC_LPC17XX_40XX_LPC17_40_MPUINIT_H
/************************************************************************************
* Included Files
@@ -59,7 +59,7 @@
************************************************************************************/
/****************************************************************************
- * Name: lpc17_mpuinitialize
+ * Name: lpc17_40_mpuinitialize
*
* Description:
* Configure the MPU to permit user-space access to only unrestricted MCU
@@ -68,13 +68,13 @@
****************************************************************************/
#ifdef CONFIG_BUILD_PROTECTED
-void lpc17_mpuinitialize(void);
+void lpc17_40_mpuinitialize(void);
#else
-# define lpc17_mpuinitialize()
+# define lpc17_40_mpuinitialize()
#endif
/****************************************************************************
- * Name: lpc17_mpu_uheap
+ * Name: lpc17_40_mpu_uheap
*
* Description:
* Map the user heap region.
@@ -82,9 +82,9 @@ void lpc17_mpuinitialize(void);
****************************************************************************/
#ifdef CONFIG_BUILD_PROTECTED
-void lpc17_mpu_uheap(uintptr_t start, size_t size);
+void lpc17_40_mpu_uheap(uintptr_t start, size_t size);
#else
-# define lpc17_mpu_uheap(start,size)
+# define lpc17_40_mpu_uheap(start,size)
#endif
-#endif /* __ARCH_ARM_SRC_LPC17XX_LPC17_MPUINIT_H */
+#endif /* __ARCH_ARM_SRC_LPC17XX_40XX_LPC17_40_MPUINIT_H */
diff --git a/arch/arm/src/lpc17xx/lpc17_ohciram.h b/arch/arm/src/lpc17xx_40xx/lpc17_40_ohciram.h
similarity index 58%
rename from arch/arm/src/lpc17xx/lpc17_ohciram.h
rename to arch/arm/src/lpc17xx_40xx/lpc17_40_ohciram.h
index 7aa894c8e0d..d87d7933042 100644
--- a/arch/arm/src/lpc17xx/lpc17_ohciram.h
+++ b/arch/arm/src/lpc17xx_40xx/lpc17_40_ohciram.h
@@ -1,5 +1,5 @@
/************************************************************************************
- * arch/arm/src/lpc17xx/lpc17_ohciram.h
+ * arch/arm/src/lpc17xx_40xx/lpc17_40_ohciram.h
*
* Copyright (C) 2010-2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt
@@ -33,8 +33,8 @@
*
************************************************************************************/
-#ifndef __ARCH_ARM_SRC_LPC17XX_LPC17_OHCIRAM_H
-#define __ARCH_ARM_SRC_LPC17XX_LPC17_OHCIRAM_H
+#ifndef __ARCH_ARM_SRC_LPC17XX_40XX_LPC17_40_OHCIRAM_H
+#define __ARCH_ARM_SRC_LPC17XX_40XX_LPC17_40_OHCIRAM_H
/************************************************************************************
* Included Files
@@ -42,33 +42,33 @@
#include
#include "chip.h"
-#include "hardware/lpc17_memorymap.h"
+#include "hardware/lpc17_40_memorymap.h"
/************************************************************************************
* Pre-processor Definitions
************************************************************************************/
/* Default, no-OHCI Case ************************************************************/
/* Assume that all of AHB SRAM will be available for heap. If this is not true, then
- * LPC17_BANK1_HEAPSIZE will be undefined but redefined below.
+ * LPC17_40_BANK1_HEAPSIZE will be undefined but redefined below.
*/
-#undef LPC17_BANK1_HEAPBASE
-#undef LPC17_BANK1_HEAPSIZE
-#ifdef LPC17_HAVE_BANK1
-# define LPC17_BANK1_HEAPBASE LPC17_SRAM_BANK1
-# define LPC17_BANK1_HEAPSIZE LPC17_BANK1_SIZE
+#undef LPC17_40_BANK1_HEAPBASE
+#undef LPC17_40_BANK1_HEAPSIZE
+#ifdef LPC17_40_HAVE_BANK1
+# define LPC17_40_BANK1_HEAPBASE LPC17_40_SRAM_BANK1
+# define LPC17_40_BANK1_HEAPSIZE LPC17_40_BANK1_SIZE
#endif
-/* Is networking enabled? Is the LPC17xx Ethernet device enabled? Does this chip have
+/* Is networking enabled? Is the LPC17xx/LPC40xx Ethernet device enabled? Does this chip have
* and Ethernet controlloer? Yes... then we will replace the above default definitions.
*/
-#if defined(CONFIG_USBHOST) && defined(CONFIG_LPC17_USBHOST) && LPC17_NUSBHOST > 0
+#if defined(CONFIG_USBHOST) && defined(CONFIG_LPC17_40_USBHOST) && LPC17_40_NUSBHOST > 0
/* OHCI RAM Configuration ***********************************************************/
/* Is AHB SRAM available? */
-#ifndef LPC17_HAVE_BANK1
+#ifndef LPC17_40_HAVE_BANK1
# error "AHB SRAM Bank1 is not available for OHCI RAM"
#endif
@@ -78,39 +78,39 @@
* bytes.
*/
-#ifndef CONFIG_LPC17_OHCIRAM_SIZE
-# define CONFIG_LPC17_OHCIRAM_SIZE LPC17_BANK1_SIZE
+#ifndef CONFIG_LPC17_40_OHCIRAM_SIZE
+# define CONFIG_LPC17_40_OHCIRAM_SIZE LPC17_40_BANK1_SIZE
#endif
-#if CONFIG_LPC17_OHCIRAM_SIZE > LPC17_BANK1_SIZE
+#if CONFIG_LPC17_40_OHCIRAM_SIZE > LPC17_40_BANK1_SIZE
# error "OHCI RAM size cannot exceed the size of AHB SRAM Bank 1"
#endif
-#if (CONFIG_LPC17_OHCIRAM_SIZE & 0xff) != 0
+#if (CONFIG_LPC17_40_OHCIRAM_SIZE & 0xff) != 0
# error "OHCI RAM size must be in multiples of 256 bytes"
#endif
/* Then position the OHCI RAM at the end of AHB SRAM Bank 1 */
-#define LPC17_OHCIRAM_END (LPC17_SRAM_BANK1 + LPC17_BANK1_SIZE)
-#define LPC17_OHCIRAM_BASE (LPC17_OHCIRAM_END - CONFIG_LPC17_OHCIRAM_SIZE)
-#define LPC17_OHCIRAM_SIZE CONFIG_LPC17_OHCIRAM_SIZE
+#define LPC17_40_OHCIRAM_END (LPC17_40_SRAM_BANK1 + LPC17_40_BANK1_SIZE)
+#define LPC17_40_OHCIRAM_BASE (LPC17_40_OHCIRAM_END - CONFIG_LPC17_40_OHCIRAM_SIZE)
+#define LPC17_40_OHCIRAM_SIZE CONFIG_LPC17_40_OHCIRAM_SIZE
/* Determine is there is any meaningful space left at the beginning of AHB Bank 1
* that could be added to the heap.
*/
-#undef LPC17_BANK1_HEAPBASE
-#undef LPC17_BANK1_HEAPSIZE
-#if LPC17_OHCIRAM_SIZE < (LPC17_BANK1_SIZE-128)
-# define LPC17_BANK1_HEAPBASE LPC17_SRAM_BANK1
-# define LPC17_BANK1_HEAPSIZE (LPC17_BANK1_SIZE - LPC17_OHCIRAM_SIZE)
+#undef LPC17_40_BANK1_HEAPBASE
+#undef LPC17_40_BANK1_HEAPSIZE
+#if LPC17_40_OHCIRAM_SIZE < (LPC17_40_BANK1_SIZE-128)
+# define LPC17_40_BANK1_HEAPBASE LPC17_40_SRAM_BANK1
+# define LPC17_40_BANK1_HEAPSIZE (LPC17_40_BANK1_SIZE - LPC17_40_OHCIRAM_SIZE)
#endif
/* Numbers and Sizes of Things ******************************************************/
/* Fixed size of the OHCI control area */
-#define LPC17_HCCA_SIZE 256
+#define LPC17_40_HCCA_SIZE 256
/* Fixed endpoint descriptor size. The actual size required by the hardware is only
* 16 bytes, however, we set aside an additional 16 bytes for for internal use by
@@ -118,7 +118,7 @@
* aligned to 16-byte boundaries.
*/
-#define LPC17_ED_SIZE 32
+#define LPC17_40_ED_SIZE 32
/* Configurable number of user endpoint descriptors (EDs). This number excludes
* the control endpoint that is always allocated.
@@ -130,7 +130,7 @@
/* Derived size of user endpoint descriptor (ED) memory. */
-#define LPC17_EDFREE_SIZE (CONFIG_LP17_USBHOST_NEDS * LPC17_ED_SIZE)
+#define LPC17_40_EDFREE_SIZE (CONFIG_LP17_USBHOST_NEDS * LPC17_40_ED_SIZE)
/* Fixed transfer descriptor size. The actual size required by the hardware is only
* 16 bytes, however, we set aside an additional 16 bytes for for internal use by
@@ -138,7 +138,7 @@
* aligned to 16-byte boundaries.
*/
-#define LPC17_TD_SIZE 32
+#define LPC17_40_TD_SIZE 32
/* Configurable number of user transfer descriptors (TDs). */
@@ -152,99 +152,99 @@
/* Derived size of user transfer descriptor (TD) memory. */
-#define LPC17_TDFREE_SIZE (CONFIG_LP17_USBHOST_NTDS * LPC17_TD_SIZE)
+#define LPC17_40_TDFREE_SIZE (CONFIG_LP17_USBHOST_NTDS * LPC17_40_TD_SIZE)
/* Configurable number of request/descriptor buffers (TDBUFFER) */
-#ifndef CONFIG_LPC17_USBHOST_TDBUFFERS
-# define CONFIG_LPC17_USBHOST_TDBUFFERS 2
+#ifndef CONFIG_LPC17_40_USBHOST_TDBUFFERS
+# define CONFIG_LPC17_40_USBHOST_TDBUFFERS 2
#endif
-#if CONFIG_LPC17_USBHOST_TDBUFFERS < 2
+#if CONFIG_LPC17_40_USBHOST_TDBUFFERS < 2
# error "At least two TD buffers are required"
#endif
/* Configurable size of a TD buffer */
-#if CONFIG_LPC17_USBHOST_TDBUFFERS > 0 && !defined(CONFIG_LPC17_USBHOST_TDBUFSIZE)
-# define CONFIG_LPC17_USBHOST_TDBUFSIZE 128
+#if CONFIG_LPC17_40_USBHOST_TDBUFFERS > 0 && !defined(CONFIG_LPC17_40_USBHOST_TDBUFSIZE)
+# define CONFIG_LPC17_40_USBHOST_TDBUFSIZE 128
#endif
-#if (CONFIG_LPC17_USBHOST_TDBUFSIZE & 3) != 0
+#if (CONFIG_LPC17_40_USBHOST_TDBUFSIZE & 3) != 0
# error "TD buffer size must be an even number of 32-bit words"
#endif
-#define LPC17_TBFREE_SIZE (CONFIG_LPC17_USBHOST_TDBUFFERS * CONFIG_LPC17_USBHOST_TDBUFSIZE)
+#define LPC17_40_TBFREE_SIZE (CONFIG_LPC17_40_USBHOST_TDBUFFERS * CONFIG_LPC17_40_USBHOST_TDBUFSIZE)
/* Configurable size of an IO buffer. The number of IO buffers will be determined
* by what is left at the end of the BANK1 memory setup aside of OHCI RAM.
*/
-#ifndef CONFIG_LPC17_USBHOST_IOBUFSIZE
-# define CONFIG_LPC17_USBHOST_IOBUFSIZE 512
+#ifndef CONFIG_LPC17_40_USBHOST_IOBUFSIZE
+# define CONFIG_LPC17_40_USBHOST_IOBUFSIZE 512
#endif
-#if (CONFIG_LPC17_USBHOST_IOBUFSIZE & 3) != 0
+#if (CONFIG_LPC17_40_USBHOST_IOBUFSIZE & 3) != 0
# error "IO buffer size must be an even number of 32-bit words"
#endif
/* OHCI Memory Layout ***************************************************************/
/* Example:
* Hardware:
- * LPC17_SRAM_BANK1 0x20008000
- * LPC17_BANK1_SIZE 16384
+ * LPC17_40_SRAM_BANK1 0x20008000
+ * LPC17_40_BANK1_SIZE 16384
*
* Configuration:
- * CONFIG_LPC17_OHCIRAM_SIZE 1536
+ * CONFIG_LPC17_40_OHCIRAM_SIZE 1536
* CONFIG_LP17_USBHOST_NEDS 2
* CONFIG_LP17_USBHOST_NTDS 3
- * CONFIG_LPC17_USBHOST_TDBUFFERS 3
- * CONFIG_LPC17_USBHOST_TDBUFSIZE 128
- * CONFIG_LPC17_USBHOST_IOBUFSIZE 512
+ * CONFIG_LPC17_40_USBHOST_TDBUFFERS 3
+ * CONFIG_LPC17_40_USBHOST_TDBUFSIZE 128
+ * CONFIG_LPC17_40_USBHOST_IOBUFSIZE 512
*
* Sizes of things
- * LPC17_EDFREE_SIZE 64 0x00000040
- * LPC17_TDFREE_SIZE 96 0x00000060
- * LPC17_TBFREE_SIZE 384 0x00000100
- * LPC17_IOFREE_SIZE 512 0x00000200
+ * LPC17_40_EDFREE_SIZE 64 0x00000040
+ * LPC17_40_TDFREE_SIZE 96 0x00000060
+ * LPC17_40_TBFREE_SIZE 384 0x00000100
+ * LPC17_40_IOFREE_SIZE 512 0x00000200
*
* Memory Layout
- * LPC17_OHCIRAM_END (0x20008000 + 16384) = 0x20084000
- * LPC17_OHCIRAM_BASE (0x2000c000 - 1536) = 0x2000ba00
- * LPC17_OHCIRAM_SIZE 1280
- * LPC17_BANK1_HEAPBASE 0x20008000
- * LPC17_BANK1_HEAPSIZE (16384 - 1280) = 15104
+ * LPC17_40_OHCIRAM_END (0x20008000 + 16384) = 0x20084000
+ * LPC17_40_OHCIRAM_BASE (0x2000c000 - 1536) = 0x2000ba00
+ * LPC17_40_OHCIRAM_SIZE 1280
+ * LPC17_40_BANK1_HEAPBASE 0x20008000
+ * LPC17_40_BANK1_HEAPSIZE (16384 - 1280) = 15104
*
- * LPC17_HCCA_BASE 0x20083a00 -- Communications area
- * LPC17_TDTAIL_ADDR 0x20083b00 -- Common. pre-allocated tail TD
- * LPC17_EDCTRL_ADDR 0x20083b20 -- Pre-allocated ED for EP0
- * LPC17_EDFREE_BASE 0x20083b40 -- Free EDs
- * LPC17_TDFREE_BASE 0x20083b80 -- Free TDs
- * LPC17_TBFREE_BASE 0x20083be0 -- Free request/descriptor buffers
- * LPC17_IOFREE_BASE 0x20083d60 -- Free large I/O buffers
- * LPC17_IOBUFFERS (0x20084000 - 0x20083d60) / 512 = 672/512 = 1
+ * LPC17_40_HCCA_BASE 0x20083a00 -- Communications area
+ * LPC17_40_TDTAIL_ADDR 0x20083b00 -- Common. pre-allocated tail TD
+ * LPC17_40_EDCTRL_ADDR 0x20083b20 -- Pre-allocated ED for EP0
+ * LPC17_40_EDFREE_BASE 0x20083b40 -- Free EDs
+ * LPC17_40_TDFREE_BASE 0x20083b80 -- Free TDs
+ * LPC17_40_TBFREE_BASE 0x20083be0 -- Free request/descriptor buffers
+ * LPC17_40_IOFREE_BASE 0x20083d60 -- Free large I/O buffers
+ * LPC17_40_IOBUFFERS (0x20084000 - 0x20083d60) / 512 = 672/512 = 1
*
* Wasted memory: 672-512 = 160 bytes
*/
-#define LPC17_HCCA_BASE (LPC17_OHCIRAM_BASE)
-#define LPC17_TDTAIL_ADDR (LPC17_HCCA_BASE + LPC17_HCCA_SIZE)
-#define LPC17_EDCTRL_ADDR (LPC17_TDTAIL_ADDR + LPC17_TD_SIZE)
-#define LPC17_EDFREE_BASE (LPC17_EDCTRL_ADDR + LPC17_ED_SIZE)
-#define LPC17_TDFREE_BASE (LPC17_EDFREE_BASE + LPC17_EDFREE_SIZE)
-#define LPC17_TBFREE_BASE (LPC17_TDFREE_BASE + LPC17_TDFREE_SIZE)
-#define LPC17_IOFREE_BASE (LPC17_TBFREE_BASE + LPC17_TBFREE_SIZE)
+#define LPC17_40_HCCA_BASE (LPC17_40_OHCIRAM_BASE)
+#define LPC17_40_TDTAIL_ADDR (LPC17_40_HCCA_BASE + LPC17_40_HCCA_SIZE)
+#define LPC17_40_EDCTRL_ADDR (LPC17_40_TDTAIL_ADDR + LPC17_40_TD_SIZE)
+#define LPC17_40_EDFREE_BASE (LPC17_40_EDCTRL_ADDR + LPC17_40_ED_SIZE)
+#define LPC17_40_TDFREE_BASE (LPC17_40_EDFREE_BASE + LPC17_40_EDFREE_SIZE)
+#define LPC17_40_TBFREE_BASE (LPC17_40_TDFREE_BASE + LPC17_40_TDFREE_SIZE)
+#define LPC17_40_IOFREE_BASE (LPC17_40_TBFREE_BASE + LPC17_40_TBFREE_SIZE)
-#if LPC17_IOFREE_BASE > LPC17_OHCIRAM_END
+#if LPC17_40_IOFREE_BASE > LPC17_40_OHCIRAM_END
# error "Insufficient OHCI RAM allocated"
#endif
/* Finally, use the remainder of the allocated OHCI for IO buffers */
-#if CONFIG_LPC17_USBHOST_IOBUFSIZE > 0
-# define LPC17_IOBUFFERS ((LPC17_OHCIRAM_END - LPC17_IOFREE_BASE) / CONFIG_LPC17_USBHOST_IOBUFSIZE)
+#if CONFIG_LPC17_40_USBHOST_IOBUFSIZE > 0
+# define LPC17_40_IOBUFFERS ((LPC17_40_OHCIRAM_END - LPC17_40_IOFREE_BASE) / CONFIG_LPC17_40_USBHOST_IOBUFSIZE)
#else
-# define LPC17_IOBUFFERS 0
+# define LPC17_40_IOBUFFERS 0
#endif
/************************************************************************************
@@ -259,5 +259,5 @@
* Public Functions
************************************************************************************/
-#endif /* CONFIG_USBHOST && CONFIG_LPC17_USBHOST && LPC17_NUSBHOST > 0*/
-#endif /* __ARCH_ARM_SRC_LPC17XX_LPC17_OHCIRAM_H */
+#endif /* CONFIG_USBHOST && CONFIG_LPC17_40_USBHOST && LPC17_40_NUSBHOST > 0*/
+#endif /* __ARCH_ARM_SRC_LPC17XX_40XX_LPC17_40_OHCIRAM_H */
diff --git a/arch/arm/src/lpc17xx/lpc17_progmem.c b/arch/arm/src/lpc17xx_40xx/lpc17_40_progmem.c
similarity index 81%
rename from arch/arm/src/lpc17xx/lpc17_progmem.c
rename to arch/arm/src/lpc17xx_40xx/lpc17_40_progmem.c
index af35b7e4253..d68a4d7a900 100644
--- a/arch/arm/src/lpc17xx/lpc17_progmem.c
+++ b/arch/arm/src/lpc17xx_40xx/lpc17_40_progmem.c
@@ -1,5 +1,5 @@
/******************************************************************************
- * arch/arm/src/lpc17xx/lpc17_progmem.c
+ * arch/arm/src/lpc17xx_40xx/lpc17_40_progmem.c
*
* Copyright (C) 2018 Michael Jung. All rights reserved.
* Author: Michael Jung
@@ -53,16 +53,16 @@
#include
#include
-#include "lpc17_progmem.h"
+#include "lpc17_40_progmem.h"
/******************************************************************************
* Private Function Prototypes
******************************************************************************/
-static void lpc17_iap(void *in, void *out);
-static uint32_t lpc17_iap_prepare_sector_for_write_operation(uint32_t sector);
-static uint32_t lpc17_iap_erase_sector(uint32_t sector);
-static uint32_t lpc17_iap_copy_ram_to_flash(void *flash, const void *ram,
+static void lpc17_40_iap(void *in, void *out);
+static uint32_t lpc17_40_iap_prepare_sector_for_write_operation(uint32_t sector);
+static uint32_t lpc17_40_iap_erase_sector(uint32_t sector);
+static uint32_t lpc17_40_iap_copy_ram_to_flash(void *flash, const void *ram,
size_t count);
/******************************************************************************
@@ -70,7 +70,7 @@ static uint32_t lpc17_iap_copy_ram_to_flash(void *flash, const void *ram,
******************************************************************************/
/******************************************************************************
- * Name: lpc17_iap
+ * Name: lpc17_40_iap
*
* Description (from UM10360):
* For in-application programming the IAP routine should be called with a word
@@ -81,19 +81,19 @@ static uint32_t lpc17_iap_copy_ram_to_flash(void *flash, const void *ram,
*
******************************************************************************/
-static void lpc17_iap(FAR void *in, FAR void *out)
+static void lpc17_40_iap(FAR void *in, FAR void *out)
{
irqstate_t flags;
flags = enter_critical_section();
- ((void (*)(FAR void *, FAR void *))LPC17_IAP_ENTRY_ADDR)(in, out);
+ ((void (*)(FAR void *, FAR void *))LPC17_40_IAP_ENTRY_ADDR)(in, out);
leave_critical_section(flags);
}
/******************************************************************************
- * Name: lpc17_iap_prepare_sector_for_write_operation
+ * Name: lpc17_40_iap_prepare_sector_for_write_operation
*
* Description (from UM10360):
* This command must be executed before executing "Copy RAM to Flash" or
@@ -103,21 +103,21 @@ static void lpc17_iap(FAR void *in, FAR void *out)
*
******************************************************************************/
-static uint32_t lpc17_iap_prepare_sector_for_write_operation(uint32_t sector)
+static uint32_t lpc17_40_iap_prepare_sector_for_write_operation(uint32_t sector)
{
uint32_t inout[3];
- inout[0] = LPC17_IAP_CMD_PREPARE_SECTORS_FOR_WRITE_OPERATION;
+ inout[0] = LPC17_40_IAP_CMD_PREPARE_SECTORS_FOR_WRITE_OPERATION;
inout[1] = sector;
inout[2] = sector;
- lpc17_iap(inout, inout);
+ lpc17_40_iap(inout, inout);
return inout[0];
}
/******************************************************************************
- * Name: lpc17_iap_erase_sector
+ * Name: lpc17_40_iap_erase_sector
*
* Description (from UM10360):
* This command is used to erase a sector or multiple sectors of on-chip flash
@@ -126,22 +126,22 @@ static uint32_t lpc17_iap_prepare_sector_for_write_operation(uint32_t sector)
*
******************************************************************************/
-static uint32_t lpc17_iap_erase_sector(uint32_t sector)
+static uint32_t lpc17_40_iap_erase_sector(uint32_t sector)
{
uint32_t inout[4];
- inout[0] = LPC17_IAP_CMD_ERASE_SECTORS;
+ inout[0] = LPC17_40_IAP_CMD_ERASE_SECTORS;
inout[1] = sector;
inout[2] = sector;
- inout[3] = LPC17_CCLK / 1000;
+ inout[3] = LPC17_40_CCLK / 1000;
- lpc17_iap(inout, inout);
+ lpc17_40_iap(inout, inout);
return inout[0];
}
/******************************************************************************
- * Name: lpc17_iap_copy_ram_to_flash
+ * Name: lpc17_40_iap_copy_ram_to_flash
*
* Description (from UM10360):
* This command is used to program the flash memory. The affected sectors
@@ -151,18 +151,18 @@ static uint32_t lpc17_iap_erase_sector(uint32_t sector)
*
******************************************************************************/
-static uint32_t lpc17_iap_copy_ram_to_flash(void *flash, const void *ram,
+static uint32_t lpc17_40_iap_copy_ram_to_flash(void *flash, const void *ram,
size_t count)
{
uint32_t inout[5];
- inout[0] = LPC17_IAP_CMD_COPY_RAM_TO_FLASH;
+ inout[0] = LPC17_40_IAP_CMD_COPY_RAM_TO_FLASH;
inout[1] = (uint32_t)flash;
inout[2] = (uint32_t)ram;
inout[3] = (uint32_t)count;
- inout[4] = LPC17_CCLK / 1000;
+ inout[4] = LPC17_40_CCLK / 1000;
- lpc17_iap(inout, inout);
+ lpc17_40_iap(inout, inout);
return inout[0];
}
@@ -181,7 +181,7 @@ static uint32_t lpc17_iap_copy_ram_to_flash(void *flash, const void *ram,
size_t up_progmem_neraseblocks(void)
{
- return CONFIG_LPC17_PROGMEM_NSECTORS;
+ return CONFIG_LPC17_40_PROGMEM_NSECTORS;
}
/******************************************************************************
@@ -207,7 +207,7 @@ bool up_progmem_isuniform(void)
size_t up_progmem_pagesize(size_t page)
{
- return (size_t)LPC17_PROGMEM_PAGE_SIZE;
+ return (size_t)LPC17_40_PROGMEM_PAGE_SIZE;
}
/******************************************************************************
@@ -220,7 +220,7 @@ size_t up_progmem_pagesize(size_t page)
size_t up_progmem_erasesize(size_t block)
{
- return (size_t)LPC17_PROGMEM_SECTOR_SIZE;
+ return (size_t)LPC17_40_PROGMEM_SECTOR_SIZE;
}
/******************************************************************************
@@ -242,12 +242,12 @@ size_t up_progmem_erasesize(size_t block)
ssize_t up_progmem_getpage(size_t addr)
{
- if (addr >= LPC17_PROGMEM_START_ADDR)
+ if (addr >= LPC17_40_PROGMEM_START_ADDR)
{
- addr -= LPC17_PROGMEM_START_ADDR;
+ addr -= LPC17_40_PROGMEM_START_ADDR;
}
- return (size_t)(addr / LPC17_PROGMEM_PAGE_SIZE);
+ return (size_t)(addr / LPC17_40_PROGMEM_PAGE_SIZE);
}
/******************************************************************************
@@ -266,7 +266,7 @@ ssize_t up_progmem_getpage(size_t addr)
size_t up_progmem_getaddress(size_t page)
{
- return (size_t)(LPC17_PROGMEM_START_ADDR + page * LPC17_PROGMEM_PAGE_SIZE);
+ return (size_t)(LPC17_40_PROGMEM_START_ADDR + page * LPC17_40_PROGMEM_PAGE_SIZE);
}
/******************************************************************************
@@ -295,26 +295,26 @@ ssize_t up_progmem_eraseblock(size_t block)
{
uint32_t rc;
- if (block >= CONFIG_LPC17_PROGMEM_NSECTORS)
+ if (block >= CONFIG_LPC17_40_PROGMEM_NSECTORS)
{
return -EFAULT;
}
- rc = lpc17_iap_prepare_sector_for_write_operation((uint32_t)block +
- LPC17_PROGMEM_START_SECTOR);
- if (rc != LPC17_IAP_RC_CMD_SUCCESS)
+ rc = lpc17_40_iap_prepare_sector_for_write_operation((uint32_t)block +
+ LPC17_40_PROGMEM_START_SECTOR);
+ if (rc != LPC17_40_IAP_RC_CMD_SUCCESS)
{
return -EIO;
}
- rc = lpc17_iap_erase_sector((uint32_t)block + LPC17_PROGMEM_START_SECTOR);
+ rc = lpc17_40_iap_erase_sector((uint32_t)block + LPC17_40_PROGMEM_START_SECTOR);
- if (rc != LPC17_IAP_RC_CMD_SUCCESS)
+ if (rc != LPC17_40_IAP_RC_CMD_SUCCESS)
{
return -EIO;
}
- return (ssize_t)LPC17_PROGMEM_SECTOR_SIZE;
+ return (ssize_t)LPC17_40_PROGMEM_SECTOR_SIZE;
}
/******************************************************************************
@@ -340,14 +340,14 @@ ssize_t up_progmem_ispageerased(size_t page)
const uint8_t *p;
int i;
- if (page >= CONFIG_LPC17_PROGMEM_NSECTORS)
+ if (page >= CONFIG_LPC17_40_PROGMEM_NSECTORS)
{
return -EFAULT;
}
p = (const uint8_t *)up_progmem_getaddress(page);
- for (i = 0; i < LPC17_PROGMEM_SECTOR_SIZE; i++)
+ for (i = 0; i < LPC17_40_PROGMEM_SECTOR_SIZE; i++)
{
if (p[i] != 0xffu)
{
@@ -355,7 +355,7 @@ ssize_t up_progmem_ispageerased(size_t page)
}
}
- return (ssize_t)(LPC17_PROGMEM_SECTOR_SIZE - i);
+ return (ssize_t)(LPC17_40_PROGMEM_SECTOR_SIZE - i);
}
/******************************************************************************
@@ -392,24 +392,24 @@ ssize_t up_progmem_write(size_t addr, FAR const void *buf, size_t count)
size_t page;
uint32_t rc;
- if (count % LPC17_PROGMEM_PAGE_SIZE)
+ if (count % LPC17_40_PROGMEM_PAGE_SIZE)
{
return -EINVAL;
}
- page = up_progmem_getpage(addr) / LPC17_PROGMEM_PAGES_PER_SECTOR +
- LPC17_PROGMEM_START_SECTOR;
+ page = up_progmem_getpage(addr) / LPC17_40_PROGMEM_PAGES_PER_SECTOR +
+ LPC17_40_PROGMEM_START_SECTOR;
- rc = lpc17_iap_prepare_sector_for_write_operation((uint32_t)page);
+ rc = lpc17_40_iap_prepare_sector_for_write_operation((uint32_t)page);
- if (rc != LPC17_IAP_RC_CMD_SUCCESS)
+ if (rc != LPC17_40_IAP_RC_CMD_SUCCESS)
{
return -EIO;
}
- rc = lpc17_iap_copy_ram_to_flash((void *)addr, buf, count);
+ rc = lpc17_40_iap_copy_ram_to_flash((void *)addr, buf, count);
- if (rc != LPC17_IAP_RC_CMD_SUCCESS)
+ if (rc != LPC17_40_IAP_RC_CMD_SUCCESS)
{
return -EIO;
}
diff --git a/arch/arm/src/lpc17xx/lpc17_progmem.h b/arch/arm/src/lpc17xx_40xx/lpc17_40_progmem.h
similarity index 58%
rename from arch/arm/src/lpc17xx/lpc17_progmem.h
rename to arch/arm/src/lpc17xx_40xx/lpc17_40_progmem.h
index fd826273c3f..d2b158c3bc0 100644
--- a/arch/arm/src/lpc17xx/lpc17_progmem.h
+++ b/arch/arm/src/lpc17xx_40xx/lpc17_40_progmem.h
@@ -1,5 +1,5 @@
/******************************************************************************
- * arch/arm/src/lpc17xx/lpc17_progmem.c
+ * arch/arm/src/lpc17xx_40xx/lpc17_40_progmem.c
*
* Copyright (C) 2018 Michael Jung. All rights reserved.
* Author: Michael Jung
@@ -33,8 +33,8 @@
*
******************************************************************************/
-#ifndef __ARCH_ARM_SRC_LPC17XX_LPC17_PROGMEM_H
-#define __ARCH_ARM_SRC_LPC17XX_LPC17_PROGMEM_H
+#ifndef __ARCH_ARM_SRC_LPC17XX_40XX_LPC17_40_PROGMEM_H
+#define __ARCH_ARM_SRC_LPC17XX_40XX_LPC17_40_PROGMEM_H
/******************************************************************************
* See NXP UM10360 LPC176x/5x User manual, Rev 4.1, Chapter 32: LPC176x/5x
@@ -61,79 +61,79 @@
/* The first 16 sectors are 4kB in size and thus not supported as progmem. */
-#define LPC17_FLASH_NUM_4K_SECTORS 16
+#define LPC17_40_FLASH_NUM_4K_SECTORS 16
/* The number of 32kB sectors depends on the target device's flash size */
-#define LPC17_FLASH_NUM_32K_SECTORS \
- ((LPC17_FLASH_SIZE - LPC17_FLASH_NUM_4K_SECTORS * 4096) / 32768)
+#define LPC17_40_FLASH_NUM_32K_SECTORS \
+ ((LPC17_40_FLASH_SIZE - LPC17_40_FLASH_NUM_4K_SECTORS * 4096) / 32768)
/* The number of 32kB sectors to be used for progmem is configurable. The
* sectors at the end of the flash are used for progmem, the rest is left
* for code and data. */
-#define LPC17_PROGMEM_START_SECTOR \
- (LPC17_FLASH_NUM_4K_SECTORS + LPC17_FLASH_NUM_32K_SECTORS - \
- CONFIG_LPC17_PROGMEM_NSECTORS)
+#define LPC17_40_PROGMEM_START_SECTOR \
+ (LPC17_40_FLASH_NUM_4K_SECTORS + LPC17_40_FLASH_NUM_32K_SECTORS - \
+ CONFIG_LPC17_40_PROGMEM_NSECTORS)
/* Base address of the flash segment used for progmem. */
-#define LPC17_PROGMEM_START_ADDR \
- (LPC17_FLASH_NUM_4K_SECTORS * 4096 + \
- (LPC17_PROGMEM_START_SECTOR - LPC17_FLASH_NUM_4K_SECTORS) * 32768)
+#define LPC17_40_PROGMEM_START_ADDR \
+ (LPC17_40_FLASH_NUM_4K_SECTORS * 4096 + \
+ (LPC17_40_PROGMEM_START_SECTOR - LPC17_40_FLASH_NUM_4K_SECTORS) * 32768)
/* Size of the flash segment used for progmem. */
-#define LPC17_PROGMEM_SIZE (CONFIG_LPC17_PROGMEM_NSECTORS * 32768)
+#define LPC17_40_PROGMEM_SIZE (CONFIG_LPC17_40_PROGMEM_NSECTORS * 32768)
/* Size of a read/write page. */
-#define LPC17_PROGMEM_PAGE_SIZE 256
+#define LPC17_40_PROGMEM_PAGE_SIZE 256
/* Total number of read/write pages. */
-#define LPC17_PROGMEM_NUM_PAGES (LPC17_PROGMEM_SIZE / LPC17_PROGMEM_PAGE_SIZE)
+#define LPC17_40_PROGMEM_NUM_PAGES (LPC17_40_PROGMEM_SIZE / LPC17_40_PROGMEM_PAGE_SIZE)
/* Size of an erase page. This driver only supports the 32kB sectors. */
-#define LPC17_PROGMEM_SECTOR_SIZE 32768
+#define LPC17_40_PROGMEM_SECTOR_SIZE 32768
/* Number of read/write pages per erase page. */
-#define LPC17_PROGMEM_PAGES_PER_SECTOR \
- (LPC17_PROGMEM_SECTOR_SIZE / LPC17_PROGMEM_PAGE_SIZE)
+#define LPC17_40_PROGMEM_PAGES_PER_SECTOR \
+ (LPC17_40_PROGMEM_SECTOR_SIZE / LPC17_40_PROGMEM_PAGE_SIZE)
/* LPC17 entry point for In-Application-Programming boot rom service function */
-#define LPC17_IAP_ENTRY_ADDR 0x1fff1ff1
+#define LPC17_40_IAP_ENTRY_ADDR 0x1fff1ff1
/* The IAP Commands required for progmem */
-#define LPC17_IAP_CMD_PREPARE_SECTORS_FOR_WRITE_OPERATION 50
-#define LPC17_IAP_CMD_COPY_RAM_TO_FLASH 51
-#define LPC17_IAP_CMD_ERASE_SECTORS 52
+#define LPC17_40_IAP_CMD_PREPARE_SECTORS_FOR_WRITE_OPERATION 50
+#define LPC17_40_IAP_CMD_COPY_RAM_TO_FLASH 51
+#define LPC17_40_IAP_CMD_ERASE_SECTORS 52
/* IAP return codes */
-#define LPC17_IAP_RC_CMD_SUCCESS 0
-#define LPC17_IAP_RC_INVALID_CMD 1
-#define LPC17_IAP_RC_SCR_ADDR_ERROR 2
-#define LPC17_IAP_RC_DST_ADDR_ERROR 3
-#define LPC17_IAP_RC_SRC_ADDR_NOT_MAPPED 4
-#define LPC17_IAP_RC_DST_ADDR_NOT_MAPPED 5
-#define LPC17_IAP_RC_COUNT_ERROR 6
-#define LPC17_IAP_RC_INVALID_SECTOR 7
-#define LPC17_IAP_RC_SECTOR_NOT_BLANK 8
-#define LPC17_IAP_RC_SECTOR_NOT_PREPARED_FOR_WRITE_OPERATION 9
-#define LPC17_IAP_RC_COMPARE_ERROR 10
-#define LPC17_IAP_RC_BUSY 11
-#define LPC17_IAP_RC_PARAM_ERROR 12
-#define LPC17_IAP_RC_ADDR_ERROR 13
-#define LPC17_IAP_RC_ADDR_NOT_MAPPED 14
-#define LPC17_IAP_RC_CMD_LOCKED 15
-#define LPC17_IAP_RC_INVALID_CODE 16
-#define LPC17_IAP_RC_INVALID_BAUD_RATE 17
-#define LPC17_IAP_RC_INVALID_STOP_BIT 18
-#define LPC17_IAP_RC_CODE_READ_PROTECTION_ENABLED 19
+#define LPC17_40_IAP_RC_CMD_SUCCESS 0
+#define LPC17_40_IAP_RC_INVALID_CMD 1
+#define LPC17_40_IAP_RC_SCR_ADDR_ERROR 2
+#define LPC17_40_IAP_RC_DST_ADDR_ERROR 3
+#define LPC17_40_IAP_RC_SRC_ADDR_NOT_MAPPED 4
+#define LPC17_40_IAP_RC_DST_ADDR_NOT_MAPPED 5
+#define LPC17_40_IAP_RC_COUNT_ERROR 6
+#define LPC17_40_IAP_RC_INVALID_SECTOR 7
+#define LPC17_40_IAP_RC_SECTOR_NOT_BLANK 8
+#define LPC17_40_IAP_RC_SECTOR_NOT_PREPARED_FOR_WRITE_OPERATION 9
+#define LPC17_40_IAP_RC_COMPARE_ERROR 10
+#define LPC17_40_IAP_RC_BUSY 11
+#define LPC17_40_IAP_RC_PARAM_ERROR 12
+#define LPC17_40_IAP_RC_ADDR_ERROR 13
+#define LPC17_40_IAP_RC_ADDR_NOT_MAPPED 14
+#define LPC17_40_IAP_RC_CMD_LOCKED 15
+#define LPC17_40_IAP_RC_INVALID_CODE 16
+#define LPC17_40_IAP_RC_INVALID_BAUD_RATE 17
+#define LPC17_40_IAP_RC_INVALID_STOP_BIT 18
+#define LPC17_40_IAP_RC_CODE_READ_PROTECTION_ENABLED 19
-#endif /* __ARCH_ARM_SRC_LPC17XX_LPC17_PROGMEM_H */
+#endif /* __ARCH_ARM_SRC_LPC17XX_40XX_LPC17_40_PROGMEM_H */
diff --git a/arch/arm/src/lpc17xx/lpc17_pwm.c b/arch/arm/src/lpc17xx_40xx/lpc17_40_pwm.c
similarity index 84%
rename from arch/arm/src/lpc17xx/lpc17_pwm.c
rename to arch/arm/src/lpc17xx_40xx/lpc17_40_pwm.c
index dbbc8de2cd0..a44cfbc3c34 100644
--- a/arch/arm/src/lpc17xx/lpc17_pwm.c
+++ b/arch/arm/src/lpc17xx_40xx/lpc17_40_pwm.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * arch/arm/src/lpc17xx/lpc17_pwm.c
+ * arch/arm/src/lpc17xx_40xx/lpc17_40_pwm.c
*
* Copyright (C) 2014 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt
@@ -54,17 +54,17 @@
#include "up_arch.h"
#include "chip.h"
-#include "hardware/lpc17_syscon.h"
-#include "lpc17_pwm.h"
+#include "hardware/lpc17_40_syscon.h"
+#include "lpc17_40_pwm.h"
#include "hardware/lpc176x_pinconfig.h"
-#include "lpc17_gpio.h"
+#include "lpc17_40_gpio.h"
#include "lpc176x_gpio.h"
/* This module then only compiles if there is at least one enabled timer
* intended for use with the PWM upper half driver.
*/
-#if defined(CONFIG_LPC17_PWM1)
+#if defined(CONFIG_LPC17_40_PWM1)
/****************************************************************************
* Pre-processor Definitions
@@ -111,7 +111,7 @@
****************************************************************************/
/* This structure represents the state of one PWM timer */
-struct lpc17_pwmtimer_s
+struct lpc17_40_pwmtimer_s
{
FAR const struct pwm_ops_s *ops; /* PWM operations */
uint8_t timid; /* Timer ID {0,...,7} */
@@ -128,18 +128,18 @@ struct lpc17_pwmtimer_s
****************************************************************************/
/* Register access */
-static uint32_t pwm_getreg(struct lpc17_pwmtimer_s *priv, int offset);
-static void pwm_putreg(struct lpc17_pwmtimer_s *priv, int offset, uint32_t value);
+static uint32_t pwm_getreg(struct lpc17_40_pwmtimer_s *priv, int offset);
+static void pwm_putreg(struct lpc17_40_pwmtimer_s *priv, int offset, uint32_t value);
#ifdef CONFIG_DEBUG_PWM_INFO
-static void pwm_dumpregs(struct lpc17_pwmtimer_s *priv, FAR const char *msg);
+static void pwm_dumpregs(struct lpc17_40_pwmtimer_s *priv, FAR const char *msg);
#else
# define pwm_dumpregs(priv,msg)
#endif
/* Timer management */
-static int pwm_timer(FAR struct lpc17_pwmtimer_s *priv,
+static int pwm_timer(FAR struct lpc17_40_pwmtimer_s *priv,
FAR const struct pwm_info_s *info);
/* PWM driver methods */
@@ -168,14 +168,14 @@ static const struct pwm_ops_s g_pwmops =
.ioctl = pwm_ioctl,
};
-#ifdef CONFIG_LPC17_PWM1
-static struct lpc17_pwmtimer_s g_pwm1dev =
+#ifdef CONFIG_LPC17_40_PWM1
+static struct lpc17_40_pwmtimer_s g_pwm1dev =
{
.ops = &g_pwmops,
.timid = 1,
- .channel = CONFIG_LPC17_PWM1_PIN,
+ .channel = CONFIG_LPC17_40_PWM1_PIN,
.timtype = TIMTYPE_TIM1,
- .base = LPC17_PWM1_BASE,
+ .base = LPC17_40_PWM1_BASE,
.pincfg = GPIO_PWM1p1_1,
.pclk = (0x1 << 12),
};
@@ -200,7 +200,7 @@ static struct lpc17_pwmtimer_s g_pwm1dev =
*
****************************************************************************/
-static uint32_t pwm_getreg(struct lpc17_pwmtimer_s *priv, int offset)
+static uint32_t pwm_getreg(struct lpc17_40_pwmtimer_s *priv, int offset)
{
return getreg32(priv->base + offset);
}
@@ -220,7 +220,7 @@ static uint32_t pwm_getreg(struct lpc17_pwmtimer_s *priv, int offset)
*
****************************************************************************/
-static void pwm_putreg(struct lpc17_pwmtimer_s *priv, int offset, uint32_t value)
+static void pwm_putreg(struct lpc17_40_pwmtimer_s *priv, int offset, uint32_t value)
{
putreg32(value, priv->base + offset);
}
@@ -240,29 +240,29 @@ static void pwm_putreg(struct lpc17_pwmtimer_s *priv, int offset, uint32_t value
****************************************************************************/
#ifdef CONFIG_DEBUG_PWM_INFO
-static void pwm_dumpregs(struct lpc17_pwmtimer_s *priv, FAR const char *msg)
+static void pwm_dumpregs(struct lpc17_40_pwmtimer_s *priv, FAR const char *msg)
{
pwminfo("%s:\n", msg);
pwminfo(" CR1: %04x CR2: %04x SMCR: %04x DIER: %04x\n",
- pwm_getreg(priv, LPC17_PWM_MR0_OFFSET),
- pwm_getreg(priv, LPC17_PWM_MR1_OFFSET),
- pwm_getreg(priv, LPC17_PWM_MR2_OFFSET),
- pwm_getreg(priv, LPC17_PWM_MR3_OFFSET));
-#if defined(CONFIG_LPC17_PWM1)
+ pwm_getreg(priv, LPC17_40_PWM_MR0_OFFSET),
+ pwm_getreg(priv, LPC17_40_PWM_MR1_OFFSET),
+ pwm_getreg(priv, LPC17_40_PWM_MR2_OFFSET),
+ pwm_getreg(priv, LPC17_40_PWM_MR3_OFFSET));
+#if defined(CONFIG_LPC17_40_PWM1)
if (priv->timtype == TIMTYPE_ADVANCED)
{
pwminfo(" RCR: %04x BDTR: %04x DCR: %04x DMAR: %04x\n",
- pwm_getreg(priv, LPC17_PWM_MR0_OFFSET),
- pwm_getreg(priv, LPC17_PWM_MR1_OFFSET),
- pwm_getreg(priv, LPC17_PWM_MR2_OFFSET),
- pwm_getreg(priv, LPC17_PWM_MR3_OFFSET));
+ pwm_getreg(priv, LPC17_40_PWM_MR0_OFFSET),
+ pwm_getreg(priv, LPC17_40_PWM_MR1_OFFSET),
+ pwm_getreg(priv, LPC17_40_PWM_MR2_OFFSET),
+ pwm_getreg(priv, LPC17_40_PWM_MR3_OFFSET));
}
else
#endif
{
pwminfo(" DCR: %04x DMAR: %04x\n",
- pwm_getreg(priv, LPC17_PWM_MR2_OFFSET),
- pwm_getreg(priv, LPC17_PWM_MR3_OFFSET));
+ pwm_getreg(priv, LPC17_40_PWM_MR2_OFFSET),
+ pwm_getreg(priv, LPC17_40_PWM_MR3_OFFSET));
}
}
#endif
@@ -282,19 +282,19 @@ static void pwm_dumpregs(struct lpc17_pwmtimer_s *priv, FAR const char *msg)
*
****************************************************************************/
-static int pwm_timer(FAR struct lpc17_pwmtimer_s *priv,
+static int pwm_timer(FAR struct lpc17_40_pwmtimer_s *priv,
FAR const struct pwm_info_s *info)
{
irqstate_t flags;
flags = enter_critical_section();
- putreg32(info->frequency, LPC17_PWM1_MR0); /* Set PWMMR0 = number of counts */
- putreg32(info->duty, LPC17_PWM1_MR1); /* Set PWM cycle */
+ putreg32(info->frequency, LPC17_40_PWM1_MR0); /* Set PWMMR0 = number of counts */
+ putreg32(info->duty, LPC17_40_PWM1_MR1); /* Set PWM cycle */
- putreg32(LER0_EN | LER3_EN, LPC17_PWM1_LER); /* Load Shadow register contents */
- putreg32(PWMENA1, LPC17_PWM1_PCR); /* Enable PWM outputs */
- putreg32(TCR_CNT_EN | TCR_PWM_EN, LPC17_PWM1_TCR); /* Enable PWM Timer */
+ putreg32(LER0_EN | LER3_EN, LPC17_40_PWM1_LER); /* Load Shadow register contents */
+ putreg32(PWMENA1, LPC17_40_PWM1_PCR); /* Enable PWM outputs */
+ putreg32(TCR_CNT_EN | TCR_PWM_EN, LPC17_40_PWM1_TCR); /* Enable PWM Timer */
leave_critical_section(flags);
pwm_dumpregs(priv, "After starting");
@@ -316,7 +316,7 @@ static int pwm_timer(FAR struct lpc17_pwmtimer_s *priv,
*
****************************************************************************/
-static int pwm_interrupt(struct lpc17_pwmtimer_s *priv)
+static int pwm_interrupt(struct lpc17_40_pwmtimer_s *priv)
{
uint16_t regval;
@@ -367,7 +367,7 @@ static int pwm_tim1interrupt(int irq, void *context, FAR void *arg)
*
****************************************************************************/
-static void pwm_set_apb_clock(FAR struct lpc17_pwmtimer_s *priv, bool on)
+static void pwm_set_apb_clock(FAR struct lpc17_40_pwmtimer_s *priv, bool on)
{
uint32_t en_bit;
uint32_t regaddr;
@@ -376,7 +376,7 @@ static void pwm_set_apb_clock(FAR struct lpc17_pwmtimer_s *priv, bool on)
switch (priv->timid)
{
-#ifdef CONFIG_LPC17_PWM1
+#ifdef CONFIG_LPC17_40_PWM1
case 1:
regaddr = STM32_RCC_APB2ENR;
en_bit = RCC_APB2ENR_TIM1EN;
@@ -419,7 +419,7 @@ static void pwm_set_apb_clock(FAR struct lpc17_pwmtimer_s *priv, bool on)
static int pwm_setup(FAR struct pwm_lowerhalf_s *dev)
{
- FAR struct lpc17_pwmtimer_s *priv = (FAR struct lpc17_pwmtimer_s *)dev;
+ FAR struct lpc17_40_pwmtimer_s *priv = (FAR struct lpc17_40_pwmtimer_s *)dev;
irqstate_t flags;
uint32_t regval;
@@ -427,24 +427,24 @@ static int pwm_setup(FAR struct pwm_lowerhalf_s *dev)
/* Power on the pwm peripheral */
- regval = getreg32(LPC17_SYSCON_PCONP);
+ regval = getreg32(LPC17_40_SYSCON_PCONP);
regval |= SYSCON_PCONP_PCPWM1;
- putreg32(regval, LPC17_SYSCON_PCONP);
+ putreg32(regval, LPC17_40_SYSCON_PCONP);
/* Select clock for the pwm peripheral */
- regval = getreg32(LPC17_SYSCON_PCLKSEL0);
+ regval = getreg32(LPC17_40_SYSCON_PCLKSEL0);
regval &= ~(0x3 << 12); /* PCLK_MC peripheral clk = CCLK = 12.5 MHz */
regval |= (0x1 << 12); /* PCLK_MC peripheral clk = CCLK = 12.5 MHz */
- putreg32(regval, LPC17_SYSCON_PCLKSEL0);
+ putreg32(regval, LPC17_40_SYSCON_PCLKSEL0);
priv->pclk = (0x1 << 12);
/* Configure the output pin */
- lpc17_configgpio(GPIO_PWM1p1_1);
+ lpc17_40_configgpio(GPIO_PWM1p1_1);
- putreg32(1, LPC17_PWM1_PR); /* Prescaler count frequency: Fpclk/1 */
- putreg32(1 << 1, LPC17_PWM1_MCR); /* Reset on match register MR0 */
+ putreg32(1, LPC17_40_PWM1_PR); /* Prescaler count frequency: Fpclk/1 */
+ putreg32(1 << 1, LPC17_40_PWM1_MCR); /* Reset on match register MR0 */
leave_critical_section(flags);
pwm_dumpgpio(priv->pincfg, "PWM setup");
@@ -469,7 +469,7 @@ static int pwm_setup(FAR struct pwm_lowerhalf_s *dev)
static int pwm_shutdown(FAR struct pwm_lowerhalf_s *dev)
{
- FAR struct lpc17_pwmtimer_s *priv = (FAR struct lpc17_pwmtimer_s *)dev;
+ FAR struct lpc17_40_pwmtimer_s *priv = (FAR struct lpc17_40_pwmtimer_s *)dev;
uint32_t pincfg;
pwminfo("TIM%d pincfg: %08x\n", priv->timid, priv->pincfg);
@@ -497,7 +497,7 @@ static int pwm_shutdown(FAR struct pwm_lowerhalf_s *dev)
static int pwm_start(FAR struct pwm_lowerhalf_s *dev,
FAR const struct pwm_info_s *info)
{
- FAR struct lpc17_pwmtimer_s *priv = (FAR struct lpc17_pwmtimer_s *)dev;
+ FAR struct lpc17_40_pwmtimer_s *priv = (FAR struct lpc17_40_pwmtimer_s *)dev;
return pwm_timer(priv, info);
}
@@ -522,7 +522,7 @@ static int pwm_start(FAR struct pwm_lowerhalf_s *dev,
static int pwm_stop(FAR struct pwm_lowerhalf_s *dev)
{
- FAR struct lpc17_pwmtimer_s *priv = (FAR struct lpc17_pwmtimer_s *)dev;
+ FAR struct lpc17_40_pwmtimer_s *priv = (FAR struct lpc17_40_pwmtimer_s *)dev;
uint32_t resetbit;
uint32_t regaddr;
uint32_t regval;
@@ -542,7 +542,7 @@ static int pwm_stop(FAR struct pwm_lowerhalf_s *dev)
switch (priv->timid)
{
-#ifdef CONFIG_LPC17_PWM1
+#ifdef CONFIG_LPC17_40_PWM1
case 1:
break;
#endif
@@ -578,7 +578,7 @@ static int pwm_stop(FAR struct pwm_lowerhalf_s *dev)
static int pwm_ioctl(FAR struct pwm_lowerhalf_s *dev, int cmd, unsigned long arg)
{
#ifdef CONFIG_DEBUG_PWM_INFO
- FAR struct lpc17_pwmtimer_s *priv = (FAR struct lpc17_pwmtimer_s *)dev;
+ FAR struct lpc17_40_pwmtimer_s *priv = (FAR struct lpc17_40_pwmtimer_s *)dev;
/* There are no platform-specific ioctl commands */
@@ -592,7 +592,7 @@ static int pwm_ioctl(FAR struct pwm_lowerhalf_s *dev, int cmd, unsigned long arg
****************************************************************************/
/****************************************************************************
- * Name: lpc17_pwminitialize
+ * Name: lpc17_40_pwminitialize
*
* Description:
* Initialize one timer for use with the upper_level PWM driver.
@@ -608,15 +608,15 @@ static int pwm_ioctl(FAR struct pwm_lowerhalf_s *dev, int cmd, unsigned long arg
*
****************************************************************************/
-FAR struct pwm_lowerhalf_s *lpc17_pwminitialize(int timer)
+FAR struct pwm_lowerhalf_s *lpc17_40_pwminitialize(int timer)
{
- FAR struct lpc17_pwmtimer_s *lower;
+ FAR struct lpc17_40_pwmtimer_s *lower;
pwminfo("TIM%d\n", timer);
switch (timer)
{
-#ifdef CONFIG_LPC17_PWM1
+#ifdef CONFIG_LPC17_40_PWM1
case 0:
lower = &g_pwm1dev;
@@ -633,4 +633,4 @@ FAR struct pwm_lowerhalf_s *lpc17_pwminitialize(int timer)
return (FAR struct pwm_lowerhalf_s *)lower;
}
-#endif /* CONFIG_LPC17_TIMn_PWM, n = 1,...,14 */
+#endif /* CONFIG_LPC17_40_TIMn_PWM, n = 1,...,14 */
diff --git a/arch/arm/src/lpc17xx/lpc17_qei.h b/arch/arm/src/lpc17xx_40xx/lpc17_40_pwm.h
similarity index 91%
rename from arch/arm/src/lpc17xx/lpc17_qei.h
rename to arch/arm/src/lpc17xx_40xx/lpc17_40_pwm.h
index dfa01ff3ffc..6bcf499029a 100644
--- a/arch/arm/src/lpc17xx/lpc17_qei.h
+++ b/arch/arm/src/lpc17xx_40xx/lpc17_40_pwm.h
@@ -1,5 +1,5 @@
/************************************************************************************
- * arch/arm/src/lpc17xx/lpc17_qei.h
+ * arch/arm/src/lpc17xx_40xx/lpc17_40_pwm.h
*
* Copyright (C) 2010, 2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt
@@ -33,15 +33,16 @@
*
************************************************************************************/
-#ifndef __ARCH_ARM_SRC_LPC17XX_LPC17_QEI_H
-#define __ARCH_ARM_SRC_LPC17XX_LPC17_QEI_H
+#ifndef __ARCH_ARM_SRC_LPC17XX_40XX_LPC17_40_PWM_H
+#define __ARCH_ARM_SRC_LPC17XX_40XX_LPC17_40_PWM_H
/************************************************************************************
* Included Files
************************************************************************************/
#include
-#include "hardware/lpc17_qei.h"
+#include "hardware/lpc17_40_pwm.h"
+#include "hardware/lpc17_40_mcpwm.h"
/************************************************************************************
* Pre-processor Definitions
@@ -59,4 +60,4 @@
* Public Functions
************************************************************************************/
-#endif /* __ARCH_ARM_SRC_LPC17XX_LPC17_QEI_H */
+#endif /* __ARCH_ARM_SRC_LPC17XX_40XX_LPC17_40_PWM_H */
diff --git a/arch/arm/src/lpc17xx/lpc17_pwm.h b/arch/arm/src/lpc17xx_40xx/lpc17_40_qei.h
similarity index 92%
rename from arch/arm/src/lpc17xx/lpc17_pwm.h
rename to arch/arm/src/lpc17xx_40xx/lpc17_40_qei.h
index 34fba32bdd7..a1758a9637c 100644
--- a/arch/arm/src/lpc17xx/lpc17_pwm.h
+++ b/arch/arm/src/lpc17xx_40xx/lpc17_40_qei.h
@@ -1,5 +1,5 @@
/************************************************************************************
- * arch/arm/src/lpc17xx/lpc17_pwm.h
+ * arch/arm/src/lpc17xx_40xx/lpc17_40_qei.h
*
* Copyright (C) 2010, 2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt
@@ -33,16 +33,15 @@
*
************************************************************************************/
-#ifndef __ARCH_ARM_SRC_LPC17XX_LPC17_PWM_H
-#define __ARCH_ARM_SRC_LPC17XX_LPC17_PWM_H
+#ifndef __ARCH_ARM_SRC_LPC17XX_40XX_LPC17_40_QEI_H
+#define __ARCH_ARM_SRC_LPC17XX_40XX_LPC17_40_QEI_H
/************************************************************************************
* Included Files
************************************************************************************/
#include
-#include "hardware/lpc17_pwm.h"
-#include "hardware/lpc17_mcpwm.h"
+#include "hardware/lpc17_40_qei.h"
/************************************************************************************
* Pre-processor Definitions
@@ -60,4 +59,4 @@
* Public Functions
************************************************************************************/
-#endif /* __ARCH_ARM_SRC_LPC17XX_LPC17_PWM_H */
+#endif /* __ARCH_ARM_SRC_LPC17XX_40XX_LPC17_40_QEI_H */
diff --git a/arch/arm/src/lpc17xx/lpc17_wdt.h b/arch/arm/src/lpc17xx_40xx/lpc17_40_rit.h
similarity index 92%
rename from arch/arm/src/lpc17xx/lpc17_wdt.h
rename to arch/arm/src/lpc17xx_40xx/lpc17_40_rit.h
index eb4d60834e3..d5d95dc5111 100644
--- a/arch/arm/src/lpc17xx/lpc17_wdt.h
+++ b/arch/arm/src/lpc17xx_40xx/lpc17_40_rit.h
@@ -1,5 +1,5 @@
/************************************************************************************
- * arch/arm/src/lpc17xx/lpc17_wdt.h
+ * arch/arm/src/lpc17xx_40xx/lpc17_40_rit.h
*
* Copyright (C) 2010, 2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt
@@ -33,15 +33,15 @@
*
************************************************************************************/
-#ifndef __ARCH_ARM_SRC_LPC17XX_LPC17_WDT_H
-#define __ARCH_ARM_SRC_LPC17XX_LPC17_WDT_H
+#ifndef __ARCH_ARM_SRC_LPC17XX_40XX_LPC17_40_RIT_H
+#define __ARCH_ARM_SRC_LPC17XX_40XX_LPC17_40_RIT_H
/************************************************************************************
* Included Files
************************************************************************************/
#include
-#include "hardware/lpc17_wdt.h"
+#include "hardware/lpc17_40_rit.h"
/************************************************************************************
* Pre-processor Definitions
@@ -59,4 +59,4 @@
* Public Functions
************************************************************************************/
-#endif /* __ARCH_ARM_SRC_LPC17XX_LPC17_WDT_H */
+#endif /* __ARCH_ARM_SRC_LPC17XX_40XX_LPC17_40_RIT_H */
diff --git a/arch/arm/src/lpc17xx/lpc17_rtc.h b/arch/arm/src/lpc17xx_40xx/lpc17_40_rtc.h
similarity index 90%
rename from arch/arm/src/lpc17xx/lpc17_rtc.h
rename to arch/arm/src/lpc17xx_40xx/lpc17_40_rtc.h
index 80523759b67..a43f5323d05 100644
--- a/arch/arm/src/lpc17xx/lpc17_rtc.h
+++ b/arch/arm/src/lpc17xx_40xx/lpc17_40_rtc.h
@@ -1,5 +1,5 @@
/************************************************************************************
- * arch/arm/src/lpc17xx/lpc17_rtc.h
+ * arch/arm/src/lpc17xx_40xx/lpc17_40_rtc.h
*
* Copyright (C) 2010, 2012-2013, 2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt
@@ -33,15 +33,15 @@
*
************************************************************************************/
-#ifndef __ARCH_ARM_SRC_LPC17XX_LPC17_RTC_H
-#define __ARCH_ARM_SRC_LPC17XX_LPC17_RTC_H
+#ifndef __ARCH_ARM_SRC_LPC17XX_40XX_LPC17_40_RTC_H
+#define __ARCH_ARM_SRC_LPC17XX_40XX_LPC17_40_RTC_H
/************************************************************************************
* Included Files
************************************************************************************/
#include
-#include "hardware/lpc17_rtc.h"
+#include "hardware/lpc17_40_rtc.h"
/************************************************************************************
* Pre-processor Definitions
@@ -64,7 +64,7 @@ typedef void (*alarmcb_t)(void);
************************************************************************************/
/************************************************************************************
- * Name: lpc17_rtc_setalarm
+ * Name: lpc17_40_rtc_setalarm
*
* Description:
* Set up an alarm.
@@ -80,7 +80,7 @@ typedef void (*alarmcb_t)(void);
#ifdef CONFIG_RTC_ALARM
struct timespec;
-int lpc17_rtc_setalarm(FAR const struct timespec *tp, alarmcb_t callback);
+int lpc17_40_rtc_setalarm(FAR const struct timespec *tp, alarmcb_t callback);
#endif
-#endif /* __ARCH_ARM_SRC_LPC17XX_LPC17_RTC_H */
+#endif /* __ARCH_ARM_SRC_LPC17XX_40XX_LPC17_40_RTC_H */
diff --git a/arch/arm/src/lpc17xx/lpc17_sdcard.c b/arch/arm/src/lpc17xx_40xx/lpc17_40_sdcard.c
similarity index 74%
rename from arch/arm/src/lpc17xx/lpc17_sdcard.c
rename to arch/arm/src/lpc17xx_40xx/lpc17_40_sdcard.c
index 04e48c44e0a..6f53a902de9 100644
--- a/arch/arm/src/lpc17xx/lpc17_sdcard.c
+++ b/arch/arm/src/lpc17xx_40xx/lpc17_40_sdcard.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * arch/arm/src/lpc17xx/lpc17_sdcard.c
+ * arch/arm/src/lpc17xx_40xx/lpc17_40_sdcard.c
*
* Copyright (C) 2013-2014, 2016-2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt
@@ -61,14 +61,14 @@
#include "chip.h"
#include "up_arch.h"
-#include "lpc17_gpdma.h"
-#include "lpc17_gpio.h"
-#include "lpc17_sdcard.h"
+#include "lpc17_40_gpdma.h"
+#include "lpc17_40_gpio.h"
+#include "lpc17_40_sdcard.h"
-#include "hardware/lpc17_syscon.h"
-#include "hardware/lpc17_pinconfig.h"
+#include "hardware/lpc17_40_syscon.h"
+#include "hardware/lpc17_40_pinconfig.h"
-#ifdef CONFIG_LPC17_SDCARD
+#ifdef CONFIG_LPC17_40_SDCARD
/****************************************************************************
* Pre-processor Definitions
@@ -78,9 +78,9 @@
/* Required system configuration options:
*
* CONFIG_ARCH_DMA - Enable architecture-specific DMA subsystem
- * initialization. Required if CONFIG_LPC17_SDCARD_DMA is enabled.
- * CONFIG_LPC17_GPDMA - Enable LPC17XX GPDMA support. Required if
- * CONFIG_LPC17_SDCARD_DMA is enabled
+ * initialization. Required if CONFIG_LPC17_40_SDCARD_DMA is enabled.
+ * CONFIG_LPC17_40_GPDMA - Enable LPC17XX_40XX GPDMA support. Required if
+ * CONFIG_LPC17_40_SDCARD_DMA is enabled
* CONFIG_SCHED_WORKQUEUE -- Callback support requires work queue support.
*
* Driver-specific configuration options:
@@ -88,24 +88,24 @@
* CONFIG_SDIO_MUXBUS - Setting this configuration enables some locking
* APIs to manage concurrent accesses on the SD card bus. This is not
* needed for the simple case of a single SD card, for example.
- * CONFIG_LPC17_SDCARD_DMA - Enable SD card DMA. This is a marginally optional.
+ * CONFIG_LPC17_40_SDCARD_DMA - Enable SD card DMA. This is a marginally optional.
* For most usages, SD accesses will cause data overruns if used without DMA.
* NOTE the above system DMA configuration options.
- * CONFIG_LPC17_SDCARD_WIDTH_D1_ONLY - This may be selected to force the
+ * CONFIG_LPC17_40_SDCARD_WIDTH_D1_ONLY - This may be selected to force the
* driver operate with only a single data line (the default is to use
* all 4 SD data lines).
* CONFIG_DEBUG_MEMCARD_* - Enables some very low-level debug output
* This also requires CONFIG_DEBUG_FS and CONFIG_DEBUG_INFO
*/
-#ifndef CONFIG_LPC17_SDCARD_DMA
+#ifndef CONFIG_LPC17_40_SDCARD_DMA
# warning "Large Non-DMA transfer may result in RX overrun failures"
#else
-# ifndef CONFIG_LPC17_GPDMA
-# error "CONFIG_LPC17_SDCARD_DMA support requires CONFIG_LPC17_GPDMA"
+# ifndef CONFIG_LPC17_40_GPDMA
+# error "CONFIG_LPC17_40_SDCARD_DMA support requires CONFIG_LPC17_40_GPDMA"
# endif
# ifndef CONFIG_SDIO_DMA
-# error CONFIG_SDIO_DMA must be defined with CONFIG_LPC17_SDCARD_DMA
+# error CONFIG_SDIO_DMA must be defined with CONFIG_LPC17_40_SDCARD_DMA
# endif
#endif
@@ -120,7 +120,7 @@
* SDCARD_MMCXFR_CLKDIV, and SDCARD_SDXFR_CLKDIV.
*/
-#define LPC17_CLCKCR_INIT (SDCARD_INIT_CLKDIV | SDCARD_CLOCK_WIDBUS_D1)
+#define LPC17_40_CLCKCR_INIT (SDCARD_INIT_CLKDIV | SDCARD_CLOCK_WIDBUS_D1)
#define SDCARD_CLOCK_MMCXFR (SDCARD_MMCXFR_CLKDIV | SDCARD_CLOCK_WIDBUS_D1)
#define SDCARD_CLOCK_SDXFR (SDCARD_SDXFR_CLKDIV | SDCARD_CLOCK_WIDBUS_D1)
#define SDCARD_CLOCK_SDWIDEXFR (SDCARD_SDXFR_CLKDIV | SDCARD_CLOCK_WIDBUS_D4)
@@ -214,7 +214,7 @@
/* Register logging support */
#ifdef CONFIG_DEBUG_MEMCARD_INFO
-# ifdef CONFIG_LPC17_SDCARD_DMA
+# ifdef CONFIG_LPC17_40_SDCARD_DMA
# define SAMPLENDX_BEFORE_SETUP 0
# define SAMPLENDX_BEFORE_ENABLE 1
# define SAMPLENDX_AFTER_SETUP 2
@@ -233,13 +233,13 @@
* Private Types
****************************************************************************/
-/* This structure defines the state of the LPC17XX SD card interface */
+/* This structure defines the state of the LPC17XX_40XX SD card interface */
-struct lpc17_dev_s
+struct lpc17_40_dev_s
{
struct sdio_dev_s dev; /* Standard, base SD card interface */
- /* LPC17XX-specific extensions */
+ /* LPC17XX_40XX-specific extensions */
/* Event support */
sem_t waitsem; /* Implements event waiting */
@@ -265,7 +265,7 @@ struct lpc17_dev_s
/* DMA data transfer support */
bool widebus; /* Required for DMA support */
-#ifdef CONFIG_LPC17_SDCARD_DMA
+#ifdef CONFIG_LPC17_40_SDCARD_DMA
volatile uint8_t xfrflags; /* Used to synchronize SD card and DMA completion events */
bool dmamode; /* true: DMA mode transfer */
DMA_HANDLE dma; /* Handle for DMA channel */
@@ -275,7 +275,7 @@ struct lpc17_dev_s
/* Register logging support */
#ifdef CONFIG_DEBUG_MEMCARD_INFO
-struct lpc17_sdcard_regs_s
+struct lpc17_40_sdcard_regs_s
{
uint8_t pwr;
uint16_t clkcr;
@@ -288,11 +288,11 @@ struct lpc17_sdcard_regs_s
uint32_t fifocnt;
};
-struct lpc17_sampleregs_s
+struct lpc17_40_sampleregs_s
{
- struct lpc17_sdcard_regs_s sdcard;
-#if defined(CONFIG_DEBUG_DMA) && defined(CONFIG_LPC17_SDCARD_DMA)
- struct lpc17_dmaregs_s dma;
+ struct lpc17_40_sdcard_regs_s sdcard;
+#if defined(CONFIG_DEBUG_DMA) && defined(CONFIG_LPC17_40_SDCARD_DMA)
+ struct lpc17_40_dmaregs_s dma;
#endif
};
#endif
@@ -303,153 +303,153 @@ struct lpc17_sampleregs_s
/* Low-level helpers ********************************************************/
-static void lpc17_takesem(struct lpc17_dev_s *priv);
-#define lpc17_givesem(priv) (nxsem_post(&priv->waitsem))
-static inline void lpc17_setclock(uint32_t clkcr);
-static void lpc17_configwaitints(struct lpc17_dev_s *priv, uint32_t waitmask,
+static void lpc17_40_takesem(struct lpc17_40_dev_s *priv);
+#define lpc17_40_givesem(priv) (nxsem_post(&priv->waitsem))
+static inline void lpc17_40_setclock(uint32_t clkcr);
+static void lpc17_40_configwaitints(struct lpc17_40_dev_s *priv, uint32_t waitmask,
sdio_eventset_t waitevents, sdio_eventset_t wkupevents);
-static void lpc17_configxfrints(struct lpc17_dev_s *priv, uint32_t xfrmask);
-static void lpc17_setpwrctrl(uint32_t pwrctrl);
-static inline uint32_t lpc17_getpwrctrl(void);
+static void lpc17_40_configxfrints(struct lpc17_40_dev_s *priv, uint32_t xfrmask);
+static void lpc17_40_setpwrctrl(uint32_t pwrctrl);
+static inline uint32_t lpc17_40_getpwrctrl(void);
/* DMA Helpers **************************************************************/
#ifdef CONFIG_DEBUG_MEMCARD_INFO
-static void lpc17_sampleinit(void);
-static void lpc17_sdcard_sample(struct lpc17_sdcard_regs_s *regs);
-static void lpc17_sample(struct lpc17_dev_s *priv, int index);
-static void lpc17_sdcard_dump(struct lpc17_sdcard_regs_s *regs, const char *msg);
-static void lpc17_dumpsample(struct lpc17_dev_s *priv,
- struct lpc17_sampleregs_s *regs, const char *msg);
-static void lpc17_dumpsamples(struct lpc17_dev_s *priv);
+static void lpc17_40_sampleinit(void);
+static void lpc17_40_sdcard_sample(struct lpc17_40_sdcard_regs_s *regs);
+static void lpc17_40_sample(struct lpc17_40_dev_s *priv, int index);
+static void lpc17_40_sdcard_dump(struct lpc17_40_sdcard_regs_s *regs, const char *msg);
+static void lpc17_40_dumpsample(struct lpc17_40_dev_s *priv,
+ struct lpc17_40_sampleregs_s *regs, const char *msg);
+static void lpc17_40_dumpsamples(struct lpc17_40_dev_s *priv);
#else
-# define lpc17_sampleinit()
-# define lpc17_sample(priv,index)
-# define lpc17_dumpsamples(priv)
+# define lpc17_40_sampleinit()
+# define lpc17_40_sample(priv,index)
+# define lpc17_40_dumpsamples(priv)
#endif
-#ifdef CONFIG_LPC17_SDCARD_DMA
-static void lpc17_dmacallback(DMA_HANDLE handle, void *arg, int status);
+#ifdef CONFIG_LPC17_40_SDCARD_DMA
+static void lpc17_40_dmacallback(DMA_HANDLE handle, void *arg, int status);
#endif
/* Data Transfer Helpers ****************************************************/
-static uint8_t lpc17_log2(uint16_t value);
-static void lpc17_dataconfig(uint32_t timeout, uint32_t dlen, uint32_t dctrl);
-static void lpc17_datadisable(void);
-static void lpc17_sendfifo(struct lpc17_dev_s *priv);
-static void lpc17_recvfifo(struct lpc17_dev_s *priv);
-static void lpc17_eventtimeout(int argc, uint32_t arg);
-static void lpc17_endwait(struct lpc17_dev_s *priv, sdio_eventset_t wkupevent);
-static void lpc17_endtransfer(struct lpc17_dev_s *priv, sdio_eventset_t wkupevent);
+static uint8_t lpc17_40_log2(uint16_t value);
+static void lpc17_40_dataconfig(uint32_t timeout, uint32_t dlen, uint32_t dctrl);
+static void lpc17_40_datadisable(void);
+static void lpc17_40_sendfifo(struct lpc17_40_dev_s *priv);
+static void lpc17_40_recvfifo(struct lpc17_40_dev_s *priv);
+static void lpc17_40_eventtimeout(int argc, uint32_t arg);
+static void lpc17_40_endwait(struct lpc17_40_dev_s *priv, sdio_eventset_t wkupevent);
+static void lpc17_40_endtransfer(struct lpc17_40_dev_s *priv, sdio_eventset_t wkupevent);
/* Interrupt Handling *******************************************************/
-static int lpc17_interrupt(int irq, void *context, FAR void *arg);
+static int lpc17_40_interrupt(int irq, void *context, FAR void *arg);
/* SD Card Interface Methods ************************************************/
/* Mutual exclusion */
#ifdef CONFIG_SDIO_MUXBUS
-static int lpc17_lock(FAR struct sdio_dev_s *dev, bool lock);
+static int lpc17_40_lock(FAR struct sdio_dev_s *dev, bool lock);
#endif
/* Initialization/setup */
-static void lpc17_reset(FAR struct sdio_dev_s *dev);
-static sdio_capset_t lpc17_capabilities(FAR struct sdio_dev_s *dev);
-static uint8_t lpc17_status(FAR struct sdio_dev_s *dev);
-static void lpc17_widebus(FAR struct sdio_dev_s *dev, bool enable);
-static void lpc17_clock(FAR struct sdio_dev_s *dev,
+static void lpc17_40_reset(FAR struct sdio_dev_s *dev);
+static sdio_capset_t lpc17_40_capabilities(FAR struct sdio_dev_s *dev);
+static uint8_t lpc17_40_status(FAR struct sdio_dev_s *dev);
+static void lpc17_40_widebus(FAR struct sdio_dev_s *dev, bool enable);
+static void lpc17_40_clock(FAR struct sdio_dev_s *dev,
enum sdio_clock_e rate);
-static int lpc17_attach(FAR struct sdio_dev_s *dev);
+static int lpc17_40_attach(FAR struct sdio_dev_s *dev);
/* Command/Status/Data Transfer */
-static int lpc17_sendcmd(FAR struct sdio_dev_s *dev, uint32_t cmd,
+static int lpc17_40_sendcmd(FAR struct sdio_dev_s *dev, uint32_t cmd,
uint32_t arg);
-static int lpc17_recvsetup(FAR struct sdio_dev_s *dev, FAR uint8_t *buffer,
+static int lpc17_40_recvsetup(FAR struct sdio_dev_s *dev, FAR uint8_t *buffer,
size_t nbytes);
-static int lpc17_sendsetup(FAR struct sdio_dev_s *dev,
+static int lpc17_40_sendsetup(FAR struct sdio_dev_s *dev,
FAR const uint8_t *buffer, uint32_t nbytes);
-static int lpc17_cancel(FAR struct sdio_dev_s *dev);
+static int lpc17_40_cancel(FAR struct sdio_dev_s *dev);
-static int lpc17_waitresponse(FAR struct sdio_dev_s *dev, uint32_t cmd);
-static int lpc17_recvshortcrc(FAR struct sdio_dev_s *dev, uint32_t cmd,
+static int lpc17_40_waitresponse(FAR struct sdio_dev_s *dev, uint32_t cmd);
+static int lpc17_40_recvshortcrc(FAR struct sdio_dev_s *dev, uint32_t cmd,
uint32_t *rshort);
-static int lpc17_recvlong(FAR struct sdio_dev_s *dev, uint32_t cmd,
+static int lpc17_40_recvlong(FAR struct sdio_dev_s *dev, uint32_t cmd,
uint32_t rlong[4]);
-static int lpc17_recvshort(FAR struct sdio_dev_s *dev, uint32_t cmd,
+static int lpc17_40_recvshort(FAR struct sdio_dev_s *dev, uint32_t cmd,
uint32_t *rshort);
-static int lpc17_recvnotimpl(FAR struct sdio_dev_s *dev, uint32_t cmd,
+static int lpc17_40_recvnotimpl(FAR struct sdio_dev_s *dev, uint32_t cmd,
uint32_t *rnotimpl);
/* EVENT handler */
-static void lpc17_waitenable(FAR struct sdio_dev_s *dev,
+static void lpc17_40_waitenable(FAR struct sdio_dev_s *dev,
sdio_eventset_t eventset);
static sdio_eventset_t
- lpc17_eventwait(FAR struct sdio_dev_s *dev, uint32_t timeout);
-static void lpc17_callbackenable(FAR struct sdio_dev_s *dev,
+ lpc17_40_eventwait(FAR struct sdio_dev_s *dev, uint32_t timeout);
+static void lpc17_40_callbackenable(FAR struct sdio_dev_s *dev,
sdio_eventset_t eventset);
-static int lpc17_registercallback(FAR struct sdio_dev_s *dev,
+static int lpc17_40_registercallback(FAR struct sdio_dev_s *dev,
worker_t callback, void *arg);
/* DMA */
-#ifdef CONFIG_LPC17_SDCARD_DMA
-static int lpc17_dmarecvsetup(FAR struct sdio_dev_s *dev,
+#ifdef CONFIG_LPC17_40_SDCARD_DMA
+static int lpc17_40_dmarecvsetup(FAR struct sdio_dev_s *dev,
FAR uint8_t *buffer, size_t buflen);
-static int lpc17_dmasendsetup(FAR struct sdio_dev_s *dev,
+static int lpc17_40_dmasendsetup(FAR struct sdio_dev_s *dev,
FAR const uint8_t *buffer, size_t buflen);
#endif
/* Initialization/uninitialization/reset ************************************/
-static void lpc17_callback(void *arg);
-static void lpc17_default(void);
+static void lpc17_40_callback(void *arg);
+static void lpc17_40_default(void);
/****************************************************************************
* Private Data
****************************************************************************/
-struct lpc17_dev_s g_scard_dev =
+struct lpc17_40_dev_s g_scard_dev =
{
.dev =
{
#ifdef CONFIG_SDIO_MUXBUS
- .lock = lpc17_lock,
+ .lock = lpc17_40_lock,
#endif
- .reset = lpc17_reset,
- .capabilities = lpc17_capabilities,
- .status = lpc17_status,
- .widebus = lpc17_widebus,
- .clock = lpc17_clock,
- .attach = lpc17_attach,
- .sendcmd = lpc17_sendcmd,
- .recvsetup = lpc17_recvsetup,
- .sendsetup = lpc17_sendsetup,
- .cancel = lpc17_cancel,
- .waitresponse = lpc17_waitresponse,
- .recvR1 = lpc17_recvshortcrc,
- .recvR2 = lpc17_recvlong,
- .recvR3 = lpc17_recvshort,
- .recvR4 = lpc17_recvnotimpl,
- .recvR5 = lpc17_recvnotimpl,
- .recvR6 = lpc17_recvshortcrc,
- .recvR7 = lpc17_recvshort,
- .waitenable = lpc17_waitenable,
- .eventwait = lpc17_eventwait,
- .callbackenable = lpc17_callbackenable,
- .registercallback = lpc17_registercallback,
+ .reset = lpc17_40_reset,
+ .capabilities = lpc17_40_capabilities,
+ .status = lpc17_40_status,
+ .widebus = lpc17_40_widebus,
+ .clock = lpc17_40_clock,
+ .attach = lpc17_40_attach,
+ .sendcmd = lpc17_40_sendcmd,
+ .recvsetup = lpc17_40_recvsetup,
+ .sendsetup = lpc17_40_sendsetup,
+ .cancel = lpc17_40_cancel,
+ .waitresponse = lpc17_40_waitresponse,
+ .recvR1 = lpc17_40_recvshortcrc,
+ .recvR2 = lpc17_40_recvlong,
+ .recvR3 = lpc17_40_recvshort,
+ .recvR4 = lpc17_40_recvnotimpl,
+ .recvR5 = lpc17_40_recvnotimpl,
+ .recvR6 = lpc17_40_recvshortcrc,
+ .recvR7 = lpc17_40_recvshort,
+ .waitenable = lpc17_40_waitenable,
+ .eventwait = lpc17_40_eventwait,
+ .callbackenable = lpc17_40_callbackenable,
+ .registercallback = lpc17_40_registercallback,
#ifdef CONFIG_SDIO_DMA
-#ifdef CONFIG_LPC17_SDCARD_DMA
- .dmarecvsetup = lpc17_dmarecvsetup,
- .dmasendsetup = lpc17_dmasendsetup,
+#ifdef CONFIG_LPC17_40_SDCARD_DMA
+ .dmarecvsetup = lpc17_40_dmarecvsetup,
+ .dmasendsetup = lpc17_40_dmasendsetup,
#else
- .dmarecvsetup = lpc17_recvsetup,
- .dmasendsetup = lpc17_sendsetup,
+ .dmarecvsetup = lpc17_40_recvsetup,
+ .dmasendsetup = lpc17_40_sendsetup,
#endif
#endif
},
@@ -458,7 +458,7 @@ struct lpc17_dev_s g_scard_dev =
/* Register logging support */
#ifdef CONFIG_DEBUG_MEMCARD_INFO
-static struct lpc17_sampleregs_s g_sampleregs[DEBUG_NSAMPLES];
+static struct lpc17_40_sampleregs_s g_sampleregs[DEBUG_NSAMPLES];
#endif
/****************************************************************************
@@ -469,7 +469,7 @@ static struct lpc17_sampleregs_s g_sampleregs[DEBUG_NSAMPLES];
* Low-level Helpers
****************************************************************************/
/****************************************************************************
- * Name: lpc17_takesem
+ * Name: lpc17_40_takesem
*
* Description:
* Take the wait semaphore (handling false alarm wakeups due to the receipt
@@ -483,7 +483,7 @@ static struct lpc17_sampleregs_s g_sampleregs[DEBUG_NSAMPLES];
*
****************************************************************************/
-static void lpc17_takesem(struct lpc17_dev_s *priv)
+static void lpc17_40_takesem(struct lpc17_40_dev_s *priv)
{
int ret;
@@ -503,7 +503,7 @@ static void lpc17_takesem(struct lpc17_dev_s *priv)
}
/****************************************************************************
- * Name: lpc17_setclock
+ * Name: lpc17_40_setclock
*
* Description:
* Modify oft-changed bits in the CLKCR register. Only the following bit-
@@ -520,9 +520,9 @@ static void lpc17_takesem(struct lpc17_dev_s *priv)
*
****************************************************************************/
-static inline void lpc17_setclock(uint32_t clkcr)
+static inline void lpc17_40_setclock(uint32_t clkcr)
{
- uint32_t regval = getreg32(LPC17_SDCARD_CLOCK);
+ uint32_t regval = getreg32(LPC17_40_SDCARD_CLOCK);
/* Clear CLKDIV, PWRSAV, BYPASS, and WIDBUS bits */
@@ -537,14 +537,14 @@ static inline void lpc17_setclock(uint32_t clkcr)
SDCARD_CLOCK_CLKEN);
regval |= clkcr;
- putreg32(regval, LPC17_SDCARD_CLOCK);
+ putreg32(regval, LPC17_40_SDCARD_CLOCK);
mcinfo("CLKCR: %08x PWR: %08x\n",
- getreg32(LPC17_SDCARD_CLOCK), getreg32(LPC17_SDCARD_PWR));
+ getreg32(LPC17_40_SDCARD_CLOCK), getreg32(LPC17_40_SDCARD_PWR));
}
/****************************************************************************
- * Name: lpc17_configwaitints
+ * Name: lpc17_40_configwaitints
*
* Description:
* Enable/disable SD card interrupts needed to suport the wait function
@@ -560,7 +560,7 @@ static inline void lpc17_setclock(uint32_t clkcr)
*
****************************************************************************/
-static void lpc17_configwaitints(struct lpc17_dev_s *priv, uint32_t waitmask,
+static void lpc17_40_configwaitints(struct lpc17_40_dev_s *priv, uint32_t waitmask,
sdio_eventset_t waitevents,
sdio_eventset_t wkupevent)
{
@@ -574,15 +574,15 @@ static void lpc17_configwaitints(struct lpc17_dev_s *priv, uint32_t waitmask,
priv->waitevents = waitevents;
priv->wkupevent = wkupevent;
priv->waitmask = waitmask;
-#ifdef CONFIG_LPC17_SDCARD_DMA
+#ifdef CONFIG_LPC17_40_SDCARD_DMA
priv->xfrflags = 0;
#endif
- putreg32(priv->xfrmask | priv->waitmask, LPC17_SDCARD_MASK0);
+ putreg32(priv->xfrmask | priv->waitmask, LPC17_40_SDCARD_MASK0);
leave_critical_section(flags);
}
/****************************************************************************
- * Name: lpc17_configxfrints
+ * Name: lpc17_40_configxfrints
*
* Description:
* Enable SD card interrupts needed to support the data transfer event
@@ -596,17 +596,17 @@ static void lpc17_configwaitints(struct lpc17_dev_s *priv, uint32_t waitmask,
*
****************************************************************************/
-static void lpc17_configxfrints(struct lpc17_dev_s *priv, uint32_t xfrmask)
+static void lpc17_40_configxfrints(struct lpc17_40_dev_s *priv, uint32_t xfrmask)
{
irqstate_t flags;
flags = enter_critical_section();
priv->xfrmask = xfrmask;
- putreg32(priv->xfrmask | priv->waitmask, LPC17_SDCARD_MASK0);
+ putreg32(priv->xfrmask | priv->waitmask, LPC17_40_SDCARD_MASK0);
leave_critical_section(flags);
}
/****************************************************************************
- * Name: lpc17_setpwrctrl
+ * Name: lpc17_40_setpwrctrl
*
* Description:
* Change the PWRCTRL field of the SD card POWER register to turn the SD card
@@ -620,7 +620,7 @@ static void lpc17_configxfrints(struct lpc17_dev_s *priv, uint32_t xfrmask)
*
****************************************************************************/
-static void lpc17_setpwrctrl(uint32_t pwrctrl)
+static void lpc17_40_setpwrctrl(uint32_t pwrctrl)
{
uint32_t regval;
@@ -628,14 +628,14 @@ static void lpc17_setpwrctrl(uint32_t pwrctrl)
* side-effect, clear the OPENDRAIN and ROD bits as well.
*/
- regval = getreg32(LPC17_SDCARD_PWR);
+ regval = getreg32(LPC17_40_SDCARD_PWR);
regval &= ~(SDCARD_PWR_CTRL_MASK | SDCARD_PWR_OPENDRAIN | SDCARD_PWR_ROD);
regval |= pwrctrl;
- putreg32(regval, LPC17_SDCARD_PWR);
+ putreg32(regval, LPC17_40_SDCARD_PWR);
}
/****************************************************************************
- * Name: lpc17_getpwrctrl
+ * Name: lpc17_40_getpwrctrl
*
* Description:
* Return the current value of the the PWRCTRL field of the SD card P
@@ -650,11 +650,11 @@ static void lpc17_setpwrctrl(uint32_t pwrctrl)
*
****************************************************************************/
-static inline uint32_t lpc17_getpwrctrl(void)
+static inline uint32_t lpc17_40_getpwrctrl(void)
{
/* Extract and return the PWRCTRL field of the PWR register. */
- return getreg32(LPC17_SDCARD_PWR) & SDCARD_PWR_CTRL_MASK;
+ return getreg32(LPC17_40_SDCARD_PWR) & SDCARD_PWR_CTRL_MASK;
}
/****************************************************************************
@@ -662,7 +662,7 @@ static inline uint32_t lpc17_getpwrctrl(void)
****************************************************************************/
/****************************************************************************
- * Name: lpc17_sampleinit
+ * Name: lpc17_40_sampleinit
*
* Description:
* Setup prior to collecting DMA samples
@@ -670,14 +670,14 @@ static inline uint32_t lpc17_getpwrctrl(void)
****************************************************************************/
#ifdef CONFIG_DEBUG_MEMCARD_INFO
-static void lpc17_sampleinit(void)
+static void lpc17_40_sampleinit(void)
{
- memset(g_sampleregs, 0xff, DEBUG_NSAMPLES * sizeof(struct lpc17_sampleregs_s));
+ memset(g_sampleregs, 0xff, DEBUG_NSAMPLES * sizeof(struct lpc17_40_sampleregs_s));
}
#endif
/****************************************************************************
- * Name: lpc17_sdcard_sample
+ * Name: lpc17_40_sdcard_sample
*
* Description:
* Sample SD card registers
@@ -685,22 +685,22 @@ static void lpc17_sampleinit(void)
****************************************************************************/
#ifdef CONFIG_DEBUG_MEMCARD_INFO
-static void lpc17_sdcard_sample(struct lpc17_sdcard_regs_s *regs)
+static void lpc17_40_sdcard_sample(struct lpc17_40_sdcard_regs_s *regs)
{
- regs->pwr = (uint8_t)getreg32(LPC17_SDCARD_PWR);
- regs->clkcr = (uint16_t)getreg32(LPC17_SDCARD_CLOCK);
- regs->dctrl = (uint16_t)getreg32(LPC17_SDCARD_DCTRL);
- regs->dtimer = getreg32(LPC17_SDCARD_DTIMER);
- regs->dlen = getreg32(LPC17_SDCARD_DLEN);
- regs->dcount = getreg32(LPC17_SDCARD_DCOUNT);
- regs->sta = getreg32(LPC17_SDCARD_STATUS);
- regs->mask = getreg32(LPC17_SDCARD_MASK0);
- regs->fifocnt = getreg32(LPC17_SDCARD_FIFOCNT);
+ regs->pwr = (uint8_t)getreg32(LPC17_40_SDCARD_PWR);
+ regs->clkcr = (uint16_t)getreg32(LPC17_40_SDCARD_CLOCK);
+ regs->dctrl = (uint16_t)getreg32(LPC17_40_SDCARD_DCTRL);
+ regs->dtimer = getreg32(LPC17_40_SDCARD_DTIMER);
+ regs->dlen = getreg32(LPC17_40_SDCARD_DLEN);
+ regs->dcount = getreg32(LPC17_40_SDCARD_DCOUNT);
+ regs->sta = getreg32(LPC17_40_SDCARD_STATUS);
+ regs->mask = getreg32(LPC17_40_SDCARD_MASK0);
+ regs->fifocnt = getreg32(LPC17_40_SDCARD_FIFOCNT);
}
#endif
/****************************************************************************
- * Name: lpc17_sample
+ * Name: lpc17_40_sample
*
* Description:
* Sample SD card/DMA registers
@@ -708,22 +708,22 @@ static void lpc17_sdcard_sample(struct lpc17_sdcard_regs_s *regs)
****************************************************************************/
#ifdef CONFIG_DEBUG_MEMCARD_INFO
-static void lpc17_sample(struct lpc17_dev_s *priv, int index)
+static void lpc17_40_sample(struct lpc17_40_dev_s *priv, int index)
{
- struct lpc17_sampleregs_s *regs = &g_sampleregs[index];
-#if defined(CONFIG_DEBUG_DMA) && defined(CONFIG_LPC17_SDCARD_DMA)
+ struct lpc17_40_sampleregs_s *regs = &g_sampleregs[index];
+#if defined(CONFIG_DEBUG_DMA) && defined(CONFIG_LPC17_40_SDCARD_DMA)
if (priv->dmamode)
{
- lpc17_dmasample(priv->dma, ®s->dma);
+ lpc17_40_dmasample(priv->dma, ®s->dma);
}
#endif
- lpc17_sdcard_sample(®s->sdcard);
+ lpc17_40_sdcard_sample(®s->sdcard);
}
#endif
/****************************************************************************
- * Name: lpc17_sdcard_dump
+ * Name: lpc17_40_sdcard_dump
*
* Description:
* Dump one register sample
@@ -731,23 +731,23 @@ static void lpc17_sample(struct lpc17_dev_s *priv, int index)
****************************************************************************/
#ifdef CONFIG_DEBUG_MEMCARD_INFO
-static void lpc17_sdcard_dump(struct lpc17_sdcard_regs_s *regs, const char *msg)
+static void lpc17_40_sdcard_dump(struct lpc17_40_sdcard_regs_s *regs, const char *msg)
{
mcinfo("SD Card Registers: %s\n", msg);
- mcinfo(" POWER[%08x]: %08x\n", LPC17_SDCARD_PWR, regs->pwr);
- mcinfo(" CLKCR[%08x]: %08x\n", LPC17_SDCARD_CLOCK, regs->clkcr);
- mcinfo(" DCTRL[%08x]: %08x\n", LPC17_SDCARD_DCTRL, regs->dctrl);
- mcinfo(" DTIMER[%08x]: %08x\n", LPC17_SDCARD_DTIMER, regs->dtimer);
- mcinfo(" DLEN[%08x]: %08x\n", LPC17_SDCARD_DLEN, regs->dlen);
- mcinfo(" DCOUNT[%08x]: %08x\n", LPC17_SDCARD_DCOUNT, regs->dcount);
- mcinfo(" STA[%08x]: %08x\n", LPC17_SDCARD_STATUS, regs->sta);
- mcinfo(" MASK[%08x]: %08x\n", LPC17_SDCARD_MASK0, regs->mask);
- mcinfo("FIFOCNT[%08x]: %08x\n", LPC17_SDCARD_FIFOCNT, regs->fifocnt);
+ mcinfo(" POWER[%08x]: %08x\n", LPC17_40_SDCARD_PWR, regs->pwr);
+ mcinfo(" CLKCR[%08x]: %08x\n", LPC17_40_SDCARD_CLOCK, regs->clkcr);
+ mcinfo(" DCTRL[%08x]: %08x\n", LPC17_40_SDCARD_DCTRL, regs->dctrl);
+ mcinfo(" DTIMER[%08x]: %08x\n", LPC17_40_SDCARD_DTIMER, regs->dtimer);
+ mcinfo(" DLEN[%08x]: %08x\n", LPC17_40_SDCARD_DLEN, regs->dlen);
+ mcinfo(" DCOUNT[%08x]: %08x\n", LPC17_40_SDCARD_DCOUNT, regs->dcount);
+ mcinfo(" STA[%08x]: %08x\n", LPC17_40_SDCARD_STATUS, regs->sta);
+ mcinfo(" MASK[%08x]: %08x\n", LPC17_40_SDCARD_MASK0, regs->mask);
+ mcinfo("FIFOCNT[%08x]: %08x\n", LPC17_40_SDCARD_FIFOCNT, regs->fifocnt);
}
#endif
/****************************************************************************
- * Name: lpc17_dumpsample
+ * Name: lpc17_40_dumpsample
*
* Description:
* Dump one register sample
@@ -755,21 +755,21 @@ static void lpc17_sdcard_dump(struct lpc17_sdcard_regs_s *regs, const char *msg)
****************************************************************************/
#ifdef CONFIG_DEBUG_MEMCARD_INFO
-static void lpc17_dumpsample(struct lpc17_dev_s *priv,
- struct lpc17_sampleregs_s *regs, const char *msg)
+static void lpc17_40_dumpsample(struct lpc17_40_dev_s *priv,
+ struct lpc17_40_sampleregs_s *regs, const char *msg)
{
-#if defined(CONFIG_DEBUG_DMA) && defined(CONFIG_LPC17_SDCARD_DMA)
+#if defined(CONFIG_DEBUG_DMA) && defined(CONFIG_LPC17_40_SDCARD_DMA)
if (priv->dmamode)
{
- lpc17_dmadump(priv->dma, ®s->dma, msg);
+ lpc17_40_dmadump(priv->dma, ®s->dma, msg);
}
#endif
- lpc17_sdcard_dump(®s->sdcard, msg);
+ lpc17_40_sdcard_dump(®s->sdcard, msg);
}
#endif
/****************************************************************************
- * Name: lpc17_dumpsamples
+ * Name: lpc17_40_dumpsamples
*
* Description:
* Dump all sampled register data
@@ -777,38 +777,38 @@ static void lpc17_dumpsample(struct lpc17_dev_s *priv,
****************************************************************************/
#ifdef CONFIG_DEBUG_MEMCARD_INFO
-static void lpc17_dumpsamples(struct lpc17_dev_s *priv)
+static void lpc17_40_dumpsamples(struct lpc17_40_dev_s *priv)
{
- lpc17_dumpsample(priv, &g_sampleregs[SAMPLENDX_BEFORE_SETUP], "Before setup");
-#if defined(CONFIG_DEBUG_DMA) && defined(CONFIG_LPC17_SDCARD_DMA)
+ lpc17_40_dumpsample(priv, &g_sampleregs[SAMPLENDX_BEFORE_SETUP], "Before setup");
+#if defined(CONFIG_DEBUG_DMA) && defined(CONFIG_LPC17_40_SDCARD_DMA)
if (priv->dmamode)
{
- lpc17_dumpsample(priv, &g_sampleregs[SAMPLENDX_BEFORE_ENABLE], "Before DMA enable");
+ lpc17_40_dumpsample(priv, &g_sampleregs[SAMPLENDX_BEFORE_ENABLE], "Before DMA enable");
}
#endif
- lpc17_dumpsample(priv, &g_sampleregs[SAMPLENDX_AFTER_SETUP], "After setup");
- lpc17_dumpsample(priv, &g_sampleregs[SAMPLENDX_END_TRANSFER], "End of transfer");
-#if defined(CONFIG_DEBUG_DMA) && defined(CONFIG_LPC17_SDCARD_DMA)
+ lpc17_40_dumpsample(priv, &g_sampleregs[SAMPLENDX_AFTER_SETUP], "After setup");
+ lpc17_40_dumpsample(priv, &g_sampleregs[SAMPLENDX_END_TRANSFER], "End of transfer");
+#if defined(CONFIG_DEBUG_DMA) && defined(CONFIG_LPC17_40_SDCARD_DMA)
if (priv->dmamode)
{
- lpc17_dumpsample(priv, &g_sampleregs[SAMPLENDX_DMA_CALLBACK], "DMA Callback");
+ lpc17_40_dumpsample(priv, &g_sampleregs[SAMPLENDX_DMA_CALLBACK], "DMA Callback");
}
#endif
}
#endif
/****************************************************************************
- * Name: lpc17_dmacallback
+ * Name: lpc17_40_dmacallback
*
* Description:
* Called when SD card DMA completes
*
****************************************************************************/
-#ifdef CONFIG_LPC17_SDCARD_DMA
-static void lpc17_dmacallback(DMA_HANDLE handle, void *arg, int status)
+#ifdef CONFIG_LPC17_40_SDCARD_DMA
+static void lpc17_40_dmacallback(DMA_HANDLE handle, void *arg, int status)
{
- FAR struct lpc17_dev_s *priv = (FAR struct lpc17_dev_s *)arg;
+ FAR struct lpc17_40_dev_s *priv = (FAR struct lpc17_40_dev_s *)arg;
DEBUGASSERT(priv->dmamode);
sdio_eventset_t result;
@@ -818,7 +818,7 @@ static void lpc17_dmacallback(DMA_HANDLE handle, void *arg, int status)
* Transfer.
*/
- lpc17_sample((struct lpc17_dev_s *)arg, SAMPLENDX_DMA_CALLBACK);
+ lpc17_40_sample((struct lpc17_40_dev_s *)arg, SAMPLENDX_DMA_CALLBACK);
/* Get the result of the DMA transfer */
@@ -841,7 +841,7 @@ static void lpc17_dmacallback(DMA_HANDLE handle, void *arg, int status)
priv->xfrflags |= SDCARD_DMADONE_FLAG;
if (priv->xfrflags == SDCARD_ALLDONE || result == SDIOWAIT_ERROR)
{
- lpc17_endtransfer(priv, result);
+ lpc17_40_endtransfer(priv, result);
}
}
#endif
@@ -851,7 +851,7 @@ static void lpc17_dmacallback(DMA_HANDLE handle, void *arg, int status)
****************************************************************************/
/****************************************************************************
- * Name: lpc17_log2
+ * Name: lpc17_40_log2
*
* Description:
* Take (approximate) log base 2 of the provided number (Only works if the
@@ -859,7 +859,7 @@ static void lpc17_dmacallback(DMA_HANDLE handle, void *arg, int status)
*
****************************************************************************/
-static uint8_t lpc17_log2(uint16_t value)
+static uint8_t lpc17_40_log2(uint16_t value)
{
uint8_t log2 = 0;
@@ -882,63 +882,63 @@ static uint8_t lpc17_log2(uint16_t value)
}
/****************************************************************************
- * Name: lpc17_dataconfig
+ * Name: lpc17_40_dataconfig
*
* Description:
* Configure the SD card data path for the next data transfer
*
****************************************************************************/
-static void lpc17_dataconfig(uint32_t timeout, uint32_t dlen, uint32_t dctrl)
+static void lpc17_40_dataconfig(uint32_t timeout, uint32_t dlen, uint32_t dctrl)
{
uint32_t regval = 0;
/* Enable data path */
- putreg32(timeout, LPC17_SDCARD_DTIMER); /* Set DTIMER */
- putreg32(dlen, LPC17_SDCARD_DLEN); /* Set DLEN */
+ putreg32(timeout, LPC17_40_SDCARD_DTIMER); /* Set DTIMER */
+ putreg32(dlen, LPC17_40_SDCARD_DLEN); /* Set DLEN */
/* Configure DCTRL DTDIR, DTMODE, and DBLOCKSIZE fields and set the DTEN
* field
*/
- regval = getreg32(LPC17_SDCARD_DCTRL);
+ regval = getreg32(LPC17_40_SDCARD_DCTRL);
regval &= ~(SDCARD_DCTRL_DTDIR | SDCARD_DCTRL_DTMODE |
SDCARD_DCTRL_DBLOCKSIZE_MASK);
dctrl &= (SDCARD_DCTRL_DTDIR | SDCARD_DCTRL_DTMODE |
SDCARD_DCTRL_DBLOCKSIZE_MASK);
regval |= (dctrl | SDCARD_DCTRL_DTEN);
- putreg32(regval, LPC17_SDCARD_DCTRL);
+ putreg32(regval, LPC17_40_SDCARD_DCTRL);
}
/****************************************************************************
- * Name: lpc17_datadisable
+ * Name: lpc17_40_datadisable
*
* Description:
- * Disable the SD card data path setup by lpc17_dataconfig() and
+ * Disable the SD card data path setup by lpc17_40_dataconfig() and
* disable DMA.
*
****************************************************************************/
-static void lpc17_datadisable(void)
+static void lpc17_40_datadisable(void)
{
uint32_t regval;
/* Disable the data path */
- putreg32(SDCARD_DTIMER_DATATIMEOUT, LPC17_SDCARD_DTIMER); /* Reset DTIMER */
- putreg32(0, LPC17_SDCARD_DLEN); /* Reset DLEN */
+ putreg32(SDCARD_DTIMER_DATATIMEOUT, LPC17_40_SDCARD_DTIMER); /* Reset DTIMER */
+ putreg32(0, LPC17_40_SDCARD_DLEN); /* Reset DLEN */
/* Reset DCTRL DTEN, DTDIR, DTMODE, DMAEN, and DBLOCKSIZE fields */
- regval = getreg32(LPC17_SDCARD_DCTRL);
+ regval = getreg32(LPC17_40_SDCARD_DCTRL);
regval &= ~(SDCARD_DCTRL_DTEN | SDCARD_DCTRL_DTDIR | SDCARD_DCTRL_DTMODE |
SDCARD_DCTRL_DMAEN | SDCARD_DCTRL_DBLOCKSIZE_MASK);
- putreg32(regval, LPC17_SDCARD_DCTRL);
+ putreg32(regval, LPC17_40_SDCARD_DCTRL);
}
/****************************************************************************
- * Name: lpc17_sendfifo
+ * Name: lpc17_40_sendfifo
*
* Description:
* Send SD card data in interrupt mode
@@ -951,7 +951,7 @@ static void lpc17_datadisable(void)
*
****************************************************************************/
-static void lpc17_sendfifo(struct lpc17_dev_s *priv)
+static void lpc17_40_sendfifo(struct lpc17_40_dev_s *priv)
{
union
{
@@ -962,7 +962,7 @@ static void lpc17_sendfifo(struct lpc17_dev_s *priv)
/* Loop while there is more data to be sent and the RX FIFO is not full */
while (priv->remaining > 0 &&
- (getreg32(LPC17_SDCARD_STATUS) & SDCARD_STATUS_TXFIFOF) == 0)
+ (getreg32(LPC17_40_SDCARD_STATUS) & SDCARD_STATUS_TXFIFOF) == 0)
{
/* Is there a full word remaining in the user buffer? */
@@ -995,12 +995,12 @@ static void lpc17_sendfifo(struct lpc17_dev_s *priv)
/* Put the word in the FIFO */
- putreg32(data.w, LPC17_SDCARD_FIFO);
+ putreg32(data.w, LPC17_40_SDCARD_FIFO);
}
}
/****************************************************************************
- * Name: lpc17_recvfifo
+ * Name: lpc17_40_recvfifo
*
* Description:
* Receive SD card data in interrupt mode
@@ -1013,7 +1013,7 @@ static void lpc17_sendfifo(struct lpc17_dev_s *priv)
*
****************************************************************************/
-static void lpc17_recvfifo(struct lpc17_dev_s *priv)
+static void lpc17_40_recvfifo(struct lpc17_40_dev_s *priv)
{
union
{
@@ -1026,11 +1026,11 @@ static void lpc17_recvfifo(struct lpc17_dev_s *priv)
*/
while (priv->remaining > 0 &&
- (getreg32(LPC17_SDCARD_STATUS) & SDCARD_STATUS_RXDAVL) != 0)
+ (getreg32(LPC17_40_SDCARD_STATUS) & SDCARD_STATUS_RXDAVL) != 0)
{
/* Read the next word from the RX FIFO */
- data.w = getreg32(LPC17_SDCARD_FIFO);
+ data.w = getreg32(LPC17_40_SDCARD_FIFO);
if (priv->remaining >= sizeof(uint32_t))
{
/* Transfer the whole word to the user buffer */
@@ -1058,7 +1058,7 @@ static void lpc17_recvfifo(struct lpc17_dev_s *priv)
}
/****************************************************************************
- * Name: lpc17_eventtimeout
+ * Name: lpc17_40_eventtimeout
*
* Description:
* The watchdog timeout setup when the event wait start has expired without
@@ -1076,9 +1076,9 @@ static void lpc17_recvfifo(struct lpc17_dev_s *priv)
*
****************************************************************************/
-static void lpc17_eventtimeout(int argc, uint32_t arg)
+static void lpc17_40_eventtimeout(int argc, uint32_t arg)
{
- struct lpc17_dev_s *priv = (struct lpc17_dev_s *)arg;
+ struct lpc17_40_dev_s *priv = (struct lpc17_40_dev_s *)arg;
/* There is always race conditions with timer expirations. */
@@ -1090,13 +1090,13 @@ static void lpc17_eventtimeout(int argc, uint32_t arg)
{
/* Yes.. wake up any waiting threads */
- lpc17_endwait(priv, SDIOWAIT_TIMEOUT);
+ lpc17_40_endwait(priv, SDIOWAIT_TIMEOUT);
mcerr("ERROR: Timeout: remaining: %d\n", priv->remaining);
}
}
/****************************************************************************
- * Name: lpc17_endwait
+ * Name: lpc17_40_endwait
*
* Description:
* Wake up a waiting thread if the waited-for event has occurred.
@@ -1113,7 +1113,7 @@ static void lpc17_eventtimeout(int argc, uint32_t arg)
*
****************************************************************************/
-static void lpc17_endwait(struct lpc17_dev_s *priv, sdio_eventset_t wkupevent)
+static void lpc17_40_endwait(struct lpc17_40_dev_s *priv, sdio_eventset_t wkupevent)
{
/* Cancel the watchdog timeout */
@@ -1121,15 +1121,15 @@ static void lpc17_endwait(struct lpc17_dev_s *priv, sdio_eventset_t wkupevent)
/* Disable event-related interrupts */
- lpc17_configwaitints(priv, 0, 0, wkupevent);
+ lpc17_40_configwaitints(priv, 0, 0, wkupevent);
/* Wake up the waiting thread */
- lpc17_givesem(priv);
+ lpc17_40_givesem(priv);
}
/****************************************************************************
- * Name: lpc17_endtransfer
+ * Name: lpc17_40_endtransfer
*
* Description:
* Terminate a transfer with the provided status. This function is called
@@ -1148,31 +1148,31 @@ static void lpc17_endwait(struct lpc17_dev_s *priv, sdio_eventset_t wkupevent)
*
****************************************************************************/
-static void lpc17_endtransfer(struct lpc17_dev_s *priv, sdio_eventset_t wkupevent)
+static void lpc17_40_endtransfer(struct lpc17_40_dev_s *priv, sdio_eventset_t wkupevent)
{
/* Disable all transfer related interrupts */
- lpc17_configxfrints(priv, 0);
+ lpc17_40_configxfrints(priv, 0);
/* Clearing pending interrupt status on all transfer related interrupts */
- putreg32(SDCARD_XFRDONE_ICR, LPC17_SDCARD_CLEAR);
+ putreg32(SDCARD_XFRDONE_ICR, LPC17_40_SDCARD_CLEAR);
/* If this was a DMA transfer, make sure that DMA is stopped */
-#ifdef CONFIG_LPC17_SDCARD_DMA
+#ifdef CONFIG_LPC17_40_SDCARD_DMA
if (priv->dmamode)
{
/* DMA debug instrumentation */
- lpc17_sample(priv, SAMPLENDX_END_TRANSFER);
+ lpc17_40_sample(priv, SAMPLENDX_END_TRANSFER);
/* Make sure that the DMA is stopped (it will be stopped automatically
* on normal transfers, but not necessarily when the transfer terminates
* on an error condition).
*/
- lpc17_dmastop(priv->dma);
+ lpc17_40_dmastop(priv->dma);
}
#endif
@@ -1186,7 +1186,7 @@ static void lpc17_endtransfer(struct lpc17_dev_s *priv, sdio_eventset_t wkupeven
{
/* Yes.. wake up any waiting threads */
- lpc17_endwait(priv, wkupevent);
+ lpc17_40_endwait(priv, wkupevent);
}
}
@@ -1195,7 +1195,7 @@ static void lpc17_endtransfer(struct lpc17_dev_s *priv, sdio_eventset_t wkupeven
****************************************************************************/
/****************************************************************************
- * Name: lpc17_interrupt
+ * Name: lpc17_40_interrupt
*
* Description:
* SD card interrupt handler
@@ -1208,9 +1208,9 @@ static void lpc17_endtransfer(struct lpc17_dev_s *priv, sdio_eventset_t wkupeven
*
****************************************************************************/
-static int lpc17_interrupt(int irq, void *context, FAR void *arg)
+static int lpc17_40_interrupt(int irq, void *context, FAR void *arg)
{
- struct lpc17_dev_s *priv = &g_scard_dev;
+ struct lpc17_40_dev_s *priv = &g_scard_dev;
uint32_t enabled;
uint32_t pending;
@@ -1221,14 +1221,14 @@ static int lpc17_interrupt(int irq, void *context, FAR void *arg)
* bits remaining, then we have work to do here.
*/
- while ((enabled = getreg32(LPC17_SDCARD_STATUS) & getreg32(LPC17_SDCARD_MASK0)) != 0)
+ while ((enabled = getreg32(LPC17_40_SDCARD_STATUS) & getreg32(LPC17_40_SDCARD_MASK0)) != 0)
{
/* Handle in progress, interrupt driven data transfers ****************/
pending = enabled & priv->xfrmask;
if (pending != 0)
{
-#ifdef CONFIG_LPC17_SDCARD_DMA
+#ifdef CONFIG_LPC17_40_SDCARD_DMA
if (!priv->dmamode)
#endif
{
@@ -1240,7 +1240,7 @@ static int lpc17_interrupt(int irq, void *context, FAR void *arg)
{
/* Receive data from the RX FIFO */
- lpc17_recvfifo(priv);
+ lpc17_40_recvfifo(priv);
}
/* Otherwise, Is the transmit FIFO half empty or less? If so we must
@@ -1252,7 +1252,7 @@ static int lpc17_interrupt(int irq, void *context, FAR void *arg)
{
/* Send data via the TX FIFO */
- lpc17_sendfifo(priv);
+ lpc17_40_sendfifo(priv);
}
}
@@ -1267,7 +1267,7 @@ static int lpc17_interrupt(int irq, void *context, FAR void *arg)
/* Was this transfer performed in DMA mode? */
-#ifdef CONFIG_LPC17_SDCARD_DMA
+#ifdef CONFIG_LPC17_40_SDCARD_DMA
if (priv->dmamode)
{
/* Yes.. Terminate the transfers only if the DMA has also
@@ -1277,7 +1277,7 @@ static int lpc17_interrupt(int irq, void *context, FAR void *arg)
priv->xfrflags |= SDCARD_XFRDONE_FLAG;
if (priv->xfrflags == SDCARD_ALLDONE)
{
- lpc17_endtransfer(priv, SDIOWAIT_TRANSFERDONE);
+ lpc17_40_endtransfer(priv, SDIOWAIT_TRANSFERDONE);
}
/* Otherwise, just disable futher transfer interrupts and
@@ -1286,7 +1286,7 @@ static int lpc17_interrupt(int irq, void *context, FAR void *arg)
else
{
- lpc17_configxfrints(priv, 0);
+ lpc17_40_configxfrints(priv, 0);
}
}
else
@@ -1294,11 +1294,11 @@ static int lpc17_interrupt(int irq, void *context, FAR void *arg)
{
/* Receive data from the RX FIFO */
- lpc17_recvfifo(priv);
+ lpc17_40_recvfifo(priv);
/* Then terminate the transfer */
- lpc17_endtransfer(priv, SDIOWAIT_TRANSFERDONE);
+ lpc17_40_endtransfer(priv, SDIOWAIT_TRANSFERDONE);
}
}
@@ -1309,7 +1309,7 @@ static int lpc17_interrupt(int irq, void *context, FAR void *arg)
/* Terminate the transfer with an error */
mcerr("ERROR: Data block CRC failure, remaining: %d\n", priv->remaining);
- lpc17_endtransfer(priv, SDIOWAIT_TRANSFERDONE | SDIOWAIT_ERROR);
+ lpc17_40_endtransfer(priv, SDIOWAIT_TRANSFERDONE | SDIOWAIT_ERROR);
}
/* Handle data timeout error */
@@ -1319,7 +1319,7 @@ static int lpc17_interrupt(int irq, void *context, FAR void *arg)
/* Terminate the transfer with an error */
mcerr("ERROR: Data timeout, remaining: %d\n", priv->remaining);
- lpc17_endtransfer(priv, SDIOWAIT_TRANSFERDONE | SDIOWAIT_TIMEOUT);
+ lpc17_40_endtransfer(priv, SDIOWAIT_TRANSFERDONE | SDIOWAIT_TIMEOUT);
}
/* Handle RX FIFO overrun error */
@@ -1329,7 +1329,7 @@ static int lpc17_interrupt(int irq, void *context, FAR void *arg)
/* Terminate the transfer with an error */
mcerr("ERROR: RX FIFO overrun, remaining: %d\n", priv->remaining);
- lpc17_endtransfer(priv, SDIOWAIT_TRANSFERDONE | SDIOWAIT_ERROR);
+ lpc17_40_endtransfer(priv, SDIOWAIT_TRANSFERDONE | SDIOWAIT_ERROR);
}
/* Handle TX FIFO underrun error */
@@ -1339,7 +1339,7 @@ static int lpc17_interrupt(int irq, void *context, FAR void *arg)
/* Terminate the transfer with an error */
mcerr("ERROR: TX FIFO underrun, remaining: %d\n", priv->remaining);
- lpc17_endtransfer(priv, SDIOWAIT_TRANSFERDONE | SDIOWAIT_ERROR);
+ lpc17_40_endtransfer(priv, SDIOWAIT_TRANSFERDONE | SDIOWAIT_ERROR);
}
/* Handle start bit error */
@@ -1349,7 +1349,7 @@ static int lpc17_interrupt(int irq, void *context, FAR void *arg)
/* Terminate the transfer with an error */
mcerr("ERROR: Start bit, remaining: %d\n", priv->remaining);
- lpc17_endtransfer(priv, SDIOWAIT_TRANSFERDONE | SDIOWAIT_ERROR);
+ lpc17_40_endtransfer(priv, SDIOWAIT_TRANSFERDONE | SDIOWAIT_ERROR);
}
}
@@ -1368,8 +1368,8 @@ static int lpc17_interrupt(int irq, void *context, FAR void *arg)
{
/* Yes.. wake the thread up */
- putreg32(SDCARD_RESPDONE_ICR | SDCARD_CMDDONE_ICR, LPC17_SDCARD_CLEAR);
- lpc17_endwait(priv, SDIOWAIT_RESPONSEDONE);
+ putreg32(SDCARD_RESPDONE_ICR | SDCARD_CMDDONE_ICR, LPC17_40_SDCARD_CLEAR);
+ lpc17_40_endwait(priv, SDIOWAIT_RESPONSEDONE);
}
}
@@ -1383,8 +1383,8 @@ static int lpc17_interrupt(int irq, void *context, FAR void *arg)
{
/* Yes.. wake the thread up */
- putreg32(SDCARD_CMDDONE_ICR, LPC17_SDCARD_CLEAR);
- lpc17_endwait(priv, SDIOWAIT_CMDDONE);
+ putreg32(SDCARD_CMDDONE_ICR, LPC17_40_SDCARD_CLEAR);
+ lpc17_40_endwait(priv, SDIOWAIT_CMDDONE);
}
}
}
@@ -1398,7 +1398,7 @@ static int lpc17_interrupt(int irq, void *context, FAR void *arg)
****************************************************************************/
/****************************************************************************
- * Name: lpc17_lock
+ * Name: lpc17_40_lock
*
* Description:
* Locks the bus. Function calls low-level multiplexed bus routines to
@@ -1414,19 +1414,19 @@ static int lpc17_interrupt(int irq, void *context, FAR void *arg)
****************************************************************************/
#ifdef CONFIG_SDIO_MUXBUS
-static int lpc17_lock(FAR struct sdio_dev_s *dev, bool lock)
+static int lpc17_40_lock(FAR struct sdio_dev_s *dev, bool lock)
{
/* Single SD card instance so there is only one possibility. The multiplex
* bus is part of board support package.
*/
- lpc17_muxbus_sdio_lock(lock);
+ lpc17_40_muxbus_sdio_lock(lock);
return OK;
}
#endif
/****************************************************************************
- * Name: lpc17_reset
+ * Name: lpc17_40_reset
*
* Description:
* Reset the SD card controller. Undo all setup and initialization.
@@ -1439,9 +1439,9 @@ static int lpc17_lock(FAR struct sdio_dev_s *dev, bool lock)
*
****************************************************************************/
-static void lpc17_reset(FAR struct sdio_dev_s *dev)
+static void lpc17_40_reset(FAR struct sdio_dev_s *dev)
{
- FAR struct lpc17_dev_s *priv = (FAR struct lpc17_dev_s *)dev;
+ FAR struct lpc17_40_dev_s *priv = (FAR struct lpc17_40_dev_s *)dev;
irqstate_t flags;
uint32_t regval;
@@ -1451,22 +1451,22 @@ static void lpc17_reset(FAR struct sdio_dev_s *dev)
/* Disable the SD Interface */
- regval = getreg32(LPC17_SDCARD_CLOCK);
+ regval = getreg32(LPC17_40_SDCARD_CLOCK);
regval &= ~SDCARD_CLOCK_CLKEN;
- putreg32(regval, LPC17_SDCARD_CLOCK);
+ putreg32(regval, LPC17_40_SDCARD_CLOCK);
- lpc17_setpwrctrl(SDCARD_PWR_CTRL_OFF);
+ lpc17_40_setpwrctrl(SDCARD_PWR_CTRL_OFF);
/* Put SD card registers in their default, reset state */
- lpc17_default();
+ lpc17_40_default();
/* Reset data */
priv->waitevents = 0; /* Set of events to be waited for */
priv->waitmask = 0; /* Interrupt enables for event waiting */
priv->wkupevent = 0; /* The event that caused the wakeup */
-#ifdef CONFIG_LPC17_SDCARD_DMA
+#ifdef CONFIG_LPC17_40_SDCARD_DMA
priv->xfrflags = 0; /* Used to synchronize SD card and DMA completion events */
#endif
@@ -1481,22 +1481,22 @@ static void lpc17_reset(FAR struct sdio_dev_s *dev)
/* DMA data transfer support */
priv->widebus = false; /* Required for DMA support */
-#ifdef CONFIG_LPC17_SDCARD_DMA
+#ifdef CONFIG_LPC17_40_SDCARD_DMA
priv->dmamode = false; /* true: DMA mode transfer */
#endif
/* Configure and enable the SD card peripheral */
- lpc17_setclock(LPC17_CLCKCR_INIT | SDCARD_CLOCK_CLKEN);
- lpc17_setpwrctrl(SDCARD_PWR_CTRL_ON);
+ lpc17_40_setclock(LPC17_40_CLCKCR_INIT | SDCARD_CLOCK_CLKEN);
+ lpc17_40_setpwrctrl(SDCARD_PWR_CTRL_ON);
leave_critical_section(flags);
mcinfo("CLCKR: %08x POWER: %08x\n",
- getreg32(LPC17_SDCARD_CLOCK), getreg32(LPC17_SDCARD_PWR));
+ getreg32(LPC17_40_SDCARD_CLOCK), getreg32(LPC17_40_SDCARD_PWR));
}
/****************************************************************************
- * Name: lpc17_capabilities
+ * Name: lpc17_40_capabilities
*
* Description:
* Get capabilities (and limitations) of the SDIO driver (optional)
@@ -1509,14 +1509,14 @@ static void lpc17_reset(FAR struct sdio_dev_s *dev)
*
****************************************************************************/
-static sdio_capset_t lpc17_capabilities(FAR struct sdio_dev_s *dev)
+static sdio_capset_t lpc17_40_capabilities(FAR struct sdio_dev_s *dev)
{
sdio_capset_t caps = 0;
-#ifdef CONFIG_LPC17_SDCARD_WIDTH_D1_ONLY
+#ifdef CONFIG_LPC17_40_SDCARD_WIDTH_D1_ONLY
caps |= SDIO_CAPS_1BIT_ONLY;
#endif
-#ifdef CONFIG_LPC17_SDCARD_DMA
+#ifdef CONFIG_LPC17_40_SDCARD_DMA
caps |= SDIO_CAPS_DMASUPPORTED;
#endif
@@ -1524,7 +1524,7 @@ static sdio_capset_t lpc17_capabilities(FAR struct sdio_dev_s *dev)
}
/****************************************************************************
- * Name: lpc17_status
+ * Name: lpc17_40_status
*
* Description:
* Get SD card status.
@@ -1533,18 +1533,18 @@ static sdio_capset_t lpc17_capabilities(FAR struct sdio_dev_s *dev)
* dev - Device-specific state data
*
* Returned Value:
- * Returns a bitset of status values (see lpc17_status_* defines)
+ * Returns a bitset of status values (see lpc17_40_status_* defines)
*
****************************************************************************/
-static sdio_statset_t lpc17_status(FAR struct sdio_dev_s *dev)
+static sdio_statset_t lpc17_40_status(FAR struct sdio_dev_s *dev)
{
- struct lpc17_dev_s *priv = (struct lpc17_dev_s *)dev;
+ struct lpc17_40_dev_s *priv = (struct lpc17_40_dev_s *)dev;
return priv->cdstatus;
}
/****************************************************************************
- * Name: lpc17_widebus
+ * Name: lpc17_40_widebus
*
* Description:
* Called after change in Bus width has been selected (via ACMD6). Most
@@ -1560,14 +1560,14 @@ static sdio_statset_t lpc17_status(FAR struct sdio_dev_s *dev)
*
****************************************************************************/
-static void lpc17_widebus(FAR struct sdio_dev_s *dev, bool wide)
+static void lpc17_40_widebus(FAR struct sdio_dev_s *dev, bool wide)
{
- struct lpc17_dev_s *priv = (struct lpc17_dev_s *)dev;
+ struct lpc17_40_dev_s *priv = (struct lpc17_40_dev_s *)dev;
priv->widebus = wide;
}
/****************************************************************************
- * Name: lpc17_clock
+ * Name: lpc17_40_clock
*
* Description:
* Enable/disable SD card clocking
@@ -1581,7 +1581,7 @@ static void lpc17_widebus(FAR struct sdio_dev_s *dev, bool wide)
*
****************************************************************************/
-static void lpc17_clock(FAR struct sdio_dev_s *dev, enum sdio_clock_e rate)
+static void lpc17_40_clock(FAR struct sdio_dev_s *dev, enum sdio_clock_e rate)
{
uint32_t clkcr;
@@ -1591,26 +1591,26 @@ static void lpc17_clock(FAR struct sdio_dev_s *dev, enum sdio_clock_e rate)
default:
case CLOCK_SDIO_DISABLED:
- clkcr = LPC17_CLCKCR_INIT;
+ clkcr = LPC17_40_CLCKCR_INIT;
return;
/* Enable in initial ID mode clocking (<400KHz) */
case CLOCK_IDMODE:
- clkcr = (LPC17_CLCKCR_INIT | SDCARD_CLOCK_CLKEN);
+ clkcr = (LPC17_40_CLCKCR_INIT | SDCARD_CLOCK_CLKEN);
break;
/* Enable in MMC normal operation clocking */
case CLOCK_MMC_TRANSFER:
clkcr = (SDCARD_CLOCK_MMCXFR | SDCARD_CLOCK_CLKEN);
- lpc17_setpwrctrl(SDCARD_PWR_OPENDRAIN);
+ lpc17_40_setpwrctrl(SDCARD_PWR_OPENDRAIN);
break;
/* SD normal operation clocking (wide 4-bit mode) */
case CLOCK_SD_TRANSFER_4BIT:
-#ifndef CONFIG_LPC17_SDCARD_WIDTH_D1_ONLY
+#ifndef CONFIG_LPC17_40_SDCARD_WIDTH_D1_ONLY
clkcr = (SDCARD_CLOCK_SDWIDEXFR | SDCARD_CLOCK_CLKEN);
break;
#endif
@@ -1624,11 +1624,11 @@ static void lpc17_clock(FAR struct sdio_dev_s *dev, enum sdio_clock_e rate)
/* Set the new clock frequency along with the clock enable/disable bit */
- lpc17_setclock(clkcr);
+ lpc17_40_setclock(clkcr);
}
/****************************************************************************
- * Name: lpc17_attach
+ * Name: lpc17_40_attach
*
* Description:
* Attach and prepare interrupts
@@ -1641,13 +1641,13 @@ static void lpc17_clock(FAR struct sdio_dev_s *dev, enum sdio_clock_e rate)
*
****************************************************************************/
-static int lpc17_attach(FAR struct sdio_dev_s *dev)
+static int lpc17_40_attach(FAR struct sdio_dev_s *dev)
{
int ret;
/* Attach the SD card interrupt handler */
- ret = irq_attach(LPC17_IRQ_MCI, lpc17_interrupt, NULL);
+ ret = irq_attach(LPC17_40_IRQ_MCI, lpc17_40_interrupt, NULL);
if (ret == OK)
{
@@ -1655,21 +1655,21 @@ static int lpc17_attach(FAR struct sdio_dev_s *dev)
* interrupt flags
*/
- putreg32(SDCARD_MASK0_RESET, LPC17_SDCARD_MASK0);
- putreg32(SDCARD_CLEAR_STATICFLAGS, LPC17_SDCARD_CLEAR);
+ putreg32(SDCARD_MASK0_RESET, LPC17_40_SDCARD_MASK0);
+ putreg32(SDCARD_CLEAR_STATICFLAGS, LPC17_40_SDCARD_CLEAR);
/* Enable SD card interrupts at the NVIC. They can now be enabled at
* the SD card controller as needed.
*/
- up_enable_irq(LPC17_IRQ_MCI);
+ up_enable_irq(LPC17_40_IRQ_MCI);
}
return ret;
}
/****************************************************************************
- * Name: lpc17_sendcmd
+ * Name: lpc17_40_sendcmd
*
* Description:
* Send the SD card command
@@ -1684,18 +1684,18 @@ static int lpc17_attach(FAR struct sdio_dev_s *dev)
*
****************************************************************************/
-static int lpc17_sendcmd(FAR struct sdio_dev_s *dev, uint32_t cmd, uint32_t arg)
+static int lpc17_40_sendcmd(FAR struct sdio_dev_s *dev, uint32_t cmd, uint32_t arg)
{
uint32_t regval;
uint32_t cmdidx;
/* Set the SD card Argument value */
- putreg32(arg, LPC17_SDCARD_ARG);
+ putreg32(arg, LPC17_40_SDCARD_ARG);
/* Clear CMDINDEX, WAITRESP, WAITINT, WAITPEND, and CPSMEN bits */
- regval = getreg32(LPC17_SDCARD_CMD);
+ regval = getreg32(LPC17_40_SDCARD_CMD);
regval &= ~(SDCARD_CMD_INDEX_MASK | SDCARD_CMD_WAITRESP_MASK |
SDCARD_CMD_WAITINT | SDCARD_CMD_WAITPEND |
SDCARD_CMD_CPSMEN);
@@ -1732,13 +1732,13 @@ static int lpc17_sendcmd(FAR struct sdio_dev_s *dev, uint32_t cmd, uint32_t arg)
/* Write the SD card CMD */
- putreg32(SDCARD_RESPDONE_ICR | SDCARD_CMDDONE_ICR, LPC17_SDCARD_CLEAR);
- putreg32(regval, LPC17_SDCARD_CMD);
+ putreg32(SDCARD_RESPDONE_ICR | SDCARD_CMDDONE_ICR, LPC17_40_SDCARD_CLEAR);
+ putreg32(regval, LPC17_40_SDCARD_CMD);
return OK;
}
/****************************************************************************
- * Name: lpc17_recvsetup
+ * Name: lpc17_40_recvsetup
*
* Description:
* Setup hardware in preparation for data transfer from the card in non-DMA
@@ -1758,10 +1758,10 @@ static int lpc17_sendcmd(FAR struct sdio_dev_s *dev, uint32_t cmd, uint32_t arg)
*
****************************************************************************/
-static int lpc17_recvsetup(FAR struct sdio_dev_s *dev, FAR uint8_t *buffer,
+static int lpc17_40_recvsetup(FAR struct sdio_dev_s *dev, FAR uint8_t *buffer,
size_t nbytes)
{
- struct lpc17_dev_s *priv = (struct lpc17_dev_s *)dev;
+ struct lpc17_40_dev_s *priv = (struct lpc17_40_dev_s *)dev;
uint32_t dblocksize;
DEBUGASSERT(priv != NULL && buffer != NULL && nbytes > 0);
@@ -1769,33 +1769,33 @@ static int lpc17_recvsetup(FAR struct sdio_dev_s *dev, FAR uint8_t *buffer,
/* Reset the DPSM configuration */
- lpc17_datadisable();
- lpc17_sampleinit();
- lpc17_sample(priv, SAMPLENDX_BEFORE_SETUP);
+ lpc17_40_datadisable();
+ lpc17_40_sampleinit();
+ lpc17_40_sample(priv, SAMPLENDX_BEFORE_SETUP);
/* Save the destination buffer information for use by the interrupt handler */
priv->buffer = (uint32_t *)buffer;
priv->remaining = nbytes;
-#ifdef CONFIG_LPC17_SDCARD_DMA
+#ifdef CONFIG_LPC17_40_SDCARD_DMA
priv->dmamode = false;
#endif
/* Then set up the SD card data path */
- dblocksize = lpc17_log2(nbytes) << SDCARD_DCTRL_DBLOCKSIZE_SHIFT;
- lpc17_dataconfig(SDCARD_DTIMER_DATATIMEOUT, nbytes,
+ dblocksize = lpc17_40_log2(nbytes) << SDCARD_DCTRL_DBLOCKSIZE_SHIFT;
+ lpc17_40_dataconfig(SDCARD_DTIMER_DATATIMEOUT, nbytes,
dblocksize | SDCARD_DCTRL_DTDIR);
/* And enable interrupts */
- lpc17_configxfrints(priv, SDCARD_RECV_MASK);
- lpc17_sample(priv, SAMPLENDX_AFTER_SETUP);
+ lpc17_40_configxfrints(priv, SDCARD_RECV_MASK);
+ lpc17_40_sample(priv, SAMPLENDX_AFTER_SETUP);
return OK;
}
/****************************************************************************
- * Name: lpc17_sendsetup
+ * Name: lpc17_40_sendsetup
*
* Description:
* Setup hardware in preparation for data transfer from the card. This method
@@ -1813,10 +1813,10 @@ static int lpc17_recvsetup(FAR struct sdio_dev_s *dev, FAR uint8_t *buffer,
*
****************************************************************************/
-static int lpc17_sendsetup(FAR struct sdio_dev_s *dev, FAR const uint8_t *buffer,
+static int lpc17_40_sendsetup(FAR struct sdio_dev_s *dev, FAR const uint8_t *buffer,
size_t nbytes)
{
- struct lpc17_dev_s *priv = (struct lpc17_dev_s *)dev;
+ struct lpc17_40_dev_s *priv = (struct lpc17_40_dev_s *)dev;
uint32_t dblocksize;
DEBUGASSERT(priv != NULL && buffer != NULL && nbytes > 0);
@@ -1824,32 +1824,32 @@ static int lpc17_sendsetup(FAR struct sdio_dev_s *dev, FAR const uint8_t *buffer
/* Reset the DPSM configuration */
- lpc17_datadisable();
- lpc17_sampleinit();
- lpc17_sample(priv, SAMPLENDX_BEFORE_SETUP);
+ lpc17_40_datadisable();
+ lpc17_40_sampleinit();
+ lpc17_40_sample(priv, SAMPLENDX_BEFORE_SETUP);
/* Save the source buffer information for use by the interrupt handler */
priv->buffer = (uint32_t *)buffer;
priv->remaining = nbytes;
-#ifdef CONFIG_LPC17_SDCARD_DMA
+#ifdef CONFIG_LPC17_40_SDCARD_DMA
priv->dmamode = false;
#endif
/* Then set up the SD card data path */
- dblocksize = lpc17_log2(nbytes) << SDCARD_DCTRL_DBLOCKSIZE_SHIFT;
- lpc17_dataconfig(SDCARD_DTIMER_DATATIMEOUT, nbytes, dblocksize);
+ dblocksize = lpc17_40_log2(nbytes) << SDCARD_DCTRL_DBLOCKSIZE_SHIFT;
+ lpc17_40_dataconfig(SDCARD_DTIMER_DATATIMEOUT, nbytes, dblocksize);
/* Enable TX interrupts */
- lpc17_configxfrints(priv, SDCARD_SEND_MASK);
- lpc17_sample(priv, SAMPLENDX_AFTER_SETUP);
+ lpc17_40_configxfrints(priv, SDCARD_SEND_MASK);
+ lpc17_40_sample(priv, SAMPLENDX_AFTER_SETUP);
return OK;
}
/****************************************************************************
- * Name: lpc17_cancel
+ * Name: lpc17_40_cancel
*
* Description:
* Cancel the data transfer setup of SDCARD_RECVSETUP, SDCARD_SENDSETUP,
@@ -1865,20 +1865,20 @@ static int lpc17_sendsetup(FAR struct sdio_dev_s *dev, FAR const uint8_t *buffer
*
****************************************************************************/
-static int lpc17_cancel(FAR struct sdio_dev_s *dev)
+static int lpc17_40_cancel(FAR struct sdio_dev_s *dev)
{
- struct lpc17_dev_s *priv = (struct lpc17_dev_s *)dev;
+ struct lpc17_40_dev_s *priv = (struct lpc17_40_dev_s *)dev;
/* Disable all transfer- and event- related interrupts */
- lpc17_configxfrints(priv, 0);
- lpc17_configwaitints(priv, 0, 0, 0);
+ lpc17_40_configxfrints(priv, 0);
+ lpc17_40_configwaitints(priv, 0, 0, 0);
/* Clearing pending interrupt status on all transfer- and event- related
* interrupts
*/
- putreg32(SDCARD_WAITALL_ICR, LPC17_SDCARD_CLEAR);
+ putreg32(SDCARD_WAITALL_ICR, LPC17_40_SDCARD_CLEAR);
/* Cancel any watchdog timeout */
@@ -1886,7 +1886,7 @@ static int lpc17_cancel(FAR struct sdio_dev_s *dev)
/* If this was a DMA transfer, make sure that DMA is stopped */
-#ifdef CONFIG_LPC17_SDCARD_DMA
+#ifdef CONFIG_LPC17_40_SDCARD_DMA
if (priv->dmamode)
{
/* Make sure that the DMA is stopped (it will be stopped automatically
@@ -1894,7 +1894,7 @@ static int lpc17_cancel(FAR struct sdio_dev_s *dev)
* on an error condition.
*/
- lpc17_dmastop(priv->dma);
+ lpc17_40_dmastop(priv->dma);
}
#endif
@@ -1905,7 +1905,7 @@ static int lpc17_cancel(FAR struct sdio_dev_s *dev)
}
/****************************************************************************
- * Name: lpc17_waitresponse
+ * Name: lpc17_40_waitresponse
*
* Description:
* Poll-wait for the response to the last command to be ready.
@@ -1919,7 +1919,7 @@ static int lpc17_cancel(FAR struct sdio_dev_s *dev)
*
****************************************************************************/
-static int lpc17_waitresponse(FAR struct sdio_dev_s *dev, uint32_t cmd)
+static int lpc17_40_waitresponse(FAR struct sdio_dev_s *dev, uint32_t cmd)
{
int32_t timeout;
uint32_t events;
@@ -1955,23 +1955,23 @@ static int lpc17_waitresponse(FAR struct sdio_dev_s *dev, uint32_t cmd)
/* Then wait for the response (or timeout) */
- while ((getreg32(LPC17_SDCARD_STATUS) & events) == 0)
+ while ((getreg32(LPC17_40_SDCARD_STATUS) & events) == 0)
{
if (--timeout <= 0)
{
mcerr("ERROR: Timeout cmd: %08x events: %08x STA: %08x\n",
- cmd, events, getreg32(LPC17_SDCARD_STATUS));
+ cmd, events, getreg32(LPC17_40_SDCARD_STATUS));
return -ETIMEDOUT;
}
}
- putreg32(SDCARD_CMDDONE_ICR, LPC17_SDCARD_CLEAR);
+ putreg32(SDCARD_CMDDONE_ICR, LPC17_40_SDCARD_CLEAR);
return OK;
}
/****************************************************************************
- * Name: lpc17_recvRx
+ * Name: lpc17_40_recvRx
*
* Description:
* Receive response to SD card command. Only the critical payload is
@@ -1992,7 +1992,7 @@ static int lpc17_waitresponse(FAR struct sdio_dev_s *dev, uint32_t cmd)
*
****************************************************************************/
-static int lpc17_recvshortcrc(FAR struct sdio_dev_s *dev, uint32_t cmd, uint32_t *rshort)
+static int lpc17_40_recvshortcrc(FAR struct sdio_dev_s *dev, uint32_t cmd, uint32_t *rshort)
{
#ifdef CONFIG_DEBUG_FEATURES
uint32_t respcmd;
@@ -2044,7 +2044,7 @@ static int lpc17_recvshortcrc(FAR struct sdio_dev_s *dev, uint32_t cmd, uint32_t
{
/* Check if a timeout or CRC error occurred */
- regval = getreg32(LPC17_SDCARD_STATUS);
+ regval = getreg32(LPC17_40_SDCARD_STATUS);
if ((regval & SDCARD_STATUS_CTIMEOUT) != 0)
{
mcerr("ERROR: Command timeout: %08x\n", regval);
@@ -2060,7 +2060,7 @@ static int lpc17_recvshortcrc(FAR struct sdio_dev_s *dev, uint32_t cmd, uint32_t
{
/* Check response received is of desired command */
- respcmd = getreg32(LPC17_SDCARD_RESPCMD);
+ respcmd = getreg32(LPC17_40_SDCARD_RESPCMD);
if ((uint8_t)(respcmd & SDCARD_RESPCMD_MASK) != (cmd & MMCSD_CMDIDX_MASK))
{
mcerr("ERROR: RESCMD=%02x CMD=%08x\n", respcmd, cmd);
@@ -2072,12 +2072,12 @@ static int lpc17_recvshortcrc(FAR struct sdio_dev_s *dev, uint32_t cmd, uint32_t
/* Clear all pending message completion events and return the R1/R6 response */
- putreg32(SDCARD_RESPDONE_ICR | SDCARD_CMDDONE_ICR, LPC17_SDCARD_CLEAR);
- *rshort = getreg32(LPC17_SDCARD_RESP0);
+ putreg32(SDCARD_RESPDONE_ICR | SDCARD_CMDDONE_ICR, LPC17_40_SDCARD_CLEAR);
+ *rshort = getreg32(LPC17_40_SDCARD_RESP0);
return ret;
}
-static int lpc17_recvlong(FAR struct sdio_dev_s *dev, uint32_t cmd, uint32_t rlong[4])
+static int lpc17_40_recvlong(FAR struct sdio_dev_s *dev, uint32_t cmd, uint32_t rlong[4])
{
uint32_t regval;
int ret = OK;
@@ -2104,7 +2104,7 @@ static int lpc17_recvlong(FAR struct sdio_dev_s *dev, uint32_t cmd, uint32_t rlo
{
/* Check if a timeout or CRC error occurred */
- regval = getreg32(LPC17_SDCARD_STATUS);
+ regval = getreg32(LPC17_40_SDCARD_STATUS);
if (regval & SDCARD_STATUS_CTIMEOUT)
{
mcerr("ERROR: Timeout STA: %08x\n", regval);
@@ -2119,19 +2119,19 @@ static int lpc17_recvlong(FAR struct sdio_dev_s *dev, uint32_t cmd, uint32_t rlo
/* Return the long response */
- putreg32(SDCARD_RESPDONE_ICR | SDCARD_CMDDONE_ICR, LPC17_SDCARD_CLEAR);
+ putreg32(SDCARD_RESPDONE_ICR | SDCARD_CMDDONE_ICR, LPC17_40_SDCARD_CLEAR);
if (rlong)
{
- rlong[0] = getreg32(LPC17_SDCARD_RESP0);
- rlong[1] = getreg32(LPC17_SDCARD_RESP1);
- rlong[2] = getreg32(LPC17_SDCARD_RESP2);
- rlong[3] = getreg32(LPC17_SDCARD_RESP3);
+ rlong[0] = getreg32(LPC17_40_SDCARD_RESP0);
+ rlong[1] = getreg32(LPC17_40_SDCARD_RESP1);
+ rlong[2] = getreg32(LPC17_40_SDCARD_RESP2);
+ rlong[3] = getreg32(LPC17_40_SDCARD_RESP3);
}
return ret;
}
-static int lpc17_recvshort(FAR struct sdio_dev_s *dev, uint32_t cmd, uint32_t *rshort)
+static int lpc17_40_recvshort(FAR struct sdio_dev_s *dev, uint32_t cmd, uint32_t *rshort)
{
uint32_t regval;
int ret = OK;
@@ -2161,7 +2161,7 @@ static int lpc17_recvshort(FAR struct sdio_dev_s *dev, uint32_t cmd, uint32_t *r
* a good response)
*/
- regval = getreg32(LPC17_SDCARD_STATUS);
+ regval = getreg32(LPC17_40_SDCARD_STATUS);
if (regval & SDCARD_STATUS_CTIMEOUT)
{
mcerr("ERROR: Timeout STA: %08x\n", regval);
@@ -2169,29 +2169,29 @@ static int lpc17_recvshort(FAR struct sdio_dev_s *dev, uint32_t cmd, uint32_t *r
}
}
- putreg32(SDCARD_RESPDONE_ICR | SDCARD_CMDDONE_ICR, LPC17_SDCARD_CLEAR);
+ putreg32(SDCARD_RESPDONE_ICR | SDCARD_CMDDONE_ICR, LPC17_40_SDCARD_CLEAR);
if (rshort)
{
- *rshort = getreg32(LPC17_SDCARD_RESP0);
+ *rshort = getreg32(LPC17_40_SDCARD_RESP0);
}
return ret;
}
/* MMC responses not supported */
-static int lpc17_recvnotimpl(FAR struct sdio_dev_s *dev, uint32_t cmd, uint32_t *rnotimpl)
+static int lpc17_40_recvnotimpl(FAR struct sdio_dev_s *dev, uint32_t cmd, uint32_t *rnotimpl)
{
- putreg32(SDCARD_RESPDONE_ICR | SDCARD_CMDDONE_ICR, LPC17_SDCARD_CLEAR);
+ putreg32(SDCARD_RESPDONE_ICR | SDCARD_CMDDONE_ICR, LPC17_40_SDCARD_CLEAR);
return -ENOSYS;
}
/****************************************************************************
- * Name: lpc17_waitenable
+ * Name: lpc17_40_waitenable
*
* Description:
* Enable/disable of a set of SD card wait events. This is part of the
* the SDCARD_WAITEVENT sequence. The set of to-be-waited-for events is
- * configured before calling lpc17_eventwait. This is done in this way
+ * configured before calling lpc17_40_eventwait. This is done in this way
* to help the driver to eliminate race conditions between the command
* setup and the subsequent events.
*
@@ -2209,17 +2209,17 @@ static int lpc17_recvnotimpl(FAR struct sdio_dev_s *dev, uint32_t cmd, uint32_t
*
****************************************************************************/
-static void lpc17_waitenable(FAR struct sdio_dev_s *dev,
+static void lpc17_40_waitenable(FAR struct sdio_dev_s *dev,
sdio_eventset_t eventset)
{
- struct lpc17_dev_s *priv = (struct lpc17_dev_s *)dev;
+ struct lpc17_40_dev_s *priv = (struct lpc17_40_dev_s *)dev;
uint32_t waitmask;
DEBUGASSERT(priv != NULL);
/* Disable event-related interrupts */
- lpc17_configwaitints(priv, 0, 0, 0);
+ lpc17_40_configwaitints(priv, 0, 0, 0);
/* Select the interrupt mask that will give us the appropriate wakeup
* interrupts.
@@ -2243,17 +2243,17 @@ static void lpc17_waitenable(FAR struct sdio_dev_s *dev,
/* Enable event-related interrupts */
- putreg32(SDCARD_WAITALL_ICR, LPC17_SDCARD_CLEAR);
- lpc17_configwaitints(priv, waitmask, eventset, 0);
+ putreg32(SDCARD_WAITALL_ICR, LPC17_40_SDCARD_CLEAR);
+ lpc17_40_configwaitints(priv, waitmask, eventset, 0);
}
/****************************************************************************
- * Name: lpc17_eventwait
+ * Name: lpc17_40_eventwait
*
* Description:
* Wait for one of the enabled events to occur (or a timeout). Note that
- * all events enabled by SDCARD_WAITEVENTS are disabled when lpc17_eventwait
- * returns. SDCARD_WAITEVENTS must be called again before lpc17_eventwait
+ * all events enabled by SDCARD_WAITEVENTS are disabled when lpc17_40_eventwait
+ * returns. SDCARD_WAITEVENTS must be called again before lpc17_40_eventwait
* can be used again.
*
* Input Parameters:
@@ -2268,10 +2268,10 @@ static void lpc17_waitenable(FAR struct sdio_dev_s *dev,
*
****************************************************************************/
-static sdio_eventset_t lpc17_eventwait(FAR struct sdio_dev_s *dev,
+static sdio_eventset_t lpc17_40_eventwait(FAR struct sdio_dev_s *dev,
uint32_t timeout)
{
- struct lpc17_dev_s *priv = (struct lpc17_dev_s *)dev;
+ struct lpc17_40_dev_s *priv = (struct lpc17_40_dev_s *)dev;
sdio_eventset_t wkupevent = 0;
irqstate_t flags;
int ret;
@@ -2305,7 +2305,7 @@ static sdio_eventset_t lpc17_eventwait(FAR struct sdio_dev_s *dev,
/* Start the watchdog timer */
delay = MSEC2TICK(timeout);
- ret = wd_start(priv->waitwdog, delay, (wdentry_t)lpc17_eventtimeout,
+ ret = wd_start(priv->waitwdog, delay, (wdentry_t)lpc17_40_eventtimeout,
1, (uint32_t)priv);
if (ret < 0)
{
@@ -2314,7 +2314,7 @@ static sdio_eventset_t lpc17_eventwait(FAR struct sdio_dev_s *dev,
}
/* Loop until the event (or the timeout occurs). Race conditions are avoided
- * by calling lpc17_waitenable prior to triggering the logic that will cause
+ * by calling lpc17_40_waitenable prior to triggering the logic that will cause
* the wait to terminate. Under certain race conditions, the waited-for
* may have already occurred before this function was called!
*/
@@ -2326,7 +2326,7 @@ static sdio_eventset_t lpc17_eventwait(FAR struct sdio_dev_s *dev,
* there will be no wait.
*/
- lpc17_takesem(priv);
+ lpc17_40_takesem(priv);
wkupevent = priv->wkupevent;
/* Check if the event has occurred. When the event has occurred, then
@@ -2343,24 +2343,24 @@ static sdio_eventset_t lpc17_eventwait(FAR struct sdio_dev_s *dev,
/* Disable event-related interrupts */
- lpc17_configwaitints(priv, 0, 0, 0);
-#ifdef CONFIG_LPC17_SDCARD_DMA
+ lpc17_40_configwaitints(priv, 0, 0, 0);
+#ifdef CONFIG_LPC17_40_SDCARD_DMA
priv->xfrflags = 0;
#endif
errout:
leave_critical_section(flags);
- lpc17_dumpsamples(priv);
+ lpc17_40_dumpsamples(priv);
return wkupevent;
}
/****************************************************************************
- * Name: lpc17_callbackenable
+ * Name: lpc17_40_callbackenable
*
* Description:
* Enable/disable of a set of SD card callback events. This is part of the
* the SD card callback sequence. The set of events is configured to enabled
- * callbacks to the function provided in lpc17_registercallback.
+ * callbacks to the function provided in lpc17_40_registercallback.
*
* Events are automatically disabled once the callback is performed and no
* further callback events will occur until they are again enabled by
@@ -2376,20 +2376,20 @@ errout:
*
****************************************************************************/
-static void lpc17_callbackenable(FAR struct sdio_dev_s *dev,
+static void lpc17_40_callbackenable(FAR struct sdio_dev_s *dev,
sdio_eventset_t eventset)
{
- struct lpc17_dev_s *priv = (struct lpc17_dev_s *)dev;
+ struct lpc17_40_dev_s *priv = (struct lpc17_40_dev_s *)dev;
mcinfo("eventset: %02x\n", eventset);
DEBUGASSERT(priv != NULL);
priv->cbevents = eventset;
- lpc17_callback(priv);
+ lpc17_40_callback(priv);
}
/****************************************************************************
- * Name: lpc17_registercallback
+ * Name: lpc17_40_registercallback
*
* Description:
* Register a callback that that will be invoked on any media status
@@ -2410,10 +2410,10 @@ static void lpc17_callbackenable(FAR struct sdio_dev_s *dev,
*
****************************************************************************/
-static int lpc17_registercallback(FAR struct sdio_dev_s *dev,
+static int lpc17_40_registercallback(FAR struct sdio_dev_s *dev,
worker_t callback, void *arg)
{
- struct lpc17_dev_s *priv = (struct lpc17_dev_s *)dev;
+ struct lpc17_40_dev_s *priv = (struct lpc17_40_dev_s *)dev;
/* Disable callbacks and register this callback and is argument */
@@ -2427,7 +2427,7 @@ static int lpc17_registercallback(FAR struct sdio_dev_s *dev,
}
/****************************************************************************
- * Name: lpc17_dmarecvsetup
+ * Name: lpc17_40_dmarecvsetup
*
* Description:
* Setup to perform a read DMA. If the processor supports a data cache,
@@ -2445,11 +2445,11 @@ static int lpc17_registercallback(FAR struct sdio_dev_s *dev,
*
****************************************************************************/
-#ifdef CONFIG_LPC17_SDCARD_DMA
-static int lpc17_dmarecvsetup(FAR struct sdio_dev_s *dev, FAR uint8_t *buffer,
+#ifdef CONFIG_LPC17_40_SDCARD_DMA
+static int lpc17_40_dmarecvsetup(FAR struct sdio_dev_s *dev, FAR uint8_t *buffer,
size_t buflen)
{
- struct lpc17_dev_s *priv = (struct lpc17_dev_s *)dev;
+ struct lpc17_40_dev_s *priv = (struct lpc17_40_dev_s *)dev;
uint32_t dblocksize;
uint32_t regval;
int ret = -EINVAL;
@@ -2459,14 +2459,14 @@ static int lpc17_dmarecvsetup(FAR struct sdio_dev_s *dev, FAR uint8_t *buffer,
/* Reset the DPSM configuration */
- lpc17_datadisable();
+ lpc17_40_datadisable();
/* Wide bus operation is required for DMA */
if (priv->widebus)
{
- lpc17_sampleinit();
- lpc17_sample(priv, SAMPLENDX_BEFORE_SETUP);
+ lpc17_40_sampleinit();
+ lpc17_40_sample(priv, SAMPLENDX_BEFORE_SETUP);
/* Save the destination buffer information for use by the interrupt handler */
@@ -2476,28 +2476,28 @@ static int lpc17_dmarecvsetup(FAR struct sdio_dev_s *dev, FAR uint8_t *buffer,
/* Then set up the SD card data path */
- dblocksize = lpc17_log2(buflen) << SDCARD_DCTRL_DBLOCKSIZE_SHIFT;
- lpc17_dataconfig(SDCARD_DTIMER_DATATIMEOUT, buflen,
+ dblocksize = lpc17_40_log2(buflen) << SDCARD_DCTRL_DBLOCKSIZE_SHIFT;
+ lpc17_40_dataconfig(SDCARD_DTIMER_DATATIMEOUT, buflen,
dblocksize | SDCARD_DCTRL_DTDIR);
/* Configure the RX DMA */
- lpc17_configxfrints(priv, SDCARD_DMARECV_MASK);
+ lpc17_40_configxfrints(priv, SDCARD_DMARECV_MASK);
- regval = getreg32(LPC17_SDCARD_DCTRL);
+ regval = getreg32(LPC17_40_SDCARD_DCTRL);
regval |= SDCARD_DCTRL_DMAEN;
- putreg32(regval, LPC17_SDCARD_DCTRL);
+ putreg32(regval, LPC17_40_SDCARD_DCTRL);
- ret = lpc17_dmasetup(priv->dma, SDCARD_RXDMA32_CONTROL,
- SDCARD_RXDMA32_CONFIG, LPC17_SDCARD_FIFO,
+ ret = lpc17_40_dmasetup(priv->dma, SDCARD_RXDMA32_CONTROL,
+ SDCARD_RXDMA32_CONFIG, LPC17_40_SDCARD_FIFO,
(uint32_t)buffer, (buflen + 3) >> 2);
if (ret == OK)
{
/* Start the DMA */
- lpc17_sample(priv, SAMPLENDX_BEFORE_ENABLE);
- lpc17_dmastart(priv->dma, lpc17_dmacallback, priv);
- lpc17_sample(priv, SAMPLENDX_AFTER_SETUP);
+ lpc17_40_sample(priv, SAMPLENDX_BEFORE_ENABLE);
+ lpc17_40_dmastart(priv->dma, lpc17_40_dmacallback, priv);
+ lpc17_40_sample(priv, SAMPLENDX_AFTER_SETUP);
}
}
@@ -2506,7 +2506,7 @@ static int lpc17_dmarecvsetup(FAR struct sdio_dev_s *dev, FAR uint8_t *buffer,
#endif
/****************************************************************************
- * Name: lpc17_dmasendsetup
+ * Name: lpc17_40_dmasendsetup
*
* Description:
* Setup to perform a write DMA. If the processor supports a data cache,
@@ -2524,11 +2524,11 @@ static int lpc17_dmarecvsetup(FAR struct sdio_dev_s *dev, FAR uint8_t *buffer,
*
****************************************************************************/
-#ifdef CONFIG_LPC17_SDCARD_DMA
-static int lpc17_dmasendsetup(FAR struct sdio_dev_s *dev,
+#ifdef CONFIG_LPC17_40_SDCARD_DMA
+static int lpc17_40_dmasendsetup(FAR struct sdio_dev_s *dev,
FAR const uint8_t *buffer, size_t buflen)
{
- struct lpc17_dev_s *priv = (struct lpc17_dev_s *)dev;
+ struct lpc17_40_dev_s *priv = (struct lpc17_40_dev_s *)dev;
uint32_t dblocksize;
uint32_t regval;
int ret = -EINVAL;
@@ -2538,14 +2538,14 @@ static int lpc17_dmasendsetup(FAR struct sdio_dev_s *dev,
/* Reset the DPSM configuration */
- lpc17_datadisable();
+ lpc17_40_datadisable();
/* Wide bus operation is required for DMA */
if (priv->widebus)
{
- lpc17_sampleinit();
- lpc17_sample(priv, SAMPLENDX_BEFORE_SETUP);
+ lpc17_40_sampleinit();
+ lpc17_40_sample(priv, SAMPLENDX_BEFORE_SETUP);
/* Save the source buffer information for use by the interrupt handler */
@@ -2555,30 +2555,30 @@ static int lpc17_dmasendsetup(FAR struct sdio_dev_s *dev,
/* Then set up the SD card data path */
- dblocksize = lpc17_log2(buflen) << SDCARD_DCTRL_DBLOCKSIZE_SHIFT;
- lpc17_dataconfig(SDCARD_DTIMER_DATATIMEOUT, buflen, dblocksize);
+ dblocksize = lpc17_40_log2(buflen) << SDCARD_DCTRL_DBLOCKSIZE_SHIFT;
+ lpc17_40_dataconfig(SDCARD_DTIMER_DATATIMEOUT, buflen, dblocksize);
/* Configure the TX DMA */
- ret = lpc17_dmasetup(priv->dma, SDCARD_TXDMA32_CONTROL,
+ ret = lpc17_40_dmasetup(priv->dma, SDCARD_TXDMA32_CONTROL,
SDCARD_TXDMA32_CONFIG, (uint32_t)buffer,
- LPC17_SDCARD_FIFO, (buflen + 3) >> 2);
+ LPC17_40_SDCARD_FIFO, (buflen + 3) >> 2);
if (ret == OK)
{
- lpc17_sample(priv, SAMPLENDX_BEFORE_ENABLE);
+ lpc17_40_sample(priv, SAMPLENDX_BEFORE_ENABLE);
- regval = getreg32(LPC17_SDCARD_DCTRL);
+ regval = getreg32(LPC17_40_SDCARD_DCTRL);
regval |= SDCARD_DCTRL_DMAEN;
- putreg32(regval, LPC17_SDCARD_DCTRL);
+ putreg32(regval, LPC17_40_SDCARD_DCTRL);
/* Start the DMA */
- lpc17_dmastart(priv->dma, lpc17_dmacallback, priv);
- lpc17_sample(priv, SAMPLENDX_AFTER_SETUP);
+ lpc17_40_dmastart(priv->dma, lpc17_40_dmacallback, priv);
+ lpc17_40_sample(priv, SAMPLENDX_AFTER_SETUP);
/* Enable TX interrupts */
- lpc17_configxfrints(priv, SDCARD_DMASEND_MASK);
+ lpc17_40_configxfrints(priv, SDCARD_DMASEND_MASK);
}
}
@@ -2590,7 +2590,7 @@ static int lpc17_dmasendsetup(FAR struct sdio_dev_s *dev,
* Initialization/uninitialization/reset
****************************************************************************/
/****************************************************************************
- * Name: lpc17_callback
+ * Name: lpc17_40_callback
*
* Description:
* Perform callback.
@@ -2602,9 +2602,9 @@ static int lpc17_dmasendsetup(FAR struct sdio_dev_s *dev,
*
****************************************************************************/
-static void lpc17_callback(void *arg)
+static void lpc17_40_callback(void *arg)
{
- struct lpc17_dev_s *priv = (struct lpc17_dev_s *)arg;
+ struct lpc17_40_dev_s *priv = (struct lpc17_40_dev_s *)arg;
/* Is a callback registered? */
@@ -2668,24 +2668,24 @@ static void lpc17_callback(void *arg)
}
/****************************************************************************
- * Name: lpc17_default
+ * Name: lpc17_40_default
*
* Description:
* Restore SD card registers to their default, reset values
*
****************************************************************************/
-static void lpc17_default(void)
+static void lpc17_40_default(void)
{
- putreg32(SDCARD_PWR_RESET, LPC17_SDCARD_PWR);
- putreg32(SDCARD_CLOCK_RESET, LPC17_SDCARD_CLOCK);
- putreg32(SDCARD_ARG_RESET, LPC17_SDCARD_ARG);
- putreg32(SDCARD_CMD_RESET, LPC17_SDCARD_CMD);
- putreg32(SDCARD_DTIMER_RESET, LPC17_SDCARD_DTIMER);
- putreg32(SDCARD_DLEN_RESET, LPC17_SDCARD_DLEN);
- putreg32(SDCARD_DCTRL_RESET, LPC17_SDCARD_DCTRL);
- putreg32(SDCARD_CLEAR_RESET, LPC17_SDCARD_CLEAR);
- putreg32(SDCARD_MASK0_RESET, LPC17_SDCARD_MASK0);
+ putreg32(SDCARD_PWR_RESET, LPC17_40_SDCARD_PWR);
+ putreg32(SDCARD_CLOCK_RESET, LPC17_40_SDCARD_CLOCK);
+ putreg32(SDCARD_ARG_RESET, LPC17_40_SDCARD_ARG);
+ putreg32(SDCARD_CMD_RESET, LPC17_40_SDCARD_CMD);
+ putreg32(SDCARD_DTIMER_RESET, LPC17_40_SDCARD_DTIMER);
+ putreg32(SDCARD_DLEN_RESET, LPC17_40_SDCARD_DLEN);
+ putreg32(SDCARD_DCTRL_RESET, LPC17_40_SDCARD_DCTRL);
+ putreg32(SDCARD_CLEAR_RESET, LPC17_40_SDCARD_CLEAR);
+ putreg32(SDCARD_MASK0_RESET, LPC17_40_SDCARD_MASK0);
}
/****************************************************************************
@@ -2712,13 +2712,13 @@ FAR struct sdio_dev_s *sdio_initialize(int slotno)
/* There is only one slot */
- struct lpc17_dev_s *priv = &g_scard_dev;
+ struct lpc17_40_dev_s *priv = &g_scard_dev;
/* Enable power on SD Interface */
- regval = getreg32(LPC17_SYSCON_PCONP);
+ regval = getreg32(LPC17_40_SYSCON_PCONP);
regval |= SYSCON_PCONP_PCSDC;
- putreg32(regval, LPC17_SYSCON_PCONP);
+ putreg32(regval, LPC17_40_SYSCON_PCONP);
/* Initialize the SD card slot structure */
/* Initialize semaphores */
@@ -2736,14 +2736,14 @@ FAR struct sdio_dev_s *sdio_initialize(int slotno)
priv->waitwdog = wd_create();
DEBUGASSERT(priv->waitwdog);
-#ifdef CONFIG_LPC17_SDCARD_DMA
+#ifdef CONFIG_LPC17_40_SDCARD_DMA
/* Configure the SDCARD DMA request */
- lpc17_dmaconfigure(DMA_REQ_SDCARD, DMA_DMASEL_SDCARD);
+ lpc17_40_dmaconfigure(DMA_REQ_SDCARD, DMA_DMASEL_SDCARD);
/* Allocate a DMA channel for SDCARD DMA */
- priv->dma = lpc17_dmachannel();
+ priv->dma = lpc17_40_dmachannel();
DEBUGASSERT(priv->dma);
#endif
@@ -2754,21 +2754,21 @@ FAR struct sdio_dev_s *sdio_initialize(int slotno)
*/
#ifndef CONFIG_SDIO_MUXBUS
- lpc17_configgpio(GPIO_SD_DAT0);
-#ifndef CONFIG_LPC17_SDCARD_WIDTH_D1_ONLY
- lpc17_configgpio(GPIO_SD_DAT1);
- lpc17_configgpio(GPIO_SD_DAT2);
- lpc17_configgpio(GPIO_SD_DAT3);
+ lpc17_40_configgpio(GPIO_SD_DAT0);
+#ifndef CONFIG_LPC17_40_SDCARD_WIDTH_D1_ONLY
+ lpc17_40_configgpio(GPIO_SD_DAT1);
+ lpc17_40_configgpio(GPIO_SD_DAT2);
+ lpc17_40_configgpio(GPIO_SD_DAT3);
#endif
- lpc17_configgpio(GPIO_SD_CLK);
- lpc17_configgpio(GPIO_SD_CMD);
+ lpc17_40_configgpio(GPIO_SD_CLK);
+ lpc17_40_configgpio(GPIO_SD_CMD);
#endif
/* Reset the card and assure that it is in the initial, unconfigured
* state.
*/
- lpc17_reset(&priv->dev);
+ lpc17_40_reset(&priv->dev);
return &g_scard_dev.dev;
}
@@ -2794,7 +2794,7 @@ FAR struct sdio_dev_s *sdio_initialize(int slotno)
void sdio_mediachange(FAR struct sdio_dev_s *dev, bool cardinslot)
{
- struct lpc17_dev_s *priv = (struct lpc17_dev_s *)dev;
+ struct lpc17_40_dev_s *priv = (struct lpc17_40_dev_s *)dev;
sdio_statset_t cdstatus;
irqstate_t flags;
@@ -2816,7 +2816,7 @@ void sdio_mediachange(FAR struct sdio_dev_s *dev, bool cardinslot)
if (cdstatus != priv->cdstatus)
{
- lpc17_callback(priv);
+ lpc17_40_callback(priv);
}
leave_critical_section(flags);
@@ -2840,7 +2840,7 @@ void sdio_mediachange(FAR struct sdio_dev_s *dev, bool cardinslot)
void sdio_wrprotect(FAR struct sdio_dev_s *dev, bool wrprotect)
{
- struct lpc17_dev_s *priv = (struct lpc17_dev_s *)dev;
+ struct lpc17_40_dev_s *priv = (struct lpc17_40_dev_s *)dev;
irqstate_t flags;
/* Update card status */
@@ -2858,4 +2858,4 @@ void sdio_wrprotect(FAR struct sdio_dev_s *dev, bool wrprotect)
mcinfo("cdstatus: %02x\n", priv->cdstatus);
leave_critical_section(flags);
}
-#endif /* CONFIG_LPC17_SDCARD */
+#endif /* CONFIG_LPC17_40_SDCARD */
diff --git a/arch/arm/src/lpc17xx/lpc17_sdcard.h b/arch/arm/src/lpc17xx_40xx/lpc17_40_sdcard.h
similarity index 94%
rename from arch/arm/src/lpc17xx/lpc17_sdcard.h
rename to arch/arm/src/lpc17xx_40xx/lpc17_40_sdcard.h
index 1057bcb60db..65bca084e44 100644
--- a/arch/arm/src/lpc17xx/lpc17_sdcard.h
+++ b/arch/arm/src/lpc17xx_40xx/lpc17_40_sdcard.h
@@ -1,5 +1,5 @@
/************************************************************************************
- * arch/arm/src/lpc17xx/lpc17_sdcard.h
+ * arch/arm/src/lpc17xx_40xx/lpc17_40_sdcard.h
*
* Copyright (C) 2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt
@@ -33,8 +33,8 @@
*
************************************************************************************/
-#ifndef __ARCH_ARM_SRC_LPC17XX_LPC17_SDCARD_H
-#define __ARCH_ARM_SRC_LPC17XX_LPC17_SDCARD_H
+#ifndef __ARCH_ARM_SRC_LPC17XX_40XX_LPC17_40_SDCARD_H
+#define __ARCH_ARM_SRC_LPC17XX_40XX_LPC17_40_SDCARD_H
/************************************************************************************
* Included Files
@@ -45,7 +45,7 @@
#include
#include "chip.h"
-#include "hardware/lpc17_sdcard.h"
+#include "hardware/lpc17_40_sdcard.h"
/************************************************************************************
* Public Functions
@@ -124,4 +124,4 @@ void sdio_wrprotect(FAR struct sdio_dev_s *dev, bool wrprotect);
#endif
#endif /* __ASSEMBLY__ */
-#endif /* __ARCH_ARM_SRC_LPC17XX_LPC17_SDCARD_H */
+#endif /* __ARCH_ARM_SRC_LPC17XX_40XX_LPC17_40_SDCARD_H */
diff --git a/arch/arm/src/lpc17xx/lpc17_serial.c b/arch/arm/src/lpc17xx_40xx/lpc17_40_serial.c
similarity index 84%
rename from arch/arm/src/lpc17xx/lpc17_serial.c
rename to arch/arm/src/lpc17xx_40xx/lpc17_40_serial.c
index cdd4ae29a9a..7b3c920013b 100644
--- a/arch/arm/src/lpc17xx/lpc17_serial.c
+++ b/arch/arm/src/lpc17xx_40xx/lpc17_40_serial.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * arch/arm/src/lpc17xx/lpc17_serial.c
+ * arch/arm/src/lpc17xx_40xx/lpc17_40_serial.c
*
* Copyright (C) 2010-2013, 2017-2018 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt
@@ -62,9 +62,9 @@
#include "up_internal.h"
#include "chip.h"
-#include "hardware/lpc17_uart.h"
-#include "lpc17_gpio.h"
-#include "lpc17_serial.h"
+#include "hardware/lpc17_40_uart.h"
+#include "lpc17_40_gpio.h"
+#include "lpc17_40_serial.h"
/****************************************************************************
* Pre-processor definitions
@@ -139,34 +139,34 @@ static const struct uart_ops_s g_uart_ops =
/* I/O buffers */
-#ifdef CONFIG_LPC17_UART0
+#ifdef CONFIG_LPC17_40_UART0
static char g_uart0rxbuffer[CONFIG_UART0_RXBUFSIZE];
static char g_uart0txbuffer[CONFIG_UART0_TXBUFSIZE];
#endif
-#ifdef CONFIG_LPC17_UART1
+#ifdef CONFIG_LPC17_40_UART1
static char g_uart1rxbuffer[CONFIG_UART1_RXBUFSIZE];
static char g_uart1txbuffer[CONFIG_UART1_TXBUFSIZE];
#endif
-#ifdef CONFIG_LPC17_UART2
+#ifdef CONFIG_LPC17_40_UART2
static char g_uart2rxbuffer[CONFIG_UART2_RXBUFSIZE];
static char g_uart2txbuffer[CONFIG_UART2_TXBUFSIZE];
#endif
-#ifdef CONFIG_LPC17_UART3
+#ifdef CONFIG_LPC17_40_UART3
static char g_uart3rxbuffer[CONFIG_UART3_RXBUFSIZE];
static char g_uart3txbuffer[CONFIG_UART3_TXBUFSIZE];
#endif
-/* This describes the state of the LPC17xx uart0 port. */
+/* This describes the state of the LPC17xx/LPC40xx uart0 port. */
-#ifdef CONFIG_LPC17_UART0
+#ifdef CONFIG_LPC17_40_UART0
static struct up_dev_s g_uart0priv =
{
- .uartbase = LPC17_UART0_BASE,
+ .uartbase = LPC17_40_UART0_BASE,
.baud = CONFIG_UART0_BAUD,
- .irq = LPC17_IRQ_UART0,
+ .irq = LPC17_40_IRQ_UART0,
.parity = CONFIG_UART0_PARITY,
.bits = CONFIG_UART0_BITS,
.stopbits2 = CONFIG_UART0_2STOP,
@@ -189,14 +189,14 @@ static uart_dev_t g_uart0port =
};
#endif
-/* This describes the state of the LPC17xx uart1 port. */
+/* This describes the state of the LPC17xx/LPC40xx uart1 port. */
-#ifdef CONFIG_LPC17_UART1
+#ifdef CONFIG_LPC17_40_UART1
static struct up_dev_s g_uart1priv =
{
- .uartbase = LPC17_UART1_BASE,
+ .uartbase = LPC17_40_UART1_BASE,
.baud = CONFIG_UART1_BAUD,
- .irq = LPC17_IRQ_UART1,
+ .irq = LPC17_40_IRQ_UART1,
.parity = CONFIG_UART1_PARITY,
.bits = CONFIG_UART1_BITS,
.stopbits2 = CONFIG_UART1_2STOP,
@@ -219,14 +219,14 @@ static uart_dev_t g_uart1port =
};
#endif
-/* This describes the state of the LPC17xx uart1 port. */
+/* This describes the state of the LPC17xx/LPC40xx uart1 port. */
-#ifdef CONFIG_LPC17_UART2
+#ifdef CONFIG_LPC17_40_UART2
static struct up_dev_s g_uart2priv =
{
- .uartbase = LPC17_UART2_BASE,
+ .uartbase = LPC17_40_UART2_BASE,
.baud = CONFIG_UART2_BAUD,
- .irq = LPC17_IRQ_UART2,
+ .irq = LPC17_40_IRQ_UART2,
.parity = CONFIG_UART2_PARITY,
.bits = CONFIG_UART2_BITS,
.stopbits2 = CONFIG_UART2_2STOP,
@@ -249,14 +249,14 @@ static uart_dev_t g_uart2port =
};
#endif
-/* This describes the state of the LPC17xx uart1 port. */
+/* This describes the state of the LPC17xx/LPC40xx uart1 port. */
-#ifdef CONFIG_LPC17_UART3
+#ifdef CONFIG_LPC17_40_UART3
static struct up_dev_s g_uart3priv =
{
- .uartbase = LPC17_UART3_BASE,
+ .uartbase = LPC17_40_UART3_BASE,
.baud = CONFIG_UART3_BAUD,
- .irq = LPC17_IRQ_UART3,
+ .irq = LPC17_40_IRQ_UART3,
.parity = CONFIG_UART3_PARITY,
.bits = CONFIG_UART3_BITS,
.stopbits2 = CONFIG_UART3_2STOP,
@@ -285,17 +285,17 @@ static uart_dev_t g_uart3port =
# if defined(CONFIG_UART0_SERIAL_CONSOLE)
# define CONSOLE_DEV g_uart0port /* UART0=console */
# define TTYS0_DEV g_uart0port /* UART0=ttyS0 */
-# ifdef CONFIG_LPC17_UART1
+# ifdef CONFIG_LPC17_40_UART1
# define TTYS1_DEV g_uart1port /* UART0=ttyS0;UART1=ttyS1 */
-# ifdef CONFIG_LPC17_UART2
+# ifdef CONFIG_LPC17_40_UART2
# define TTYS2_DEV g_uart2port /* UART0=ttyS0;UART1=ttyS1;UART2=ttyS2 */
-# ifdef CONFIG_LPC17_UART3
+# ifdef CONFIG_LPC17_40_UART3
# define TTYS3_DEV g_uart3port /* UART0=ttyS0;UART1=ttyS1;UART2=ttyS2;UART3=ttyS3 */
# else
# undef TTYS3_DEV /* UART0=ttyS0;UART1=ttyS1;UART2=ttyS;No ttyS3 */
# endif
# else
-# ifdef CONFIG_LPC17_UART3
+# ifdef CONFIG_LPC17_40_UART3
# define TTYS2_DEV g_uart3port /* UART0=ttyS0;UART1=ttyS1;UART3=ttys2;No ttyS3 */
# else
# undef TTYS2_DEV /* UART0=ttyS0;UART1=ttyS1;No ttyS2;No ttyS3 */
@@ -303,16 +303,16 @@ static uart_dev_t g_uart3port =
# undef TTYS3_DEV /* No ttyS3 */
# endif
# else
-# ifdef CONFIG_LPC17_UART2
+# ifdef CONFIG_LPC17_40_UART2
# define TTYS1_DEV g_uart2port /* UART0=ttyS0;UART2=ttyS1;No ttyS3 */
-# ifdef CONFIG_LPC17_UART3
+# ifdef CONFIG_LPC17_40_UART3
# define TTYS2_DEV g_uart3port /* UART0=ttyS0;UART2=ttyS1;UART3=ttyS2;No ttyS3 */
# else
# undef TTYS2_DEV /* UART0=ttyS0;UART2=ttyS1;No ttyS2;No ttyS3 */
# endif
# undef TTYS3_DEV /* No ttyS3 */
# else
-# ifdef CONFIG_LPC17_UART3
+# ifdef CONFIG_LPC17_40_UART3
# define TTYS1_DEV g_uart3port /* UART0=ttyS0;UART3=ttyS1;No ttyS2;No ttyS3 */
# else
# undef TTYS1_DEV /* UART0=ttyS0;No ttyS1;No ttyS2;No ttyS3 */
@@ -324,17 +324,17 @@ static uart_dev_t g_uart3port =
# elif defined(CONFIG_UART1_SERIAL_CONSOLE)
# define CONSOLE_DEV g_uart1port /* UART1=console */
# define TTYS0_DEV g_uart1port /* UART1=ttyS0 */
-# ifdef CONFIG_LPC17_UART0
+# ifdef CONFIG_LPC17_40_UART0
# define TTYS1_DEV g_uart0port /* UART1=ttyS0;UART0=ttyS1 */
-# ifdef CONFIG_LPC17_UART2
+# ifdef CONFIG_LPC17_40_UART2
# define TTYS2_DEV g_uart2port /* UART1=ttyS0;UART0=ttyS1;UART2=ttyS2 */
-# ifdef CONFIG_LPC17_UART3
+# ifdef CONFIG_LPC17_40_UART3
# define TTYS3_DEV g_uart3port /* UART1=ttyS0;UART0=ttyS1;UART2=ttyS2;UART3=ttyS3 */
# else
# undef TTYS3_DEV /* UART1=ttyS0;UART0=ttyS1;UART2=ttyS;No ttyS3 */
# endif
# else
-# ifdef CONFIG_LPC17_UART3
+# ifdef CONFIG_LPC17_40_UART3
# define TTYS2_DEV g_uart3port /* UART1=ttyS0;UART0=ttyS1;UART3=ttys2;No ttyS3 */
# else
# undef TTYS2_DEV /* UART1=ttyS0;UART0=ttyS1;No ttyS2;No ttyS3 */
@@ -342,16 +342,16 @@ static uart_dev_t g_uart3port =
# undef TTYS3_DEV /* No ttyS3 */
# endif
# else
-# ifdef CONFIG_LPC17_UART2
+# ifdef CONFIG_LPC17_40_UART2
# define TTYS1_DEV g_uart2port /* UART1=ttyS0;UART2=ttyS1 */
-# ifdef CONFIG_LPC17_UART3
+# ifdef CONFIG_LPC17_40_UART3
# define TTYS2_DEV g_uart3port /* UART1=ttyS0;UART2=ttyS1;UART3=ttyS2;No ttyS3 */
# else
# undef TTYS2_DEV /* UART1=ttyS0;UART2=ttyS1;No ttyS2;No ttyS3 */
# endif
# undef TTYS3_DEV /* No ttyS3 */
# else
-# ifdef CONFIG_LPC17_UART3
+# ifdef CONFIG_LPC17_40_UART3
# define TTYS1_DEV g_uart3port /* UART1=ttyS0;UART3=ttyS1;No ttyS2;No ttyS3 */
# else
# undef TTYS1_DEV /* UART1=ttyS0;No ttyS1;No ttyS2;No ttyS3 */
@@ -363,17 +363,17 @@ static uart_dev_t g_uart3port =
# elif defined(CONFIG_UART2_SERIAL_CONSOLE)
# define CONSOLE_DEV g_uart2port /* UART2=console */
# define TTYS0_DEV g_uart2port /* UART2=ttyS0 */
-# ifdef CONFIG_LPC17_UART2
+# ifdef CONFIG_LPC17_40_UART2
# define TTYS1_DEV g_uart0port /* UART2=ttyS0;UART0=ttyS1 */
-# ifdef CONFIG_LPC17_UART1
+# ifdef CONFIG_LPC17_40_UART1
# define TTYS2_DEV g_uart1port /* UART2=ttyS0;UART0=ttyS1;UART1=ttyS2 */
-# ifdef CONFIG_LPC17_UART3
+# ifdef CONFIG_LPC17_40_UART3
# define TTYS3_DEV g_uart3port /* UART2=ttyS0;UART0=ttyS1;UART1=ttyS2;UART3=ttyS3 */
# else
# undef TTYS3_DEV /* UART2=ttyS0;UART0=ttyS1;UART1=ttyS;No ttyS3 */
# endif
# else
-# ifdef CONFIG_LPC17_UART3
+# ifdef CONFIG_LPC17_40_UART3
# define TTYS2_DEV g_uart3port /* UART2=ttyS0;UART0=ttyS1;UART3=ttys2;No ttyS3 */
# else
# undef TTYS2_DEV /* UART2=ttyS0;UART0=ttyS1;No ttyS2;No ttyS3 */
@@ -381,16 +381,16 @@ static uart_dev_t g_uart3port =
# undef TTYS3_DEV /* No ttyS3 */
# endif
# else
-# ifdef CONFIG_LPC17_UART1
+# ifdef CONFIG_LPC17_40_UART1
# define TTYS1_DEV g_uart1port /* UART2=ttyS0;UART1=ttyS1 */
-# ifdef CONFIG_LPC17_UART3
+# ifdef CONFIG_LPC17_40_UART3
# define TTYS2_DEV g_uart3port /* UART2=ttyS0;UART1=ttyS1;UART3=ttyS2 */
# else
# undef TTYS2_DEV /* UART2=ttyS0;UART1=ttyS1;No ttyS2;No ttyS3 */
# endif
# undef TTYS3_DEV /* No ttyS3 */
# else
-# ifdef CONFIG_LPC17_UART3
+# ifdef CONFIG_LPC17_40_UART3
# define TTYS1_DEV g_uart3port /* UART2=ttyS0;UART3=ttyS1;No ttyS3 */
# else
# undef TTYS1_DEV /* UART2=ttyS0;No ttyS1;No ttyS2;No ttyS3 */
@@ -402,17 +402,17 @@ static uart_dev_t g_uart3port =
# elif defined(CONFIG_UART3_SERIAL_CONSOLE)
# define CONSOLE_DEV g_uart3port /* UART3=console */
# define TTYS0_DEV g_uart3port /* UART3=ttyS0 */
-# ifdef CONFIG_LPC17_UART0
+# ifdef CONFIG_LPC17_40_UART0
# define TTYS1_DEV g_uart0port /* UART3=ttyS0;UART0=ttyS1 */
-# ifdef CONFIG_LPC17_UART1
+# ifdef CONFIG_LPC17_40_UART1
# define TTYS2_DEV g_uart1port /* UART3=ttyS0;UART0=ttyS1;UART1=ttyS2 */
-# ifdef CONFIG_LPC17_UART2
+# ifdef CONFIG_LPC17_40_UART2
# define TTYS3_DEV g_uart2port /* UART3=ttyS0;UART0=ttyS1;UART1=ttyS2;UART2=ttyS3 */
# else
# undef TTYS3_DEV /* UART3=ttyS0;UART0=ttyS1;UART1=ttyS;No ttyS3 */
# endif
# else
-# ifdef CONFIG_LPC17_UART2
+# ifdef CONFIG_LPC17_40_UART2
# define TTYS2_DEV g_uart2port /* UART3=ttyS0;UART0=ttyS1;UART2=ttys2;No ttyS3 */
# else
# undef TTYS2_DEV /* UART3=ttyS0;UART0=ttyS1;No ttyS2;No ttyS3 */
@@ -420,16 +420,16 @@ static uart_dev_t g_uart3port =
# undef TTYS3_DEV /* No ttyS3 */
# endif
# else
-# ifdef CONFIG_LPC17_UART1
+# ifdef CONFIG_LPC17_40_UART1
# define TTYS1_DEV g_uart1port /* UART3=ttyS0;UART1=ttyS1 */
-# ifdef CONFIG_LPC17_UART2
+# ifdef CONFIG_LPC17_40_UART2
# define TTYS2_DEV g_uart2port /* UART3=ttyS0;UART1=ttyS1;UART2=ttyS2;No ttyS3 */
# else
# undef TTYS2_DEV /* UART3=ttyS0;UART1=ttyS1;No ttyS2;No ttyS3 */
# endif
# undef TTYS3_DEV /* No ttyS3 */
# else
-# ifdef CONFIG_LPC17_UART2
+# ifdef CONFIG_LPC17_40_UART2
# define TTYS1_DEV g_uart2port /* UART3=ttyS0;UART2=ttyS1;No ttyS3;No ttyS3 */
# undef TTYS3_DEV /* UART3=ttyS0;UART2=ttyS1;No ttyS2;No ttyS3 */
# else
@@ -442,17 +442,17 @@ static uart_dev_t g_uart3port =
# endif
#else /* No console */
# define TTYS0_DEV g_uart0port /* UART0=ttyS0 */
-# ifdef CONFIG_LPC17_UART1
+# ifdef CONFIG_LPC17_40_UART1
# define TTYS1_DEV g_uart1port /* UART0=ttyS0;UART1=ttyS1 */
-# ifdef CONFIG_LPC17_UART2
+# ifdef CONFIG_LPC17_40_UART2
# define TTYS2_DEV g_uart2port /* UART0=ttyS0;UART1=ttyS1;UART2=ttyS2 */
-# ifdef CONFIG_LPC17_UART3
+# ifdef CONFIG_LPC17_40_UART3
# define TTYS3_DEV g_uart3port /* UART0=ttyS0;UART1=ttyS1;UART2=ttyS2;UART3=ttyS3 */
# else
# undef TTYS3_DEV /* UART0=ttyS0;UART1=ttyS1;UART2=ttyS;No ttyS3 */
# endif
# else
-# ifdef CONFIG_LPC17_UART3
+# ifdef CONFIG_LPC17_40_UART3
# define TTYS2_DEV g_uart3port /* UART0=ttyS0;UART1=ttyS1;UART3=ttys2;No ttyS3 */
# else
# undef TTYS2_DEV /* UART0=ttyS0;UART1=ttyS1;No ttyS2;No ttyS3 */
@@ -460,16 +460,16 @@ static uart_dev_t g_uart3port =
# undef TTYS3_DEV /* No ttyS3 */
# endif
# else
-# ifdef CONFIG_LPC17_UART2
+# ifdef CONFIG_LPC17_40_UART2
# define TTYS1_DEV g_uart2port /* UART0=ttyS0;UART2=ttyS1;No ttyS3 */
-# ifdef CONFIG_LPC17_UART3
+# ifdef CONFIG_LPC17_40_UART3
# define TTYS2_DEV g_uart3port /* UART0=ttyS0;UART2=ttyS1;UART3=ttyS2;No ttyS3 */
# else
# undef TTYS2_DEV /* UART0=ttyS0;UART2=ttyS1;No ttyS2;No ttyS3 */
# endif
# undef TTYS3_DEV /* No ttyS3 */
# else
-# ifdef CONFIG_LPC17_UART3
+# ifdef CONFIG_LPC17_40_UART3
# define TTYS1_DEV g_uart3port /* UART0=ttyS0;UART3=ttyS1;No ttyS2;No ttyS3 */
# else
# undef TTYS1_DEV /* UART0=ttyS0;No ttyS1;No ttyS2;No ttyS3 */
@@ -514,7 +514,7 @@ static inline void up_disableuartint(struct up_dev_s *priv, uint32_t *ier)
}
priv->ier &= ~UART_IER_ALLIE;
- up_serialout(priv, LPC17_UART_IER_OFFSET, priv->ier);
+ up_serialout(priv, LPC17_40_UART_IER_OFFSET, priv->ier);
}
/****************************************************************************
@@ -524,7 +524,7 @@ static inline void up_disableuartint(struct up_dev_s *priv, uint32_t *ier)
static inline void up_restoreuartint(struct up_dev_s *priv, uint32_t ier)
{
priv->ier |= ier & UART_IER_ALLIE;
- up_serialout(priv, LPC17_UART_IER_OFFSET, priv->ier);
+ up_serialout(priv, LPC17_40_UART_IER_OFFSET, priv->ier);
}
/****************************************************************************
@@ -533,7 +533,7 @@ static inline void up_restoreuartint(struct up_dev_s *priv, uint32_t ier)
static inline void up_enablebreaks(struct up_dev_s *priv, bool enable)
{
- uint32_t lcr = up_serialin(priv, LPC17_UART_LCR_OFFSET);
+ uint32_t lcr = up_serialin(priv, LPC17_40_UART_LCR_OFFSET);
if (enable)
{
@@ -544,11 +544,11 @@ static inline void up_enablebreaks(struct up_dev_s *priv, bool enable)
lcr &= ~UART_LCR_BRK;
}
- up_serialout(priv, LPC17_UART_LCR_OFFSET, lcr);
+ up_serialout(priv, LPC17_40_UART_LCR_OFFSET, lcr);
}
/************************************************************************************
- * Name: lpc17_uartcclkdiv
+ * Name: lpc17_40_uartcclkdiv
*
* Description:
* Select a CCLK divider to produce the UART PCLK. The stratey is to select the
@@ -567,7 +567,7 @@ static inline void up_enablebreaks(struct up_dev_s *priv, bool enable)
*
* PCLK = CCLK / divisor
*
- * For the LPC178x, the PCLK is determined by the global divisor setting in
+ * For the LPC178x/40xx, the PCLK is determined by the global divisor setting in
* the PLKSEL register (and, in that case, this function is not needed).
*
* NOTE: This is an inline function. If a typical optimization level is used and
@@ -577,7 +577,7 @@ static inline void up_enablebreaks(struct up_dev_s *priv, bool enable)
************************************************************************************/
#ifdef LPC176x
-static inline uint32_t lpc17_uartcclkdiv(uint32_t baud)
+static inline uint32_t lpc17_40_uartcclkdiv(uint32_t baud)
{
/* Ignoring the fractional divider, the BAUD is given by:
*
@@ -589,7 +589,7 @@ static inline uint32_t lpc17_uartcclkdiv(uint32_t baud)
*
* PCLK = CCLK / divisor
*
- * And for the LPC178x, the PCLK is determined by the global divisor setting in
+ * And for the LPC178x/40xx, the PCLK is determined by the global divisor setting in
* the PLKSEL register (and, in that case, this function is not needed).
*/
@@ -609,7 +609,7 @@ static inline uint32_t lpc17_uartcclkdiv(uint32_t baud)
* BAUD <= CCLK / 16 / MinDL
*/
- if (baud < (LPC17_CCLK / 16 / UART_MINDL))
+ if (baud < (LPC17_40_CCLK / 16 / UART_MINDL))
{
return SYSCON_PCLKSEL_CCLK;
}
@@ -625,7 +625,7 @@ static inline uint32_t lpc17_uartcclkdiv(uint32_t baud)
* BAUD <= CCLK / 8 / MinDL
*/
- else if (baud < (LPC17_CCLK / 8 / UART_MINDL))
+ else if (baud < (LPC17_40_CCLK / 8 / UART_MINDL))
{
return SYSCON_PCLKSEL_CCLK2;
}
@@ -641,7 +641,7 @@ static inline uint32_t lpc17_uartcclkdiv(uint32_t baud)
* BAUD <= CCLK / 4 / MinDL
*/
- else if (baud < (LPC17_CCLK / 4 / UART_MINDL))
+ else if (baud < (LPC17_40_CCLK / 4 / UART_MINDL))
{
return SYSCON_PCLKSEL_CCLK4;
}
@@ -657,7 +657,7 @@ static inline uint32_t lpc17_uartcclkdiv(uint32_t baud)
* BAUD <= CCLK / 2 / MinDL
*/
- else /* if (baud < (LPC17_CCLK / 2 / UART_MINDL)) */
+ else /* if (baud < (LPC17_40_CCLK / 2 / UART_MINDL)) */
{
return SYSCON_PCLKSEL_CCLK8;
}
@@ -665,7 +665,7 @@ static inline uint32_t lpc17_uartcclkdiv(uint32_t baud)
#endif /* LPC176x */
/************************************************************************************
- * Name: lpc17_uart0config, uart1config, uart2config, and uart3config
+ * Name: lpc17_40_uart0config, uart1config, uart2config, and uart3config
*
* Description:
* Configure the UART. UART0/1/2/3 peripherals are configured using the following
@@ -682,8 +682,8 @@ static inline uint32_t lpc17_uartcclkdiv(uint32_t baud)
*
************************************************************************************/
-#ifdef CONFIG_LPC17_UART0
-static inline void lpc17_uart0config(void)
+#ifdef CONFIG_LPC17_40_UART0
+static inline void lpc17_40_uart0config(void)
{
uint32_t regval;
irqstate_t flags;
@@ -691,29 +691,29 @@ static inline void lpc17_uart0config(void)
/* Step 1: Enable power on UART0 */
flags = enter_critical_section();
- regval = getreg32(LPC17_SYSCON_PCONP);
+ regval = getreg32(LPC17_40_SYSCON_PCONP);
regval |= SYSCON_PCONP_PCUART0;
- putreg32(regval, LPC17_SYSCON_PCONP);
+ putreg32(regval, LPC17_40_SYSCON_PCONP);
/* Step 2: Enable clocking on UART */
#ifdef LPC176x
- regval = getreg32(LPC17_SYSCON_PCLKSEL0);
+ regval = getreg32(LPC17_40_SYSCON_PCLKSEL0);
regval &= ~SYSCON_PCLKSEL0_UART0_MASK;
regval |= ((uint32_t)g_uart0priv.cclkdiv << SYSCON_PCLKSEL0_UART0_SHIFT);
- putreg32(regval, LPC17_SYSCON_PCLKSEL0);
+ putreg32(regval, LPC17_40_SYSCON_PCLKSEL0);
#endif
/* Step 3: Configure I/O pins */
- lpc17_configgpio(GPIO_UART0_TXD);
- lpc17_configgpio(GPIO_UART0_RXD);
+ lpc17_40_configgpio(GPIO_UART0_TXD);
+ lpc17_40_configgpio(GPIO_UART0_RXD);
leave_critical_section(flags);
};
#endif
-#ifdef CONFIG_LPC17_UART1
-static inline void lpc17_uart1config(void)
+#ifdef CONFIG_LPC17_40_UART1
+static inline void lpc17_40_uart1config(void)
{
uint32_t regval;
irqstate_t flags;
@@ -721,39 +721,39 @@ static inline void lpc17_uart1config(void)
/* Step 1: Enable power on UART1 */
flags = enter_critical_section();
- regval = getreg32(LPC17_SYSCON_PCONP);
+ regval = getreg32(LPC17_40_SYSCON_PCONP);
regval |= SYSCON_PCONP_PCUART1;
- putreg32(regval, LPC17_SYSCON_PCONP);
+ putreg32(regval, LPC17_40_SYSCON_PCONP);
/* Step 2: Enable clocking on UART */
#ifdef LPC176x
- regval = getreg32(LPC17_SYSCON_PCLKSEL0);
+ regval = getreg32(LPC17_40_SYSCON_PCLKSEL0);
regval &= ~SYSCON_PCLKSEL0_UART1_MASK;
regval |= ((uint32_t)g_uart1priv.cclkdiv << SYSCON_PCLKSEL0_UART1_SHIFT);
- putreg32(regval, LPC17_SYSCON_PCLKSEL0);
+ putreg32(regval, LPC17_40_SYSCON_PCLKSEL0);
#endif
/* Step 3: Configure I/O pins */
- lpc17_configgpio(GPIO_UART1_TXD);
- lpc17_configgpio(GPIO_UART1_RXD);
+ lpc17_40_configgpio(GPIO_UART1_TXD);
+ lpc17_40_configgpio(GPIO_UART1_RXD);
#if defined(CONFIG_UART1_IFLOWCONTROL) || defined(CONFIG_UART1_OFLOWCONTROL)
- lpc17_configgpio(GPIO_UART1_CTS);
- lpc17_configgpio(GPIO_UART1_RTS);
- lpc17_configgpio(GPIO_UART1_DCD);
- lpc17_configgpio(GPIO_UART1_DSR);
- lpc17_configgpio(GPIO_UART1_DTR);
-#ifdef CONFIG_LPC17_UART1_RINGINDICATOR
- lpc17_configgpio(GPIO_UART1_RI);
+ lpc17_40_configgpio(GPIO_UART1_CTS);
+ lpc17_40_configgpio(GPIO_UART1_RTS);
+ lpc17_40_configgpio(GPIO_UART1_DCD);
+ lpc17_40_configgpio(GPIO_UART1_DSR);
+ lpc17_40_configgpio(GPIO_UART1_DTR);
+#ifdef CONFIG_LPC17_40_UART1_RINGINDICATOR
+ lpc17_40_configgpio(GPIO_UART1_RI);
#endif
#endif
leave_critical_section(flags);
};
#endif
-#ifdef CONFIG_LPC17_UART2
-static inline void lpc17_uart2config(void)
+#ifdef CONFIG_LPC17_40_UART2
+static inline void lpc17_40_uart2config(void)
{
uint32_t regval;
irqstate_t flags;
@@ -761,29 +761,29 @@ static inline void lpc17_uart2config(void)
/* Step 1: Enable power on UART2 */
flags = enter_critical_section();
- regval = getreg32(LPC17_SYSCON_PCONP);
+ regval = getreg32(LPC17_40_SYSCON_PCONP);
regval |= SYSCON_PCONP_PCUART2;
- putreg32(regval, LPC17_SYSCON_PCONP);
+ putreg32(regval, LPC17_40_SYSCON_PCONP);
/* Step 2: Enable clocking on UART */
#ifdef LPC176x
- regval = getreg32(LPC17_SYSCON_PCLKSEL1);
+ regval = getreg32(LPC17_40_SYSCON_PCLKSEL1);
regval &= ~SYSCON_PCLKSEL1_UART2_MASK;
regval |= ((uint32_t)g_uart2priv.cclkdiv << SYSCON_PCLKSEL1_UART2_SHIFT);
- putreg32(regval, LPC17_SYSCON_PCLKSEL1);
+ putreg32(regval, LPC17_40_SYSCON_PCLKSEL1);
#endif
/* Step 3: Configure I/O pins */
- lpc17_configgpio(GPIO_UART2_TXD);
- lpc17_configgpio(GPIO_UART2_RXD);
+ lpc17_40_configgpio(GPIO_UART2_TXD);
+ lpc17_40_configgpio(GPIO_UART2_RXD);
leave_critical_section(flags);
};
#endif
-#ifdef CONFIG_LPC17_UART3
-static inline void lpc17_uart3config(void)
+#ifdef CONFIG_LPC17_40_UART3
+static inline void lpc17_40_uart3config(void)
{
uint32_t regval;
irqstate_t flags;
@@ -791,29 +791,29 @@ static inline void lpc17_uart3config(void)
/* Step 1: Enable power on UART3 */
flags = enter_critical_section();
- regval = getreg32(LPC17_SYSCON_PCONP);
+ regval = getreg32(LPC17_40_SYSCON_PCONP);
regval |= SYSCON_PCONP_PCUART3;
- putreg32(regval, LPC17_SYSCON_PCONP);
+ putreg32(regval, LPC17_40_SYSCON_PCONP);
/* Step 2: Enable clocking on UART */
#ifdef LPC176x
- regval = getreg32(LPC17_SYSCON_PCLKSEL1);
+ regval = getreg32(LPC17_40_SYSCON_PCLKSEL1);
regval &= ~SYSCON_PCLKSEL1_UART3_MASK;
regval |= ((uint32_t)g_uart3priv.cclkdiv << SYSCON_PCLKSEL1_UART3_SHIFT);
- putreg32(regval, LPC17_SYSCON_PCLKSEL1);
+ putreg32(regval, LPC17_40_SYSCON_PCLKSEL1);
#endif
/* Step 3: Configure I/O pins */
- lpc17_configgpio(GPIO_UART3_TXD);
- lpc17_configgpio(GPIO_UART3_RXD);
+ lpc17_40_configgpio(GPIO_UART3_TXD);
+ lpc17_40_configgpio(GPIO_UART3_RXD);
leave_critical_section(flags);
};
#endif
/************************************************************************************
- * Name: lpc17_uartdl
+ * Name: lpc17_40_uartdl
*
* Description:
* Select a divider to produce the BAUD from the UART PCLK.
@@ -828,34 +828,34 @@ static inline void lpc17_uart3config(void)
************************************************************************************/
#ifdef LPC176x
-static inline uint32_t lpc17_uartdl(uint32_t baud, uint8_t divcode)
+static inline uint32_t lpc17_40_uartdl(uint32_t baud, uint8_t divcode)
{
uint32_t num;
switch (divcode)
{
case SYSCON_PCLKSEL_CCLK4: /* PCLK_peripheral = CCLK/4 */
- num = (LPC17_CCLK / 4);
+ num = (LPC17_40_CCLK / 4);
break;
case SYSCON_PCLKSEL_CCLK: /* PCLK_peripheral = CCLK */
- num = LPC17_CCLK;
+ num = LPC17_40_CCLK;
break;
case SYSCON_PCLKSEL_CCLK2: /* PCLK_peripheral = CCLK/2 */
- num = (LPC17_CCLK / 2);
+ num = (LPC17_40_CCLK / 2);
break;
case SYSCON_PCLKSEL_CCLK8: /* PCLK_peripheral = CCLK/8 (except CAN1, CAN2, and CAN) */
default:
- num = (LPC17_CCLK / 8);
+ num = (LPC17_40_CCLK / 8);
break;
}
return num / (baud << 4);
}
#else
-static inline uint32_t lpc17_uartdl(uint32_t baud)
+static inline uint32_t lpc17_40_uartdl(uint32_t baud)
{
return (uint32_t)BOARD_PCLK_FREQUENCY / (baud << 4);
}
@@ -883,15 +883,15 @@ static int up_setup(struct uart_dev_s *dev)
/* Clear fifos */
- up_serialout(priv, LPC17_UART_FCR_OFFSET, (UART_FCR_RXRST | UART_FCR_TXRST));
+ up_serialout(priv, LPC17_40_UART_FCR_OFFSET, (UART_FCR_RXRST | UART_FCR_TXRST));
/* Set trigger */
- up_serialout(priv, LPC17_UART_FCR_OFFSET, (UART_FCR_FIFOEN | UART_FCR_RXTRIGGER_8));
+ up_serialout(priv, LPC17_40_UART_FCR_OFFSET, (UART_FCR_FIFOEN | UART_FCR_RXTRIGGER_8));
/* Set up the IER */
- priv->ier = up_serialin(priv, LPC17_UART_IER_OFFSET);
+ priv->ier = up_serialin(priv, LPC17_40_UART_IER_OFFSET);
/* Set up the LCR */
@@ -924,44 +924,44 @@ static int up_setup(struct uart_dev_s *dev)
* ignored by baudrate calculation => has to be disabled
*/
- up_serialout(priv, LPC17_UART_FDR_OFFSET,
+ up_serialout(priv, LPC17_40_UART_FDR_OFFSET,
(1 << UART_FDR_MULVAL_SHIFT) + (0 << UART_FDR_DIVADDVAL_SHIFT));
/* Enter DLAB=1 */
- up_serialout(priv, LPC17_UART_LCR_OFFSET, (lcr | UART_LCR_DLAB));
+ up_serialout(priv, LPC17_40_UART_LCR_OFFSET, (lcr | UART_LCR_DLAB));
/* Set the BAUD divisor */
#ifdef LPC176x
- dl = lpc17_uartdl(priv->baud, priv->cclkdiv);
+ dl = lpc17_40_uartdl(priv->baud, priv->cclkdiv);
#else
- dl = lpc17_uartdl(priv->baud);
+ dl = lpc17_40_uartdl(priv->baud);
#endif
- up_serialout(priv, LPC17_UART_DLM_OFFSET, dl >> 8);
- up_serialout(priv, LPC17_UART_DLL_OFFSET, dl & 0xff);
+ up_serialout(priv, LPC17_40_UART_DLM_OFFSET, dl >> 8);
+ up_serialout(priv, LPC17_40_UART_DLL_OFFSET, dl & 0xff);
/* Clear DLAB */
- up_serialout(priv, LPC17_UART_LCR_OFFSET, lcr);
+ up_serialout(priv, LPC17_40_UART_LCR_OFFSET, lcr);
/* Configure the FIFOs */
- up_serialout(priv, LPC17_UART_FCR_OFFSET,
+ up_serialout(priv, LPC17_40_UART_FCR_OFFSET,
(UART_FCR_RXTRIGGER_8 | UART_FCR_TXRST | UART_FCR_RXRST |
UART_FCR_FIFOEN));
/* Enable Auto-RTS and Auto-CS Flow Control in the Modem Control Register */
#if defined(CONFIG_UART1_IFLOWCONTROL) || defined(CONFIG_UART1_OFLOWCONTROL)
- if (priv->uartbase == LPC17_UART1_BASE)
+ if (priv->uartbase == LPC17_40_UART1_BASE)
{
#if defined(CONFIG_UART1_IFLOWCONTROL) && defined(CONFIG_UART1_OFLOWCONTROL)
- up_serialout(priv, LPC17_UART_MCR_OFFSET, (UART_MCR_RTSEN | UART_MCR_CTSEN));
+ up_serialout(priv, LPC17_40_UART_MCR_OFFSET, (UART_MCR_RTSEN | UART_MCR_CTSEN));
#elif defined(CONFIG_UART1_IFLOWCONTROL)
- up_serialout(priv, LPC17_UART_MCR_OFFSET, UART_MCR_RTSEN);
+ up_serialout(priv, LPC17_40_UART_MCR_OFFSET, UART_MCR_RTSEN);
#else
- up_serialout(priv, LPC17_UART_MCR_OFFSET, UART_MCR_CTSEN);
+ up_serialout(priv, LPC17_40_UART_MCR_OFFSET, UART_MCR_CTSEN);
#endif
}
#endif
@@ -1068,7 +1068,7 @@ static int up_interrupt(int irq, void *context, void *arg)
* termination conditions
*/
- status = up_serialin(priv, LPC17_UART_IIR_OFFSET);
+ status = up_serialin(priv, LPC17_40_UART_IIR_OFFSET);
/* The UART_IIR_INTSTATUS bit should be zero if there are pending
* interrupts
@@ -1110,7 +1110,7 @@ static int up_interrupt(int irq, void *context, void *arg)
{
/* Read the modem status register (MSR) to clear */
- status = up_serialin(priv, LPC17_UART_MSR_OFFSET);
+ status = up_serialin(priv, LPC17_40_UART_MSR_OFFSET);
_info("MSR: %02x\n", status);
break;
}
@@ -1121,7 +1121,7 @@ static int up_interrupt(int irq, void *context, void *arg)
{
/* Read the line status register (LSR) to clear */
- status = up_serialin(priv, LPC17_UART_LSR_OFFSET);
+ status = up_serialin(priv, LPC17_40_UART_LSR_OFFSET);
_info("LSR: %02x\n", status);
break;
}
@@ -1235,27 +1235,27 @@ static int up_ioctl(struct file *filep, int cmd, unsigned long arg)
*/
#if 0 /* ifdef LPC176x */
- priv->cclkdiv = lpc17_uartcclkdiv(priv->baud);
+ priv->cclkdiv = lpc17_40_uartcclkdiv(priv->baud);
#endif
/* DLAB open latch */
/* REVISIT: Shouldn't we just call up_setup() to do all of the following? */
- lcr = getreg32(priv->uartbase + LPC17_UART_LCR_OFFSET);
- up_serialout(priv, LPC17_UART_LCR_OFFSET, (lcr | UART_LCR_DLAB));
+ lcr = getreg32(priv->uartbase + LPC17_40_UART_LCR_OFFSET);
+ up_serialout(priv, LPC17_40_UART_LCR_OFFSET, (lcr | UART_LCR_DLAB));
/* Set the BAUD divisor */
#ifdef LPC176x
- dl = lpc17_uartdl(priv->baud, priv->cclkdiv);
+ dl = lpc17_40_uartdl(priv->baud, priv->cclkdiv);
#else
- dl = lpc17_uartdl(priv->baud);
+ dl = lpc17_40_uartdl(priv->baud);
#endif
- up_serialout(priv, LPC17_UART_DLM_OFFSET, dl >> 8);
- up_serialout(priv, LPC17_UART_DLL_OFFSET, dl & 0xff);
+ up_serialout(priv, LPC17_40_UART_DLM_OFFSET, dl >> 8);
+ up_serialout(priv, LPC17_40_UART_DLL_OFFSET, dl & 0xff);
/* Clear DLAB */
- up_serialout(priv, LPC17_UART_LCR_OFFSET, lcr);
+ up_serialout(priv, LPC17_40_UART_LCR_OFFSET, lcr);
}
break;
#endif
@@ -1283,8 +1283,8 @@ static int up_receive(struct uart_dev_s *dev, uint32_t *status)
struct up_dev_s *priv = (struct up_dev_s *)dev->priv;
uint32_t rbr;
- *status = up_serialin(priv, LPC17_UART_LSR_OFFSET);
- rbr = up_serialin(priv, LPC17_UART_RBR_OFFSET);
+ *status = up_serialin(priv, LPC17_40_UART_LSR_OFFSET);
+ rbr = up_serialin(priv, LPC17_40_UART_RBR_OFFSET);
return rbr;
}
@@ -1310,7 +1310,7 @@ static void up_rxint(struct uart_dev_s *dev, bool enable)
priv->ier &= ~UART_IER_RBRIE;
}
- up_serialout(priv, LPC17_UART_IER_OFFSET, priv->ier);
+ up_serialout(priv, LPC17_40_UART_IER_OFFSET, priv->ier);
}
/****************************************************************************
@@ -1324,7 +1324,7 @@ static void up_rxint(struct uart_dev_s *dev, bool enable)
static bool up_rxavailable(struct uart_dev_s *dev)
{
struct up_dev_s *priv = (struct up_dev_s *)dev->priv;
- return ((up_serialin(priv, LPC17_UART_LSR_OFFSET) & UART_LSR_RDR) != 0);
+ return ((up_serialin(priv, LPC17_40_UART_LSR_OFFSET) & UART_LSR_RDR) != 0);
}
/****************************************************************************
@@ -1338,7 +1338,7 @@ static bool up_rxavailable(struct uart_dev_s *dev)
static void up_send(struct uart_dev_s *dev, int ch)
{
struct up_dev_s *priv = (struct up_dev_s *)dev->priv;
- up_serialout(priv, LPC17_UART_THR_OFFSET, (uint32_t)ch);
+ up_serialout(priv, LPC17_40_UART_THR_OFFSET, (uint32_t)ch);
}
/****************************************************************************
@@ -1359,7 +1359,7 @@ static void up_txint(struct uart_dev_s *dev, bool enable)
{
#ifndef CONFIG_SUPPRESS_SERIAL_INTS
priv->ier |= UART_IER_THREIE;
- up_serialout(priv, LPC17_UART_IER_OFFSET, priv->ier);
+ up_serialout(priv, LPC17_40_UART_IER_OFFSET, priv->ier);
/* Fake a TX interrupt here by just calling uart_xmitchars() with
* interrupts disabled (note this may recurse).
@@ -1371,7 +1371,7 @@ static void up_txint(struct uart_dev_s *dev, bool enable)
else
{
priv->ier &= ~UART_IER_THREIE;
- up_serialout(priv, LPC17_UART_IER_OFFSET, priv->ier);
+ up_serialout(priv, LPC17_40_UART_IER_OFFSET, priv->ier);
}
leave_critical_section(flags);
@@ -1388,7 +1388,7 @@ static void up_txint(struct uart_dev_s *dev, bool enable)
static bool up_txready(struct uart_dev_s *dev)
{
struct up_dev_s *priv = (struct up_dev_s *)dev->priv;
- return ((up_serialin(priv, LPC17_UART_LSR_OFFSET) & UART_LSR_THRE) != 0);
+ return ((up_serialin(priv, LPC17_40_UART_LSR_OFFSET) & UART_LSR_THRE) != 0);
}
/****************************************************************************
@@ -1402,7 +1402,7 @@ static bool up_txready(struct uart_dev_s *dev)
static bool up_txempty(struct uart_dev_s *dev)
{
struct up_dev_s *priv = (struct up_dev_s *)dev->priv;
- return ((up_serialin(priv, LPC17_UART_LSR_OFFSET) & UART_LSR_THRE) != 0);
+ return ((up_serialin(priv, LPC17_40_UART_LSR_OFFSET) & UART_LSR_THRE) != 0);
}
/****************************************************************************
@@ -1426,43 +1426,43 @@ void up_earlyserialinit(void)
{
/* Configure all UARTs (except the CONSOLE UART) and disable interrupts */
-#ifdef CONFIG_LPC17_UART0
+#ifdef CONFIG_LPC17_40_UART0
#ifdef LPC176x
- g_uart0priv.cclkdiv = lpc17_uartcclkdiv(CONFIG_UART0_BAUD);
+ g_uart0priv.cclkdiv = lpc17_40_uartcclkdiv(CONFIG_UART0_BAUD);
#endif
#ifndef CONFIG_UART0_SERIAL_CONSOLE
- lpc17_uart0config();
+ lpc17_40_uart0config();
#endif
up_disableuartint(&g_uart0priv, NULL);
#endif
-#ifdef CONFIG_LPC17_UART1
+#ifdef CONFIG_LPC17_40_UART1
#ifdef LPC176x
- g_uart1priv.cclkdiv = lpc17_uartcclkdiv(CONFIG_UART1_BAUD);
+ g_uart1priv.cclkdiv = lpc17_40_uartcclkdiv(CONFIG_UART1_BAUD);
#endif
#ifndef CONFIG_UART1_SERIAL_CONSOLE
- lpc17_uart1config();
+ lpc17_40_uart1config();
#else
#endif
up_disableuartint(&g_uart1priv, NULL);
#endif
-#ifdef CONFIG_LPC17_UART2
+#ifdef CONFIG_LPC17_40_UART2
#ifdef LPC176x
- g_uart2priv.cclkdiv = lpc17_uartcclkdiv(CONFIG_UART2_BAUD);
+ g_uart2priv.cclkdiv = lpc17_40_uartcclkdiv(CONFIG_UART2_BAUD);
#endif
#ifndef CONFIG_UART2_SERIAL_CONSOLE
- lpc17_uart2config();
+ lpc17_40_uart2config();
#endif
up_disableuartint(&g_uart2priv, NULL);
#endif
-#ifdef CONFIG_LPC17_UART3
+#ifdef CONFIG_LPC17_40_UART3
#ifdef LPC176x
- g_uart3priv.cclkdiv = lpc17_uartcclkdiv(CONFIG_UART3_BAUD);
+ g_uart3priv.cclkdiv = lpc17_40_uartcclkdiv(CONFIG_UART3_BAUD);
#endif
#ifndef CONFIG_UART3_SERIAL_CONSOLE
- lpc17_uart3config();
+ lpc17_40_uart3config();
#endif
up_disableuartint(&g_uart3priv, NULL);
#endif
diff --git a/arch/arm/src/lpc17xx/lpc17_serial.h b/arch/arm/src/lpc17xx_40xx/lpc17_40_serial.h
similarity index 90%
rename from arch/arm/src/lpc17xx/lpc17_serial.h
rename to arch/arm/src/lpc17xx_40xx/lpc17_40_serial.h
index 9e0205182bb..624deaa7b45 100644
--- a/arch/arm/src/lpc17xx/lpc17_serial.h
+++ b/arch/arm/src/lpc17xx_40xx/lpc17_40_serial.h
@@ -1,5 +1,5 @@
/************************************************************************************
- * arch/arm/src/lpc17xx/lpc17_serial.h
+ * arch/arm/src/lpc17xx_40xx/lpc17_40_serial.h
*
* Copyright (C) 2010, 2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt
@@ -33,8 +33,8 @@
*
************************************************************************************/
-#ifndef __ARCH_ARM_SRC_LPC17XX_LPC17_SERIAL_H
-#define __ARCH_ARM_SRC_LPC17XX_LPC17_SERIAL_H
+#ifndef __ARCH_ARM_SRC_LPC17XX_40XX_LPC17_40_SERIAL_H
+#define __ARCH_ARM_SRC_LPC17XX_40XX_LPC17_40_SERIAL_H
/************************************************************************************
* Included Files
@@ -43,10 +43,10 @@
#include
#include
-#include "hardware/lpc17_uart.h"
-#include "hardware/lpc17_syscon.h"
+#include "hardware/lpc17_40_uart.h"
+#include "hardware/lpc17_40_syscon.h"
-#include "lpc17_gpio.h"
+#include "lpc17_40_gpio.h"
/************************************************************************************
* Pre-processor Definitions
@@ -57,8 +57,8 @@
/* Are any UARTs enabled? */
#undef HAVE_UART
-#if defined(CONFIG_LPC17_UART0) || defined(CONFIG_LPC17_UART1) || \
- defined(CONFIG_LPC17_UART2) || defined(CONFIG_LPC17_UART3)
+#if defined(CONFIG_LPC17_40_UART0) || defined(CONFIG_LPC17_40_UART1) || \
+ defined(CONFIG_LPC17_40_UART2) || defined(CONFIG_LPC17_40_UART3)
# define HAVE_UART 1
#endif
@@ -66,22 +66,22 @@
* any UARTn, n=0,1,2,3
*/
-#if defined(CONFIG_UART0_SERIAL_CONSOLE) && defined(CONFIG_LPC17_UART0)
+#if defined(CONFIG_UART0_SERIAL_CONSOLE) && defined(CONFIG_LPC17_40_UART0)
# undef CONFIG_UART1_SERIAL_CONSOLE
# undef CONFIG_UART2_SERIAL_CONSOLE
# undef CONFIG_UART3_SERIAL_CONSOLE
# define HAVE_CONSOLE 1
-#elif defined(CONFIG_UART1_SERIAL_CONSOLE) && defined(CONFIG_LPC17_UART1)
+#elif defined(CONFIG_UART1_SERIAL_CONSOLE) && defined(CONFIG_LPC17_40_UART1)
# undef CONFIG_UART0_SERIAL_CONSOLE
# undef CONFIG_UART2_SERIAL_CONSOLE
# undef CONFIG_UART3_SERIAL_CONSOLE
# define HAVE_CONSOLE 1
-#elif defined(CONFIG_UART2_SERIAL_CONSOLE) && defined(CONFIG_LPC17_UART2)
+#elif defined(CONFIG_UART2_SERIAL_CONSOLE) && defined(CONFIG_LPC17_40_UART2)
# undef CONFIG_UART0_SERIAL_CONSOLE
# undef CONFIG_UART1_SERIAL_CONSOLE
# undef CONFIG_UART3_SERIAL_CONSOLE
# define HAVE_CONSOLE 1
-#elif defined(CONFIG_UART3_SERIAL_CONSOLE) && defined(CONFIG_LPC17_UART3)
+#elif defined(CONFIG_UART3_SERIAL_CONSOLE) && defined(CONFIG_LPC17_40_UART3)
# undef CONFIG_UART0_SERIAL_CONSOLE
# undef CONFIG_UART1_SERIAL_CONSOLE
# undef CONFIG_UART2_SERIAL_CONSOLE
@@ -102,7 +102,7 @@
# undef CONFIG_UART2_OFLOWCONTROL
# undef CONFIG_UART3_IFLOWCONTROL
# undef CONFIG_UART3_OFLOWCONTROL
-#ifndef CONFIG_LPC17_UART1
+#ifndef CONFIG_LPC17_40_UART1
# undef CONFIG_UART1_IFLOWCONTROL
# undef CONFIG_UART1_OFLOWCONTROL
#endif
@@ -130,4 +130,4 @@
* Public Functions
************************************************************************************/
-#endif /* __ARCH_ARM_SRC_LPC17XX_LPC17_SERIAL_H */
+#endif /* __ARCH_ARM_SRC_LPC17XX_40XX_LPC17_40_SERIAL_H */
diff --git a/arch/arm/src/lpc17xx/lpc17_spi.c b/arch/arm/src/lpc17xx_40xx/lpc17_40_spi.c
similarity index 88%
rename from arch/arm/src/lpc17xx/lpc17_spi.c
rename to arch/arm/src/lpc17xx_40xx/lpc17_40_spi.c
index c75a57fa80e..d56f89154ee 100644
--- a/arch/arm/src/lpc17xx/lpc17_spi.c
+++ b/arch/arm/src/lpc17xx_40xx/lpc17_40_spi.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * arch/arm/src/lpc17xx/lpc17_spi.c
+ * arch/arm/src/lpc17xx_40xx/lpc17_40_spi.c
*
* Copyright (C) 2010, 2012-2013, 2016-2017 Gregory Nutt. All rights
* reserved.
@@ -56,11 +56,11 @@
#include "up_arch.h"
#include "chip.h"
-#include "hardware/lpc17_syscon.h"
-#include "lpc17_gpio.h"
-#include "lpc17_spi.h"
+#include "hardware/lpc17_40_syscon.h"
+#include "lpc17_40_gpio.h"
+#include "lpc17_40_spi.h"
-#ifdef CONFIG_LPC17_SPI
+#ifdef CONFIG_LPC17_40_SPI
/****************************************************************************
* Pre-processor Definitions
@@ -86,7 +86,7 @@
*/
#define SPI_PCLKSET_DIV SYSCON_PCLKSEL_CCLK
-#define SPI_CLOCK LPC17_CCLK
+#define SPI_CLOCK LPC17_40_CCLK
/****************************************************************************
* Private Types
@@ -94,7 +94,7 @@
/* This structure descibes the state of the SSP driver */
-struct lpc17_spidev_s
+struct lpc17_40_spidev_s
{
struct spi_dev_s spidev; /* Externally visible part of the SPI interface */
sem_t exclsem; /* Held while chip is selected for mutual exclusion */
@@ -125,28 +125,28 @@ static void spi_recvblock(FAR struct spi_dev_s *dev, FAR void *buffer, size_
static const struct spi_ops_s g_spiops =
{
.lock = spi_lock,
- .select = lpc17_spiselect,
+ .select = lpc17_40_spiselect,
.setfrequency = spi_setfrequency,
.setmode = spi_setmode,
.setbits = spi_setbits,
#ifdef CONFIG_SPI_HWFEATURES
.hwfeatures = 0, /* Not supported */
#endif
- .status = lpc17_spistatus,
+ .status = lpc17_40_spistatus,
#ifdef CONFIG_SPI_CMDDATA
- .cmddata = lpc17_spicmddata,
+ .cmddata = lpc17_40_spicmddata,
#endif
.send = spi_send,
.sndblock = spi_sndblock,
.recvblock = spi_recvblock,
#ifdef CONFIG_SPI_CALLBACK
- .registercallback = lpc17_spiregister, /* Provided externally */
+ .registercallback = lpc17_40_spiregister, /* Provided externally */
#else
.registercallback = 0, /* Not implemented */
#endif
};
-static struct lpc17_spidev_s g_spidev =
+static struct lpc17_40_spidev_s g_spidev =
{
.spidev = { &g_spiops },
};
@@ -182,7 +182,7 @@ static struct lpc17_spidev_s g_spidev =
static int spi_lock(FAR struct spi_dev_s *dev, bool lock)
{
- FAR struct lpc17_spidev_s *priv = (FAR struct lpc17_spidev_s *)dev;
+ FAR struct lpc17_40_spidev_s *priv = (FAR struct lpc17_40_spidev_s *)dev;
int ret;
if (lock)
@@ -227,7 +227,7 @@ static int spi_lock(FAR struct spi_dev_s *dev, bool lock)
static uint32_t spi_setfrequency(FAR struct spi_dev_s *dev, uint32_t frequency)
{
- FAR struct lpc17_spidev_s *priv = (FAR struct lpc17_spidev_s *)dev;
+ FAR struct lpc17_40_spidev_s *priv = (FAR struct lpc17_40_spidev_s *)dev;
uint32_t divisor;
uint32_t actual;
@@ -263,7 +263,7 @@ static uint32_t spi_setfrequency(FAR struct spi_dev_s *dev, uint32_t frequency)
/* Save the new divisor value */
- putreg32(divisor, LPC17_SPI_CCR);
+ putreg32(divisor, LPC17_40_SPI_CCR);
/* Calculate the new actual */
@@ -295,7 +295,7 @@ static uint32_t spi_setfrequency(FAR struct spi_dev_s *dev, uint32_t frequency)
static void spi_setmode(FAR struct spi_dev_s *dev, enum spi_mode_e mode)
{
- FAR struct lpc17_spidev_s *priv = (FAR struct lpc17_spidev_s *)dev;
+ FAR struct lpc17_40_spidev_s *priv = (FAR struct lpc17_40_spidev_s *)dev;
uint32_t regval;
/* Has the mode changed? */
@@ -304,7 +304,7 @@ static void spi_setmode(FAR struct spi_dev_s *dev, enum spi_mode_e mode)
{
/* Yes... Set CR appropriately */
- regval = getreg32(LPC17_SPI_CR);
+ regval = getreg32(LPC17_40_SPI_CR);
regval &= ~(SPI_CR_CPOL | SPI_CR_CPHA);
switch (mode)
@@ -329,7 +329,7 @@ static void spi_setmode(FAR struct spi_dev_s *dev, enum spi_mode_e mode)
return;
}
- putreg32(regval, LPC17_SPI_CR);
+ putreg32(regval, LPC17_40_SPI_CR);
/* Save the mode so that subsequent re-configuratins will be faster */
@@ -354,7 +354,7 @@ static void spi_setmode(FAR struct spi_dev_s *dev, enum spi_mode_e mode)
static void spi_setbits(FAR struct spi_dev_s *dev, int nbits)
{
- FAR struct lpc17_spidev_s *priv = (FAR struct lpc17_spidev_s *)dev;
+ FAR struct lpc17_40_spidev_s *priv = (FAR struct lpc17_40_spidev_s *)dev;
uint32_t regval;
/* Has the number of bits changed? */
@@ -365,11 +365,11 @@ static void spi_setbits(FAR struct spi_dev_s *dev, int nbits)
{
/* Yes... Set CR appropriately */
- regval = getreg32(LPC17_SPI_CR);
+ regval = getreg32(LPC17_40_SPI_CR);
regval &= ~SPI_CR_BITS_MASK;
regval |= (nbits << SPI_CR_BITS_SHIFT) & SPI_CR_BITS_MASK;
regval |= SPI_CR_BITENABLE;
- regval = getreg32(LPC17_SPI_CR);
+ regval = getreg32(LPC17_40_SPI_CR);
/* Save the selection so the subsequence re-configurations will be faster */
@@ -397,19 +397,19 @@ static uint16_t spi_send(FAR struct spi_dev_s *dev, uint16_t wd)
{
/* Write the data to transmitted to the SPI Data Register */
- putreg32((uint32_t)wd, LPC17_SPI_DR);
+ putreg32((uint32_t)wd, LPC17_40_SPI_DR);
/* Wait for the SPIF bit in the SPI Status Register to be set to 1. The
* SPIF bit will be set after the last sampling clock edge of the SPI
* data transfer.
*/
- while ((getreg32(LPC17_SPI_SR) & SPI_SR_SPIF) == 0);
+ while ((getreg32(LPC17_40_SPI_SR) & SPI_SR_SPIF) == 0);
/* Read the SPI Status Register again to clear the status bit */
- (void)getreg32(LPC17_SPI_SR);
- return (uint16_t)getreg32(LPC17_SPI_DR);
+ (void)getreg32(LPC17_40_SPI_SR);
+ return (uint16_t)getreg32(LPC17_40_SPI_DR);
}
/****************************************************************************
@@ -442,18 +442,18 @@ static void spi_sndblock(FAR struct spi_dev_s *dev, FAR const void *buffer, size
/* Write the data to transmitted to the SPI Data Register */
data = *ptr++;
- putreg32((uint32_t)data, LPC17_SPI_DR);
+ putreg32((uint32_t)data, LPC17_40_SPI_DR);
/* Wait for the SPIF bit in the SPI Status Register to be set to 1. The
* SPIF bit will be set after the last sampling clock edge of the SPI
* data transfer.
*/
- while ((getreg32(LPC17_SPI_SR) & SPI_SR_SPIF) == 0);
+ while ((getreg32(LPC17_40_SPI_SR) & SPI_SR_SPIF) == 0);
/* Read the SPI Status Register again to clear the status bit */
- (void)getreg32(LPC17_SPI_SR);
+ (void)getreg32(LPC17_40_SPI_SR);
nwords--;
}
}
@@ -488,22 +488,22 @@ static void spi_recvblock(FAR struct spi_dev_s *dev, FAR void *buffer, size_t nw
* read data.
*/
- putreg32(0xff, LPC17_SPI_DR);
+ putreg32(0xff, LPC17_40_SPI_DR);
/* Wait for the SPIF bit in the SPI Status Register to be set to 1. The
* SPIF bit will be set after the last sampling clock edge of the SPI
* data transfer.
*/
- while ((getreg32(LPC17_SPI_SR) & SPI_SR_SPIF) == 0);
+ while ((getreg32(LPC17_40_SPI_SR) & SPI_SR_SPIF) == 0);
/* Read the SPI Status Register again to clear the status bit */
- (void)getreg32(LPC17_SPI_SR);
+ (void)getreg32(LPC17_40_SPI_SR);
/* Read the received data from the SPI Data Register */
- *ptr++ = (uint8_t)getreg32(LPC17_SPI_DR);
+ *ptr++ = (uint8_t)getreg32(LPC17_40_SPI_DR);
nwords--;
}
}
@@ -513,7 +513,7 @@ static void spi_recvblock(FAR struct spi_dev_s *dev, FAR void *buffer, size_t nw
****************************************************************************/
/****************************************************************************
- * Name: lpc17_spibus_initialize
+ * Name: lpc17_40_spibus_initialize
*
* Description:
* Initialize the selected SPI port.
@@ -526,9 +526,9 @@ static void spi_recvblock(FAR struct spi_dev_s *dev, FAR void *buffer, size_t nw
*
****************************************************************************/
-FAR struct spi_dev_s *lpc17_spibus_initialize(int port)
+FAR struct spi_dev_s *lpc17_40_spibus_initialize(int port)
{
- FAR struct lpc17_spidev_s *priv = &g_spidev;
+ FAR struct lpc17_40_spidev_s *priv = &g_spidev;
irqstate_t flags;
uint32_t regval;
@@ -542,28 +542,28 @@ FAR struct spi_dev_s *lpc17_spibus_initialize(int port)
*/
flags = enter_critical_section();
- lpc17_configgpio(GPIO_SPI_SCK);
- lpc17_configgpio(GPIO_SPI_MISO);
- lpc17_configgpio(GPIO_SPI_MOSI);
+ lpc17_40_configgpio(GPIO_SPI_SCK);
+ lpc17_40_configgpio(GPIO_SPI_MISO);
+ lpc17_40_configgpio(GPIO_SPI_MOSI);
/* Configure clocking */
- regval = getreg32(LPC17_SYSCON_PCLKSEL0);
+ regval = getreg32(LPC17_40_SYSCON_PCLKSEL0);
regval &= ~SYSCON_PCLKSEL0_SPI_MASK;
regval |= (SPI_PCLKSET_DIV << SYSCON_PCLKSEL0_SPI_SHIFT);
- putreg32(regval, LPC17_SYSCON_PCLKSEL0);
+ putreg32(regval, LPC17_40_SYSCON_PCLKSEL0);
/* Enable peripheral clocking to SPI and SPI1 */
- regval = getreg32(LPC17_SYSCON_PCONP);
+ regval = getreg32(LPC17_40_SYSCON_PCONP);
regval |= SYSCON_PCONP_PCSPI;
- putreg32(regval, LPC17_SYSCON_PCONP);
+ putreg32(regval, LPC17_40_SYSCON_PCONP);
leave_critical_section(flags);
/* Configure 8-bit SPI mode and master mode */
putreg32(SPI_CR_BITS_8BITS | SPI_CR_BITENABLE | SPI_CR_MSTR,
- LPC17_SPI_CR);
+ LPC17_40_SPI_CR);
/* Set the initial SPI configuration */
@@ -581,4 +581,4 @@ FAR struct spi_dev_s *lpc17_spibus_initialize(int port)
return &priv->spidev;
}
-#endif /* CONFIG_LPC17_SPI */
+#endif /* CONFIG_LPC17_40_SPI */
diff --git a/arch/arm/src/lpc17xx/lpc17_spi.h b/arch/arm/src/lpc17xx_40xx/lpc17_40_spi.h
similarity index 81%
rename from arch/arm/src/lpc17xx/lpc17_spi.h
rename to arch/arm/src/lpc17xx_40xx/lpc17_40_spi.h
index c807b88a53f..37ad9cd98fd 100644
--- a/arch/arm/src/lpc17xx/lpc17_spi.h
+++ b/arch/arm/src/lpc17xx_40xx/lpc17_40_spi.h
@@ -1,5 +1,5 @@
/************************************************************************************
- * arch/arm/src/lpc17xx/lpc17_spi.h
+ * arch/arm/src/lpc17xx_40xx/lpc17_40_spi.h
*
* Copyright (C) 2010, 2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt
@@ -33,8 +33,8 @@
*
************************************************************************************/
-#ifndef __ARCH_ARM_SRC_LPC17XX_LPC17_SPI_H
-#define __ARCH_ARM_SRC_LPC17XX_LPC17_SPI_H
+#ifndef __ARCH_ARM_SRC_LPC17XX_40XX_LPC17_40_SPI_H
+#define __ARCH_ARM_SRC_LPC17XX_40XX_LPC17_40_SPI_H
/************************************************************************************
* Included Files
@@ -44,7 +44,7 @@
#include
-#include "hardware/lpc17_spi.h"
+#include "hardware/lpc17_40_spi.h"
/************************************************************************************
* Pre-processor Definitions
@@ -58,7 +58,7 @@
* Public Data
************************************************************************************/
-#ifdef CONFIG_LPC17_SPI
+#ifdef CONFIG_LPC17_40_SPI
#ifndef __ASSEMBLY__
#ifdef __cplusplus
@@ -73,7 +73,7 @@ extern "C"
struct spi_dev_s; /* Forward reference */
/************************************************************************************
- * Name: lpc17_spibus_initialize
+ * Name: lpc17_40_spibus_initialize
*
* Description:
* Initialize the selected SPI port.
@@ -86,38 +86,38 @@ struct spi_dev_s; /* Forward reference */
*
************************************************************************************/
-FAR struct spi_dev_s *lpc17_spibus_initialize(int port);
+FAR struct spi_dev_s *lpc17_40_spibus_initialize(int port);
/************************************************************************************
- * Name: lpc17_spiselect, lpc17_status, and lpc17_spicmddata
+ * Name: lpc17_40_spiselect, lpc17_40_status, and lpc17_40_spicmddata
*
* Description:
* These external functions must be provided by board-specific logic. They are
* implementations of the select, status, and cmddata methods of the SPI interface
* defined by struct spi_ops_s (see include/nuttx/spi/spi.h). All other methods
- * including lpc17_spibus_initialize()) are provided by common LPC17xx logic. To use
+ * including lpc17_40_spibus_initialize()) are provided by common LPC17xx/LPC40xx logic. To use
* this common SPI logic on your board:
*
- * 1. Provide logic in lpc17_boardinitialize() to configure SPI chip select pins.
- * 2. Provide lpc17_spiselect() and lpc17_spistatus() functions in your board-
+ * 1. Provide logic in lpc17_40_boardinitialize() to configure SPI chip select pins.
+ * 2. Provide lpc17_40_spiselect() and lpc17_40_spistatus() functions in your board-
* specific logic. These functions will perform chip selection and status
* operations using GPIOs in the way your board is configured.
* 2. If CONFIG_SPI_CMDDATA is defined in the NuttX configuration, provide
- * lpc17_spicmddata() functions in your board-specific logic. This function
+ * lpc17_40_spicmddata() functions in your board-specific logic. This function
* will perform cmd/data selection operations using GPIOs in the way your
* board is configured.
- * 3. Add a call to lpc17_spibus_initialize() in your low level application
+ * 3. Add a call to lpc17_40_spibus_initialize() in your low level application
* initialization logic
- * 4. The handle returned by lpc17_spibus_initialize() may then be used to bind the
+ * 4. The handle returned by lpc17_40_spibus_initialize() may then be used to bind the
* SPI driver to higher level logic (e.g., calling mmcsd_spislotinitialize(),
* for example, will bind the SPI driver to the SPI MMC/SD driver).
*
************************************************************************************/
-void lpc17_spiselect(FAR struct spi_dev_s *dev, uint32_t devid, bool selected);
-uint8_t lpc17_spistatus(FAR struct spi_dev_s *dev, uint32_t devid);
+void lpc17_40_spiselect(FAR struct spi_dev_s *dev, uint32_t devid, bool selected);
+uint8_t lpc17_40_spistatus(FAR struct spi_dev_s *dev, uint32_t devid);
#ifdef CONFIG_SPI_CMDDATA
-int lpc17_spicmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
+int lpc17_40_spicmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
#endif
/****************************************************************************
@@ -139,7 +139,7 @@ int lpc17_spicmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
void spi_flush(FAR struct spi_dev_s *dev);
/****************************************************************************
- * Name: lpc17_spiregister
+ * Name: lpc17_40_spiregister
*
* Description:
* If the board supports a card detect callback to inform the SPI-based
@@ -159,7 +159,7 @@ void spi_flush(FAR struct spi_dev_s *dev);
****************************************************************************/
#ifdef CONFIG_SPI_CALLBACK
-int lpc17_spiregister(FAR struct spi_dev_s *dev, spi_mediachange_t callback,
+int lpc17_40_spiregister(FAR struct spi_dev_s *dev, spi_mediachange_t callback,
FAR void *arg);
#endif
@@ -168,5 +168,5 @@ int lpc17_spiregister(FAR struct spi_dev_s *dev, spi_mediachange_t callback,
#endif
#endif /* __ASSEMBLY__ */
-#endif /* CONFIG_LPC17_SPI */
-#endif /* __ARCH_ARM_SRC_LPC17XX_LPC17_SPI_H */
+#endif /* CONFIG_LPC17_40_SPI */
+#endif /* __ARCH_ARM_SRC_LPC17XX_40XX_LPC17_40_SPI_H */
diff --git a/arch/arm/src/lpc17xx/lpc17_ssp.c b/arch/arm/src/lpc17xx_40xx/lpc17_40_ssp.c
similarity index 77%
rename from arch/arm/src/lpc17xx/lpc17_ssp.c
rename to arch/arm/src/lpc17xx_40xx/lpc17_40_ssp.c
index 477572c8695..f91ca568ccc 100644
--- a/arch/arm/src/lpc17xx/lpc17_ssp.c
+++ b/arch/arm/src/lpc17xx_40xx/lpc17_40_ssp.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * arch/arm/src/lpc17xx/lpc17_ssp.c
+ * arch/arm/src/lpc17xx_40xx/lpc17_40_ssp.c
*
* Copyright (C) 2010-2013, 2016-2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt
@@ -55,12 +55,12 @@
#include "up_arch.h"
#include "chip.h"
-#include "hardware/lpc17_syscon.h"
-#include "lpc17_gpio.h"
-#include "lpc17_ssp.h"
+#include "hardware/lpc17_40_syscon.h"
+#include "lpc17_40_gpio.h"
+#include "lpc17_40_ssp.h"
-#if defined(CONFIG_LPC17_SSP0) || defined(CONFIG_LPC17_SSP1) || \
- defined(CONFIG_LPC17_SSP2)
+#if defined(CONFIG_LPC17_40_SSP0) || defined(CONFIG_LPC17_40_SSP1) || \
+ defined(CONFIG_LPC17_40_SSP2)
/****************************************************************************
* Pre-processor Definitions
@@ -86,15 +86,15 @@
* use the CCLK undivided to get the SSP_CLOCK.
*/
-# if LPC17_CCLK > 100000000
+# if LPC17_40_CCLK > 100000000
# error "CCLK <= 100,000,000 assumed"
# endif
# define SSP_PCLKSET_DIV SYSCON_PCLKSEL_CCLK
-# define SSP_CLOCK LPC17_CCLK
+# define SSP_CLOCK LPC17_40_CCLK
-#elif defined(LPC178x)
-/* All peripherals are clocked by the same peripheral clock in the LPC178x
+#elif defined(LPC178x_40xx)
+/* All peripherals are clocked by the same peripheral clock in the LPC178x/40xx
* family.
*/
@@ -108,11 +108,11 @@
/* This structure descibes the state of the SSP driver */
-struct lpc17_sspdev_s
+struct lpc17_40_sspdev_s
{
struct spi_dev_s spidev; /* Externally visible part of the SPI interface */
uint32_t sspbase; /* SPIn base address */
-#ifdef CONFIG_LPC17_SSP_INTERRUPTS
+#ifdef CONFIG_LPC17_40_SSP_INTERRUPTS
uint8_t sspirq; /* SPI IRQ number */
#endif
sem_t exclsem; /* Held while chip is selected for mutual exclusion */
@@ -128,8 +128,8 @@ struct lpc17_sspdev_s
/* Helpers */
-static inline uint32_t ssp_getreg(FAR struct lpc17_sspdev_s *priv, uint8_t offset);
-static inline void ssp_putreg(FAR struct lpc17_sspdev_s *priv, uint8_t offset,
+static inline uint32_t ssp_getreg(FAR struct lpc17_40_sspdev_s *priv, uint8_t offset);
+static inline void ssp_putreg(FAR struct lpc17_40_sspdev_s *priv, uint8_t offset,
uint32_t value);
/* SPI methods */
@@ -144,118 +144,118 @@ static void ssp_recvblock(FAR struct spi_dev_s *dev, FAR void *buffer, size_
/* Initialization */
-#ifdef CONFIG_LPC17_SSP0
-static inline FAR struct lpc17_sspdev_s *lpc17_ssp0initialize(void);
+#ifdef CONFIG_LPC17_40_SSP0
+static inline FAR struct lpc17_40_sspdev_s *lpc17_40_ssp0initialize(void);
#endif
-#ifdef CONFIG_LPC17_SSP1
-static inline FAR struct lpc17_sspdev_s *lpc17_ssp1initialize(void);
+#ifdef CONFIG_LPC17_40_SSP1
+static inline FAR struct lpc17_40_sspdev_s *lpc17_40_ssp1initialize(void);
#endif
-#ifdef CONFIG_LPC17_SSP2
-static inline FAR struct lpc17_sspdev_s *lpc17_ssp2initialize(void);
+#ifdef CONFIG_LPC17_40_SSP2
+static inline FAR struct lpc17_40_sspdev_s *lpc17_40_ssp2initialize(void);
#endif
/****************************************************************************
* Private Data
****************************************************************************/
-#ifdef CONFIG_LPC17_SSP0
+#ifdef CONFIG_LPC17_40_SSP0
static const struct spi_ops_s g_spi0ops =
{
.lock = ssp_lock,
- .select = lpc17_ssp0select, /* Provided externally */
+ .select = lpc17_40_ssp0select, /* Provided externally */
.setfrequency = ssp_setfrequency,
.setmode = ssp_setmode,
.setbits = ssp_setbits,
#ifdef CONFIG_SPI_HWFEATURES
.hwfeatures = 0, /* Not supported */
#endif
- .status = lpc17_ssp0status, /* Provided externally */
+ .status = lpc17_40_ssp0status, /* Provided externally */
#ifdef CONFIG_SPI_CMDDATA
- .cmddata = lpc17_ssp0cmddata, /* Provided externally */
+ .cmddata = lpc17_40_ssp0cmddata, /* Provided externally */
#endif
.send = ssp_send,
.sndblock = ssp_sndblock,
.recvblock = ssp_recvblock,
#ifdef CONFIG_SPI_CALLBACK
- .registercallback = lpc17_ssp0register, /* Provided externally */
+ .registercallback = lpc17_40_ssp0register, /* Provided externally */
#else
.registercallback = 0, /* Not implemented */
#endif
};
-static struct lpc17_sspdev_s g_ssp0dev =
+static struct lpc17_40_sspdev_s g_ssp0dev =
{
.spidev = { &g_spi0ops },
- .sspbase = LPC17_SSP0_BASE,
-#ifdef CONFIG_LPC17_SSP_INTERRUPTS
- .sspirq = LPC17_IRQ_SSP0,
+ .sspbase = LPC17_40_SSP0_BASE,
+#ifdef CONFIG_LPC17_40_SSP_INTERRUPTS
+ .sspirq = LPC17_40_IRQ_SSP0,
#endif
};
-#endif /* CONFIG_LPC17_SSP0 */
+#endif /* CONFIG_LPC17_40_SSP0 */
-#ifdef CONFIG_LPC17_SSP1
+#ifdef CONFIG_LPC17_40_SSP1
static const struct spi_ops_s g_spi1ops =
{
.lock = ssp_lock,
- .select = lpc17_ssp1select, /* Provided externally */
+ .select = lpc17_40_ssp1select, /* Provided externally */
.setfrequency = ssp_setfrequency,
.setmode = ssp_setmode,
.setbits = ssp_setbits,
- .status = lpc17_ssp1status, /* Provided externally */
+ .status = lpc17_40_ssp1status, /* Provided externally */
#ifdef CONFIG_SPI_CMDDATA
- .cmddata = lpc17_ssp1cmddata, /* Provided externally */
+ .cmddata = lpc17_40_ssp1cmddata, /* Provided externally */
#endif
.send = ssp_send,
.sndblock = ssp_sndblock,
.recvblock = ssp_recvblock,
#ifdef CONFIG_SPI_CALLBACK
- .registercallback = lpc17_ssp1register, /* Provided externally */
+ .registercallback = lpc17_40_ssp1register, /* Provided externally */
#else
.registercallback = 0, /* Not implemented */
#endif
};
-static struct lpc17_sspdev_s g_ssp1dev =
+static struct lpc17_40_sspdev_s g_ssp1dev =
{
.spidev = { &g_spi1ops },
- .sspbase = LPC17_SSP1_BASE,
-#ifdef CONFIG_LPC17_SSP_INTERRUPTS
- .sspirq = LPC17_IRQ_SSP1,
+ .sspbase = LPC17_40_SSP1_BASE,
+#ifdef CONFIG_LPC17_40_SSP_INTERRUPTS
+ .sspirq = LPC17_40_IRQ_SSP1,
#endif
};
-#endif /* CONFIG_LPC17_SSP1 */
+#endif /* CONFIG_LPC17_40_SSP1 */
-#ifdef CONFIG_LPC17_SSP2
+#ifdef CONFIG_LPC17_40_SSP2
static const struct spi_ops_s g_spi2ops =
{
.lock = ssp_lock,
- .select = lpc17_ssp2select, /* Provided externally */
+ .select = lpc17_40_ssp2select, /* Provided externally */
.setfrequency = ssp_setfrequency,
.setmode = ssp_setmode,
.setbits = ssp_setbits,
- .status = lpc17_ssp2status, /* Provided externally */
+ .status = lpc17_40_ssp2status, /* Provided externally */
#ifdef CONFIG_SPI_CMDDATA
- .cmddata = lpc17_ssp2cmddata, /* Provided externally */
+ .cmddata = lpc17_40_ssp2cmddata, /* Provided externally */
#endif
.send = ssp_send,
.sndblock = ssp_sndblock,
.recvblock = ssp_recvblock,
#ifdef CONFIG_SPI_CALLBACK
- .registercallback = lpc17_ssp2register, /* Provided externally */
+ .registercallback = lpc17_40_ssp2register, /* Provided externally */
#else
.registercallback = 0, /* Not implemented */
#endif
};
-static struct lpc17_sspdev_s g_ssp2dev =
+static struct lpc17_40_sspdev_s g_ssp2dev =
{
.spidev = { &g_spi2ops },
- .sspbase = LPC17_SSP2_BASE,
-#ifdef CONFIG_LPC17_SSP_INTERRUPTS
- .sspirq = LPC17_IRQ_SSP2,
+ .sspbase = LPC17_40_SSP2_BASE,
+#ifdef CONFIG_LPC17_40_SSP_INTERRUPTS
+ .sspirq = LPC17_40_IRQ_SSP2,
#endif
};
-#endif /* CONFIG_LPC17_SSP2 */
+#endif /* CONFIG_LPC17_40_SSP2 */
/****************************************************************************
* Public Data
@@ -280,7 +280,7 @@ static struct lpc17_sspdev_s g_ssp2dev =
*
****************************************************************************/
-static inline uint32_t ssp_getreg(FAR struct lpc17_sspdev_s *priv, uint8_t offset)
+static inline uint32_t ssp_getreg(FAR struct lpc17_40_sspdev_s *priv, uint8_t offset)
{
return getreg32(priv->sspbase + (uint32_t)offset);
}
@@ -301,7 +301,7 @@ static inline uint32_t ssp_getreg(FAR struct lpc17_sspdev_s *priv, uint8_t offse
*
****************************************************************************/
-static inline void ssp_putreg(FAR struct lpc17_sspdev_s *priv, uint8_t offset, uint32_t value)
+static inline void ssp_putreg(FAR struct lpc17_40_sspdev_s *priv, uint8_t offset, uint32_t value)
{
putreg32(value, priv->sspbase + (uint32_t)offset);
}
@@ -329,7 +329,7 @@ static inline void ssp_putreg(FAR struct lpc17_sspdev_s *priv, uint8_t offset, u
static int ssp_lock(FAR struct spi_dev_s *dev, bool lock)
{
- FAR struct lpc17_sspdev_s *priv = (FAR struct lpc17_sspdev_s *)dev;
+ FAR struct lpc17_40_sspdev_s *priv = (FAR struct lpc17_40_sspdev_s *)dev;
int ret;
if (lock)
@@ -374,7 +374,7 @@ static int ssp_lock(FAR struct spi_dev_s *dev, bool lock)
static uint32_t ssp_setfrequency(FAR struct spi_dev_s *dev, uint32_t frequency)
{
- FAR struct lpc17_sspdev_s *priv = (FAR struct lpc17_sspdev_s *)dev;
+ FAR struct lpc17_40_sspdev_s *priv = (FAR struct lpc17_40_sspdev_s *)dev;
uint32_t cpsdvsr;
uint32_t scr;
uint32_t regval;
@@ -397,7 +397,7 @@ static uint32_t ssp_setfrequency(FAR struct spi_dev_s *dev, uint32_t frequency)
*
* Let's try for a solution with the smallest value of SCR. NOTES:
* (1) In the calculations below, the value of the variable 'scr' is
- * (SCR+1) in the above equation. (2) On slower LPC17xx parts, SCR
+ * (SCR+1) in the above equation. (2) On slower LPC17xx/LPC40xx parts, SCR
* will probably always be zero.
*/
@@ -440,12 +440,12 @@ static uint32_t ssp_setfrequency(FAR struct spi_dev_s *dev, uint32_t frequency)
/* Save the new CPSDVSR and SCR values */
- ssp_putreg(priv, LPC17_SSP_CPSR_OFFSET, cpsdvsr);
+ ssp_putreg(priv, LPC17_40_SSP_CPSR_OFFSET, cpsdvsr);
- regval = ssp_getreg(priv, LPC17_SSP_CR0_OFFSET);
+ regval = ssp_getreg(priv, LPC17_40_SSP_CR0_OFFSET);
regval &= ~SSP_CR0_SCR_MASK;
regval |= ((scr - 1) << SSP_CR0_SCR_SHIFT);
- ssp_putreg(priv, LPC17_SSP_CR0_OFFSET, regval);
+ ssp_putreg(priv, LPC17_40_SSP_CR0_OFFSET, regval);
/* Calculate the new actual */
@@ -477,7 +477,7 @@ static uint32_t ssp_setfrequency(FAR struct spi_dev_s *dev, uint32_t frequency)
static void ssp_setmode(FAR struct spi_dev_s *dev, enum spi_mode_e mode)
{
- FAR struct lpc17_sspdev_s *priv = (FAR struct lpc17_sspdev_s *)dev;
+ FAR struct lpc17_40_sspdev_s *priv = (FAR struct lpc17_40_sspdev_s *)dev;
uint32_t regval;
/* Has the mode changed? */
@@ -486,7 +486,7 @@ static void ssp_setmode(FAR struct spi_dev_s *dev, enum spi_mode_e mode)
{
/* Yes... Set CR0 appropriately */
- regval = ssp_getreg(priv, LPC17_SSP_CR0_OFFSET);
+ regval = ssp_getreg(priv, LPC17_40_SSP_CR0_OFFSET);
regval &= ~(SSP_CR0_CPOL | SSP_CR0_CPHA);
switch (mode)
@@ -512,7 +512,7 @@ static void ssp_setmode(FAR struct spi_dev_s *dev, enum spi_mode_e mode)
return;
}
- ssp_putreg(priv, LPC17_SSP_CR0_OFFSET, regval);
+ ssp_putreg(priv, LPC17_40_SSP_CR0_OFFSET, regval);
/* Save the mode so that subsequent re-configurations will be faster */
@@ -537,7 +537,7 @@ static void ssp_setmode(FAR struct spi_dev_s *dev, enum spi_mode_e mode)
static void ssp_setbits(FAR struct spi_dev_s *dev, int nbits)
{
- FAR struct lpc17_sspdev_s *priv = (FAR struct lpc17_sspdev_s *)dev;
+ FAR struct lpc17_40_sspdev_s *priv = (FAR struct lpc17_40_sspdev_s *)dev;
uint32_t regval;
/* Has the number of bits changed? */
@@ -548,10 +548,10 @@ static void ssp_setbits(FAR struct spi_dev_s *dev, int nbits)
{
/* Yes... Set CR1 appropriately */
- regval = ssp_getreg(priv, LPC17_SSP_CR0_OFFSET);
+ regval = ssp_getreg(priv, LPC17_40_SSP_CR0_OFFSET);
regval &= ~SSP_CR0_DSS_MASK;
regval |= ((nbits - 1) << SSP_CR0_DSS_SHIFT);
- ssp_putreg(priv, LPC17_SSP_CR0_OFFSET, regval);
+ ssp_putreg(priv, LPC17_40_SSP_CR0_OFFSET, regval);
/* Save the selection so the subsequence re-configurations will be faster */
@@ -577,24 +577,24 @@ static void ssp_setbits(FAR struct spi_dev_s *dev, int nbits)
static uint16_t ssp_send(FAR struct spi_dev_s *dev, uint16_t wd)
{
- FAR struct lpc17_sspdev_s *priv = (FAR struct lpc17_sspdev_s *)dev;
+ FAR struct lpc17_40_sspdev_s *priv = (FAR struct lpc17_40_sspdev_s *)dev;
register uint32_t regval;
/* Wait while the TX FIFO is full */
- while (!(ssp_getreg(priv, LPC17_SSP_SR_OFFSET) & SSP_SR_TNF));
+ while (!(ssp_getreg(priv, LPC17_40_SSP_SR_OFFSET) & SSP_SR_TNF));
/* Write the byte to the TX FIFO */
- ssp_putreg(priv, LPC17_SSP_DR_OFFSET, (uint32_t)wd);
+ ssp_putreg(priv, LPC17_40_SSP_DR_OFFSET, (uint32_t)wd);
/* Wait for the RX FIFO not empty */
- while (!(ssp_getreg(priv, LPC17_SSP_SR_OFFSET) & SSP_SR_RNE));
+ while (!(ssp_getreg(priv, LPC17_40_SSP_SR_OFFSET) & SSP_SR_RNE));
/* Get the value from the RX FIFO and return it */
- regval = ssp_getreg(priv, LPC17_SSP_DR_OFFSET);
+ regval = ssp_getreg(priv, LPC17_40_SSP_DR_OFFSET);
spiinfo("%04x->%04x\n", wd, regval);
return (uint16_t)regval;
}
@@ -620,7 +620,7 @@ static uint16_t ssp_send(FAR struct spi_dev_s *dev, uint16_t wd)
static void ssp_sndblock(FAR struct spi_dev_s *dev, FAR const void *buffer, size_t nwords)
{
- FAR struct lpc17_sspdev_s *priv = (FAR struct lpc17_sspdev_s *)dev;
+ FAR struct lpc17_40_sspdev_s *priv = (FAR struct lpc17_40_sspdev_s *)dev;
union
{
FAR const uint8_t *p8;
@@ -638,7 +638,7 @@ static void ssp_sndblock(FAR struct spi_dev_s *dev, FAR const void *buffer, size
{
/* While the TX FIFO is not full and there are bytes left to send */
- while ((ssp_getreg(priv, LPC17_SSP_SR_OFFSET) & SSP_SR_TNF) && nwords)
+ while ((ssp_getreg(priv, LPC17_40_SSP_SR_OFFSET) & SSP_SR_TNF) && nwords)
{
/* Fetch the data to send */
@@ -653,7 +653,7 @@ static void ssp_sndblock(FAR struct spi_dev_s *dev, FAR const void *buffer, size
/* Send the data */
- ssp_putreg(priv, LPC17_SSP_DR_OFFSET, data);
+ ssp_putreg(priv, LPC17_40_SSP_DR_OFFSET, data);
nwords--;
}
}
@@ -665,12 +665,12 @@ static void ssp_sndblock(FAR struct spi_dev_s *dev, FAR const void *buffer, size
{
/* Is there anything in the RX fifo? */
- sr = ssp_getreg(priv, LPC17_SSP_SR_OFFSET);
+ sr = ssp_getreg(priv, LPC17_40_SSP_SR_OFFSET);
if ((sr & SSP_SR_RNE) != 0)
{
/* Yes.. Read and discard */
- (void)ssp_getreg(priv, LPC17_SSP_DR_OFFSET);
+ (void)ssp_getreg(priv, LPC17_40_SSP_DR_OFFSET);
}
/* There is a race condition where TFE may go true just before
@@ -682,7 +682,7 @@ static void ssp_sndblock(FAR struct spi_dev_s *dev, FAR const void *buffer, size
else if ((sr & SSP_SR_TFE) != 0)
{
up_udelay(100);
- sr = ssp_getreg(priv, LPC17_SSP_SR_OFFSET);
+ sr = ssp_getreg(priv, LPC17_40_SSP_SR_OFFSET);
}
}
while ((sr & SSP_SR_RNE) != 0 || (sr & SSP_SR_TFE) == 0);
@@ -709,7 +709,7 @@ static void ssp_sndblock(FAR struct spi_dev_s *dev, FAR const void *buffer, size
static void ssp_recvblock(FAR struct spi_dev_s *dev, FAR void *buffer, size_t nwords)
{
- FAR struct lpc17_sspdev_s *priv = (FAR struct lpc17_sspdev_s *)dev;
+ FAR struct lpc17_40_sspdev_s *priv = (FAR struct lpc17_40_sspdev_s *)dev;
union
{
FAR uint8_t *p8;
@@ -732,10 +732,10 @@ static void ssp_recvblock(FAR struct spi_dev_s *dev, FAR void *buffer, size_t nw
*/
spiinfo("TX: rxpending: %d nwords: %d\n", rxpending, nwords);
- while ((ssp_getreg(priv, LPC17_SSP_SR_OFFSET) & SSP_SR_TNF) &&
- (rxpending < LPC17_SSP_FIFOSZ) && nwords)
+ while ((ssp_getreg(priv, LPC17_40_SSP_SR_OFFSET) & SSP_SR_TNF) &&
+ (rxpending < LPC17_40_SSP_FIFOSZ) && nwords)
{
- ssp_putreg(priv, LPC17_SSP_DR_OFFSET, 0xffff);
+ ssp_putreg(priv, LPC17_40_SSP_DR_OFFSET, 0xffff);
nwords--;
rxpending++;
}
@@ -743,9 +743,9 @@ static void ssp_recvblock(FAR struct spi_dev_s *dev, FAR void *buffer, size_t nw
/* Now, read the RX data from the RX FIFO while the RX FIFO is not empty */
spiinfo("RX: rxpending: %d\n", rxpending);
- while (ssp_getreg(priv, LPC17_SSP_SR_OFFSET) & SSP_SR_RNE)
+ while (ssp_getreg(priv, LPC17_40_SSP_SR_OFFSET) & SSP_SR_RNE)
{
- data = (uint8_t)ssp_getreg(priv, LPC17_SSP_DR_OFFSET);
+ data = (uint8_t)ssp_getreg(priv, LPC17_40_SSP_DR_OFFSET);
if (priv->nbits > 8)
{
*u.p16++ = (uint16_t)data;
@@ -760,7 +760,7 @@ static void ssp_recvblock(FAR struct spi_dev_s *dev, FAR void *buffer, size_t nw
}
/****************************************************************************
- * Name: lpc17_ssp0initialize
+ * Name: lpc17_40_ssp0initialize
*
* Description:
* Initialize the SSP0
@@ -773,8 +773,8 @@ static void ssp_recvblock(FAR struct spi_dev_s *dev, FAR void *buffer, size_t nw
*
****************************************************************************/
-#ifdef CONFIG_LPC17_SSP0
-static inline FAR struct lpc17_sspdev_s *lpc17_ssp0initialize(void)
+#ifdef CONFIG_LPC17_40_SSP0
+static inline FAR struct lpc17_40_sspdev_s *lpc17_40_ssp0initialize(void)
{
irqstate_t flags;
uint32_t regval;
@@ -789,24 +789,24 @@ static inline FAR struct lpc17_sspdev_s *lpc17_ssp0initialize(void)
*/
flags = enter_critical_section();
- lpc17_configgpio(GPIO_SSP0_SCK);
- lpc17_configgpio(GPIO_SSP0_MISO);
- lpc17_configgpio(GPIO_SSP0_MOSI);
+ lpc17_40_configgpio(GPIO_SSP0_SCK);
+ lpc17_40_configgpio(GPIO_SSP0_MISO);
+ lpc17_40_configgpio(GPIO_SSP0_MOSI);
/* Configure clocking */
#ifdef LPC176x
- regval = getreg32(LPC17_SYSCON_PCLKSEL1);
+ regval = getreg32(LPC17_40_SYSCON_PCLKSEL1);
regval &= ~SYSCON_PCLKSEL1_SSP0_MASK;
regval |= (SSP_PCLKSET_DIV << SYSCON_PCLKSEL1_SSP0_SHIFT);
- putreg32(regval, LPC17_SYSCON_PCLKSEL1);
+ putreg32(regval, LPC17_40_SYSCON_PCLKSEL1);
#endif
/* Enable peripheral clocking to SSP0 */
- regval = getreg32(LPC17_SYSCON_PCONP);
+ regval = getreg32(LPC17_40_SYSCON_PCONP);
regval |= SYSCON_PCONP_PCSSP0;
- putreg32(regval, LPC17_SYSCON_PCONP);
+ putreg32(regval, LPC17_40_SYSCON_PCONP);
leave_critical_section(flags);
return &g_ssp0dev;
@@ -814,7 +814,7 @@ static inline FAR struct lpc17_sspdev_s *lpc17_ssp0initialize(void)
#endif
/****************************************************************************
- * Name: lpc17_ssp1initialize
+ * Name: lpc17_40_ssp1initialize
*
* Description:
* Initialize the SSP1
@@ -827,8 +827,8 @@ static inline FAR struct lpc17_sspdev_s *lpc17_ssp0initialize(void)
*
****************************************************************************/
-#ifdef CONFIG_LPC17_SSP1
-static inline FAR struct lpc17_sspdev_s *lpc17_ssp1initialize(void)
+#ifdef CONFIG_LPC17_40_SSP1
+static inline FAR struct lpc17_40_sspdev_s *lpc17_40_ssp1initialize(void)
{
irqstate_t flags;
uint32_t regval;
@@ -843,24 +843,24 @@ static inline FAR struct lpc17_sspdev_s *lpc17_ssp1initialize(void)
*/
flags = enter_critical_section();
- lpc17_configgpio(GPIO_SSP1_SCK);
- lpc17_configgpio(GPIO_SSP1_MISO);
- lpc17_configgpio(GPIO_SSP1_MOSI);
+ lpc17_40_configgpio(GPIO_SSP1_SCK);
+ lpc17_40_configgpio(GPIO_SSP1_MISO);
+ lpc17_40_configgpio(GPIO_SSP1_MOSI);
/* Configure clocking */
#ifdef LPC176x
- regval = getreg32(LPC17_SYSCON_PCLKSEL0);
+ regval = getreg32(LPC17_40_SYSCON_PCLKSEL0);
regval &= ~SYSCON_PCLKSEL0_SSP1_MASK;
regval |= (SSP_PCLKSET_DIV << SYSCON_PCLKSEL0_SSP1_SHIFT);
- putreg32(regval, LPC17_SYSCON_PCLKSEL0);
+ putreg32(regval, LPC17_40_SYSCON_PCLKSEL0);
#endif
/* Enable peripheral clocking to SSP0 and SSP1 */
- regval = getreg32(LPC17_SYSCON_PCONP);
+ regval = getreg32(LPC17_40_SYSCON_PCONP);
regval |= SYSCON_PCONP_PCSSP1;
- putreg32(regval, LPC17_SYSCON_PCONP);
+ putreg32(regval, LPC17_40_SYSCON_PCONP);
leave_critical_section(flags);
return &g_ssp1dev;
@@ -868,7 +868,7 @@ static inline FAR struct lpc17_sspdev_s *lpc17_ssp1initialize(void)
#endif
/****************************************************************************
- * Name: lpc17_ssp2initialize
+ * Name: lpc17_40_ssp2initialize
*
* Description:
* Initialize the SSP2
@@ -881,8 +881,8 @@ static inline FAR struct lpc17_sspdev_s *lpc17_ssp1initialize(void)
*
****************************************************************************/
-#ifdef CONFIG_LPC17_SSP2
-static inline FAR struct lpc17_sspdev_s *lpc17_ssp2initialize(void)
+#ifdef CONFIG_LPC17_40_SSP2
+static inline FAR struct lpc17_40_sspdev_s *lpc17_40_ssp2initialize(void)
{
irqstate_t flags;
uint32_t regval;
@@ -896,24 +896,24 @@ static inline FAR struct lpc17_sspdev_s *lpc17_ssp2initialize(void)
*/
flags = enter_critical_section();
- lpc17_configgpio(GPIO_SSP2_SCK);
- lpc17_configgpio(GPIO_SSP2_MISO);
- lpc17_configgpio(GPIO_SSP2_MOSI);
+ lpc17_40_configgpio(GPIO_SSP2_SCK);
+ lpc17_40_configgpio(GPIO_SSP2_MISO);
+ lpc17_40_configgpio(GPIO_SSP2_MOSI);
/* Configure clocking */
#ifdef LPC176x
- regval = getreg32(LPC17_SYSCON_PCLKSEL0);
+ regval = getreg32(LPC17_40_SYSCON_PCLKSEL0);
regval &= ~SYSCON_PCLKSEL0_SSP2_MASK;
regval |= (SSP_PCLKSET_DIV << SYSCON_PCLKSEL0_SSP2_SHIFT);
- putreg32(regval, LPC17_SYSCON_PCLKSEL0);
+ putreg32(regval, LPC17_40_SYSCON_PCLKSEL0);
#endif
/* Enable peripheral clocking to SSP0 and SSP1 */
- regval = getreg32(LPC17_SYSCON_PCONP);
+ regval = getreg32(LPC17_40_SYSCON_PCONP);
regval |= SYSCON_PCONP_PCSSP2;
- putreg32(regval, LPC17_SYSCON_PCONP);
+ putreg32(regval, LPC17_40_SYSCON_PCONP);
leave_critical_section(flags);
return &g_ssp2dev;
@@ -925,7 +925,7 @@ static inline FAR struct lpc17_sspdev_s *lpc17_ssp2initialize(void)
****************************************************************************/
/****************************************************************************
- * Name: lpc17_sspbus_initialize
+ * Name: lpc17_40_sspbus_initialize
*
* Description:
* Initialize the selected SSP port.
@@ -938,9 +938,9 @@ static inline FAR struct lpc17_sspdev_s *lpc17_ssp2initialize(void)
*
****************************************************************************/
-FAR struct spi_dev_s *lpc17_sspbus_initialize(int port)
+FAR struct spi_dev_s *lpc17_40_sspbus_initialize(int port)
{
- FAR struct lpc17_sspdev_s *priv;
+ FAR struct lpc17_40_sspdev_s *priv;
uint32_t regval;
int i;
@@ -948,19 +948,19 @@ FAR struct spi_dev_s *lpc17_sspbus_initialize(int port)
switch (port)
{
-#ifdef CONFIG_LPC17_SSP0
+#ifdef CONFIG_LPC17_40_SSP0
case 0:
- priv = lpc17_ssp0initialize();
+ priv = lpc17_40_ssp0initialize();
break;
#endif
-#ifdef CONFIG_LPC17_SSP1
+#ifdef CONFIG_LPC17_40_SSP1
case 1:
- priv = lpc17_ssp1initialize();
+ priv = lpc17_40_ssp1initialize();
break;
#endif
-#ifdef CONFIG_LPC17_SSP2
+#ifdef CONFIG_LPC17_40_SSP2
case 2:
- priv = lpc17_ssp2initialize();
+ priv = lpc17_40_ssp2initialize();
break;
#endif
default:
@@ -969,12 +969,12 @@ FAR struct spi_dev_s *lpc17_sspbus_initialize(int port)
/* Configure 8-bit SPI mode */
- ssp_putreg(priv, LPC17_SSP_CR0_OFFSET, SSP_CR0_DSS_8BIT | SSP_CR0_FRF_SPI);
+ ssp_putreg(priv, LPC17_40_SSP_CR0_OFFSET, SSP_CR0_DSS_8BIT | SSP_CR0_FRF_SPI);
/* Disable the SSP and all interrupts (we'll poll for all data) */
- ssp_putreg(priv, LPC17_SSP_CR1_OFFSET, 0);
- ssp_putreg(priv, LPC17_SSP_IMSC_OFFSET, 0);
+ ssp_putreg(priv, LPC17_40_SSP_CR1_OFFSET, 0);
+ ssp_putreg(priv, LPC17_40_SSP_IMSC_OFFSET, 0);
/* Set the initial SSP configuration */
@@ -992,11 +992,11 @@ FAR struct spi_dev_s *lpc17_sspbus_initialize(int port)
/* Enable the SPI */
- regval = ssp_getreg(priv, LPC17_SSP_CR1_OFFSET);
- ssp_putreg(priv, LPC17_SSP_CR1_OFFSET, regval | SSP_CR1_SSE);
- for (i = 0; i < LPC17_SSP_FIFOSZ; i++)
+ regval = ssp_getreg(priv, LPC17_40_SSP_CR1_OFFSET);
+ ssp_putreg(priv, LPC17_40_SSP_CR1_OFFSET, regval | SSP_CR1_SSE);
+ for (i = 0; i < LPC17_40_SSP_FIFOSZ; i++)
{
- (void)ssp_getreg(priv, LPC17_SSP_DR_OFFSET);
+ (void)ssp_getreg(priv, LPC17_40_SSP_DR_OFFSET);
}
return &priv->spidev;
@@ -1019,28 +1019,28 @@ FAR struct spi_dev_s *lpc17_sspbus_initialize(int port)
void ssp_flush(FAR struct spi_dev_s *dev)
{
- FAR struct lpc17_sspdev_s *priv = (FAR struct lpc17_sspdev_s *)dev;
+ FAR struct lpc17_40_sspdev_s *priv = (FAR struct lpc17_40_sspdev_s *)dev;
/* Wait for the TX FIFO not full indication */
- while (!(ssp_getreg(priv, LPC17_SSP_SR_OFFSET) & SSP_SR_TNF));
- ssp_putreg(priv, LPC17_SSP_DR_OFFSET, 0xff);
+ while (!(ssp_getreg(priv, LPC17_40_SSP_SR_OFFSET) & SSP_SR_TNF));
+ ssp_putreg(priv, LPC17_40_SSP_DR_OFFSET, 0xff);
/* Wait until TX FIFO and TX shift buffer are empty */
- while (ssp_getreg(priv, LPC17_SSP_SR_OFFSET) & SSP_SR_BSY);
+ while (ssp_getreg(priv, LPC17_40_SSP_SR_OFFSET) & SSP_SR_BSY);
/* Wait until RX FIFO is not empty */
- while (!(ssp_getreg(priv, LPC17_SSP_SR_OFFSET) & SSP_SR_RNE));
+ while (!(ssp_getreg(priv, LPC17_40_SSP_SR_OFFSET) & SSP_SR_RNE));
/* Then read and discard bytes until the RX FIFO is empty */
do
{
- (void)ssp_getreg(priv, LPC17_SSP_DR_OFFSET);
+ (void)ssp_getreg(priv, LPC17_40_SSP_DR_OFFSET);
}
- while (ssp_getreg(priv, LPC17_SSP_SR_OFFSET) & SSP_SR_RNE);
+ while (ssp_getreg(priv, LPC17_40_SSP_SR_OFFSET) & SSP_SR_RNE);
}
-#endif /* CONFIG_LPC17_SSP0/1 */
+#endif /* CONFIG_LPC17_40_SSP0/1 */
diff --git a/arch/arm/src/lpc17xx/lpc17_ssp.h b/arch/arm/src/lpc17xx_40xx/lpc17_40_ssp.h
similarity index 75%
rename from arch/arm/src/lpc17xx/lpc17_ssp.h
rename to arch/arm/src/lpc17xx_40xx/lpc17_40_ssp.h
index d08e1b8d179..4f4bb4c4179 100644
--- a/arch/arm/src/lpc17xx/lpc17_ssp.h
+++ b/arch/arm/src/lpc17xx_40xx/lpc17_40_ssp.h
@@ -1,5 +1,5 @@
/************************************************************************************
- * arch/arm/src/lpc17xx/lpc17_ssp.h
+ * arch/arm/src/lpc17xx_40xx/lpc17_40_ssp.h
*
* Copyright (C) 2010, 2012-2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt
@@ -33,8 +33,8 @@
*
************************************************************************************/
-#ifndef __ARCH_ARM_SRC_LPC17XX_LPC17_SSP_H
-#define __ARCH_ARM_SRC_LPC17XX_LPC17_SSP_H
+#ifndef __ARCH_ARM_SRC_LPC17XX_40XX_LPC17_40_SSP_H
+#define __ARCH_ARM_SRC_LPC17XX_40XX_LPC17_40_SSP_H
/************************************************************************************
* Included Files
@@ -44,9 +44,9 @@
#include
-#include "hardware/lpc17_ssp.h"
+#include "hardware/lpc17_40_ssp.h"
-#if defined(CONFIG_LPC17_SSP0) || defined(CONFIG_LPC17_SSP1)
+#if defined(CONFIG_LPC17_40_SSP0) || defined(CONFIG_LPC17_40_SSP1)
/************************************************************************************
* Pre-processor Definitions
@@ -71,7 +71,7 @@ extern "C"
************************************************************************************/
/************************************************************************************
- * Name: lpc17_sspbus_initialize
+ * Name: lpc17_40_sspbus_initialize
*
* Description:
* Initialize the selected SSP port.
@@ -84,47 +84,47 @@ extern "C"
*
************************************************************************************/
-FAR struct spi_dev_s *lpc17_sspbus_initialize(int port);
+FAR struct spi_dev_s *lpc17_40_sspbus_initialize(int port);
/************************************************************************************
- * Name: lpc17_ssp0/ssp1select, lpc17_ssp0/ssp1status, and lpc17_ssp0/ssp1cmddata
+ * Name: lpc17_40_ssp0/ssp1select, lpc17_40_ssp0/ssp1status, and lpc17_40_ssp0/ssp1cmddata
*
* Description:
* These external functions must be provided by board-specific logic. They are
* implementations of the select, status, and cmddata methods of the SPI interface
* defined by struct spi_ops_s (see include/nuttx/spi/spi.h). All other methods
- * including lpc17_sspbus_initialize()) are provided by common LPC17xx logic. To use
+ * including lpc17_40_sspbus_initialize()) are provided by common LPC17xx/LPC40xx logic. To use
* this common SPI logic on your board:
*
- * 1. Provide logic in lpc17_boardinitialize() to configure SSP chip select pins.
- * 2. Provide lpc17_ssp0/ssp1select() and lpc17_ssp0/ssp1status() functions
+ * 1. Provide logic in lpc17_40_boardinitialize() to configure SSP chip select pins.
+ * 2. Provide lpc17_40_ssp0/ssp1select() and lpc17_40_ssp0/ssp1status() functions
* in your board-specific logic. These functions will perform chip selection
* and status operations using GPIOs in the way your board is configured.
* 2. If CONFIG_SPI_CMDDATA is defined in the NuttX configuration, provide
- * lpc17_ssp0/ssp1cmddata() functions in your board-specific logic. These
+ * lpc17_40_ssp0/ssp1cmddata() functions in your board-specific logic. These
* functions will perform cmd/data selection operations using GPIOs in the way
* your board is configured.
- * 3. Add a call to lpc17_sspbus_initialize() in your low level application
+ * 3. Add a call to lpc17_40_sspbus_initialize() in your low level application
* initialization logic
- * 4. The handle returned by lpc17_sspbus_initialize() may then be used to bind the
+ * 4. The handle returned by lpc17_40_sspbus_initialize() may then be used to bind the
* SSP driver to higher level logic (e.g., calling mmcsd_spislotinitialize(),
* for example, will bind the SSP driver to the SPI MMC/SD driver).
*
************************************************************************************/
-#ifdef CONFIG_LPC17_SSP0
-void lpc17_ssp0select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected);
-uint8_t lpc17_ssp0status(FAR struct spi_dev_s *dev, uint32_t devid);
+#ifdef CONFIG_LPC17_40_SSP0
+void lpc17_40_ssp0select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected);
+uint8_t lpc17_40_ssp0status(FAR struct spi_dev_s *dev, uint32_t devid);
#ifdef CONFIG_SPI_CMDDATA
-int lpc17_ssp0cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
+int lpc17_40_ssp0cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
#endif
#endif
-#ifdef CONFIG_LPC17_SSP1
-void lpc17_ssp1select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected);
-uint8_t lpc17_ssp1status(FAR struct spi_dev_s *dev, uint32_t devid);
+#ifdef CONFIG_LPC17_40_SSP1
+void lpc17_40_ssp1select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected);
+uint8_t lpc17_40_ssp1status(FAR struct spi_dev_s *dev, uint32_t devid);
#ifdef CONFIG_SPI_CMDDATA
-int lpc17_ssp1cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
+int lpc17_40_ssp1cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
#endif
#endif
@@ -144,12 +144,12 @@ int lpc17_ssp1cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
*
****************************************************************************/
-#if defined(CONFIG_LPC17_SSP0) || defined(CONFIG_LPC17_SSP1)
+#if defined(CONFIG_LPC17_40_SSP0) || defined(CONFIG_LPC17_40_SSP1)
void ssp_flush(FAR struct spi_dev_s *dev);
#endif
/****************************************************************************
- * Name: lpc17_ssp0/1register
+ * Name: lpc17_40_ssp0/1register
*
* Description:
* If the board supports a card detect callback to inform the SPI-based
@@ -169,13 +169,13 @@ void ssp_flush(FAR struct spi_dev_s *dev);
****************************************************************************/
#ifdef CONFIG_SPI_CALLBACK
-#ifdef CONFIG_LPC17_SSP0
-int lpc17_ssp0register(FAR struct spi_dev_s *dev, spi_mediachange_t callback,
+#ifdef CONFIG_LPC17_40_SSP0
+int lpc17_40_ssp0register(FAR struct spi_dev_s *dev, spi_mediachange_t callback,
FAR void *arg);
#endif
-#ifdef CONFIG_LPC17_SSP1
-int lpc17_ssp1register(FAR struct spi_dev_s *dev, spi_mediachange_t callback,
+#ifdef CONFIG_LPC17_40_SSP1
+int lpc17_40_ssp1register(FAR struct spi_dev_s *dev, spi_mediachange_t callback,
FAR void *arg);
#endif
#endif
@@ -185,5 +185,5 @@ int lpc17_ssp1register(FAR struct spi_dev_s *dev, spi_mediachange_t callback,
#endif
#endif /* __ASSEMBLY__ */
-#endif /* CONFIG_LPC17_SSP0 || CONFIG_LPC17_SSP1 */
-#endif /* __ARCH_ARM_SRC_LPC17XX_LPC17_SSP_H */
+#endif /* CONFIG_LPC17_40_SSP0 || CONFIG_LPC17_40_SSP1 */
+#endif /* __ARCH_ARM_SRC_LPC17XX_40XX_LPC17_40_SSP_H */
diff --git a/arch/arm/src/lpc17xx/lpc17_start.c b/arch/arm/src/lpc17xx_40xx/lpc17_40_start.c
similarity index 95%
rename from arch/arm/src/lpc17xx/lpc17_start.c
rename to arch/arm/src/lpc17xx_40xx/lpc17_40_start.c
index 441a0a38e83..a985dd2c128 100644
--- a/arch/arm/src/lpc17xx/lpc17_start.c
+++ b/arch/arm/src/lpc17xx_40xx/lpc17_40_start.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * arch/arm/src/lpc17xx/lpc17_start.c
+ * arch/arm/src/lpc17xx_40xx/lpc17_40_start.c
*
* Copyright (C) 2010, 2012-2013, 2015, 2018 Gregory Nutt. All rights
* reserved.
@@ -52,10 +52,10 @@
#include "up_internal.h"
#include "nvic.h"
-#include "lpc17_clockconfig.h"
-#include "lpc17_lowputc.h"
-#include "lpc17_userspace.h"
-#include "lpc17_start.h"
+#include "lpc17_40_clockconfig.h"
+#include "lpc17_40_lowputc.h"
+#include "lpc17_40_userspace.h"
+#include "lpc17_40_start.h"
/****************************************************************************
* Pre-processor Definitions
@@ -106,7 +106,7 @@ const uintptr_t g_idle_topstack = HEAP_BASE;
#endif
/****************************************************************************
- * Name: lpc17_fpuconfig
+ * Name: lpc17_40_fpuconfig
*
* Description:
* Configure the FPU. Relative bit settings:
@@ -131,7 +131,7 @@ const uintptr_t g_idle_topstack = HEAP_BASE;
#ifdef CONFIG_ARCH_FPU
#ifndef CONFIG_ARMV7M_LAZYFPU
-static inline void lpc17_fpuconfig(void)
+static inline void lpc17_40_fpuconfig(void)
{
uint32_t regval;
@@ -161,7 +161,7 @@ static inline void lpc17_fpuconfig(void)
#else
-static inline void lpc17_fpuconfig(void)
+static inline void lpc17_40_fpuconfig(void)
{
uint32_t regval;
@@ -192,7 +192,7 @@ static inline void lpc17_fpuconfig(void)
#endif
#else
-# define lpc17_fpuconfig()
+# define lpc17_40_fpuconfig()
#endif
/****************************************************************************
@@ -230,9 +230,9 @@ void __start(void)
/* Configure the uart so that we can get debug output as soon as possible */
- lpc17_clockconfig();
- lpc17_fpuconfig();
- lpc17_lowsetup();
+ lpc17_40_clockconfig();
+ lpc17_40_fpuconfig();
+ lpc17_40_lowsetup();
showprogress('A');
/* Clear .bss. We'll do this inline (vs. calling memset) just to be
@@ -273,13 +273,13 @@ void __start(void)
*/
#ifdef CONFIG_BUILD_PROTECTED
- lpc17_userspace();
+ lpc17_40_userspace();
showprogress('E');
#endif
/* Initialize onboard resources */
- lpc17_boardinitialize();
+ lpc17_40_boardinitialize();
showprogress('F');
/* Then start NuttX */
diff --git a/arch/arm/src/lpc17xx/lpc17_start.h b/arch/arm/src/lpc17xx_40xx/lpc17_40_start.h
similarity index 90%
rename from arch/arm/src/lpc17xx/lpc17_start.h
rename to arch/arm/src/lpc17xx_40xx/lpc17_40_start.h
index 79d6fbac397..3bcbf3a1c8d 100644
--- a/arch/arm/src/lpc17xx/lpc17_start.h
+++ b/arch/arm/src/lpc17xx_40xx/lpc17_40_start.h
@@ -1,5 +1,5 @@
/************************************************************************************
- * arch/arm/src/lpc17xx/lpc17_start.h
+ * arch/arm/src/lpc17xx_40xx/lpc17_40_start.h
*
* Copyright (C) 2017-2018 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt
@@ -33,8 +33,8 @@
*
************************************************************************************/
-#ifndef __ARCH_ARM_SRC_LPC17XX_LPC17_START_H
-#define __ARCH_ARM_SRC_LPC17XX_LPC17_START_H
+#ifndef __ARCH_ARM_SRC_LPC17XX_40XX_LPC17_40_START_H
+#define __ARCH_ARM_SRC_LPC17XX_40XX_LPC17_40_START_H
/************************************************************************************
* Included Files
@@ -63,16 +63,16 @@ extern const uintptr_t g_idle_topstack;
************************************************************************************/
/************************************************************************************
- * Name: lpc17_boardinitialize
+ * Name: lpc17_40_boardinitialize
*
* Description:
- * All LPC17xx architectures must provide the following entry point. This entry
+ * All LPC17xx/LPC40xx architectures must provide the following entry point. This entry
* point is called early in the initialization -- after clocking and memory have
* been configured but before caches have been enabled and before any devices have
* been initialized.
*
************************************************************************************/
-void lpc17_boardinitialize(void);
+void lpc17_40_boardinitialize(void);
-#endif /* __ARCH_ARM_SRC_LPC17XX_LPC17_START_H */
+#endif /* __ARCH_ARM_SRC_LPC17XX_40XX_LPC17_40_START_H */
diff --git a/arch/arm/src/lpc17xx/lpc17_timer.c b/arch/arm/src/lpc17xx_40xx/lpc17_40_timer.c
similarity index 80%
rename from arch/arm/src/lpc17xx/lpc17_timer.c
rename to arch/arm/src/lpc17xx_40xx/lpc17_40_timer.c
index ea780238f77..4db14dd9f18 100644
--- a/arch/arm/src/lpc17xx/lpc17_timer.c
+++ b/arch/arm/src/lpc17xx_40xx/lpc17_40_timer.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * arch/arm/src/lpc17xx/lpc17_timer.c
+ * arch/arm/src/lpc17xx_40xx/lpc17_40_timer.c
*
* Copyright (C) 2014, 2016 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt
@@ -54,17 +54,17 @@
#include "up_arch.h"
#include "chip.h"
-#include "hardware/lpc17_syscon.h"
-#include "lpc17_timer.h"
+#include "hardware/lpc17_40_syscon.h"
+#include "lpc17_40_timer.h"
#include "hardware/lpc176x_pinconfig.h"
-#include "lpc17_gpio.h"
+#include "lpc17_40_gpio.h"
#include "lpc176x_gpio.h"
/* This module then only compiles if there is at least one enabled timer
* intended for use with the TIMER upper half driver.
*/
-#if defined(CONFIG_LPC17_TMR0)
+#if defined(CONFIG_LPC17_40_TMR0)
/****************************************************************************
* Pre-processor Definitions
@@ -94,7 +94,7 @@
****************************************************************************/
/* This structure represents the state of one PWM timer */
-struct lpc17_timer_s
+struct lpc17_40_timer_s
{
FAR const struct pwm_ops_s *ops; /* PWM operations */
uint8_t timid; /* Timer ID {0,...,7} */
@@ -111,18 +111,18 @@ struct lpc17_timer_s
****************************************************************************/
/* Register access */
-static uint32_t timer_getreg(struct lpc17_timer_s *priv, int offset);
-static void timer_putreg(struct lpc17_timer_s *priv, int offset, uint32_t value);
+static uint32_t timer_getreg(struct lpc17_40_timer_s *priv, int offset);
+static void timer_putreg(struct lpc17_40_timer_s *priv, int offset, uint32_t value);
#ifdef CONFIG_DEBUG_PWM_INFO
-static void timer_dumpregs(struct lpc17_timer_s *priv, FAR const char *msg);
+static void timer_dumpregs(struct lpc17_40_timer_s *priv, FAR const char *msg);
#else
# define timer_dumpregs(priv,msg)
#endif
/* Timer management */
-static int timer_timer(FAR struct lpc17_timer_s *priv,
+static int timer_timer(FAR struct lpc17_40_timer_s *priv,
FAR const struct pwm_info_s *info);
/* PWM driver methods */
@@ -151,14 +151,14 @@ static const struct pwm_ops_s g_pwmops =
.ioctl = timer_ioctl,
};
-#ifdef CONFIG_LPC17_TMR0
-static struct lpc17_timer_s g_pwm1dev =
+#ifdef CONFIG_LPC17_40_TMR0
+static struct lpc17_40_timer_s g_pwm1dev =
{
.ops = &g_pwmops,
.timid = 1,
- .channel = CONFIG_LPC17_MAT0_PIN,
+ .channel = CONFIG_LPC17_40_MAT0_PIN,
.timtype = TIMTYPE_TIM1,
- .base = LPC17_TMR1_BASE,
+ .base = LPC17_40_TMR1_BASE,
.pincfg = GPIO_MAT0p1_2,
.pclk = (0x1 << 12),
};
@@ -183,7 +183,7 @@ static struct lpc17_timer_s g_pwm1dev =
*
****************************************************************************/
-static uint32_t timer_getreg(struct lpc17_timer_s *priv, int offset)
+static uint32_t timer_getreg(struct lpc17_40_timer_s *priv, int offset)
{
return getreg32(priv->base + offset);
}
@@ -203,7 +203,7 @@ static uint32_t timer_getreg(struct lpc17_timer_s *priv, int offset)
*
****************************************************************************/
-static void timer_putreg(struct lpc17_timer_s *priv, int offset,
+static void timer_putreg(struct lpc17_40_timer_s *priv, int offset,
uint32_t value)
{
putreg32(value, priv->base + offset);
@@ -224,29 +224,29 @@ static void timer_putreg(struct lpc17_timer_s *priv, int offset,
****************************************************************************/
#ifdef CONFIG_DEBUG_PWM_INFO
-static void timer_dumpregs(struct lpc17_timer_s *priv, FAR const char *msg)
+static void timer_dumpregs(struct lpc17_40_timer_s *priv, FAR const char *msg)
{
pwminfo("%s:\n", msg);
pwminfo(" CR1: %04x CR2: %04x SMCR: %04x DIER: %04x\n",
- timer_getreg(priv, LPC17_PWM_MR0_OFFSET),
- timer_getreg(priv, LPC17_PWM_MR1_OFFSET),
- timer_getreg(priv, LPC17_PWM_MR2_OFFSET),
- timer_getreg(priv, LPC17_PWM_MR3_OFFSET));
-#if defined(CONFIG_LPC17_TMR0)
+ timer_getreg(priv, LPC17_40_PWM_MR0_OFFSET),
+ timer_getreg(priv, LPC17_40_PWM_MR1_OFFSET),
+ timer_getreg(priv, LPC17_40_PWM_MR2_OFFSET),
+ timer_getreg(priv, LPC17_40_PWM_MR3_OFFSET));
+#if defined(CONFIG_LPC17_40_TMR0)
if (priv->timtype == TIMTYPE_ADVANCED)
{
pwminfo(" RCR: %04x BDTR: %04x DCR: %04x DMAR: %04x\n",
- timer_getreg(priv, LPC17_PWM_MR0_OFFSET),
- timer_getreg(priv, LPC17_PWM_MR1_OFFSET),
- timer_getreg(priv, LPC17_PWM_MR2_OFFSET),
- timer_getreg(priv, LPC17_PWM_MR3_OFFSET));
+ timer_getreg(priv, LPC17_40_PWM_MR0_OFFSET),
+ timer_getreg(priv, LPC17_40_PWM_MR1_OFFSET),
+ timer_getreg(priv, LPC17_40_PWM_MR2_OFFSET),
+ timer_getreg(priv, LPC17_40_PWM_MR3_OFFSET));
}
else
#endif
{
pwminfo(" DCR: %04x DMAR: %04x\n",
- timer_getreg(priv, LPC17_PWM_MR2_OFFSET),
- timer_getreg(priv, LPC17_PWM_MR3_OFFSET));
+ timer_getreg(priv, LPC17_40_PWM_MR2_OFFSET),
+ timer_getreg(priv, LPC17_40_PWM_MR3_OFFSET));
}
}
#endif
@@ -266,7 +266,7 @@ static void timer_dumpregs(struct lpc17_timer_s *priv, FAR const char *msg)
*
****************************************************************************/
-static int timer_timer(FAR struct lpc17_timer_s *priv,
+static int timer_timer(FAR struct lpc17_40_timer_s *priv,
FAR const struct pwm_info_s *info)
{
irqstate_t flags;
@@ -274,11 +274,11 @@ static int timer_timer(FAR struct lpc17_timer_s *priv,
flags = enter_critical_section();
- putreg32(info->frequency, LPC17_TMR0_MR1); /* Set TIMER0 MR1 = number of counts */
- putreg32(info->frequency, LPC17_TMR1_MR0); /* Set TIMER1 MR0 = number of counts */
+ putreg32(info->frequency, LPC17_40_TMR0_MR1); /* Set TIMER0 MR1 = number of counts */
+ putreg32(info->frequency, LPC17_40_TMR1_MR0); /* Set TIMER1 MR0 = number of counts */
- putreg32(1, LPC17_TMR0_TCR); /* Start timer0 */
- putreg32(1, LPC17_TMR1_TCR); /* Start timer1 */
+ putreg32(1, LPC17_40_TMR0_TCR); /* Start timer0 */
+ putreg32(1, LPC17_40_TMR1_TCR); /* Start timer1 */
leave_critical_section(flags);
timer_dumpregs(priv, "After starting");
@@ -300,7 +300,7 @@ static int timer_timer(FAR struct lpc17_timer_s *priv,
*
****************************************************************************/
-static int timer_interrupt(struct lpc17_timer_s *priv)
+static int timer_interrupt(struct lpc17_40_timer_s *priv)
{
uint16_t regval;
@@ -363,7 +363,7 @@ static int timer_tim1interrupt(int irq, void *context)
static int timer_setup(FAR struct pwm_lowerhalf_s *dev)
{
- FAR struct lpc17_timer_s *priv = (FAR struct lpc17_timer_s *)dev;
+ FAR struct lpc17_40_timer_s *priv = (FAR struct lpc17_40_timer_s *)dev;
irqstate_t flags;
uint32_t regval;
@@ -371,58 +371,58 @@ static int timer_setup(FAR struct pwm_lowerhalf_s *dev)
/* Power on the timer peripherals */
- regval = getreg32(LPC17_SYSCON_PCONP);
+ regval = getreg32(LPC17_40_SYSCON_PCONP);
regval |= SYSCON_PCONP_PCTIM0;
regval |= SYSCON_PCONP_PCTIM1;
regval |= SYSCON_PCONP_PCTIM2;
regval |= SYSCON_PCONP_PCTIM3;
- putreg32(regval, LPC17_SYSCON_PCONP);
+ putreg32(regval, LPC17_40_SYSCON_PCONP);
/* Select clock for the timer peripheral */
- regval = getreg32(LPC17_SYSCON_PCLKSEL0);
+ regval = getreg32(LPC17_40_SYSCON_PCLKSEL0);
regval &= ~(0x3 << 2);
regval |= (0x1 << 2); /* PCLK_MC peripheral clk=CCLK=12.5 MHz */
regval &= ~(0x3 << 4);
regval |= (0x1 << 4); /* PCLK_MC peripheral clk=CCLK=12.5 MHz */
- putreg32(regval, LPC17_SYSCON_PCLKSEL0);
- regval = getreg32(LPC17_SYSCON_PCLKSEL1);
+ putreg32(regval, LPC17_40_SYSCON_PCLKSEL0);
+ regval = getreg32(LPC17_40_SYSCON_PCLKSEL1);
regval &= ~(0x3 << 12);
regval |= (0x1 << 12); /* PCLK_MC peripheral clk=CCLK=12.5 MHz */
regval &= ~(0x3 << 14);
regval |= (0x1 << 14); /* PCLK_MC peripheral clk=CCLK=12.5 MHz */
- putreg32(regval, LPC17_SYSCON_PCLKSEL1);
+ putreg32(regval, LPC17_40_SYSCON_PCLKSEL1);
priv->pclk = (0x1 << 12) | (0x1 << 4);
- putreg32(1000, LPC17_TMR0_MR1); /* Set TIMER0 MR1 = number of counts */
+ putreg32(1000, LPC17_40_TMR0_MR1); /* Set TIMER0 MR1 = number of counts */
- putreg32(1, LPC17_TMR0_PR); /* Prescaler count frequency: Fpclk/1 */
- putreg32(~(0x3 << 0), LPC17_TMR0_CCR); /* Prescaler count frequency: Fpclk/1 */
- putreg32(~(0x3 << 0), LPC17_TMR0_CTCR); /* Prescaler count frequency: Fpclk/1 */
- putreg32((2 << 3), LPC17_TMR0_MCR); /* Reset on match register MR1 */
+ putreg32(1, LPC17_40_TMR0_PR); /* Prescaler count frequency: Fpclk/1 */
+ putreg32(~(0x3 << 0), LPC17_40_TMR0_CCR); /* Prescaler count frequency: Fpclk/1 */
+ putreg32(~(0x3 << 0), LPC17_40_TMR0_CTCR); /* Prescaler count frequency: Fpclk/1 */
+ putreg32((2 << 3), LPC17_40_TMR0_MCR); /* Reset on match register MR1 */
/* Output bit toggle on external match event External match on MR1, Toggle
* external bit
*/
- putreg32(((1 << 1) | (3 << 6)), LPC17_TMR0_EMR);
- putreg32((1 << 0), LPC17_TMR0_TCR); /* Start timer0 */
+ putreg32(((1 << 1) | (3 << 6)), LPC17_40_TMR0_EMR);
+ putreg32((1 << 0), LPC17_40_TMR0_TCR); /* Start timer0 */
/* Configure the output pins GPIO3.26 */
- lpc17_configgpio(GPIO_MAT0p1_2);
+ lpc17_40_configgpio(GPIO_MAT0p1_2);
- putreg32(500, LPC17_TMR1_MR0); /* Set TIMER1 MR0 = number of counts */
+ putreg32(500, LPC17_40_TMR1_MR0); /* Set TIMER1 MR0 = number of counts */
- putreg32(1, LPC17_TMR1_PR); /* Prescaler count frequency:Fpclk/1 */
- putreg32(~(0x3 << 0), LPC17_TMR1_CCR); /* Prescaler count frequency:Fpclk/1 */
- putreg32(~(0x3 << 0), LPC17_TMR1_CTCR); /* Prescaler count frequency:Fpclk/1 */
- putreg32((2 << 0), LPC17_TMR1_MCR); /* Reset on match register MR0 */
-// putreg32(((1 << 0 )| (3 << 4)), LPC17_TMR1_EMR); /* Output bit toggle on external match event MAT0 */
- putreg32((1 << 0), LPC17_TMR1_TCR); /* Start timer1 */
+ putreg32(1, LPC17_40_TMR1_PR); /* Prescaler count frequency:Fpclk/1 */
+ putreg32(~(0x3 << 0), LPC17_40_TMR1_CCR); /* Prescaler count frequency:Fpclk/1 */
+ putreg32(~(0x3 << 0), LPC17_40_TMR1_CTCR); /* Prescaler count frequency:Fpclk/1 */
+ putreg32((2 << 0), LPC17_40_TMR1_MCR); /* Reset on match register MR0 */
+// putreg32(((1 << 0 )| (3 << 4)), LPC17_40_TMR1_EMR); /* Output bit toggle on external match event MAT0 */
+ putreg32((1 << 0), LPC17_40_TMR1_TCR); /* Start timer1 */
/* configure the output pins GPIO3.26 */
-// lpc17_configgpio(GPIO_MAT0p1_2);
+// lpc17_40_configgpio(GPIO_MAT0p1_2);
leave_critical_section(flags);
pwm_dumpgpio(priv->pincfg, "TIMER setup");
@@ -447,7 +447,7 @@ static int timer_setup(FAR struct pwm_lowerhalf_s *dev)
static int timer_shutdown(FAR struct pwm_lowerhalf_s *dev)
{
- FAR struct lpc17_timer_s *priv = (FAR struct lpc17_timer_s *)dev;
+ FAR struct lpc17_40_timer_s *priv = (FAR struct lpc17_40_timer_s *)dev;
uint32_t pincfg;
pwminfo("TIM%d pincfg: %08x\n", priv->timid, priv->pincfg);
@@ -475,7 +475,7 @@ static int timer_shutdown(FAR struct pwm_lowerhalf_s *dev)
static int timer_start(FAR struct pwm_lowerhalf_s *dev,
FAR const struct pwm_info_s *info)
{
- FAR struct lpc17_timer_s *priv = (FAR struct lpc17_timer_s *)dev;
+ FAR struct lpc17_40_timer_s *priv = (FAR struct lpc17_40_timer_s *)dev;
return timer_timer(priv, info);
}
@@ -500,7 +500,7 @@ static int timer_start(FAR struct pwm_lowerhalf_s *dev,
static int timer_stop(FAR struct pwm_lowerhalf_s *dev)
{
- FAR struct lpc17_timer_s *priv = (FAR struct lpc17_timer_s *)dev;
+ FAR struct lpc17_40_timer_s *priv = (FAR struct lpc17_40_timer_s *)dev;
uint32_t resetbit;
uint32_t regaddr;
uint32_t regval;
@@ -520,7 +520,7 @@ static int timer_stop(FAR struct pwm_lowerhalf_s *dev)
switch (priv->timid)
{
-#ifdef CONFIG_LPC17_TMR0
+#ifdef CONFIG_LPC17_40_TMR0
case 1:
break;
#endif
@@ -556,7 +556,7 @@ static int timer_stop(FAR struct pwm_lowerhalf_s *dev)
static int timer_ioctl(FAR struct pwm_lowerhalf_s *dev, int cmd, unsigned long arg)
{
#ifdef CONFIG_DEBUG_PWM_INFO
- FAR struct lpc17_timer_s *priv = (FAR struct lpc17_timer_s *)dev;
+ FAR struct lpc17_40_timer_s *priv = (FAR struct lpc17_40_timer_s *)dev;
/* There are no platform-specific ioctl commands */
@@ -570,7 +570,7 @@ static int timer_ioctl(FAR struct pwm_lowerhalf_s *dev, int cmd, unsigned long a
****************************************************************************/
/****************************************************************************
- * Name: lpc17_timerinitialize
+ * Name: lpc17_40_timerinitialize
*
* Description:
* Initialize one timer for use with the upper_level TIMER driver.
@@ -586,15 +586,15 @@ static int timer_ioctl(FAR struct pwm_lowerhalf_s *dev, int cmd, unsigned long a
*
****************************************************************************/
-FAR struct pwm_lowerhalf_s *lpc17_timerinitialize(int timer)
+FAR struct pwm_lowerhalf_s *lpc17_40_timerinitialize(int timer)
{
- FAR struct lpc17_timer_s *lower;
+ FAR struct lpc17_40_timer_s *lower;
pwminfo("TIM%d\n", timer);
switch (timer)
{
-#ifdef CONFIG_LPC17_TMR0
+#ifdef CONFIG_LPC17_40_TMR0
case 0:
lower = &g_pwm1dev;
@@ -611,4 +611,4 @@ FAR struct pwm_lowerhalf_s *lpc17_timerinitialize(int timer)
return (FAR struct pwm_lowerhalf_s *)lower;
}
-#endif /* CONFIG_LPC17_TIMn_TIMER, n = 1,...,14 */
+#endif /* CONFIG_LPC17_40_TIMn_TIMER, n = 1,...,14 */
diff --git a/arch/arm/src/lpc17xx/lpc17_timer.h b/arch/arm/src/lpc17xx_40xx/lpc17_40_timer.h
similarity index 91%
rename from arch/arm/src/lpc17xx/lpc17_timer.h
rename to arch/arm/src/lpc17xx_40xx/lpc17_40_timer.h
index 3f0e8af09ac..9c5144cdc9d 100644
--- a/arch/arm/src/lpc17xx/lpc17_timer.h
+++ b/arch/arm/src/lpc17xx_40xx/lpc17_40_timer.h
@@ -1,5 +1,5 @@
/************************************************************************************
- * arch/arm/src/lpc17xx/lpc17_timer.h
+ * arch/arm/src/lpc17xx_40xx/lpc17_40_timer.h
*
* Copyright (C) 2010, 2012-2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt