diff --git a/Documentation/NuttX.html b/Documentation/NuttX.html
index 7c6111b6d4e..41107d7d35e 100644
--- a/Documentation/NuttX.html
+++ b/Documentation/NuttX.html
@@ -104,7 +104,7 @@
NuttX RTOS
- Last Updated: May 19, 2019
+ Last Updated: July 11, 2019
|
@@ -2771,14 +2771,21 @@ nsh>
NXP LPC11xx.
Support is provided for the NXP LPC11xx family of processors.
- In particular, support is provided for LPCXpression LPC1115 board.
+ In particular, support is provided for LPCXpresso LPC1115 board.
This port was contributed by Alan Carvalho de Assis.
STATUS:
The first released version was provided in NuttX 7.10.
- Refer to the board README.txt file for further information.
+ Refer to the board README.txt file for further information.
+
+
+ Obsoleted:
+ Support for the LPCXpresso-LPC1115 and for the LPC1115 architecture in general was removed after NuttX-7.30.
+ The LPC11 port was never really used (to my knowledge) and was no longer supported.
+ A snapshot of the port is still available in the Obsoleted repository.
+ It can be brought back into the main repository at any time if anyone is willing to provide support for the architecture.
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/README.html b/Documentation/README.html
index fa56f3d72df..18f537a3096 100644
--- a/Documentation/README.html
+++ b/Documentation/README.html
@@ -153,8 +153,6 @@ nuttx/
| | `- README.txt
| |- lpc4370-link2/
| | `- README.txt
- | |- lpcxpresso-lpc1115/
- | | `- README.txt
| |- lpcxpresso-lpc1768/
| | `- README.txt
| |- lpcxpresso-lpc54628/
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/README.txt b/README.txt
index 3ab4d62b2f1..1391538b2b7 100644
--- a/README.txt
+++ b/README.txt
@@ -1848,8 +1848,6 @@ nuttx/
| | `- README.txt
| |- lpc4370-link2/
| | `- README.txt
- | |- lpcxpresso-lpc1115/
- | | `- README.txt
| |- lpcxpresso-lpc1768/
| | `- README.txt
| |- lpcxpresso-lpc54628/
diff --git a/arch/README.txt b/arch/README.txt
index 51bccd4ad56..551dd2d5f4f 100644
--- a/arch/README.txt
+++ b/arch/README.txt
@@ -166,9 +166,8 @@ arch/arm - ARM-based micro-controllers
arch/arm/include/imx6 and arch/arm/src/imrt
arch/arm/include/kinetis and arch/arm/src/kinetis
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/lc823450 and arch/arm/src/lc823450
+ 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..15bc202557a 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -133,21 +133,14 @@ config ARCH_CHIP_LM
---help---
TI/Luminary Stellaris LMS3 and LM4F architectures (ARM Cortex-M3/4)
-config ARCH_CHIP_LPC11XX
- bool "NXP LPC11xx"
- select ARCH_CORTEXM0
- ---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"
@@ -665,9 +658,8 @@ config ARCH_CHIP
default "kinetis" if ARCH_CHIP_KINETIS
default "kl" if ARCH_CHIP_KL
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 "tiva" if ARCH_CHIP_LM || ARCH_CHIP_TIVA || ARCH_CHIP_SIMPLELINK
+ 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
@@ -877,11 +869,8 @@ endif
if ARCH_CHIP_LM || ARCH_CHIP_TIVA || ARCH_CHIP_SIMPLELINK
source arch/arm/src/tiva/Kconfig
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/cxd56xx/geofence.h b/arch/arm/include/cxd56xx/geofence.h
new file mode 100644
index 00000000000..0f400d2dda4
--- /dev/null
+++ b/arch/arm/include/cxd56xx/geofence.h
@@ -0,0 +1,233 @@
+/****************************************************************************
+ * arch/arm/include/cxd56xx/geofence.h
+ *
+ * Copyright 2018 Sony Semiconductor Solutions Corporation
+ *
+ * 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 of Sony Semiconductor Solutions Corporation 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_CXD56XX_GEOFENCE_H
+#define __ARCH_ARM_INCLUDE_CXD56XX_GEOFENCE_H
+
+#ifdef __cplusplus
+#define EXTERN extern "C"
+extern "C"
+{
+#else
+#define EXTERN extern
+#endif
+
+/* Start geofence monitoring.
+ * This command is used to start the geofence monitoring.
+ *
+ * param arg
+ * Parameter is Unnecessary. Set Zero.
+ */
+
+#define CXD56_GEOFENCE_IOCTL_START 1
+
+/* Stop geofence monitoring.
+ * This command is used to stop the geofence monitoring.
+ *
+ * param arg
+ * Parameter is Unnecessary. Set Zero.
+ */
+
+#define CXD56_GEOFENCE_IOCTL_STOP 2
+
+/* Add region.
+ * This command is used to add the region.
+ *
+ * param arg
+ * Parameter is struct cxd56_geofence_region_s.
+ */
+
+#define CXD56_GEOFENCE_IOCTL_ADD 3
+
+/* Modify region.
+ * This command is used to modify the region.
+ *
+ * param arg
+ * Parameter is struct cxd56_geofence_region_s.
+ */
+
+#define CXD56_GEOFENCE_IOCTL_MODIFY 4
+
+/* Delete region.
+ * This command is used to delete the region.
+ *
+ * param arg
+ * Parameter is region id.
+ */
+
+#define CXD56_GEOFENCE_IOCTL_DELETE 5
+
+/* Delete all region.
+ * This command is used to delete all region.
+ *
+ * param arg
+ * Parameter is Unnecessary. Set Zero.
+ */
+
+#define CXD56_GEOFENCE_IOCTL_ALL_DELETE 6
+
+/* Get region data.
+ * This command is used to get region data.
+ *
+ * param arg
+ * Parameter is struct cxd56_geofence_region_s pointer
+ * Latitude and longitude and radius data of specified id is stored.
+ */
+
+#define CXD56_GEOFENCE_IOCTL_GET_REGION_DATA 7
+
+/* Get used id.
+ * This command is used to get used region id.
+ *
+ * param arg
+ * Parameter is uint32_t data pointer.
+ * The used id is represented by bit field.
+ * For example, when ID0 and ID19 are used,
+ * since bit0 and bit19 are set, the return value is 0x00080001.
+ */
+
+#define CXD56_GEOFENCE_IOCTL_GET_USED_ID 8
+
+/* Get all status.
+ * This command is used to get all region status.
+ *
+ * param arg
+ * Parameter is Unnecessary. Set Zero.
+ * All region status will stored in next read data.
+ */
+
+#define CXD56_GEOFENCE_IOCTL_GET_ALL_STATUS 9
+
+/* Set goefence operation mode
+ * This command is used to set operation mode.
+ *
+ * param arg
+ * Parameter is struct cxd56_geofence_mode_s.
+ */
+
+#define CXD56_GEOFENCE_IOCTL_SET_MODE 10
+
+/* check macros for GNSS commands */
+
+#define CXD56_GEOFENCE_IOCTL_INVAL 0
+#define CXD56_GEOFENCE_IOCTL_MAX 11
+
+/* The transition type indicating that the user exits the region. */
+
+#define CXD56_GEOFENCE_TRANSITION_EXIT 0
+
+/* The transition type indicating that the user enters the region. */
+
+#define CXD56_GEOFENCE_TRANSITION_ENTER 1
+
+/* The transition type indicating that the user enters and
+ * dwells in region for a given period of time.
+ */
+
+#define CXD56_GEOFENCE_TRANSITION_DWELL 2
+
+/* MAX number of region on the CXD56xx. */
+
+#define CXD56_GEOFENCE_REGION_CAPACITY 20
+
+/* Region center point and radius data
+ *
+ * The latitude and longtitude data format is
+ * integer value multiplied by 1000000.
+ * Example: When latitude is 35.123456, specify 35123456.
+ */
+
+struct cxd56_geofence_region_s
+{
+ /* Region ID The range of ID is 0 to 19. */
+
+ uint8_t id;
+
+ /* Latitude (degree) of the center position of the region. */
+
+ long latitude;
+
+ /* Longitude (degree) of the center position of the region. */
+
+ long longitude;
+
+ /* Radius (m) of the region. */
+
+ uint16_t radius;
+};
+
+/* Geofence mode setting parameter */
+
+struct cxd56_geofence_mode_s
+{
+ uint16_t deadzone; /* dead zone [meter] */
+ uint16_t dwell_detecttime; /* Dewlling period time [sec] */
+};
+
+/* The transition data */
+
+struct cxd56_geofence_trans_s
+{
+ /* Region ID */
+
+ uint8_t id;
+
+ /* Transition status.
+ * The status is #CXD56_GEOFENCE_TRANSITION_EXIT or
+ * #CXD56_GEOFENCE_TRANSITION_ENTER or #CXD56_GEOFENCE_TRANSITION_DWELL.
+ */
+
+ uint8_t status;
+};
+
+/* Geofence output data structer. */
+
+struct cxd56_geofence_status_s
+{
+ /* Updated region ID count */
+
+ uint8_t update;
+
+ /* The detail data od updated region ID */
+
+ struct cxd56_geofence_trans_s status[CXD56_GEOFENCE_REGION_CAPACITY];
+};
+
+#undef EXTERN
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ARCH_ARM_INCLUDE_ARCH_CXD56XX_GEOFENCE_H */
diff --git a/arch/arm/include/cxd56xx/gnss.h b/arch/arm/include/cxd56xx/gnss.h
new file mode 100644
index 00000000000..0bee9d46d00
--- /dev/null
+++ b/arch/arm/include/cxd56xx/gnss.h
@@ -0,0 +1,869 @@
+/****************************************************************************
+ * arch/arm/include/cxd56xx/gnss.h
+ *
+ * Copyright 2018,2019 Sony Semiconductor Solutions Corporation
+ *
+ * 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 of Sony Semiconductor Solutions Corporation 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_CXD56XX_GNSS_H
+#define __ARCH_ARM_INCLUDE_CXD56XX_GNSS_H
+
+#ifdef __cplusplus
+#define EXTERN extern "C"
+extern "C" {
+#else
+#define EXTERN extern
+#endif
+
+/****************************************************************************
+ * include files
+ ****************************************************************************/
+
+#include
+
+/* Start the positioning.
+ * This command is used to start the positioning.
+ *
+ * param arg
+ * Start mode value of uint32_t. Not address pointer.
+ * One of #CXD56_GNSS_STMOD_COLD, #CXD56_GNSS_STMOD_WARM, #CXD56_GNSS_STMOD_HOT
+ */
+
+#define CXD56_GNSS_IOCTL_START 1
+
+/* Stop the positioning.
+ * This command is used to stop the positioning. GNSS will transition to idle
+ * mode.
+ *
+ * param arg
+ * Parameter is Unnecessary. Set Zero.
+ */
+
+#define CXD56_GNSS_IOCTL_STOP 2
+
+/* Select the satellite systems.
+ * This command is used to select the satellite systems to be used for
+ * positioning.
+ * The satellite system is defined as a bit, and you can select mutiple
+ * sattelites using OR value.
+ * Do not specify zero, please select at least one system.
+ * This command must be issued in idle mode.
+ *
+ * param[in] arg
+ * Satellite system bitmap value of uint32_t. Not address pointer.
+ * Bit OR of #CXD56_GNSS_SAT_GPS, #CXD56_GNSS_SAT_GLONASS,
+ * #CXD56_GNSS_SAT_SBAS, #CXD56_GNSS_SAT_QZ_L1CA, #CXD56_GNSS_SAT_QZ_L1S.
+ */
+
+#define CXD56_GNSS_IOCTL_SELECT_SATELLITE_SYSTEM 3
+
+/* Get satellite system to be used for measurement GNSS.
+ * The satellite system setting of the subscriber that a
+ * SF_COMMAND_COMMON_START command was published is acquired.
+ *
+ * param[out] arg
+ * Address pinting to of uint32_t object.
+ * Bit OR of #CXD56_GNSS_SAT_GPS, #CXD56_GNSS_SAT_GLONASS,
+ * #CXD56_GNSS_SAT_SBAS, #CXD56_GNSS_SAT_QZ_L1CA, #CXD56_GNSS_SAT_QZ_L1S.
+ */
+
+#define CXD56_GNSS_IOCTL_GET_SATELLITE_SYSTEM 4
+
+/* Set the receiver approximate position.
+ * The receiver position is set using ellipsoidal coordinates (latitude,
+ * longitude, altitude).
+ * If ellipsoidal coordinates setting, north latitude and east longitude
+ * direction as positive.
+ * When specifying south latitude or west longitude, set it to a negative
+ * value.
+ *
+ * The receiver position, current time and TCXO offset value, ephemeris data
+ * are required in order to initiate a hot start
+ * so the position must have been set to GNSS using this command prior to hot
+ * start.
+ * Set GNSS configure with this command before hot start if receiver position
+ * is not stored in the memory.
+ * This command must be issued in idle mode.
+ *
+ * param[in] arg
+ * Address pointing to struct #cxd56_gnss_ellipsoidal_position_s object.
+ */
+
+#define CXD56_GNSS_IOCTL_SET_RECEIVER_POSITION_ELLIPSOIDAL 5
+
+/* Set the receiver approximate position.
+ * The receiver position is set using orthogonal coordinates (x, y, z).
+ * The receiver position, current time and TCXO offset value, ephemeris data
+ * are required in order to initiate a hot start.
+ * Set the position with this command before hot start if no position
+ * information in GNSS.
+ * This command must be issued in idle mode.
+ *
+ * param[in] arg
+ * Address pointing to struct #cxd56_gnss_orthogonal_position_s object.
+ */
+
+#define CXD56_GNSS_IOCTL_SET_RECEIVER_POSITION_ORTHOGONAL 6
+
+/* Set receiver operation mode.
+ * Can set operation mode and measurement cycle.
+ * The cycle data is 1000msec aligned only and cannot set 0msec.
+ *
+ * param[in] arg
+ * Address pointing to struct #cxd56_gnss_ope_mode_param_s object.
+ */
+
+#define CXD56_GNSS_IOCTL_SET_OPE_MODE 7
+
+/* Get receiver operation mode.
+ *
+ * param[out] arg
+ * Address pointing to struct #cxd56_gnss_ope_mode_param_s object.
+ */
+
+#define CXD56_GNSS_IOCTL_GET_OPE_MODE 8
+
+/* Set receiver TCXO offset value to GNSS.
+ * Receiver TCXO offset value set in "Hz". It can specify positive direction
+ * or negative direction by a sign int the argument.
+ * The receiver position, current time and TCXO offset value, ephemeris data
+ * are required in order to initiate a hot start.
+ * Set the offset with this command before hot start if no offset information
+ * in GNSS.
+ * This command must be issued in idle mode.
+ *
+ * param[in] arg
+ * TCXO offset value of uint32_t. Not address pointer.
+ * Address pointing to a offset value(int32_t) object.
+ */
+
+#define CXD56_GNSS_IOCTL_SET_TCXO_OFFSET 9
+
+/* Get receiver TCXO offset value.
+ *
+ * param[out] arg
+ * Address pointing to int32_t object.
+ */
+
+#define CXD56_GNSS_IOCTL_GET_TCXO_OFFSET 10
+
+/* Set receiver time to GNSS.
+ * The UTC time standard is used for the receiver time stored in a argument of
+ * cxd56_gnss_datetime type.
+ * The receiver position, current time and TCXO offset value, ephemeris data
+ * are required in order to initiate a hot start.
+ * Set the time with this command before hot start if GPS time is not counted
+ * in RTC.
+ * This command must be issued in idle mode.
+ *
+ * param[in] arg
+ * Address pointing to struct #cxd56_gnss_datetime_s object.
+ */
+
+#define CXD56_GNSS_IOCTL_SET_TIME 11
+
+/* Get the latest almanac data extracted from the satellite signal.
+ * Almanac data size is 2048(GPS) or 576(GLONASS) bytes.
+ * This command must be issued in idle mode.
+ *
+ * param[out] arg
+ * Address pointing to struct #cxd56_gnss_orbital_param_s object.
+ */
+
+#define CXD56_GNSS_IOCTL_GET_ALMANAC 12
+
+/* Set almanac data.
+ * Almanac data size is 2048(GPS) or 576(GLONASS) bytes.
+ * This command must be issued in idle mode.
+ *
+ * param[in] arg
+ * Address pointing to struct #cxd56_gnss_orbital_param_s object.
+ */
+
+#define CXD56_GNSS_IOCTL_SET_ALMANAC 13
+
+/* Get the latest ephemeris data extracted from the satellite signal.
+ * Ephemeris data size is 3072(GPS) or 1152(GLONASS) bytes.
+ * This command must be issued in idle mode.
+ *
+ * param[out] arg
+ * Address pointing to struct #cxd56_gnss_orbital_param_s object.
+ */
+
+#define CXD56_GNSS_IOCTL_GET_EPHEMERIS 14
+
+/* Set ephemeris data.
+ * Ephemeris data size is 3072(GPS) or 1152(GLONASS) bytes.
+ * This command must be issued in idle mode.
+ *
+ * param[in] arg
+ * Address pointing to struct #cxd56_gnss_orbital_param_s object.
+ */
+
+#define CXD56_GNSS_IOCTL_SET_EPHEMERIS 15
+
+/* This command is used to save the backup data. The backup data contents are
+ * saved in the flash memory.
+ * The backup data saved in the flash memory is automatically restored at
+ * boot-up of GNSS.
+ * The receiver position, ephemeris, almanac, TCXO offset and other
+ * information required
+ * for hot start are included in the backup data.
+ * By saving it with this command, you can restore the information necessary
+ * for starting except time at boot time.
+ * This command must be issued in idle mode.
+ *
+ * param arg
+ * Parameter is Unnecessary. Set Zero.
+ */
+
+#define CXD56_GNSS_IOCTL_SAVE_BACKUP_DATA 16
+
+/* Erase backup data on flash memory.
+ * This command must be issued in idle mode.
+ *
+ * param arg
+ * Parameter is Unnecessary. Set Zero.
+ */
+
+#define CXD56_GNSS_IOCTL_ERASE_BACKUP_DATA 17
+
+/* Open CEP data file for GNSS device.
+ *
+ * Open the CEP data file and make the data available from the device.
+ * The file name to be opened is specified by Kconfig.
+ * This command must be issued in idle mode, between calling open function
+ * for GNSS device and issuing the command CXD56_GNSS_IOCTL_START.
+ *
+ * param[in] arg
+ * Parameter is Unnecessary. Set Zero.
+ */
+
+#define CXD56_GNSS_IOCTL_OPEN_CEP_DATA 18
+
+/* Close the CEP data file opened with the command
+ * CXD56_GNSS_IOCTL_OPEN_CEP_DATA.
+ * This command must be issued in idle mode.
+ *
+ * param arg
+ * Parameter is Unnecessary. Set Zero.
+ */
+
+#define CXD56_GNSS_IOCTL_CLOSE_CEP_DATA 19
+
+/* Check the validity of the CEP assist data.
+ * Return error code if the data file dose not exist or data is invalid.
+ *
+ * param arg
+ * Parameter is Unnecessary. Set Zero.
+ */
+
+#define CXD56_GNSS_IOCTL_CHECK_CEP_DATA 20
+
+/* Get age(lifetime) information of assist data.
+ * Age includes start date and time represented by the Julian date(MJD), and
+ * validity period.
+ * Conversion MJD to YMD is following formula.
+ * (Assist data start time must 0:00 (GPS time))\n
+ * If the data file dose not exist, an error will be returned.
+ *
+ * JD12 = floor(MJD + 2400001)
+ * e = floor((JD12 - 1867216.25) / 36524.25)
+ * f = JD12 + (e - floor(e / 4) + 1)
+ * g = f + 1524
+ * h = floor((g - 122.1) / 365.25)
+ * i = floor(365.25 * h)
+ * j = floor((g - i) / 30.6001)
+ *
+ * d = g - i - floor(30.6001 * j)
+ * m = j - 12 * floor(j / 14) - 1
+ * w = h - 4716 + floor((14 - m) / 12)
+ *
+ * if w > 0 then y = w else y = w - 1
+ *
+ * param[in] arg
+ * Address pointing to struct #cxd56_gnss_cep_age_s object.
+ */
+
+#define CXD56_GNSS_IOCTL_GET_CEP_AGE 21
+
+/* Reset CEP assist data init flag & valid flag.
+ * This command for notifying that the data has been updated.
+ * Execute this command before measurement if assist data updated.
+ *
+ * param arg
+ * Parameter is Unnecessary. Set Zero.
+ */
+
+#define CXD56_GNSS_IOCTL_RESET_CEP_FLAG 22
+
+/* Currently version not supported. */
+
+#define CXD56_GNSS_IOCTL_RTK_START 23
+
+/* Currently version not supported. */
+
+#define CXD56_GNSS_IOCTL_RTK_STOP 24
+
+/* Currently version not supported. */
+
+#define CXD56_GNSS_IOCTL_RTK_SET_INTERVAL 25
+
+/* Currently version not supported. */
+
+#define CXD56_GNSS_IOCTL_RTK_GET_INTERVAL 26
+
+/* Currently version not supported. */
+
+#define CXD56_GNSS_IOCTL_RTK_SELECT_SATELLITE_SYSTEM 27
+
+/* Currently version not supported. */
+
+#define CXD56_GNSS_IOCTL_RTK_GET_SATELLITE_SYSTEM 28
+
+/* Currently version not supported. */
+
+#define CXD56_GNSS_IOCTL_RTK_SET_EPHEMERIS_ENABLER 29
+
+/* Currently version not supported. */
+
+#define CXD56_GNSS_IOCTL_RTK_GET_EPHEMERIS_ENABLER 30
+
+/* Set acquist data.
+ *
+ * param[in] arg
+ * Address pointing to struct #cxd56_gnss_agps_acquist_s object.
+ */
+
+#define CXD56_GNSS_IOCTL_AGPS_SET_ACQUIST 31
+
+/* Set frame time.
+ *
+ * param[in] arg
+ * Address pointing to struct #cxd56_gnss_agps_frametime_s object.
+ */
+
+#define CXD56_GNSS_IOCTL_AGPS_SET_FRAMETIME 32
+
+/* Set tau_GPS(τGPS: Differnece of system time between GPS and Glonass
+ * system).
+ *
+ * param[in] arg
+ * Address pointing to tau GPS value(τGPS, double) object.
+ */
+
+#define CXD56_GNSS_IOCTL_AGPS_SET_TAU_GPS 33
+
+/* Set high precision receiver time.
+ *
+ * param arg
+ * Address pointing to struct #cxd56_gnss_agps_time_gps_s object.
+ */
+
+#define CXD56_GNSS_IOCTL_AGPS_SET_TIME_GPS 34
+
+/* Clear info(s) for hot start.
+ *
+ * param arg
+ * Bit OR of #CXD56_GNSS_GCLR_EPH, #CXD56_GNSS_GCLR_ALM, #CXD56_GNSS_GCLR_PV,
+ * #CXD56_GNSS_GCLR_TIME, #CXD56_GNSS_GCLR_TCXO, #CXD56_GNSS_GCLR_ALL.
+ */
+
+#define CXD56_GNSS_IOCTL_AGPS_CLEAR_RECEIVER_INFO 35
+
+/* Set acquist data.
+ *
+ * param[in] arg
+ * Address pointing to struct #cxd56_gnss_agps_tow_assist_s object.
+ */
+
+#define CXD56_GNSS_IOCTL_AGPS_SET_TOW_ASSIST 36
+
+/* Set acquist data.
+ *
+ * param[in] arg
+ * Address pointing to struct #cxd56_gnss_agps_utc_model_s object.
+ */
+
+#define CXD56_GNSS_IOCTL_AGPS_SET_UTC_MODEL 37
+
+/* Enable or not to output spectrum data of GNSS signal.
+ *
+ * param arg
+ * Address pointing to struct #cxd56_gnss_spectrum_control_s object.
+ */
+
+#define CXD56_GNSS_IOCTL_SPECTRUM_CONTROL 38
+
+/* Start GPS factory test.
+ * Test results can get by CXD56_GNSS_IOCTL_FACTORY_GET_TEST_RESULT command
+ * after execute this command and waiting 1 second.
+ * This command execute during measurement stop.
+ * After executing this command, it is not accepted except for
+ * CXD56_GNSS_IOCTL_FACTORY_GET_TEST_RESULT and
+ * CXD56_GNSS_IOCTL_FACTORY_STOP_TEST.
+ *
+ * param[in] arg
+ * Address pointing to struct #cxd56_gnss_test_info_s object.
+ */
+
+#define CXD56_GNSS_IOCTL_FACTORY_START_TEST 39
+
+/* Stop GPS factory test.
+ *
+ * param arg
+ * Parameter is Unnecessary. Set Zero.
+ */
+
+#define CXD56_GNSS_IOCTL_FACTORY_STOP_TEST 40
+
+/* Get GPS factory test result.
+ *
+ * param[out] arg
+ * Address pointing to struct #cxd56_gnss_test_result_s object.
+ */
+
+#define CXD56_GNSS_IOCTL_FACTORY_GET_TEST_RESULT 41
+
+/* Set signal information for GNSS events from GNSS device driver.
+ * The field 'enable' of struct #cxd56_gnss_signal_setting_s to be given
+ * as a parameter must be specified as 1 when setting and 0 when unsetting.
+ * param[out] arg
+ * Address pointing to struct #cxd56_gnss_signal_setting_s object.
+ */
+
+#define CXD56_GNSS_IOCTL_SIGNAL_SET 42
+
+/* Start PVTLOG.
+ * Automatically saves the PVT log in the GNSS core.
+ *
+ * param arg
+ * Address pointing to #cxd56_pvtlog_setting_s object.
+ */
+
+#define CXD56_GNSS_IOCTL_PVTLOG_START 43
+
+/* Stop PVTLOG.
+ * param arg
+ * Parameter is Unnecessary. Set Zero.
+ */
+
+#define CXD56_GNSS_IOCTL_PVTLOG_STOP 44
+
+/* Delete PVTlog data.
+ * Delete the log data saved in the GNSS core.
+ * param arg
+ * Parameter is Unnecessary. Set Zero.
+ */
+
+#define CXD56_GNSS_IOCTL_PVTLOG_DELETE_LOG 45
+
+/* Get PVTLOG status.
+ * This command is for getting the log stored status.
+ * The status data include stored log data count and logging time.
+ *
+ * param arg
+ * Address pointing to #cxd56_pvtlog_status_s.
+ */
+
+#define CXD56_GNSS_IOCTL_PVTLOG_GET_STATUS 46
+
+/* Currently version not supported. */
+
+#define CXD56_GNSS_IOCTL_NAVMSG_START 47
+
+/* Set ephemeris data.
+ * Only satellites with data are output.
+ * Ephemeris data size is variable.
+ * Ephemeris data max size is 3072(GPS) or 1152(GLONASS) bytes.
+ * This command must be issued in idle mode.
+ *
+ * param[in] arg
+ * Address pointing to struct #cxd56_gnss_set_var_ephemeris_s object.
+ */
+
+#define CXD56_GNSS_IOCTL_SET_VAR_EPHEMERIS 48
+
+/* Get the latest ephemeris data extracted from the satellite signal.
+ * Only satellites with data are output.
+ * Ephemeris data size is variable.
+ * Ephemeris data max size is 3072(GPS) or 1152(GLONASS) bytes.
+ * This command must be issued in idle mode.
+ *
+ * param[out] arg
+ * Address pointing to struct #cxd56_gnss_get_var_ephemeris_s object.
+ */
+
+#define CXD56_GNSS_IOCTL_GET_VAR_EPHEMERIS 49
+
+/* check macros for GNSS commands */
+
+#define CXD56_GNSS_IOCTL_INVAL 0
+#define CXD56_GNSS_IOCTL_MAX 50
+
+/* Same value to GD Start mode CXD56_GNSS_STMOD_XXXX for GD_Start */
+
+#define CXD56_GNSS_STMOD_COLD 0 /* Cold Start */
+#define CXD56_GNSS_STMOD_WARM 1 /* Warm Start */
+#define CXD56_GNSS_STMOD_WARM_ACC2 2 /* Warm Start, better accuracy, less TTFF than WARM */
+#define CXD56_GNSS_STMOD_HOT 3 /* Hot Start */
+#define CXD56_GNSS_STMOD_HOT_ACC 4 /* Hot Start, better accuracy, less TTFF than HOT */
+#define CXD56_GNSS_STMOD_HOT_ACC2 5 /* Hot Start, better accuracy, less TTFF than ACC */
+#define CXD56_GNSS_STMOD_HOT_ACC3 6 /* Optimized hot start, better TTFF than HOT */
+#define CXD56_GNSS_STMOD_GSPQ CXD56_GNSS_STMOD_HOT_ACC3
+
+#define CXD56_GNSS_GPS_ALMANAC_SIZE 2048 /* GPS Almanac Size */
+
+#define CXD56_GNSS_GPS_EPHEMERIS_SIZE 3072 /* GPS Ephemeris Size */
+
+#define CXD56_GNSS_GLONASS_ALMANAC_SIZE 576 /* GLONASS Almanac Size */
+
+#define CXD56_GNSS_GLONASS_EPHEMERIS_SIZE 1152 /* GLONASS Ephemeris Size */
+
+#define CXD56_GNSS_QZSSL1CA_ALMANAC_SIZE 640 /* GPS Almanac Size */
+
+#define CXD56_GNSS_QZSSL1CA_EPHEMERIS_SIZE 960 /* GPS Ephemeris Size */
+
+/* PVTLOG notify threshold of the stored data. */
+
+#define CXD56_GNSS_PVTLOG_THRESHOLD_FULL 0 /* Limit of the storage size */
+#define CXD56_GNSS_PVTLOG_THRESHOLD_HALF 1 /* 1/2 of the Storage size */
+#define CXD56_GNSS_PVTLOG_THRESHOLD_ONE_DATA 2 /* Each log stored */
+
+/* Offset for last GNSS data */
+
+#define CXD56_GNSS_READ_OFFSET_LAST_GNSS 0x0000
+
+/* Offset for GNSS data */
+
+#define CXD56_GNSS_READ_OFFSET_GNSS(N) (0x1000 + 0x800 * (N))
+
+/* Offset for AGPS data */
+
+#define CXD56_GNSS_READ_OFFSET_AGPS 0x5000
+
+/* Offset for RTK data */
+
+#define CXD56_GNSS_READ_OFFSET_RTK 0x6000
+
+/* Offset for RTK GPS Ephemeris data */
+
+#define CXD56_GNSS_READ_OFFSET_GPSEPHEMERIS 0x7000
+
+/* Offset for RTK GLONASS Ephemeris data */
+
+#define CXD56_GNSS_READ_OFFSET_GLNEPHEMERIS 0x8000
+
+/* Offset for SBAS data */
+
+#define CXD56_GNSS_READ_OFFSET_SBAS 0x9000
+
+/* Offset for DC report */
+
+#define CXD56_GNSS_READ_OFFSET_DCREPORT 0x9800
+
+/* Offset for Spectrum data */
+
+#define CXD56_GNSS_READ_OFFSET_SPECTRUM 0xa000
+
+/* Offset for GNSS info */
+
+#define CXD56_GNSS_READ_OFFSET_INFO 0xf000
+
+/* Offset for PVTLOG data */
+
+#define CXD56_GNSS_READ_OFFSET_PVTLOG 0x10000
+
+/* Signal types from GNSS */
+
+/* Signal type is GNSS */
+
+#define CXD56_GNSS_SIG_GNSS 0
+
+/* Signal type is PVTLog */
+
+#define CXD56_GNSS_SIG_PVTLOG 2
+
+/* Signal type is AGPS */
+
+#define CXD56_GNSS_SIG_AGPS 3
+
+/* Signal type is RTK Career Phase */
+
+#define CXD56_GNSS_SIG_RTK 4
+
+/* Signal type is Soectrum */
+
+#define CXD56_GNSS_SIG_SPECTRUM 5
+
+/* Signal type is RTK GPS Ephemeris */
+
+#define CXD56_GNSS_SIG_GPSEPHEMERIS 11
+
+/* Signal type is RTK GLONASS Ephemeris */
+
+#define CXD56_GNSS_SIG_GLNEPHEMERIS 12
+
+/* Signal type is SBAS */
+
+#define CXD56_GNSS_SIG_SBAS 14
+
+/* Signal type is QZSS DC report */
+
+#define CXD56_GNSS_SIG_DCREPORT 15
+
+/****************************************************************************
+ * Public Types
+ ****************************************************************************/
+
+/* GNSS operation mode and cycle */
+
+struct cxd56_gnss_ope_mode_param_s
+{
+
+ /* receiver operation mode
+ * 0: No Change Operation
+ * 1: Normal(default)
+ */
+
+ uint32_t mode;
+
+ /* Positioning cycle[ms]
+ * The cycle data is 1000msec aligned only and
+ * cannot set 0msec.
+ * (Init value 1000)
+ */
+
+ uint32_t cycle;
+};
+
+/* Sattelite almanac, ephemeris data */
+
+struct cxd56_gnss_orbital_param_s
+{
+ uint32_t type; /* One of #CXD56_GNSS_DATA_GPS,
+ * #CXD56_GNSS_DATA_GLONASS or
+ * #CXD56_GNSS_DATA_QZSSL1CA.
+ */
+ FAR uint32_t *data; /* Address pointing to almanac or ephemeris data buffer */
+};
+
+/* date and time */
+
+struct cxd56_gnss_datetime_s
+{
+ struct cxd56_gnss_date_s date; /* date */
+ struct cxd56_gnss_time_s time; /* time */
+};
+
+/* ellipsoidal position */
+
+struct cxd56_gnss_ellipsoidal_position_s
+{
+ double latitude; /* latitude[degree] */
+ double longitude; /* longitude[degree] */
+ double altitude; /* altitude[meter] */
+};
+
+/* ellipsoidal position */
+
+struct cxd56_gnss_orthogonal_position_s
+{
+ int32_t x; /* x[meter] */
+ int32_t y; /* y[meter] */
+ int32_t z; /* z[meter] */
+};
+
+/* Currently version not supported. */
+
+struct cxd56_gnss_cep_data_s
+{
+ FAR uint32_t *data;
+ uint32_t size;
+ uint32_t counter;
+};
+
+/* CEP age info */
+
+struct cxd56_gnss_cep_age_s
+{
+ float age; /* age */
+ float cepi; /* cepi */
+};
+
+/* acquist data and size for AGPS */
+
+struct cxd56_gnss_agps_acquist_s
+{
+ FAR uint8_t *data; /* Address pointing to aquist data buffer */
+ uint16_t size; /* Aquist data size */
+};
+
+/* tow assist data and size for AGPS */
+
+struct cxd56_gnss_agps_tow_assist_s
+{
+ FAR uint8_t *data; /* Address pointing to tow assist data buffer */
+ uint16_t size; /* assist data size */
+};
+
+/* utc model data and size for AGPS */
+
+struct cxd56_gnss_agps_utc_model_s
+{
+ FAR uint8_t *data; /* Address pointing to utc model data buffer */
+ uint16_t size; /* utc model data size */
+};
+
+/* Time from frame start[sec]. */
+
+struct cxd56_gnss_agps_frametime_s
+{
+ uint16_t sec; /* Integer part */
+ uint32_t frac; /* Fraction part */
+};
+
+/* High precision receiver time */
+
+struct cxd56_gnss_agps_time_gps_s
+{
+ struct cxd56_gnss_date_s date; /* Date */
+ struct cxd56_gnss_time_s time; /* Time */
+};
+
+/* different time between AGPS and GLONASS Time */
+
+struct cxd56_gnss_agps_tau_gps_s
+{
+ double taugps; /* tau Time */
+};
+
+/* Signal spectrum output control parameter */
+
+struct cxd56_gnss_spectrum_control_s
+{
+ uint8_t enable; /* Spectrum data output enable */
+ uint32_t time; /* Passed Time */
+ uint8_t point1; /* Monitor point1 (7-9) */
+ uint8_t point2; /* Monitor point2 (7-9) */
+ uint8_t step1; /* Sampling step1 (0-7) */
+ uint8_t step2; /* Sampling step2 (0-7) */
+};
+
+struct cxd56_gnss_test_info_s
+{
+ uint32_t satellite; /* Specify satellite by svID */
+ uint32_t reserve1; /* Reserve (always specify 0) */
+ uint32_t reserve2; /* Reserve (always specify 0) */
+ uint32_t reserve3; /* Reserve (always specify 0) */
+};
+
+struct cxd56_gnss_test_result_s
+{
+ float cn; /* CN ratio [dB-Hz] */
+ float doppler; /* Doppler [Hz] */
+};
+
+/* signal setting for reading data asychronously
+ * The field 'enable' of struct #cxd56_gnss_signal_setting_s to be given as a
+ * parameter must be specified as 1 when setting and 0 when unsetting.
+ * Field 'gnsssig' specifies the value of 'Signal types from GNSS',
+ * this is not POSIX signal.
+ * Field 'signo' is application specific number of POSIX signal.
+ * 'data' will be passed as an argument to the handler.
+ */
+
+struct cxd56_gnss_signal_setting_s
+{
+ int fd; /* The descriptor for signal handler */
+ uint8_t enable; /* 1 when set this setting, 0 is clear */
+ uint8_t gnsssig; /* GNSS signal as CXD56_GNSS_SIG_GNSS, _AGPS, etc. */
+ int signo; /* system signal number to notify read completion */
+ FAR void *data; /* user data */
+};
+
+/* Information for use after being signaled to read data asychronously */
+
+struct cxd56_gnss_signal_info_s
+{
+ int fd; /* The file descriptor to use in signal handler */
+ uint8_t gnsssig; /* GNSS signal as CXD56_GNSS_SIG_GNSS, _AGPS, etc. */
+ int signo; /* system signal number to notify read completion */
+ FAR void *data; /* user data */
+};
+
+/* PVTLOG setting Parameter.
+ * If the log interval(cycle) is smaller than the positioning interval,
+ * it is logged every positioning interval.
+ * The output timing is specified by the ratio to the log buffer in the
+ * GNSS device by threshold. Possible values are
+ * #CXD56_GNSS_PVTLOG_THRESHOLD_FULL, #CXD56_GNSS_PVTLOG_THRESHOLD_HALF,
+ * and #CXD56_GNSS_PVTLOG_THRESHOLD_ONE_DATA.
+ */
+
+struct cxd56_pvtlog_setting_s
+{
+ uint32_t cycle; /* PVT log interval in seconds */
+ uint32_t threshold; /* Notification threshold of log storage amount */
+};
+
+struct cxd56_pvtlog_status_s
+{
+ struct cxd56_gnss_status_s status; /* The stored logs status */
+};
+
+struct cxd56_rtk_setting_s
+{
+ int interval; /* RTK data output interval */
+ uint32_t gnss; /* RTK satellite setting */
+ int ephout; /* Ephemeris notify enable setting */
+ uint64_t sbasout; /* sbas notify enable setting */
+};
+
+struct cxd56_gnss_set_var_ephemeris_s
+{
+ uint32_t *data; /* Address pointing to ephemeris data buffer */
+ uint32_t size; /* ephemeris data buffer size */
+};
+
+struct cxd56_gnss_get_var_ephemeris_s
+{
+ uint32_t type; /* One of #CXD56_GNSS_DATA_GPS, #CXD56_GNSS_DATA_GLONASS. */
+ uint32_t *data; /* Address pointing to ephemeris data buffer */
+ uint32_t size; /* ephemeris data buffer size */
+};
+
+#undef EXTERN
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ARCH_ARM_INCLUDE_CXD56XX_GNSS_H */
diff --git a/arch/arm/include/cxd56xx/gnss_type.h b/arch/arm/include/cxd56xx/gnss_type.h
new file mode 100644
index 00000000000..85111b8b084
--- /dev/null
+++ b/arch/arm/include/cxd56xx/gnss_type.h
@@ -0,0 +1,710 @@
+/****************************************************************************
+ * arch/arm/include/cxd56xx/gnss_type.h
+ *
+ * Copyright 2018,2019 Sony Semiconductor Solutions Corporation
+ *
+ * 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 of Sony Semiconductor Solutions Corporation 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_CXD56XX_GNSS_TYPE_H
+#define __ARCH_ARM_INCLUDE_CXD56XX_GNSS_TYPE_H
+
+/* NOTICE:
+ * This file defines a structure that stores GNSS positioning
+ * data of CXD 56xx. The public header file gnss_type.h for NuttX
+ * of the CXD 56xx SDK has been copied as gd_type.h in the nxloader
+ * build system and used. Therefore, if you change the definitions
+ * in this file, please synchronize and change the other.
+ */
+
+#ifdef __cplusplus
+#define EXTERN extern "C"
+extern "C" {
+#else
+#define EXTERN extern
+#endif
+
+/****************************************************************************
+ * include files
+ ****************************************************************************/
+
+#include
+
+/* Max number of satellites */
+
+#define CXD56_GNSS_MAX_SV_NUM 32
+
+/* GNSS satellite system */
+
+#define CXD56_GNSS_SAT_NONE (0) /* None */
+#define CXD56_GNSS_SAT_GPS (1U << 0) /* GPS */
+#define CXD56_GNSS_SAT_GLONASS (1U << 1) /* Glonass */
+#define CXD56_GNSS_SAT_SBAS (1U << 2) /* SBAS */
+#define CXD56_GNSS_SAT_QZ_L1CA (1U << 3) /* QZSS/L1CA */
+#define CXD56_GNSS_SAT_IMES (1U << 4) /* IMES */
+#define CXD56_GNSS_SAT_QZ_L1S (1U << 5) /* QZSS/L1S */
+#define CXD56_GNSS_SAT_BEIDOU (1U << 6) /* BeiDou */
+#define CXD56_GNSS_SAT_GALILEO (1U << 7) /* Galileo */
+
+/* GNSS positioning type */
+
+#define CXD56_GNSS_PVT_TYPE_NONE 0 /* Positioning data none */
+#define CXD56_GNSS_PVT_TYPE_GNSS 1 /* by GNSS */
+#define CXD56_GNSS_PVT_TYPE_IMES 2 /* by IMES */
+#define CXD56_GNSS_PVT_TYPE_USER 3 /* API setting */
+
+/* GNSS position fix mode */
+
+#define CXD56_GNSS_PVT_POSFIX_INVALID 1 /* No measurement */
+#define CXD56_GNSS_PVT_POSFIX_2D 2 /* 2D fix */
+#define CXD56_GNSS_PVT_POSFIX_3D 3 /* 3D fix */
+
+/* GNSS velocity fix mode */
+
+#define CXD56_GNSS_PVT_VELFIX_INVALID 1 /* No measurement */
+#define CXD56_GNSS_PVT_VELFIX_2DVZ 2 /* 2D VZ fix */
+#define CXD56_GNSS_PVT_VELFIX_2DOFFSET 3 /* 2D Offset fix */
+#define CXD56_GNSS_PVT_VELFIX_3D 4 /* 3D fix */
+#define CXD56_GNSS_PVT_VELFIX_1D 5 /* 1D fix */
+#define CXD56_GNSS_PVT_VELFIX_PRED 6 /* Prediction */
+
+/* GNSS oribital infomation data type, almanac & ephemeris */
+
+#define CXD56_GNSS_DATA_GPS 0 /* GPS data type */
+#define CXD56_GNSS_DATA_GLONASS 1 /* Glonass data type */
+#define CXD56_GNSS_DATA_QZSSL1CA 2 /* QZSS/L1CA data type */
+
+/* GNSS satellite status */
+
+#define CXD56_GNSS_SV_STAT_NONE (0) /* None */
+#define CXD56_GNSS_SV_STAT_TRACKING (1 << 0) /* Tracking */
+#define CXD56_GNSS_SV_STAT_POSITIONING (1 << 1) /* Positioning */
+#define CXD56_GNSS_SV_STAT_CALC_VELOCITY (1 << 2) /* Calc Velocity */
+#define CXD56_GNSS_SV_STAT_VISIBLE (1 << 3) /* Visible */
+#define CXD56_GNSS_SV_STAT_SUB_CH (1 << 4) /* Sub Ch */
+
+/* GNSS 1PPS synchronization status (internal use) */
+
+#define CXD56_GNSS_PPS_NOT_ADJUSTED 0 /* not adjusted */
+#define CXD56_GNSS_PPS_ADJUSTED 1 /* adjusted */
+#define CXD56_GNSS_PPS_ADJUSTED_SSDGLN 2 /* adjusted SSDGLN */
+#define CXD56_GNSS_PPS_ADJUSTED_SSD 3 /* adjusted SSD */
+#define CXD56_GNSS_PPS_ADJUSTED_POS 4 /* adjusted POS */
+#define CXD56_GNSS_PPS_DEGRADE2 5 /* Degrade2 */
+#define CXD56_GNSS_PPS_DEGRADE 6 /* Degrade */
+#define CXD56_GNSS_PPS_COMPLETE 7 /* Complete */
+
+/* GNSS Output interval of carrier phase info. */
+
+#define CXD56_GNSS_RTK_INTERVAL_1HZ 1000 /* 1Hz */
+#define CXD56_GNSS_RTK_INTERVAL_2HZ 500 /* 2Hz */
+#define CXD56_GNSS_RTK_INTERVAL_5HZ 200 /* 5Hz */
+#define CXD56_GNSS_RTK_INTERVAL_10HZ 100 /* 10Hz */
+#define CXD56_GNSS_RTK_INTERVAL_20HZ 50 /* 20H */
+
+/* Carrier phase max satellite number */
+
+#define CXD56_GNSS_RTK_MAX_SV_NUM 24
+
+/* GNSS Spectrum data size */
+
+/* Spectrum Data Max(adjusted as CXD56_GNSS_SPECTRUM_DATA will be 116byte.) */
+
+#define CXD56_GNSS_SPECTRUM_MAXNUM 37
+
+/* Peak Spectrum Data */
+
+#define CXD56_GNSS_PEAK_SPECTRUM_MAXNUM 3
+
+/* SPZ_INT_API */
+
+/* DC Report data size */
+
+#define CXD56_GNSS_QSM_MSG_BIT_NUM 250
+#define CXD56_GNSS_QSM_NUM_BITS_IN_BYTE 8
+
+/* AGPS Measurement tracking data */
+
+#define CXD56_GNSS_SUPL_TRK_DATA_SIZE (16)
+
+/* PVTLOG Max stored log number */
+
+#define CXD56_GNSS_PVTLOG_MAXNUM 170
+
+/* assist bit fields */
+
+#define CXD56_GNSS_PVT_RECEIVER_ASSIST_NONE (0x00)
+#define CXD56_GNSS_PVT_RECEIVER_ASSIST_USER (0x01)
+#define CXD56_GNSS_PVT_RECEIVER_ASSIST_CEPPOS (0x02)
+#define CXD56_GNSS_PVT_RECEIVER_ASSIST_CEPVEL (0x04)
+#define CXD56_GNSS_PVT_RECEIVER_ASSIST_AEPPOS (0x08)
+#define CXD56_GNSS_PVT_RECEIVER_ASSIST_AEPVEL (0x10)
+
+/* GNSS positionig data elements */
+
+/* Day (UTC) */
+
+struct cxd56_gnss_date_s
+{
+ uint16_t year; /* year */
+ uint8_t month; /* month */
+ uint8_t day; /* day */
+};
+
+/* Time (UTC) */
+
+struct cxd56_gnss_time_s
+{
+ uint8_t hour; /* hour */
+ uint8_t minute; /* minitue */
+ uint8_t sec; /* sec */
+ uint32_t usec; /* usec */
+};
+
+/* Time (GPS) */
+
+struct cxd56_gnss_wntow_s
+{
+ uint32_t tow; /* truncated TOW (1 = 6sec, 0 ... 100799) */
+ uint16_t weeknumber; /* week number (0 ... 1023) */
+ uint8_t sec; /* offset (0 ... 5) */
+ uint8_t rollover; /* Number of WN Roll Over (0 ... 255) */
+ double frac; /* fraction */
+};
+
+/* struct cxd56_gnss_dop_s - Dilution Of Precision */
+
+struct cxd56_gnss_dop_s
+{
+ float pdop; /* Position DOP */
+ float hdop; /* Horizontal DOP */
+ float vdop; /* Vertical DOP */
+ float tdop; /* Time DOP */
+ float ewdop; /* East-West DOP */
+ float nsdop; /* North-South DOP */
+ float majdop; /* Stdev of semi-major axis */
+ float mindop; /* Stdev of semi-minor axis */
+ float oridop; /* Orientation of semi-major axis [deg] */
+};
+
+/* struct cxd56_gnss_var_s - Variance */
+
+struct cxd56_gnss_var_s
+{
+ float hvar; /* Horizontal */
+ float vvar; /* Vertical */
+};
+
+/* Extra data for debugging */
+
+#define CXD56_GNSS_PVT_RECEIVER_EXTRA_DATA_SIZE (520)
+#define CXD56_GNSS_PVT_RECEIVER_EXTRA_DATA \
+ uint8_t extra[CXD56_GNSS_PVT_RECEIVER_EXTRA_DATA_SIZE]
+#define CXD56_GNSS_PVT_SV_EXTRA_DATA_SIZE 40
+#define CXD56_GNSS_PVT_SV_EXTRA_DATA \
+ uint8_t extra[CXD56_GNSS_PVT_SV_EXTRA_DATA_SIZE]
+#define CXD56_GNSS_FFT_MAXPOOLNUM (8)
+
+/* GNSS AGPS clear flag */
+
+#define CXD56_GNSS_GCLR_EPH 0x00000001 /* ephemeris */
+#define CXD56_GNSS_GCLR_ALM 0x00000002 /* almanac */
+#define CXD56_GNSS_GCLR_PV 0x00000004 /* position and velocity */
+#define CXD56_GNSS_GCLR_TIME 0x00000008 /* time */
+#define CXD56_GNSS_GCLR_TCXO 0x00010000 /* TCXO offset */
+#define CXD56_GNSS_GCLR_ALL 0xffffffff /* all of above */
+
+/* GNSS Receiver data */
+
+struct cxd56_gnss_receiver_s
+{
+ uint8_t type; /* [out] Position type; 0:Invalid, 1:GNSS,
+ * 2:IMES, 3:user set, 4:previous
+ */
+ uint8_t dgps; /* [out] FALSE:SGPS, TRUE:DGPS */
+ uint8_t pos_fixmode; /* [out] 1:Invalid, 2:2D, 3:3D */
+ uint8_t vel_fixmode; /* [out] 1:Invalid, 2:2D VZ, 3:2D Offset,
+ * 4:3D, 5:1D, 6:PRED
+ */
+ uint8_t numsv; /* [out] Nr of visible satellites */
+ uint8_t numsv_tracking; /* [out] Nr of tracking satellites */
+ uint8_t numsv_calcpos; /* [out] Nr of satellites to calculate position */
+ uint8_t numsv_calcvel; /* [out] Nr of satellites to calculate velocity */
+ uint8_t assist; /* [out] bit field
+ * [7..5]Reserved
+ * [4]AEP Velocity
+ * [3]AEP Position
+ * [2]CEP Velocity
+ * [1]CEP Position,
+ * [0]user set
+ */
+ uint8_t pos_dataexist; /* [out] 0:none, 1:exist */
+ uint16_t svtype; /* [out] Using sv system, bit field;
+ * bit0:GPS, bit1:GLONASS, bit2:SBAS,
+ * bit3:QZSS_L1CA, bit4:IMES,
+ * bit5:QZSS_L1SAIF, bit6:Beidu,
+ * bit7:Galileo
+ */
+ uint16_t pos_svtype; /* [out] using sv system, bit field;
+ * bit0:GPS, bit1:GLONASS, bit2:SBAS,
+ * bit3:QZSS_L1CA, bit4:IMES,
+ * bit5:QZSS_L1SAIF, bit6:Beidu,
+ * bit7:Galileo
+ * */
+ uint16_t vel_svtype; /* [out] using sv system, bit field; bit0:GPS,
+ * bit0:GPS, bit1:GLONASS, bit2:SBAS,
+ * bit3:QZSS_L1CA, bit4:IMES,
+ * bit5:QZSS_L1SAIF, bit6:Beidu,
+ * bit7:Galileo
+ */
+ uint32_t possource; /* [out] position source; 0:Invalid, 1:GNSS,
+ * 2:IMES, 3:user set, 4:previous
+ */
+ int32_t tcxo_offset; /* [out] TCXO offset[Hz] */
+ struct cxd56_gnss_dop_s pos_dop; /* [out] DOPs of Position */
+ struct cxd56_gnss_dop_s vel_idx; /* [out] Weighted DOPs of Velocity */
+ struct cxd56_gnss_var_s pos_accuracy; /* [out] Accuracy of Position */
+ double latitude; /* [out] Latitude [degree] */
+ double longitude; /* [out] Longitude [degree] */
+ double altitude; /* [out] Altitude [m] */
+ double geoid; /* [out] Geoid height [m] */
+ float velocity; /* [out] Velocity [m/s] */
+ float direction; /* [out] Direction [degree] */
+ struct cxd56_gnss_date_s date; /* [out] Current day (UTC) */
+ struct cxd56_gnss_time_s time; /* [out] Current time (UTC) */
+ struct cxd56_gnss_date_s gpsdate; /* [out] Current day (GPS) */
+ struct cxd56_gnss_time_s gpstime; /* [out] Current time (GPS) */
+ struct cxd56_gnss_time_s receivetime; /* [out] Receive time (UTC) */
+ uint32_t priv; /* [out] For internal use */
+ CXD56_GNSS_PVT_RECEIVER_EXTRA_DATA; /* [out] Receiver extra data */
+};
+
+/* GNSS satellite data */
+
+struct cxd56_gnss_sv_s
+{
+ uint16_t type; /* [out] Using sv system, bit field; bit0:GPS,
+ * bit1:GLONASS, bit2:SBAS, bit3:QZSS_L1CA,
+ * bit4:IMES, bit5:QZSS_L1SAIF, bit6:Beidu,
+ * bit7:Galileo
+ * same as struct cxd56_gnss_receiver_s::svtype
+ */
+ uint8_t svid; /* [out] Satellite id */
+ uint8_t stat; /* Using sv info, bit field; bit0:tracking,
+ * bit1:positioning, bit2:calculating velocity,
+ * bit3:visible satellite
+ */
+ uint8_t elevation; /* [out] Elevation [degree] */
+ int16_t azimuth; /* [out] Azimuth [degree] */
+ float siglevel; /* [out] CN */
+ CXD56_GNSS_PVT_SV_EXTRA_DATA; /* [out] Sv extra data */
+};
+
+/* Positioning data with SV data */
+
+struct cxd56_gnss_positiondata_s
+{
+ uint64_t data_timestamp; /* [out] Timestamp */
+ uint32_t status; /* [out] Positioning data status 0 : Valid, <0: Invalid */
+ uint32_t svcount; /* [out] Sv data count */
+ struct cxd56_gnss_receiver_s receiver; /* [out] Receiver data */
+ struct cxd56_gnss_sv_s sv[CXD56_GNSS_MAX_SV_NUM]; /* [out] Sv data array */
+};
+
+/* QZSS DC report data */
+
+struct cxd56_gnss_dcreport_data_s
+{
+ uint8_t sf[CXD56_GNSS_QSM_MSG_BIT_NUM /
+ CXD56_GNSS_QSM_NUM_BITS_IN_BYTE + 1]; /* [out] Message body */
+ uint8_t svid; /* [out] Satellite id */
+};
+
+/* SF_EVENT_GNSS_MEASUREMENT_VALUE */
+
+/* SUPL tracking data */
+
+struct cxd56_supl_trkdata_s
+{
+ uint8_t gnssid; /* [out] sv system
+ * GPS: 0x01
+ * GLONASS: 0x02
+ * SBAS : 0x04
+ * QZSS_L1C/A:0x08
+ */
+ uint8_t signalid; /* [out] Always 0 */
+ uint8_t svid; /* [out] Satellite Id
+ * GPS: 1-32
+ * GLONASS: 1-24
+ * SBAS: 120-158
+ * QZSS_L1C/A 193-197
+ */
+ uint8_t cn; /* [out] CN ratio [dBHz] */
+ uint8_t codephase_ambiguty; /* Currently version not supported. */
+ uint8_t carriorquality_indicator; /* Currently version not supported. */
+ uint8_t codephase_rmserr; /* Currently version not supported. */
+ uint8_t multipath_indicator; /* Currently version not supported. */
+ uint32_t codephase; /* [out] Code Phase[ms] scale: 2-21[ms] */
+ uint16_t wholechip; /* [out] Chip integer part */
+ uint16_t fracchip; /* [out] Chip frac part */
+ uint32_t adr; /* Currently version not supported. */
+ int16_t doppler; /* [out] Doppler [Hz] */
+};
+
+/* SUPL positioning data */
+
+struct cxd56_supl_posdata_s
+{
+ double uncertainty_semi_major; /* [out] Uncertainty semi-major */
+ double uncertainty_semi_minor; /* [out] Uncertainty semi-minor */
+ double orientation_of_major_axis; /* [out] Orientation of major axis */
+ double uncertainty_altitude; /* [out] Uncertainty Altitude */
+ uint32_t tow; /* [out] Time of week [sec]
+ * acquisition TOW : 0-604799
+ * no acquisition TOW : 0xffffffff
+ */
+ float frac_sec; /* [out] Under second part[sec]
+ * no acquisition TOW : -1
+ */
+ float horizontal_accuracy; /* [out] Horizontal accuracy [m]
+ * disable : -1
+ */
+ uint16_t ref_frame; /* Currently version not supported */
+ uint8_t tod_unc; /* [out] Acquisition : 1
+ * no acquisition : 0
+ */
+ uint8_t num_of_sat; /* [out] Tracking Sv number */
+};
+
+/* SUPL Measurement data struct */
+
+struct cxd56_supl_mesurementdata_s
+{
+ /* [out] Supl positioning data */
+
+ struct cxd56_supl_posdata_s supl_pos;
+
+ /* [out] Tracking satellite data */
+
+ struct cxd56_supl_trkdata_s trackingsat[CXD56_GNSS_SUPL_TRK_DATA_SIZE];
+};
+
+/* struct cxd56_gnss_timetag_s - Internal time tag */
+
+struct cxd56_gnss_timetag_s
+{
+ uint32_t msec; /* [ms] whole millisecond part */
+ uint32_t frac; /* Under millisecond part (0 ... cycle-1) */
+ uint16_t cycle; /* Resolution of 1ms */
+};
+
+/* Time and frequency information for RTK */
+
+struct cxd56_rtk_info_s
+{
+ uint64_t timestamp; /* [out] system timestamp */
+ uint64_t timesnow; /* [out] system now times */
+ struct cxd56_gnss_wntow_s wntow; /* [out] GPS time */
+ struct cxd56_gnss_date_s date; /* [out] Date (UTC time) */
+ struct cxd56_gnss_time_s time; /* [out] Time (UTC time) */
+ struct cxd56_gnss_timetag_s tag; /* [out] TimeTag */
+ double clockdrift; /* [out] [Hz] clock drift @1.5GHz
+ * (valid only if cdvalidity is 1)
+ */
+ int8_t cdvalidity; /* [out] clock drift validity
+ * (0: invalid, 1: valid)
+ */
+ uint8_t ppsstatus; /* [out] 1PPS synchronization status */
+ int8_t svcount; /* [out] Num of sv */
+};
+
+/* Carrier phase and related data for RTK */
+
+struct cxd56_rtk_sv_s
+{
+ double pseudorange; /* [out] [m] pseudo range */
+ double carrierphase; /* [out] [wave number] carrier phase */
+ uint32_t gnss; /* [out] GNSS type (CXD56_GNSS_GNSS_XXX) */
+ int8_t svid; /* [out] Satellite id */
+ int8_t fdmch; /* [out] Frequency slot for GLONASS (-7 ... 6) */
+ int16_t cn; /* [out] [0.01dBHz] CN */
+ int8_t polarity; /* [out] Carrier polarity
+ * (0: not inverted, 1: inverted)
+ */
+ int8_t lastpreamble; /* [out] Parity of last premable (0: ok, 1: ng) */
+ int8_t lli; /* [out] Lock loss indicator
+ * (0: no lock loss, 1: lock loss)
+ */
+ int8_t ch; /* [out] TRK channel number */
+ float c2p; /* [out] C2P (0 ... 1.0) */
+ float doppler; /* [out] [Hz] Doppler shift */
+};
+
+/* RTK Carrier phase data */
+
+struct cxd56_rtk_carrierphase_s
+{
+ /* [out] Time and frequency information */
+
+ struct cxd56_rtk_info_s infoout;
+
+ /* [out] Carrier phase and related data */
+
+ struct cxd56_rtk_sv_s svout[CXD56_GNSS_RTK_MAX_SV_NUM];
+};
+
+/* Ephemeris data (GPS) */
+
+struct cxd56_rtk_gpsephemeris_s
+{
+ uint64_t timesnow; /* [out] system now times */
+ uint8_t ppsstatus; /* [out] 1PPS synchronization status */
+ uint16_t t_oc; /* [out] SV Clock Correction */
+ double af0; /* [out] SV Clock Correction */
+ double af1; /* [out] SV Clock Correction */
+ double af2; /* [out] SV Clock Correction */
+ double crs; /* [out] Amplitude correction term of orbital radius(sin) */
+ double delta_n; /* [out] Average motion difference [rad] */
+ double m0; /* [out] Average near point separation at t_oe [rad] */
+ double cuc; /* [out] Latitude amplitude correction term(cos) */
+ double e; /* [out] Eccentricity of orbit */
+ double cus; /* [out] Latitude amplitude correction term(sin) */
+ double sqrt_a; /* [out] Square root of the orbital length radius */
+ double cic; /* [out] Amplitude correction term of orbital inclination angle(cos) */
+ double omega0; /* [out] Rise of ascension at Weekly Epoch [rad] */
+ double cis; /* [out] Amplitude correction term of orbital inclination angle(sin) */
+ double i0; /* [out] Orbital inclination angle at t_oe */
+ double crc; /* [out] Amplitude correction term of orbital radius(cos) */
+ double omega; /* [out] Perigee argument [rad] */
+ double omega_dot; /* [out] Ascension of ascending node correction [rad] */
+ double i_dot; /* [out] Orbital inclination angle correction [rad] */
+ double accuracy; /* [out] nominal URA (User Range Accuracy) [m] */
+ double tgd; /* [out] Estimated Group Delay Differential */
+
+ /* tocwntow, tocdate, toctime are valid if ppsstatus >= 1(adjusted) */
+
+ struct cxd56_gnss_wntow_s tocwntow; /* [out] toc */
+ struct cxd56_gnss_date_s tocdate; /* [out] toc Date */
+ struct cxd56_gnss_time_s toctime; /* [out] toc Time */
+
+ int32_t toe; /* [out] Reference time [s] */
+ int32_t tow; /* [out] Time of Week (truncated) */
+ int16_t id; /* [out] Satellite id */
+ uint8_t iode; /* [out] Issue of Data (Ephemeris) Subframe 2 */
+ int8_t codes_on_l2; /* [out] Code(s) on L2 Channel */
+ int16_t weeknumber; /* [out] Full week number */
+ int8_t l2p; /* [out] Data Flag for L2 P-Code */
+ uint8_t health; /* [out] SV Health (6bit for ephemeris / 8bit for almanac) */
+ int16_t iodc; /* [out] Issue of Data, Clock (IODC) */
+ int8_t fitinterval; /* [out] Fit interval flag */
+};
+
+/* Ephemeris data (GLONASS) */
+
+struct cxd56_rtk_glonassephemeris_s
+{
+ uint64_t timesnow; /* [out] system now times */
+ uint32_t valid; /* [out] valid */
+ uint8_t ppsstatus; /* [out] 1PPS synchronization status */
+ uint8_t slot; /* [out] slot 1...24 (It generates from svid. Usually same as me->n) */
+ int8_t ch; /* [out] ch -7...6 */
+ uint8_t p1; /* [out] The difference of t_b from the previous frame */
+ uint8_t tk_h; /* [out] Current frame first time (hours) */
+ uint8_t tk_m; /* [out] Current frame first time (minutes) */
+ uint8_t tk_s; /* [out] Current frame first time (seconds) */
+ double xv; /* [out] The velocity vector components of t_b */
+ float xa; /* [out] The acceleration components of t_b */
+ double xp; /* [out] The position of t_b */
+ uint8_t bn; /* [out] The health info */
+ uint8_t p2; /* [out] flag of oddness ("1") or evenness ("0") of the value of t_b */
+ uint16_t tb; /* [out] Reference time t_b (15...1425) */
+ uint8_t hn_e; /* [out] Carrier frequency number (0...31, (25...31)=(7...-1)) */
+ double yv; /* [out] The velocity vector components of t_b */
+ float ya; /* [out] The acceleration components of t_b */
+ double yp; /* [out] The position of t_b */
+ uint8_t p3; /* [out] Number of almanacs in the current frame */
+ float gn; /* [out] Carrier frequency relative deviation of t_b */
+ uint8_t p; /* [out] Origin of tau variable */
+ uint8_t health; /* [out] Health flag */
+ double zv; /* [out] The velocity vector components of t_b */
+ float za; /* [out] The acceleration components of t_b */
+ double zp; /* [out] The position of t_b */
+ float tn; /* [out] Correction to the satellite time t_n relative to GLONASS time t_c */
+ float dtn; /* [out] Difference in internal delay between L2 and L1 */
+ uint8_t en; /* [out] Number of days from when data was uploaded until t_b (0...31) */
+ uint8_t p4; /* [out] Flag of ephemeris parameters updating */
+ uint8_t ft; /* [out] The URA (index) of t_b */
+ uint16_t nt; /* [out] Number of days since 1/1 of a leap year */
+ uint8_t n; /* [out] Slot number of the signaling satellite (0...31) */
+ uint8_t m; /* [out] Satellite type (0...3) */
+};
+
+/* Spectrum Data */
+
+struct cxd56_gnss_spectrum_s
+{
+ uint8_t status; /* FFT Sampling Point 0-1 */
+ uint8_t samplingstep; /* FFT Sampling Step 1-16 */
+ uint8_t sizemode; /* FFT Sampling Num 0:1024 1:512 2:256 */
+ uint8_t datacount; /* Spectrum data count */
+ uint8_t datanum; /* Spectrum data Size */
+ uint8_t ifgain; /* IfGain 0-15 */
+ uint16_t dataindex; /* Spectrum data Inex */
+ uint16_t spectrum[CXD56_GNSS_SPECTRUM_MAXNUM]; /* Spectrum Data Buffer */
+ double peak[CXD56_GNSS_PEAK_SPECTRUM_MAXNUM]; /* Peak Spectrum */
+};
+
+#define CXD56_GNSS_SBAS_MESSAGE_DATA_LEN (27)
+
+/* SBAS Data */
+
+struct cxd56_gnss_sbasdata_s
+{
+ uint64_t timesnow; /* system now times */
+ uint32_t gpstow; /* GPS Time of Week */
+ uint16_t gpswn; /* GPS week number */
+ uint16_t svid; /* satellite id */
+ uint8_t msgid; /* sbas message ID */
+ uint8_t sbasmsg[CXD56_GNSS_SBAS_MESSAGE_DATA_LEN]; /* sbas message data */
+};
+
+/******** PVTLog Parameter ***********/
+
+/* Latitude of PVT data */
+
+struct cxd56_pvtlog_latitude_s
+{
+ uint32_t frac :14; /* Decimal */
+ uint32_t minute :6; /* Minute */
+ uint32_t degree :7; /* Degree */
+ uint32_t sign :1; /* Sign */
+ uint32_t rsv :4; /* Reserved */
+};
+
+/* Longitude of PVT data */
+
+struct cxd56_pvtlog_longitude_s
+{
+ uint32_t frac :14; /* Decimal */
+ uint32_t minute :6; /* Minute */
+ uint32_t degree :8; /* Degree */
+ uint32_t sign :1; /* Sign */
+ uint32_t rsv :3; /* Reserved */
+};
+
+/* Altitude of PVT data */
+
+struct cxd56_pvtlog_altitude_s
+{
+ uint32_t frac :4; /* Decimal */
+ uint32_t rsv1 :12; /* Reserved */
+ uint32_t meter :14; /* Integer */
+ uint32_t sign :1; /* Sign */
+ uint32_t rsv2 :1; /* Reserved */
+};
+
+/* Velocity of PVT data */
+
+struct cxd56_pvtlog_velocity_s
+{
+ uint16_t knot :14; /* Integer */
+ uint16_t rsv :2; /* Reserved */
+};
+
+/* Direction of PVT data */
+
+struct cxd56_pvtlog_direction_s
+{
+ uint16_t frac :4; /* Decimal */
+ uint16_t degree :9; /* Integer */
+ uint16_t rsv :3; /* Reserved */
+};
+
+/* Time (UTC) of PVT data */
+
+struct cxd56_pvtlog_time_s
+{
+ uint32_t msec :7; /* msec */
+ uint32_t rsv1 :1; /* Reserved */
+ uint32_t sec :6; /* Second */
+ uint32_t rsv2 :2; /* Reserved */
+ uint32_t minute :6; /* Minute */
+ uint32_t rsv3 :2; /* Reserved */
+ uint32_t hour :5; /* Hour */
+ uint32_t rsv4 :3; /* Reserved */
+};
+
+/* Date (UTC) of PVT data */
+
+struct cxd56_pvtlog_date_s
+{
+ uint32_t year :7; /* Year */
+ uint32_t day :5; /* Day */
+ uint32_t month :4; /* Month */
+ uint32_t rsv :16; /* Reserved */
+};
+
+/* PVTLog save data struct */
+
+struct cxd56_pvtlog_data_s
+{
+ struct cxd56_pvtlog_latitude_s latitude; /* Latitude of data 4B */
+ struct cxd56_pvtlog_longitude_s longitude; /* Longitude of data 4B */
+ struct cxd56_pvtlog_altitude_s altitude; /* Altitude of data 4B */
+ struct cxd56_pvtlog_velocity_s velocity; /* Velocity of data 2B */
+ struct cxd56_pvtlog_direction_s direction; /* Direction of data 2B */
+ struct cxd56_pvtlog_time_s time; /* Time (UTC) 4B */
+ struct cxd56_pvtlog_date_s date; /* Date (UTC) 4B */
+};
+
+/* PVTLog notification data struct */
+
+struct cxd56_pvtlog_s
+{
+ uint32_t log_count; /* [in] Valid log count of log_data */
+ struct cxd56_pvtlog_data_s log_data[CXD56_GNSS_PVTLOG_MAXNUM]; /* [in] Stored log data */
+};
+
+/* PVTLog Status Data */
+
+struct cxd56_gnss_status_s
+{
+ uint32_t log_count; /* [in] Saved log count */
+ struct cxd56_pvtlog_time_s start_time; /* [in] Time (UTC) 4B */
+ struct cxd56_pvtlog_date_s start_date; /* [in] Date (UTC) 4B */
+ struct cxd56_pvtlog_time_s end_time; /* [in] Time (UTC) 4B */
+ struct cxd56_pvtlog_date_s end_date; /* [in] Date (UTC) 4B */
+};
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* ARCH_ARM_INCLUDE_CXD56XX_GNSS_TYPE_H */
diff --git a/arch/arm/src/lpc11xx/lpc11_wdt.h b/arch/arm/include/cxd56xx/uart0.h
similarity index 57%
rename from arch/arm/src/lpc11xx/lpc11_wdt.h
rename to arch/arm/include/cxd56xx/uart0.h
index f2b073b5833..3fd1420646b 100644
--- a/arch/arm/src/lpc11xx/lpc11_wdt.h
+++ b/arch/arm/include/cxd56xx/uart0.h
@@ -1,8 +1,7 @@
-/************************************************************************************
- * arch/arm/src/lpc11xx/lpc11_wdt.h
+/****************************************************************************
+ * arch/arm/include/cxd56xx/cxd56_uart0.h
*
- * Copyright (C) 2015 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt
+ * Copyright 2018 Sony Semiconductor Solutions Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -14,9 +13,10 @@
* 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.
+ * 3. Neither the name of Sony Semiconductor Solutions Corporation 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
@@ -31,32 +31,38 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
- ************************************************************************************/
+ ****************************************************************************/
-#ifndef __ARCH_ARM_SRC_LPC11XX_LPC11_WDT_H
-#define __ARCH_ARM_SRC_LPC11XX_LPC11_WDT_H
+#ifndef __ARM_ARCH_INCLUDE_CXD56XX_CXD56_UART0_H
+#define __ARM_ARCH_INCLUDE_CXD56XX_CXD56_UART0_H
-/************************************************************************************
- * Included Files
- ************************************************************************************/
-
-#include
-#include "hardware/lpc11_wdt.h"
-
-/************************************************************************************
- * Pre-processor Definitions
- ************************************************************************************/
-
-/************************************************************************************
+/****************************************************************************
* Public Types
- ************************************************************************************/
+ ****************************************************************************/
-/************************************************************************************
- * Public Data
- ************************************************************************************/
+#ifndef __ASSEMBLY__
-/************************************************************************************
- * Public Functions
- ************************************************************************************/
+#undef EXTERN
+#if defined(__cplusplus)
+#define EXTERN extern "C"
+extern "C"
+{
+#else
+#define EXTERN extern
+#endif
-#endif /* __ARCH_ARM_SRC_LPC11XX_LPC11_WDT_H */
+/****************************************************************************
+ * Public Function Prototypes
+ ****************************************************************************/
+
+int cxd56_uart0initialize(FAR const char *devname);
+void cxd56_uart0uninitialize(FAR const char *devname);
+
+#undef EXTERN
+#if defined(__cplusplus)
+}
+#endif
+
+#endif /* __ASSEMBLY__ */
+
+#endif /* __ARM_ARCH_INCLUDE_CXD56XX_CXD56_UART0_H */
diff --git a/arch/arm/include/lpc11xx/chip.h b/arch/arm/include/lpc11xx/chip.h
deleted file mode 100644
index 7d287d325f0..00000000000
--- a/arch/arm/include/lpc11xx/chip.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/************************************************************************************
- * arch/arm/include/lpc11xx/chip.h
- *
- * Copyright (C) 2015 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_INCLUDE_LPC11XX_CHIP_H
-#define __ARCH_ARM_INCLUDE_LPC11XX_CHIP_H
-
-/************************************************************************************
- * Included Files
- ************************************************************************************/
-
-#include
-
-/************************************************************************************
- * Pre-processor Definitions
- ************************************************************************************/
-
-/* Get customizations for each supported chip */
-
-#if defined(CONFIG_ARCH_CHIP_LPC1115)
-# define LPC111x 1 /* LPC111x family */
-# define LPC11_FLASH_SIZE (64*1024) /* 64Kb */
-# define LPC11_SRAM_SIZE (8*1024) /* 8Kb */
-# define LPC11_CPUSRAM_SIZE (8*1024)
-# undef LPC11_HAVE_BANK0 /* No AHB SRAM bank 0 */
-# undef LPC11_HAVE_BANK1 /* No AHB SRAM bank 1 */
-# define LPC11_NETHCONTROLLERS 0 /* No Ethernet controller */
-# define LPC11_NUSBHOST 0 /* No USB host controller */
-# define LPC11_NUSBOTG 0 /* No USB OTG controller */
-# define LPC11_NUSBDEV 1 /* One USB device controller */
-# define LPC11_NCAN 1 /* One CAN controller */
-# define LPC11_NI2S 0 /* No I2S modules */
-# define LPC11_NDAC 0 /* No DAC module */
-#else
-# error "Unsupported LPC11xx 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:6] of each field, bits[5:0] read as zero and ignore writes.
- */
-
-#define NVIC_SYSH_PRIORITY_MIN 0xc0 /* All bits[7:6] 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 0x40 /* Two bits of interrupt priority used */
-
-/************************************************************************************
- * Public Types
- ************************************************************************************/
-
-/************************************************************************************
- * Public Data
- ************************************************************************************/
-
-/************************************************************************************
- * Public Functions
- ************************************************************************************/
-
-#endif /* __ARCH_ARM_INCLUDE_LPC11XX_CHIP_H */
diff --git a/arch/arm/include/lpc11xx/irq.h b/arch/arm/include/lpc11xx/irq.h
deleted file mode 100644
index bb89a61a576..00000000000
--- a/arch/arm/include/lpc11xx/irq.h
+++ /dev/null
@@ -1,143 +0,0 @@
-/****************************************************************************
- * arch/arm/include/lpc11xxx/irq.h
- *
- * Copyright (C) 2015 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_LPC11XX_IRQ_H
-#define __ARCH_ARM_INCLUDE_LPC11XX_IRQ_H
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#ifndef __ASSEMBLY__
-# include
-#endif
-#include
-
-/****************************************************************************
- * 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.
- */
-
-/* Common Processor Exceptions (vectors 0-15) */
-
-#define LPC11_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 LPC11_IRQ_NMI (2) /* Vector 2: Non-Maskable Interrupt (NMI) */
-#define LPC11_IRQ_HARDFAULT (3) /* Vector 3: Hard fault */
- /* Vectors 4-10: Reserved */
-#define LPC11_IRQ_SVCALL (11) /* Vector 11: SVC call */
- /* Vector 12-13: Reserved */
-#define LPC11_IRQ_PENDSV (14) /* Vector 14: Pendable system service request */
-#define LPC11_IRQ_SYSTICK (15) /* Vector 15: System tick */
-
-/* External interrupts (vectors >= 16) */
-
-#define LPC11_IRQ_EXTINT (16) /* Vector number of the first external interrupt */
-
-#if defined(CONFIG_ARCH_CHIP_LPC1115)
-#define LPC11_IRQ_PIO0_0 (16) /* Vector 16: PIO0_0 */
-#define LPC11_IRQ_PIO0_1 (17) /* Vector 17: PIO0_1 */
-#define LPC11_IRQ_PIO0_2 (18) /* Vector 18: PIO0_2 */
-#define LPC11_IRQ_PIO0_3 (19) /* Vector 19: PIO0_3 */
-#define LPC11_IRQ_PIO0_4 (20) /* Vector 20: PIO0_4 */
-#define LPC11_IRQ_PIO0_5 (21) /* Vector 21: PIO0_5 */
-#define LPC11_IRQ_PIO0_6 (22) /* Vector 22: PIO0_6 */
-#define LPC11_IRQ_PIO0_7 (23) /* Vector 23: PIO0_7 */
-#define LPC11_IRQ_PIO0_8 (24) /* Vector 24: PIO0_8 */
-#define LPC11_IRQ_PIO0_9 (25) /* Vector 25: PIO0_9 */
-#define LPC11_IRQ_PIO0_10 (26) /* Vector 26: PIO0_10 */
-#define LPC11_IRQ_PIO0_11 (27) /* Vector 27: PIO0_11 */
-#define LPC11_IRQ_PIO1_0 (28) /* Vector 28: PIO1_0 */
-#define LPC11_IRQ_CCAN (29) /* Vector 29: C_CAN controller for LPC11Cxx */
-#define LPC11_IRQ_SSP1 (30) /* Vector 30: SPI1/SSP1 */
-#define LPC11_IRQ_I2C0 (31) /* Vector 31: I2C0 */
-#define LPC11_IRQ_CT16B0 (32) /* Vector 32: Clock/Timer0 16 bits */
-#define LPC11_IRQ_CT16B1 (33) /* Vector 33: Clock/Timer1 16 bits */
-#define LPC11_IRQ_CT32B0 (34) /* Vector 34: Clock/Timer0 32 bits */
-#define LPC11_IRQ_CT32B1 (35) /* Vector 35: Clock/Timer1 32 bits */
-#define LPC11_IRQ_SSP0 (36) /* Vector 36: SPI0/SSP0 */
-#define LPC11_IRQ_UART (37) /* Vector 37: UART */
- /* Vector 38: Reserved */
- /* Vector 39: Reserved */
-#define LPC11_IRQ_ADC (40) /* Vector 40: Analog/Digital Converter */
-#define LPC11_IRQ_WDT (41) /* Vector 41: Watchdog timer */
-#define LPC11_IRQ_BOD (42) /* Vector 42: Brownout Detection */
- /* Vector 43: Reserved */
-#define LPC11_IRQ_PIO3 (44) /* Vector 44: PIO3 */
-#define LPC11_IRQ_PIO2 (45) /* Vector 45: PIO2 */
-#define LPC11_IRQ_PIO1 (46) /* Vector 46: PIO1 */
-#define LPC11_IRQ_PIO0 (47) /* Vector 47: PIO0 */
-#endif
-
-#define NR_IRQS (48) /* 32 interrupts plus 16 exceptions */
-
-/****************************************************************************
- * Public Types
- ****************************************************************************/
-
-#ifndef __ASSEMBLY__
-typedef void (*vic_vector_t)(uint32_t *regs);
-
-/****************************************************************************
- * Inline functions
- ****************************************************************************/
-
-/****************************************************************************
- * Public Data
- ****************************************************************************/
-
-/****************************************************************************
- * Public Function Prototypes
- ****************************************************************************/
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* __ASSEMBLY__ */
-
-#endif /* __ARCH_ARM_INCLUDE_LPC11XX_IRQ_H */
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/cxd56xx/Kconfig b/arch/arm/src/cxd56xx/Kconfig
index 14ca69e6d9f..3dcfe81281d 100644
--- a/arch/arm/src/cxd56xx/Kconfig
+++ b/arch/arm/src/cxd56xx/Kconfig
@@ -224,6 +224,46 @@ config CXD56_GPIO_IRQ
---help---
Enable support for GPIO interrupts
+config CXD56_UART0
+ bool "UART0"
+ default n
+ ---help---
+ UART interface with hardware flow control in the application subsystem.
+
+if CXD56_UART0
+
+config CXD56_UART0_BAUD
+ int "CXD56 UART0 BAUD"
+ default 921600
+
+config CXD56_UART0_PARITY
+ int "CXd56 UART0 parity"
+ default 0
+ range 0 2
+ ---help---
+ CXD56 UART0 parity. 0=None, 1=Odd, 2=Even. Default: None
+
+config CXD56_UART0_BITS
+ int "CXD56 UART0 number of bits"
+ default 8
+ range 5 8
+ ---help---
+ CXD56 UART0 number of bits. Default: 8
+
+config CXD56_UART0_2STOP
+ int "CXD56 UART0 two stop bits"
+ default 0
+ ---help---
+ 0=1 stop bit, 1=Two stop bits. Default: 1 stop bit
+
+config CXD56_UART0_FLOWCONTROL
+ bool "CXD56 UART0 flow control"
+ default n
+ ---help---
+ Enable CXD56 UART0 RTS flow control
+
+endif
+
config CXD56_UART1
bool "UART1"
default y
@@ -1183,4 +1223,71 @@ config CXD56_GE2D
default n
---help---
A hardware image processor device.
+
+config CXD56_GNSS
+ bool "GNSS device"
+ default n
+
+if CXD56_GNSS
+
+menu "GNSS settings"
+
+config CXD56_GNSS_NPOLLWAITERS
+ int "GNSS max poll waiters"
+ default 4
+
+config CXD56_GNSS_NSIGNALRECEIVERS
+ int "GNSS max signal receivers"
+ default 4
+
+config CXD56_GNSS_WORKER_STACKSIZE
+ int "GNSS worker thread stack size"
+ default 128
+
+config CXD56_GNSS_WORKER_THREAD_PRIORITY
+ int "GNSS worker thread priority"
+ default 255
+
+config CXD56_GNSS_BACKUP_FILENAME
+ string "GNSS backup file name"
+ default "/mnt/spif/gnss_backup.bin"
+ ---help---
+ Specify the path and file name of backup data.
+
+config CXD56_GNSS_CEP_FILENAME
+ string "GNSS CEP file name"
+ default "/mnt/sd0/gnss_cep.bin"
+ ---help---
+ Specify the path and file name of cep data.
+
+config CXD56_GNSS_FW_RTK
+ bool "Support carrier-phase data output for Real-Time Kinematic"
+ default n
+ ---help---
+ This is experimental function.
+
+config CXD56_GNSS_DEBUG_FEATURE
+ bool "GNSS debug feature"
+
+if CXD56_GNSS_DEBUG_FEATURE
+
+config CXD56_GNSS_DEBUG_ERROR
+ bool "GNSS debug error"
+
+config CXD56_GNSS_DEBUG_WARN
+ bool "GNSS debug warn"
+
+config CXD56_GNSS_DEBUG_INFO
+ bool "GNSS debug info"
+
+endif # CXD56_GNSS_DEBUG_FEATURE
+
+endmenu
+config CXD56_GEOFENCE
+ bool "Geofence Support"
+ default y
+ depends on CXD56_GNSS
+
+endif
+
endmenu
diff --git a/arch/arm/src/cxd56xx/Make.defs b/arch/arm/src/cxd56xx/Make.defs
index 9a2c000a580..65a79318df7 100644
--- a/arch/arm/src/cxd56xx/Make.defs
+++ b/arch/arm/src/cxd56xx/Make.defs
@@ -101,6 +101,10 @@ CHIP_CSRCS += cxd56_powermgr.c
CHIP_CSRCS += cxd56_farapi.c
CHIP_CSRCS += cxd56_sysctl.c
+ifeq ($(CONFIG_CXD56_UART0),y)
+CHIP_CSRCS += cxd56_uart0.c
+endif
+
ifeq ($(CONFIG_CXD56_PM_PROCFS),y)
CHIP_CSRCS += cxd56_powermgr_procfs.c
endif
@@ -181,3 +185,12 @@ endif
ifeq ($(CONFIG_CXD56_WDT),y)
CHIP_CSRCS += cxd56_wdt.c
endif
+
+ifeq ($(CONFIG_CXD56_GNSS),y)
+CHIP_CSRCS += cxd56_gnss.c
+CHIP_CSRCS += cxd56_cpu1signal.c
+endif
+
+ifeq ($(CONFIG_CXD56_GEOFENCE),y)
+CHIP_CSRCS += cxd56_geofence.c
+endif
diff --git a/arch/arm/src/cxd56xx/cxd56_cpu1signal.c b/arch/arm/src/cxd56xx/cxd56_cpu1signal.c
new file mode 100644
index 00000000000..7dac15dd2f2
--- /dev/null
+++ b/arch/arm/src/cxd56xx/cxd56_cpu1signal.c
@@ -0,0 +1,281 @@
+/****************************************************************************
+ * arch/arm/src/cxd56xx/cxd56_cpu1signal.c
+ *
+ * Copyright 2018 Sony Semiconductor Solutions Corporation
+ *
+ * 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 of Sony Semiconductor Solutions Corporation 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.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include "cxd56_icc.h"
+#include "cxd56_cpu1signal.h"
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+#ifndef CONFIG_CXD56CPU1_WORKER_STACKSIZE
+# define CONFIG_CXD56CPU1_WORKER_STACKSIZE 1024
+#endif
+
+#ifndef CONFIG_CXD56CPU1_WORKER_THREAD_PRIORITY
+# define CONFIG_CXD56CPU1_WORKER_THREAD_PRIORITY (SCHED_PRIORITY_MAX)
+#endif
+
+#define CXD56CPU1_CPUID 1
+
+/****************************************************************************
+ * Private Type
+ ****************************************************************************/
+
+struct cxd56_sigtype_s
+{
+ int use;
+ cxd56_cpu1sighandler_t handler;
+ FAR void * data;
+};
+
+struct cxd56cpu1_info_s
+{
+ pthread_t workertid;
+ int ndev;
+ struct cxd56_sigtype_s sigtype[CXD56_CPU1_DATA_TYPE_MAX];
+};
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+static struct cxd56cpu1_info_s g_cpu1_info = {0};
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+static FAR void *cxd56cpu1_worker(FAR void *arg)
+{
+ struct cxd56cpu1_info_s *priv = (struct cxd56cpu1_info_s *)arg;
+ iccmsg_t msg;
+ uint8_t sigtype;
+ int ret;
+
+ msg.cpuid = CXD56CPU1_CPUID;
+
+ while (1)
+ {
+ ret = cxd56_iccrecvmsg(&msg, 0);
+ if (ret < 0)
+ {
+ continue;
+ }
+ sigtype = (uint8_t)CXD56_CPU1_GET_DEV(msg.data);
+ if (sigtype >= CXD56_CPU1_DATA_TYPE_MAX)
+ {
+ _info("Caught invalid sigtype %d.\n", sigtype);
+ continue;
+ }
+
+ if (priv->sigtype[sigtype].handler)
+ {
+ priv->sigtype[sigtype].handler(msg.data,
+ priv->sigtype[sigtype].data);
+ }
+ }
+
+ return arg;
+}
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+int cxd56_cpu1sigsend(uint8_t sigtype, uint32_t data)
+{
+ iccmsg_t msg;
+
+ msg.cpuid = CXD56CPU1_CPUID;
+ msg.msgid = sigtype;
+ msg.data = data;
+
+ return cxd56_iccsend(CXD56_PROTO_GNSS, &msg, 0);
+}
+
+void cxd56_cpu1sigregisterhandler(uint8_t sigtype,
+ cxd56_cpu1sighandler_t handler)
+{
+ struct cxd56cpu1_info_s *priv = &g_cpu1_info;
+
+ if (sigtype >= CXD56_CPU1_DATA_TYPE_MAX)
+ {
+ return;
+ }
+
+ priv->sigtype[sigtype].handler = handler;
+}
+
+void cxd56_cpu1sigunregisterhandler(uint8_t sigtype)
+{
+ struct cxd56cpu1_info_s *priv = &g_cpu1_info;
+
+ if (sigtype >= CXD56_CPU1_DATA_TYPE_MAX)
+ {
+ return;
+ }
+
+ priv->sigtype[sigtype].handler = NULL;
+}
+
+int cxd56_cpu1siginit(uint8_t sigtype, FAR void *data)
+{
+ struct cxd56cpu1_info_s *priv = &g_cpu1_info;
+ pthread_attr_t tattr;
+ struct sched_param param;
+ pthread_t tid;
+ int ret;
+
+ if (sigtype >= CXD56_CPU1_DATA_TYPE_MAX)
+ {
+ return -ENODEV;
+ }
+
+ sched_lock();
+
+ if (priv->sigtype[sigtype].use)
+ {
+ ret = -EBUSY;
+ goto _err1;
+ }
+
+ priv->sigtype[sigtype].use = true;
+ priv->sigtype[sigtype].data = data;
+
+ if (priv->ndev > 0)
+ {
+ ret = OK;
+ goto _err1;
+ }
+
+ priv->ndev++;
+
+ sched_unlock();
+
+ cxd56_iccinit(CXD56_PROTO_GNSS);
+
+ ret = cxd56_iccinitmsg(CXD56CPU1_CPUID);
+ if (ret < 0)
+ {
+ _err("Failed to initialize ICC for GPS CPU: %d\n", ret);
+ goto _err0;
+ }
+
+ pthread_attr_init(&tattr);
+ tattr.stacksize = CONFIG_CXD56CPU1_WORKER_STACKSIZE;
+ param.sched_priority = CONFIG_CXD56CPU1_WORKER_THREAD_PRIORITY;
+ pthread_attr_setschedparam(&tattr, ¶m);
+
+ ret = pthread_create(&tid, &tattr, cxd56cpu1_worker,
+ (pthread_addr_t)priv);
+ if (ret != 0)
+ {
+ cxd56_iccuninitmsg(CXD56CPU1_CPUID);
+ ret = -ret; /* pthread_create does not modify errno. */
+ goto _err0;
+ }
+ priv->workertid = tid;
+
+ return ret;
+
+_err0:
+ priv->sigtype[sigtype].use = false;
+ priv->sigtype[sigtype].data = NULL;
+ return ret;
+
+_err1:
+ sched_unlock();
+ return ret;
+}
+
+int cxd56_cpu1siguninit(uint8_t sigtype)
+{
+ struct cxd56cpu1_info_s *priv = &g_cpu1_info;
+ pthread_t tid;
+ int ret;
+
+ if (sigtype >= CXD56_CPU1_DATA_TYPE_MAX)
+ {
+ return -ENODEV;
+ }
+
+ sched_lock();
+
+ if (!priv->sigtype[sigtype].use)
+ {
+ ret = -EBUSY;
+ goto _err1;
+ }
+
+ priv->ndev--;
+ priv->sigtype[sigtype].use = false;
+ priv->sigtype[sigtype].data = NULL;
+
+ if (priv->ndev > 0)
+ {
+ ret = OK;
+ goto _err0;
+ }
+
+ tid = priv->workertid;
+ priv->workertid = 0;
+
+ sched_unlock();
+
+ pthread_cancel(tid);
+ pthread_join(tid, NULL);
+
+ cxd56_iccuninit(CXD56CPU1_CPUID);
+
+ return 0;
+
+_err1:
+ sched_unlock();
+
+_err0:
+ return ret;
+}
diff --git a/arch/arm/src/cxd56xx/cxd56_cpu1signal.h b/arch/arm/src/cxd56xx/cxd56_cpu1signal.h
new file mode 100644
index 00000000000..5898da67f9e
--- /dev/null
+++ b/arch/arm/src/cxd56xx/cxd56_cpu1signal.h
@@ -0,0 +1,81 @@
+/****************************************************************************
+ * arch/arm/src/cxd56xx/cxd56_cpu1signal.h
+ *
+ * Copyright 2018 Sony Semiconductor Solutions Corporation
+ *
+ * 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 of Sony Semiconductor Solutions Corporation 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_CXD56XX_CXD56_CPU1SIGNAL_H
+#define __ARCH_ARM_SRC_CXD56XX_CXD56_CPU1SIGNAL_H
+
+/* CPU1 Notifyable functions */
+
+#define CXD56_CPU1_DATA_TYPE_GNSS 0
+#define CXD56_CPU1_DATA_TYPE_GEOFENCE 1
+#define CXD56_CPU1_DATA_TYPE_PVTLOG 2
+#define CXD56_CPU1_DATA_TYPE_AGPS 3
+#define CXD56_CPU1_DATA_TYPE_RTK 4
+#define CXD56_CPU1_DATA_TYPE_SPECTRUM 5
+#define CXD56_CPU1_DATA_TYPE_INFO 6
+#define CXD56_CPU1_DATA_TYPE_BACKUP 7
+#define CXD56_CPU1_DATA_TYPE_CEP 8
+#define CXD56_CPU1_DATA_TYPE_CEPFILE 9
+#define CXD56_CPU1_DATA_TYPE_BKUPFILE 10
+#define CXD56_CPU1_DATA_TYPE_GPSEPHEMERIS 11
+#define CXD56_CPU1_DATA_TYPE_GLNEPHEMERIS 12
+#define CXD56_CPU1_DATA_TYPE_CPUFIFOAPI 13
+#define CXD56_CPU1_DATA_TYPE_SBAS 14
+#define CXD56_CPU1_DATA_TYPE_DCREPORT 15
+#define CXD56_CPU1_DATA_TYPE_MAX 16
+
+/* CPU1 devices */
+
+#define CXD56_CPU1_DEV_GNSS (CXD56_CPU1_DATA_TYPE_GNSS)
+#define CXD56_CPU1_DEV_GEOFENCE (CXD56_CPU1_DATA_TYPE_GEOFENCE)
+
+#define CXD56_CPU1_DEV_MASK 0xff
+#define CXD56_CPU1_GET_DEV(DATA) ((DATA) & CXD56_CPU1_DEV_MASK)
+#define CXD56_CPU1_GET_DATA(DATA) ((DATA) >> 8)
+
+#if CXD56_CPU1_DATA_TYPE_MAX > (CXD56_CPU1_DEV_MASK + 1)
+#error "CXD56_CPU1_DEV must be smaller than 0xf"
+#endif
+
+typedef void (*cxd56_cpu1sighandler_t)(uint32_t data, FAR void *userdata);
+
+extern int cxd56_cpu1siginit(uint8_t cpu1dev, FAR void *data);
+extern int cxd56_cpu1siguninit(uint8_t cpu1dev);
+extern void cxd56_cpu1sigregisterhandler(uint8_t cpu1dev,
+ cxd56_cpu1sighandler_t handler);
+extern void cxd56_cpu1sigunregisterhandler(uint8_t cpu1dev);
+extern int cxd56_cpu1sigsend(uint8_t sigtype, uint32_t data);
+
+#endif /* __ARCH_ARM_SRC_CXD56XX_CXD56_CPU1SIGNAL_H */
diff --git a/arch/arm/src/cxd56xx/cxd56_geofence.c b/arch/arm/src/cxd56xx/cxd56_geofence.c
new file mode 100644
index 00000000000..8454bf02f92
--- /dev/null
+++ b/arch/arm/src/cxd56xx/cxd56_geofence.c
@@ -0,0 +1,777 @@
+/****************************************************************************
+ * arch/arm/src/cxd56xx/cxd56_geofence.c
+ *
+ * Copyright 2018 Sony Semiconductor Solutions Corporation
+ *
+ * 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 of Sony Semiconductor Solutions Corporation 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.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include
+#include
+#include
+
+#include
+#include "cxd56_gnss_api.h"
+#include "cxd56_cpu1signal.h"
+#include "cxd56_gnss.h"
+
+#if defined(CONFIG_CXD56_GEOFENCE)
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+#ifndef CONFIG_GEOFENCE_NPOLLWAITERS
+# define CONFIG_GEOFENCE_NPOLLWAITERS 4
+#endif
+
+/****************************************************************************
+ * Private Types
+ ****************************************************************************/
+
+struct cxd56_geofence_dev_s
+{
+ sem_t devsem;
+ FAR struct pollfd *fds[CONFIG_GEOFENCE_NPOLLWAITERS];
+};
+
+/****************************************************************************
+ * Private Function Prototypes
+ ****************************************************************************/
+
+/* file operation functions */
+
+static int cxd56_geofence_open(FAR struct file *filep);
+static int cxd56_geofence_close(FAR struct file *filep);
+static ssize_t cxd56_geofence_read(FAR struct file *filep, FAR char *buffer,
+ size_t len);
+static int cxd56_geofence_ioctl(FAR struct file *filep, int cmd,
+ unsigned long arg);
+#ifndef CONFIG_DISABLE_POLL
+static int cxd56_geofence_poll(FAR struct file *filep, FAR struct pollfd *fds,
+ bool setup);
+#endif
+
+/* ioctl command functions */
+
+static int cxd56_geofence_start(unsigned long arg);
+static int cxd56_geofence_stop(unsigned long arg);
+static int cxd56_geofence_add_region(unsigned long arg);
+static int cxd56_geofence_modify_region(unsigned long arg);
+static int cxd56_geofence_delete_region(unsigned long arg);
+static int cxd56_geofence_delete_all_region(unsigned long arg);
+static int cxd56_geofence_get_region_data(unsigned long arg);
+static int cxd56_geofence_get_used_id(unsigned long arg);
+static int cxd56_geofence_get_all_status(unsigned long arg);
+static int cxd56_geofence_set_mode(unsigned long arg);
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/* This the vtable that supports the character driver interface */
+
+static const struct file_operations g_geofencefops =
+{
+ cxd56_geofence_open, /* open */
+ cxd56_geofence_close, /* close */
+ cxd56_geofence_read, /* read */
+ 0, /* write */
+ 0, /* seek */
+ cxd56_geofence_ioctl, /* ioctl */
+#ifndef CONFIG_DISABLE_POLL
+ cxd56_geofence_poll, /* poll */
+#endif
+};
+
+/* ioctl command list */
+
+FAR static int (*g_cmdlist[CXD56_GEOFENCE_IOCTL_MAX])(unsigned long) =
+{
+ NULL, /* CXD56_GEOFENCE_IOCTL_INVAL = 0 */
+ cxd56_geofence_start,
+ cxd56_geofence_stop,
+ cxd56_geofence_add_region,
+ cxd56_geofence_modify_region,
+ cxd56_geofence_delete_region,
+ cxd56_geofence_delete_all_region,
+ cxd56_geofence_get_region_data,
+ cxd56_geofence_get_used_id,
+ cxd56_geofence_get_all_status,
+ cxd56_geofence_set_mode,
+
+ /* max CXD56_GEOFENCE_IOCTL_MAX */
+};
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: cxd56_geofence_start
+ *
+ * Description:
+ * Process CXD56_GEOFENCE_IOCTL_START command.
+ * Start GEOFENCE Detect
+ *
+ * Input Parameters:
+ * arg - Data for command
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+static int cxd56_geofence_start(unsigned long arg)
+{
+ return GD_RegisterGeofence();
+}
+
+/****************************************************************************
+ * Name: cxd56_geofence_stop
+ *
+ * Description:
+ * Process CXD56_GEOFENCE_IOCTL_STOP command.
+ * Stop GEOFENCE Detect
+ *
+ * Input Parameters:
+ * arg - Data for command
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+static int cxd56_geofence_stop(unsigned long arg)
+{
+ return GD_ReleaseGeofence();
+}
+
+/****************************************************************************
+ * Name: cxd56_geofence_add_region
+ *
+ * Description:
+ * Process CXD56_GEOFENCE_IOCTL_ADD command.
+ * Add region
+ *
+ * Input Parameters:
+ * arg - Data for command
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+static int cxd56_geofence_add_region(unsigned long arg)
+{
+ int ret;
+ FAR struct cxd56_geofence_region_s *reg_data;
+
+ if (!arg)
+ {
+ return -EINVAL;
+ }
+ reg_data = (FAR struct cxd56_geofence_region_s *)arg;
+
+ ret = GD_GeoAddRegion(reg_data->id, reg_data->latitude, reg_data->longitude,
+ reg_data->radius);
+
+ return ret;
+}
+
+/****************************************************************************
+ * Name: cxd56_geofence_modify_region
+ *
+ * Description:
+ * Process CXD56_GEOFENCE_IOCTL_MODIFY command.
+ * Modify region
+ *
+ * Input Parameters:
+ * arg - Data for command
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+static int cxd56_geofence_modify_region(unsigned long arg)
+{
+ int ret;
+ FAR struct cxd56_geofence_region_s *reg_data;
+
+ if (!arg)
+ {
+ return -EINVAL;
+ }
+ reg_data = (FAR struct cxd56_geofence_region_s *)arg;
+
+ ret = GD_GeoModifyRegion(reg_data->id, reg_data->latitude,
+ reg_data->longitude, reg_data->radius);
+
+ return ret;
+}
+
+/****************************************************************************
+ * Name: cxd56_geofence_delete_region
+ *
+ * Description:
+ * Process CXD56_GEOFENCE_IOCTL_DELETE command.
+ * Delete region
+ *
+ * Input Parameters:
+ * arg - Data for command
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+static int cxd56_geofence_delete_region(unsigned long arg)
+{
+ int ret;
+ FAR uint8_t id;
+
+ if (UINT8_MAX < arg)
+ {
+ return -EINVAL;
+ }
+
+ id = (uint8_t)arg;
+ ret = GD_GeoDeleteRegione(id);
+
+ return ret;
+}
+
+/****************************************************************************
+ * Name: cxd56_geofence_delete_all_region
+ *
+ * Description:
+ * Process CXD56_GEOFENCE_IOCTL_ALL_DELETE command.
+ * All delete region
+ *
+ * Input Parameters:
+ * arg - Data for command
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+static int cxd56_geofence_delete_all_region(unsigned long arg)
+{
+ int ret;
+
+ ret = GD_GeoDeleteAllRegion();
+
+ return ret;
+}
+
+/****************************************************************************
+ * Name: cxd56_geofence_get_region_data
+ *
+ * Description:
+ * Process CXD56_GEOFENCE_IOCTL_GET_REGION_DATA command.
+ * Get used region ID
+ *
+ * Input Parameters:
+ * arg - Data for command
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+static int cxd56_geofence_get_region_data(unsigned long arg)
+{
+ int ret;
+ FAR struct cxd56_geofence_region_s *reg_data;
+
+ if (!arg)
+ {
+ return -EINVAL;
+ }
+ reg_data = (FAR struct cxd56_geofence_region_s *)arg;
+
+ ret = GD_GeoGetRegionData(reg_data->id, ®_data->latitude,
+ ®_data->longitude, ®_data->radius);
+
+ return ret;
+}
+
+/****************************************************************************
+ * Name: cxd56_geofence_get_used_id
+ *
+ * Description:
+ * Process CXD56_GEOFENCE_IOCTL_GET_USED_ID command.
+ * Get used region ID
+ *
+ * Input Parameters:
+ * arg - Data for command
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+static int cxd56_geofence_get_used_id(unsigned long arg)
+{
+ if (!arg)
+ {
+ return -EINVAL;
+ }
+
+ *(uint32_t *)arg = GD_GeoGetUsedRegionId();
+
+ return 0;
+}
+
+/****************************************************************************
+ * Name: cxd56_geofence_get_all_status
+ *
+ * Description:
+ * Process CXD56_GEOFENCE_IOCTL_GET_ALL_STATUS command.
+ * Get All transition status
+ *
+ * Input Parameters:
+ * arg - Data for command
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+static int cxd56_geofence_get_all_status(unsigned long arg)
+{
+ int ret;
+
+ ret = GD_GeoSetAllRgionNotifyRequest();
+
+ return ret;
+}
+
+/****************************************************************************
+ * Name: cxd56_geofence_set_mode
+ *
+ * Description:
+ * Process CXD56_GEOFENCE_IOCTL_SET_MODE command.
+ * Set geofence operation mode
+ *
+ * Input Parameters:
+ * arg - Data for command
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+static int cxd56_geofence_set_mode(unsigned long arg)
+{
+ int ret;
+ FAR struct cxd56_geofence_mode_s *mode;
+
+ if (!arg)
+ {
+ return -EINVAL;
+ }
+ mode = (FAR struct cxd56_geofence_mode_s *)arg;
+
+ ret = GD_GeoSetOpMode(mode->deadzone, mode->dwell_detecttime);
+
+ return ret;
+}
+
+/****************************************************************************
+ * Name: cxd56_geofence_sighandler
+ *
+ * Description:
+ * Common signal handler from GNSS CPU.
+ *
+ * Input Parameters:
+ * data - Received data from GNSS CPU
+ * userdata - User data, this is the device information specified by the
+ * second argument of the function cxd56_cpu1siginit.
+ *
+ * Returned Value:
+ * None
+ *
+ ****************************************************************************/
+
+static void cxd56_geofence_sighandler(uint32_t data, FAR void *userdata)
+{
+ FAR struct cxd56_geofence_dev_s *priv =
+ (FAR struct cxd56_geofence_dev_s *)userdata;
+ int i;
+ int ret;
+
+ ret = sem_wait(&priv->devsem);
+ if (ret < 0)
+ {
+ return;
+ }
+
+ for (i = 0; i < CONFIG_GEOFENCE_NPOLLWAITERS; i++)
+ {
+ struct pollfd *fds = priv->fds[i];
+ if (fds)
+ {
+ fds->revents |= POLLIN;
+ gnssinfo("Report events: %02x\n", fds->revents);
+ sem_post(fds->sem);
+ }
+ }
+
+ sem_post(&priv->devsem);
+}
+
+/****************************************************************************
+ * Name: cxd56_geofence_initialize
+ *
+ * Description:
+ * initialize GEOFENCE device
+ *
+ * Input Parameters:
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+static int cxd56_geofence_initialize(FAR struct cxd56_geofence_dev_s* dev)
+{
+ int32_t ret = 0;
+
+ return ret;
+}
+
+/****************************************************************************
+ * Name: cxd56_geofence_open
+ *
+ * Description:
+ * Standard character driver open method.
+ *
+ * Input Parameters:
+ * filep - File structure pointer
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+static int cxd56_geofence_open(FAR struct file *filep)
+{
+ int32_t ret = 0;
+
+ return ret;
+}
+
+/****************************************************************************
+ * Name: cxd56_geofence_close
+ *
+ * Description:
+ * Standard character driver close method.
+ *
+ * Input Parameters:
+ * filep - File structure pointer
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+static int cxd56_geofence_close(FAR struct file *filep)
+{
+ int32_t ret = 0;
+
+ return ret;
+}
+
+/****************************************************************************
+ * Name: cxd56_geofence_read
+ *
+ * Description:
+ * Standard character driver read method.
+ *
+ * Input Parameters:
+ * filep - File structure pointer
+ * buffer - Buffer to write
+ * buflen - The write length of the buffer
+ *
+ * Returned Value:
+ * Always returns -ENOENT error.
+ *
+ ****************************************************************************/
+
+static ssize_t cxd56_geofence_read(FAR struct file *filep, FAR char *buffer,
+ size_t len)
+{
+ int32_t ret = 0;
+
+ /* Check argument */
+
+ if (!buffer)
+ {
+ ret = -EINVAL;
+ goto _err;
+ }
+ if (len == 0)
+ {
+ ret = 0;
+ goto _err;
+ }
+
+ /* GD_ReadBuffer returns copied data size or negative error code */
+
+ ret = GD_ReadBuffer(CXD56_CPU1_DEV_GEOFENCE, 0, buffer, len);
+
+_err:
+ return ret;
+}
+
+/****************************************************************************
+ * Name: cxd56_geofence_ioctl
+ *
+ * Description:
+ * Standard character driver ioctl method.
+ *
+ * Input Parameters:
+ * filep - File structure pointer
+ * fds - Array of file descriptor
+ * setup - 1 if start poll, 0 if stop poll
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+static int cxd56_geofence_ioctl(FAR struct file *filep, int cmd,
+ unsigned long arg)
+{
+ if (cmd <= CXD56_GEOFENCE_IOCTL_INVAL || cmd >= CXD56_GEOFENCE_IOCTL_MAX)
+ {
+ return -EINVAL;
+ }
+
+ return g_cmdlist[cmd](arg);
+}
+
+/****************************************************************************
+ * Name: cxd56_geofence_poll
+ *
+ * Description:
+ * Standard character driver poll method.
+ *
+ * Input Parameters:
+ * filep - File structure pointer
+ * fds - array of file descriptor
+ * setup - 1 if start poll, 0 if stop poll
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+#ifndef CONFIG_DISABLE_POLL
+static int cxd56_geofence_poll(FAR struct file *filep, FAR struct pollfd *fds,
+ bool setup)
+{
+ FAR struct inode * inode;
+ FAR struct cxd56_geofence_dev_s *priv;
+ int ret = OK;
+ int i;
+
+ inode = filep->f_inode;
+ priv = (FAR struct cxd56_geofence_dev_s *)inode->i_private;
+
+ ret = sem_wait(&priv->devsem);
+ if (ret < 0)
+ {
+ return ret;
+ }
+
+ if (setup)
+ {
+ if ((fds->events & POLLIN) == 0)
+ {
+ ret = -EDEADLK;
+ goto errout;
+ }
+
+ for (i = 0; i < CONFIG_GEOFENCE_NPOLLWAITERS; i++)
+ {
+ /* Find an unused slot */
+
+ if (priv->fds[i] == NULL)
+ {
+ /* Bind the poll structure and this slot */
+
+ priv->fds[i] = fds;
+ fds->priv = &priv->fds[i];
+ GD_SetNotifyMask(CXD56_CPU1_DEV_GEOFENCE, FALSE);
+ break;
+ }
+ }
+
+ /* No space in priv fds array for poll handling */
+
+ if (i >= CONFIG_GEOFENCE_NPOLLWAITERS)
+ {
+ fds->priv = NULL;
+ ret = -EBUSY;
+ goto errout;
+ }
+ }
+ else if (fds->priv)
+ {
+ /* This is a request to tear down the poll. */
+
+ struct pollfd **slot = (struct pollfd **)fds->priv;
+
+ /* Remove all memory of the poll setup */
+
+ *slot = NULL;
+ fds->priv = NULL;
+ }
+
+errout:
+ sem_post(&priv->devsem);
+ return ret;
+}
+#endif
+
+/****************************************************************************
+ * Name: cxd56_geofence_register
+ *
+ * Description:
+ * Register the GEOFENCE character device as 'devpath'
+ *
+ * Input Parameters:
+ * devpath - The full path to the driver to register. E.g., "/dev/geofence"
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+static int cxd56_geofence_register(FAR const char *devpath)
+{
+ FAR struct cxd56_geofence_dev_s *priv;
+ int ret;
+
+ priv = (FAR struct cxd56_geofence_dev_s *)kmm_malloc(
+ sizeof(struct cxd56_geofence_dev_s));
+ if (!priv)
+ {
+ gnsserr("Failed to allocate instance\n");
+ return -ENOMEM;
+ }
+
+ memset(priv, 0, sizeof(struct cxd56_geofence_dev_s));
+ sem_init(&priv->devsem, 0, 1);
+
+ ret = cxd56_geofence_initialize(priv);
+ if (ret < 0)
+ {
+ gnsserr("Failed to initialize geofence device!\n");
+ goto _err0;
+ }
+
+ ret = register_driver(devpath, &g_geofencefops, 0666, priv);
+ if (ret < 0)
+ {
+ gnsserr("Failed to register driver: %d\n", ret);
+ goto _err0;
+ }
+
+ ret = cxd56_cpu1siginit(CXD56_CPU1_DEV_GEOFENCE, priv);
+ if (ret < 0)
+ {
+ gnsserr("Failed to initialize ICC for GPS CPU: %d\n", ret);
+ goto _err2;
+ }
+
+ cxd56_cpu1sigregisterhandler(CXD56_CPU1_DEV_GEOFENCE,
+ cxd56_geofence_sighandler);
+
+ gnssinfo("GEOFENCE driver loaded successfully!\n");
+
+ return ret;
+
+_err2:
+ unregister_driver(devpath);
+_err0:
+ kmm_free(priv);
+ return ret;
+}
+
+/****************************************************************************
+ * Name: cxd56_geofenceinitialize
+ *
+ * Description:
+ * Initialize GEOFENCE device
+ *
+ * Input Parameters:
+ * devpath - The full path to the driver to register. E.g., "/dev/geofence"
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+int cxd56_geofenceinitialize(FAR const char *devpath)
+{
+ int ret;
+
+ gnssinfo("Initializing GEOFENCE..\n");
+
+ ret = cxd56_geofence_register(devpath);
+ if (ret < 0)
+ {
+ gnsserr("Error registering GEOFENCE\n");
+ }
+
+ return ret;
+}
+
+#endif
diff --git a/arch/arm/src/cxd56xx/cxd56_geofence.h b/arch/arm/src/cxd56xx/cxd56_geofence.h
new file mode 100644
index 00000000000..cb6c764a095
--- /dev/null
+++ b/arch/arm/src/cxd56xx/cxd56_geofence.h
@@ -0,0 +1,86 @@
+/****************************************************************************
+ * arch/arm/src/cxd56xx/cxd56_geofence.h
+ *
+ * Copyright 2018 Sony Semiconductor Solutions Corporation
+ *
+ * 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 of Sony Semiconductor Solutions Corporation 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_CXD56XX_CXD56_GEOFENCE_H
+#define __ARCH_ARM_SRC_CXD56XX_CXD56_GEOFENCE_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+#undef EXTERN
+#if defined(__cplusplus)
+#define EXTERN extern "C"
+extern "C"
+{
+#else
+#define EXTERN extern
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: cxd56_geofenceinitialize
+ *
+ * Description:
+ * Initialize GEOFENCE device
+ *
+ * Input Parameters:
+ * devpath - The full path to the driver to register. E.g., "/dev/geofence"
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+int cxd56_geofenceinitialize(FAR const char *devpath);
+
+#undef EXTERN
+#if defined(__cplusplus)
+}
+#endif
+
+#endif /* __ASSEMBLY__ */
+#endif /* __ARCH_ARM_SRC_CXD56XX_CXD56_GEOFENCE_H */
diff --git a/arch/arm/src/cxd56xx/cxd56_gnss.c b/arch/arm/src/cxd56xx/cxd56_gnss.c
new file mode 100644
index 00000000000..a5c809f6d18
--- /dev/null
+++ b/arch/arm/src/cxd56xx/cxd56_gnss.c
@@ -0,0 +1,2937 @@
+/****************************************************************************
+ * arch/arm/src/cxd56xx/cxd56_gnss.c
+ *
+ * Copyright 2018,2019 Sony Semiconductor Solutions Corporation
+ *
+ * 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 of Sony Semiconductor Solutions Corporation 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.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include "cxd56_gnss_api.h"
+#include "cxd56_cpu1signal.h"
+#include "cxd56_gnss.h"
+
+#if defined(CONFIG_CXD56_GNSS)
+
+/****************************************************************************
+ * External Defined Functions
+ ****************************************************************************/
+
+extern int PM_LoadImage(int cpuid, const char* filename);
+extern int PM_StartCpu(int cpuid, int wait);
+extern int PM_SleepCpu(int cpuid, int mode);
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+#ifndef CONFIG_CXD56_GNSS_NPOLLWAITERS
+# define CONFIG_CXD56_GNSS_NPOLLWAITERS 4
+#endif
+
+#ifndef CONFIG_CXD56_GNSS_NSIGNALRECEIVERS
+# define CONFIG_CXD56_GNSS_NSIGNALRECEIVERS 4
+#endif
+
+#ifndef CONFIG_CXD56_GNSS_BACKUP_BUFFER_SIZE
+# define CONFIG_CXD56_GNSS_BACKUP_BUFFER_SIZE 1024
+#endif
+
+#ifndef CONFIG_CXD56_GNSS_BACKUP_FILENAME
+# define CONFIG_CXD56_GNSS_BACKUP_FILENAME "/mnt/spif/gnss_backup.bin"
+#endif
+
+#ifndef CONFIG_CXD56_GNSS_CEP_FILENAME
+# define CONFIG_CXD56_GNSS_CEP_FILENAME "/mnt/spif/gnss_cep.bin"
+#endif
+
+#define CXD56_GNSS_GPS_CPUID 1
+#ifdef CONFIG_CXD56_GNSS_FW_RTK
+# define CXD56_GNSS_FWNAME "gnssfwrtk"
+#else
+# define CXD56_GNSS_FWNAME "gnssfw"
+#endif
+#ifndef PM_SLEEP_MODE_COLD
+# define PM_SLEEP_MODE_COLD 2
+#endif
+#ifndef PM_SLEEP_MODE_HOT_ENABLE
+# define PM_SLEEP_MODE_HOT_ENABLE 7
+#endif
+#ifndef PM_SLEEP_MODE_HOT_DISABLE
+# define PM_SLEEP_MODE_HOT_DISABLE 8
+#endif
+
+/* Notify data of PUBLISH_TYPE_GNSS */
+
+#define CXD56_GNSS_NOTIFY_TYPE_POSITION 0
+#define CXD56_GNSS_NOTIFY_TYPE_BOOTCOMP 1
+#define CXD56_GNSS_NOTIFY_TYPE_REQBKUPDAT 2
+#define CXD56_GNSS_NOTIFY_TYPE_REQCEPOPEN 3
+#define CXD56_GNSS_NOTIFY_TYPE_REQCEPCLOSE 4
+#define CXD56_GNSS_NOTIFY_TYPE_REQCEPDAT 5
+#define CXD56_GNSS_NOTIFY_TYPE_REQCEPBUFFREE 6
+
+/* GNSS core CPU FIFO interface API */
+
+#define CXD56_GNSS_GD_GNSS_START 0
+#define CXD56_GNSS_GD_GNSS_STOP 1
+#define CXD56_GNSS_GD_GNSS_CEPINITASSISTDATA 2
+
+/* CPU FIFO API bitfield converter */
+
+#define CXD56_GNSS_CPUFIFOAPI_SET_DATA(API, DATA) (((DATA) << 8) | (API))
+
+/* Common info shared with GNSS core */
+
+#define GNSS_SHARED_INFO_MAX_ARGC 6
+
+/* GDSP File read/write arguments */
+
+#define GNSS_ARGS_FILE_OFFSET 0
+#define GNSS_ARGS_FILE_BUF 1
+#define GNSS_ARGS_FILE_LENGTH 2
+
+/****************************************************************************
+ * Private Types
+ ****************************************************************************/
+
+#ifndef CONFIG_DISABLE_SIGNAL
+struct cxd56_gnss_sig_s
+{
+ uint8_t enable;
+ int pid;
+ FAR struct cxd56_gnss_signal_info_s info;
+};
+#endif
+
+struct cxd56_gnss_shared_info_s
+{
+ int retval;
+ uint32_t argc;
+ uint32_t argv[GNSS_SHARED_INFO_MAX_ARGC];
+};
+
+struct cxd56_gnss_dev_s
+{
+ sem_t devsem;
+ sem_t syncsem;
+ uint8_t num_open;
+ uint8_t notify_data;
+ FAR FILE * cepfp;
+ FAR void * cepbuf;
+ FAR struct pollfd *fds[CONFIG_CXD56_GNSS_NPOLLWAITERS];
+#if !defined(CONFIG_DISABLE_SIGNAL) && \
+ (CONFIG_CXD56_GNSS_NSIGNALRECEIVERS != 0)
+ struct cxd56_gnss_sig_s sigs[CONFIG_CXD56_GNSS_NSIGNALRECEIVERS];
+#endif
+ struct cxd56_gnss_shared_info_s shared_info;
+ sem_t ioctllock;
+ sem_t apiwait;
+ int apiret;
+};
+
+/****************************************************************************
+ * Private Function Prototypes
+ ****************************************************************************/
+
+/* ioctl command functions */
+
+static int cxd56_gnss_start(FAR struct file *filep, unsigned long arg);
+static int cxd56_gnss_stop(FAR struct file *filep, unsigned long arg);
+static int cxd56_gnss_select_satellite_system(FAR struct file *filep,
+ unsigned long arg);
+static int cxd56_gnss_get_satellite_system(FAR struct file *filep,
+ unsigned long arg);
+static int
+cxd56_gnss_set_receiver_position_ellipsoidal(FAR struct file *filep,
+ unsigned long arg);
+static int cxd56_gnss_set_receiver_position_orthogonal(FAR struct file *filep,
+ unsigned long arg);
+static int cxd56_gnss_set_ope_mode(FAR struct file *filep, unsigned long arg);
+static int cxd56_gnss_get_ope_mode(FAR struct file *filep, unsigned long arg);
+static int cxd56_gnss_set_tcxo_offset(FAR struct file *filep,
+ unsigned long arg);
+static int cxd56_gnss_get_tcxo_offset(FAR struct file *filep,
+ unsigned long arg);
+static int cxd56_gnss_set_time(FAR struct file *filep, unsigned long arg);
+static int cxd56_gnss_get_almanac(FAR struct file *filep, unsigned long arg);
+static int cxd56_gnss_set_almanac(FAR struct file *filep, unsigned long arg);
+static int cxd56_gnss_get_ephemeris(FAR struct file *filep,
+ unsigned long arg);
+static int cxd56_gnss_set_ephemeris(FAR struct file *filep,
+ unsigned long arg);
+static int cxd56_gnss_save_backup_data(FAR struct file *filep,
+ unsigned long arg);
+static int cxd56_gnss_erase_backup_data(FAR struct file *filep,
+ unsigned long arg);
+static int cxd56_gnss_open_cep_data(FAR struct file *filep,
+ unsigned long arg);
+static int cxd56_gnss_close_cep_data(FAR struct file *filep,
+ unsigned long arg);
+static int cxd56_gnss_check_cep_data(FAR struct file *filep,
+ unsigned long arg);
+static int cxd56_gnss_get_cep_age(FAR struct file *filep, unsigned long arg);
+static int cxd56_gnss_reset_cep_flag(FAR struct file *filep,
+ unsigned long arg);
+static int cxd56_gnss_set_acquist_data(FAR struct file *filep,
+ unsigned long arg);
+static int cxd56_gnss_set_frametime(FAR struct file *filep,
+ unsigned long arg);
+static int cxd56_gnss_set_tau_gps(FAR struct file *filep, unsigned long arg);
+static int cxd56_gnss_set_time_gps(FAR struct file *filep, unsigned long arg);
+static int cxd56_gnss_clear_receiver_info(FAR struct file *filep,
+ unsigned long arg);
+static int cxd56_gnss_set_tow_assist(FAR struct file *filep,
+ unsigned long arg);
+static int cxd56_gnss_set_utc_model(FAR struct file *filep,
+ unsigned long arg);
+static int cxd56_gnss_control_spectrum(FAR struct file *filep,
+ unsigned long arg);
+static int cxd56_gnss_start_test(FAR struct file *filep, unsigned long arg);
+static int cxd56_gnss_stop_test(FAR struct file *filep, unsigned long arg);
+static int cxd56_gnss_get_test_result(FAR struct file *filep,
+ unsigned long arg);
+static int cxd56_gnss_set_signal(FAR struct file *filep, unsigned long arg);
+static int cxd56_gnss_start_pvtlog(FAR struct file *filep, unsigned long arg);
+static int cxd56_gnss_stop_pvtlog(FAR struct file *filep, unsigned long arg);
+static int cxd56_gnss_delete_pvtlog(FAR struct file *filep,
+ unsigned long arg);
+static int cxd56_gnss_get_pvtlog_status(FAR struct file *filep,
+ unsigned long arg);
+static int cxd56_gnss_start_rtk_output(FAR struct file *filep,
+ unsigned long arg);
+static int cxd56_gnss_stop_rtk_output(FAR struct file *filep,
+ unsigned long arg);
+static int cxd56_gnss_set_rtk_interval(FAR struct file *filep,
+ unsigned long arg);
+static int cxd56_gnss_get_rtk_interval(FAR struct file *filep,
+ unsigned long arg);
+static int cxd56_gnss_select_rtk_satellite(FAR struct file *filep,
+ unsigned long arg);
+static int cxd56_gnss_get_rtk_satellite(FAR struct file *filep,
+ unsigned long arg);
+static int cxd56_gnss_set_rtk_ephemeris_enable(FAR struct file *filep,
+ unsigned long arg);
+static int cxd56_gnss_get_rtk_ephemeris_enable(FAR struct file *filep,
+ unsigned long arg);
+static int cxd56_gnss_start_navmsg_output(FAR struct file *filep,
+ unsigned long arg);
+static int cxd56_gnss_get_var_ephemeris(FAR struct file *filep,
+ unsigned long arg);
+static int cxd56_gnss_set_var_ephemeris(FAR struct file *filep,
+ unsigned long arg);
+
+/* file operation functions */
+
+static int cxd56_gnss_open(FAR struct file *filep);
+static int cxd56_gnss_close(FAR struct file *filep);
+static ssize_t cxd56_gnss_read(FAR struct file *filep, FAR char *buffer,
+ size_t len);
+static ssize_t cxd56_gnss_write(FAR struct file *filep,
+ FAR const char *buffer, size_t buflen);
+static int cxd56_gnss_ioctl(FAR struct file *filep, int cmd,
+ unsigned long arg);
+#ifndef CONFIG_DISABLE_POLL
+static int cxd56_gnss_poll(FAR struct file *filep, FAR struct pollfd *fds,
+ bool setup);
+#endif
+static int8_t cxd56_gnss_select_notifytype(off_t fpos, uint32_t *offset);
+
+static int cxd56_gnss_cpufifo_api(FAR struct file *filep, unsigned int api,
+ unsigned int data);
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/* This the vtable that supports the character driver interface */
+
+static const struct file_operations g_gnssfops =
+{
+ cxd56_gnss_open, /* open */
+ cxd56_gnss_close, /* close */
+ cxd56_gnss_read, /* read */
+ cxd56_gnss_write, /* write */
+ 0, /* seek */
+ cxd56_gnss_ioctl, /* ioctl */
+#ifndef CONFIG_DISABLE_POLL
+ cxd56_gnss_poll, /* poll */
+#endif
+};
+
+/* GNSS ioctl command list */
+
+static int (*g_cmdlist[CXD56_GNSS_IOCTL_MAX])(FAR struct file *filep,
+ unsigned long arg) =
+{
+ NULL, /* CXD56_GNSS_IOCTL_INVAL = 0 */
+ cxd56_gnss_start,
+ cxd56_gnss_stop,
+ cxd56_gnss_select_satellite_system,
+ cxd56_gnss_get_satellite_system,
+ cxd56_gnss_set_receiver_position_ellipsoidal,
+ cxd56_gnss_set_receiver_position_orthogonal,
+ cxd56_gnss_set_ope_mode,
+ cxd56_gnss_get_ope_mode,
+ cxd56_gnss_set_tcxo_offset,
+ cxd56_gnss_get_tcxo_offset,
+ cxd56_gnss_set_time,
+ cxd56_gnss_get_almanac,
+ cxd56_gnss_set_almanac,
+ cxd56_gnss_get_ephemeris,
+ cxd56_gnss_set_ephemeris,
+ cxd56_gnss_save_backup_data,
+ cxd56_gnss_erase_backup_data,
+ cxd56_gnss_open_cep_data,
+ cxd56_gnss_close_cep_data,
+ cxd56_gnss_check_cep_data,
+ cxd56_gnss_get_cep_age,
+ cxd56_gnss_reset_cep_flag,
+ cxd56_gnss_start_rtk_output,
+ cxd56_gnss_stop_rtk_output,
+ cxd56_gnss_set_rtk_interval,
+ cxd56_gnss_get_rtk_interval,
+ cxd56_gnss_select_rtk_satellite,
+ cxd56_gnss_get_rtk_satellite,
+ cxd56_gnss_set_rtk_ephemeris_enable,
+ cxd56_gnss_get_rtk_ephemeris_enable,
+ cxd56_gnss_set_acquist_data,
+ cxd56_gnss_set_frametime,
+ cxd56_gnss_set_tau_gps,
+ cxd56_gnss_set_time_gps,
+ cxd56_gnss_clear_receiver_info,
+ cxd56_gnss_set_tow_assist,
+ cxd56_gnss_set_utc_model,
+ cxd56_gnss_control_spectrum,
+ cxd56_gnss_start_test,
+ cxd56_gnss_stop_test,
+ cxd56_gnss_get_test_result,
+ cxd56_gnss_set_signal,
+ cxd56_gnss_start_pvtlog,
+ cxd56_gnss_stop_pvtlog,
+ cxd56_gnss_delete_pvtlog,
+ cxd56_gnss_get_pvtlog_status,
+ cxd56_gnss_start_navmsg_output,
+ cxd56_gnss_set_var_ephemeris,
+ cxd56_gnss_get_var_ephemeris,
+
+ /* max CXD56_GNSS_IOCTL_MAX */
+};
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/* IOCTL private functions */
+
+/****************************************************************************
+ * Name: cxd56_gnss_start
+ *
+ * Description:
+ * Process CXD56_GNSS_IOCTL_START command.
+ * Start a positioning
+ * begining to search the satellites and measure the receiver position
+ *
+ * Input Parameters:
+ * filep - File structure pointer
+ * arg - Data for command
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+static int cxd56_gnss_start(FAR struct file *filep, unsigned long arg)
+{
+ int ret;
+ int retry = 50;
+ uint8_t start_mode = (uint8_t)arg;
+
+ ret = board_lna_power_control(true);
+ if (ret < 0)
+ {
+ return ret;
+ }
+
+ while (!g_rtc_enabled && 0 < retry--)
+ {
+ /* GNSS requires stable RTC */
+
+ usleep(100 * 1000);
+ }
+
+ ret = cxd56_gnss_cpufifo_api(filep, CXD56_GNSS_GD_GNSS_START,
+ start_mode);
+ if (ret < 0)
+ {
+ board_lna_power_control(false);
+ }
+
+ return ret;
+}
+
+/****************************************************************************
+ * Name: cxd56_gnss_stop
+ *
+ * Description:
+ * Process CXD56_GNSS_IOCTL_STOP command.
+ * Stop a positioning.
+ *
+ * Input Parameters:
+ * filep - File structure pointer
+ * arg - Data for command
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+static int cxd56_gnss_stop(FAR struct file *filep, unsigned long arg)
+{
+ int ret;
+
+ ret = cxd56_gnss_cpufifo_api(filep, CXD56_GNSS_GD_GNSS_STOP, 0);
+ board_lna_power_control(false);
+
+ return ret;
+}
+
+/****************************************************************************
+ * Name: cxd56_gnss_get_satellite_system
+ *
+ * Description:
+ * Process CXD56_GNSS_IOCTL_SELECT_SATELLITE_SYSTEM command.
+ * Select GNSSs to positioning
+ * These are able to specified by CXD56_GNSS_B_SAT_XXX defines.
+ *
+ * Input Parameters:
+ * filep - File structure pointer
+ * arg - Data for command
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+static int cxd56_gnss_select_satellite_system(FAR struct file *filep,
+ unsigned long arg)
+{
+ uint32_t system = (uint32_t)arg;
+
+ return GD_SelectSatelliteSystem(system);
+}
+
+/****************************************************************************
+ * Name: cxd56_gnss_get_satellite_system
+ *
+ * Description:
+ * Process CXD56_GNSS_IOCTL_GET_SATELLITE_SYSTEM command.
+ * Get current using GNSSs to positioning
+ * A argument 'satellite' indicates current GNSSs by bit fields defined by
+ * CXD56_GNSS_B_SAT_XXX.
+ *
+ * Input Parameters:
+ * filep - File structure pointer
+ * arg - Data for command
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+static int cxd56_gnss_get_satellite_system(FAR struct file *filep,
+ unsigned long arg)
+{
+ int ret;
+ uint32_t system;
+
+ if (!arg)
+ {
+ return -EINVAL;
+ }
+
+ ret = GD_GetSatelliteSystem(&system);
+ *(uint32_t *)arg = system;
+
+ return ret;
+}
+
+/****************************************************************************
+ * Name: cxd56_gnss_set_receiver_position_ellipsoidal
+ *
+ * Description:
+ * Process CXD56_GNSS_IOCTL_SET_RECEIVER_POSITION_ELLIPSOIDAL command.
+ * Set the rough receiver position
+ * arg = { double lat, double lon, double height }
+ *
+ * Input Parameters:
+ * filep - File structure pointer
+ * arg - Data for command
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+static int
+cxd56_gnss_set_receiver_position_ellipsoidal(FAR struct file *filep,
+ unsigned long arg)
+{
+ FAR struct cxd56_gnss_ellipsoidal_position_s *pos;
+
+ if (!arg)
+ {
+ return -EINVAL;
+ }
+
+ pos = (FAR struct cxd56_gnss_ellipsoidal_position_s *)arg;
+
+ return GD_SetReceiverPositionEllipsoidal(&pos->latitude, &pos->longitude,
+ &pos->altitude);
+}
+
+/****************************************************************************
+ * Name: cxd56_gnss_set_receiver_position_orthogonal
+ *
+ * Description:
+ * Process CXD56_GNSS_IOCTL_SET_RECEIVER_POSITION_ORTHOGONAL command.
+ * Set the rough receiver position as orgothonal
+ * arg = { int32_t x, int32_t y, int32_t z }
+ *
+ * Input Parameters:
+ * filep - File structure pointer
+ * arg - Data for command
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+static int cxd56_gnss_set_receiver_position_orthogonal(FAR struct file *filep,
+ unsigned long arg)
+{
+ FAR struct cxd56_gnss_orthogonal_position_s *pos;
+
+ if (!arg)
+ {
+ return -EINVAL;
+ }
+
+ pos = (FAR struct cxd56_gnss_orthogonal_position_s *)arg;
+ return GD_SetReceiverPositionOrthogonal(pos->x, pos->y, pos->z);
+}
+
+/****************************************************************************
+ * Name: cxd56_gnss_set_ope_mode
+ *
+ * Description:
+ * Process CXD56_GNSS_IOCTL_SET_OPE_MODE command.
+ * Set GNSS operation mode.
+ *
+ * Input Parameters:
+ * filep - File structure pointer
+ * arg - Data for command
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+static int cxd56_gnss_set_ope_mode(FAR struct file *filep, unsigned long arg)
+{
+ FAR struct cxd56_gnss_ope_mode_param_s *ope_mode;
+ if (!arg)
+ {
+ return -EINVAL;
+ }
+
+ ope_mode = (FAR struct cxd56_gnss_ope_mode_param_s *)arg;
+
+ return GD_SetOperationMode(ope_mode->mode, ope_mode->cycle);
+}
+
+/****************************************************************************
+ * Name: cxd56_gnss_get_ope_mode
+ *
+ * Description:
+ * Process CXD56_GNSS_IOCTL_GET_OPE_MODE command.
+ * Set the TCXO offset
+ *
+ * Input Parameters:
+ * filep - File structure pointer
+ * arg - Data for command
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+static int cxd56_gnss_get_ope_mode(FAR struct file *filep, unsigned long arg)
+{
+ FAR struct cxd56_gnss_ope_mode_param_s *ope_mode;
+ if (!arg)
+ {
+ return -EINVAL;
+ }
+
+ ope_mode = (FAR struct cxd56_gnss_ope_mode_param_s *)arg;
+
+ return GD_GetOperationMode(&ope_mode->mode, &ope_mode->cycle);
+}
+
+/****************************************************************************
+ * Name: cxd56_gnss_set_tcxo_offset
+ *
+ * Description:
+ * Process CXD56_GNSS_IOCTL_SET_TCXO_OFFSET command.
+ * Set the TCXO offset
+ *
+ * Input Parameters:
+ * filep - File structure pointer
+ * arg - Data for command
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+static int cxd56_gnss_set_tcxo_offset(FAR struct file *filep,
+ unsigned long arg)
+{
+ int32_t offset = (int32_t)arg;
+
+ return GD_SetTcxoOffset(offset);
+}
+
+/****************************************************************************
+ * Name: cxd56_gnss_get_tcxo_offset
+ *
+ * Description:
+ * Process CXD56_GNSS_IOCTL_GET_TCXO_OFFSET command.
+ * Get the TCXO offset
+ *
+ * Input Parameters:
+ * filep - File structure pointer
+ * arg - Data for command
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+static int cxd56_gnss_get_tcxo_offset(FAR struct file *filep,
+ unsigned long arg)
+{
+ int ret;
+ int32_t offset;
+
+ if (!arg)
+ {
+ return -EINVAL;
+ }
+
+ ret = GD_GetTcxoOffset(&offset);
+ *(uint32_t *)arg = offset;
+
+ return ret;
+}
+
+/****************************************************************************
+ * Name: cxd56_gnss_set_time
+ *
+ * Description:
+ * Process CXD56_GNSS_IOCTL_SET_TIME command.
+ * Set the estimated current time of the receiver.
+ * 1st argument date & time are in UTC.
+ *
+ * Input Parameters:
+ * filep - File structure pointer
+ * arg - Data for command
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+static int cxd56_gnss_set_time(FAR struct file *filep, unsigned long arg)
+{
+ FAR struct cxd56_gnss_datetime_s *date_time;
+
+ if (!arg)
+ {
+ return -EINVAL;
+ }
+
+ date_time = (FAR struct cxd56_gnss_datetime_s *)arg;
+
+ return GD_SetTime(&date_time->date, &date_time->time);
+}
+
+/****************************************************************************
+ * Name: cxd56_gnss_get_almanac
+ *
+ * Description:
+ * Process CXD56_GNSS_IOCTL_GET_ALMANAC command.
+ * Get the almanac data
+ *
+ * Input Parameters:
+ * filep - File structure pointer
+ * arg - Data for command
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+static int cxd56_gnss_get_almanac(FAR struct file *filep, unsigned long arg)
+{
+ FAR struct cxd56_gnss_orbital_param_s *param;
+ uint32_t almanac_size;
+
+ if (!arg)
+ {
+ return -EINVAL;
+ }
+
+ param = (FAR struct cxd56_gnss_orbital_param_s *)arg;
+
+ return GD_GetAlmanac(param->type, param->data, &almanac_size);
+}
+
+/****************************************************************************
+ * Name: cxd56_gnss_set_almanac
+ *
+ * Description:
+ * Process CXD56_GNSS_IOCTL_SET_ALMANAC command.
+ * Set the almanac data
+ *
+ * Input Parameters:
+ * filep - File structure pointer
+ * arg - Data for command
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+static int cxd56_gnss_set_almanac(FAR struct file *filep, unsigned long arg)
+{
+ FAR struct cxd56_gnss_orbital_param_s *param;
+
+ if (!arg)
+ {
+ return -EINVAL;
+ }
+
+ param = (FAR struct cxd56_gnss_orbital_param_s *)arg;
+
+ return GD_SetAlmanac(param->type, param->data);
+}
+
+/****************************************************************************
+ * Name: cxd56_gnss_get_ephemeris
+ *
+ * Description:
+ * Process CXD56_GNSS_IOCTL_GET_EPHEMERIS command.
+ * Get the Ephemeris data
+ *
+ * Input Parameters:
+ * filep - File structure pointer
+ * arg - Data for command
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+static int cxd56_gnss_get_ephemeris(FAR struct file *filep, unsigned long arg)
+{
+ FAR struct cxd56_gnss_orbital_param_s *param;
+ uint32_t ephemeris_size;
+
+ if (!arg)
+ {
+ return -EINVAL;
+ }
+
+ param = (FAR struct cxd56_gnss_orbital_param_s *)arg;
+
+ return GD_GetEphemeris(param->type, param->data, &ephemeris_size);
+}
+
+/****************************************************************************
+ * Name: cxd56_gnss_set_ephemeris
+ *
+ * Description:
+ * Process CXD56_GNSS_IOCTL_SET_EPHEMERIS command.
+ * Set the Ephemeris data
+ *
+ * Input Parameters:
+ * filep - File structure pointer
+ * arg - Data for command
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+static int cxd56_gnss_set_ephemeris(FAR struct file *filep, unsigned long arg)
+{
+ FAR struct cxd56_gnss_orbital_param_s *param;
+
+ if (!arg)
+ {
+ return -EINVAL;
+ }
+
+ param = (FAR struct cxd56_gnss_orbital_param_s *)arg;
+
+ return GD_SetEphemeris(param->type, param->data);
+}
+
+/****************************************************************************
+ * Name: cxd56_gnss_save_backup_data
+ *
+ * Description:
+ * Process CXD56_GNSS_IOCTL_SAVE_BACKUP_DATA command.
+ * Save the backup data to a Flash memory.
+ *
+ * Input Parameters:
+ * filep - File structure pointer
+ * arg - Data for command
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+static int cxd56_gnss_save_backup_data(FAR struct file *filep,
+ unsigned long arg)
+{
+ FAR char *buf;
+ FAR FILE *fp;
+ int n = 0;
+ int32_t offset = 0;
+
+ buf = (char *)malloc(CONFIG_CXD56_GNSS_BACKUP_BUFFER_SIZE);
+ if (buf == NULL)
+ {
+ return -ENOMEM;
+ }
+
+ fp = fopen(CONFIG_CXD56_GNSS_BACKUP_FILENAME, "wb");
+ if (fp == NULL)
+ {
+ free(buf);
+ return -ENOENT;
+ }
+
+ do
+ {
+ n = GD_ReadBuffer(CXD56_CPU1_DATA_TYPE_BACKUP, offset, buf,
+ CONFIG_CXD56_GNSS_BACKUP_BUFFER_SIZE);
+ if (n <= 0)
+ {
+ break;
+ }
+ n = fwrite(buf, 1, n, fp);
+ offset += n;
+ }
+ while (n == CONFIG_CXD56_GNSS_BACKUP_BUFFER_SIZE);
+
+ free(buf);
+ fclose(fp);
+
+ return n < 0 ? n : 0;
+}
+
+/****************************************************************************
+ * Name: cxd56_gnss_erase_backup_data
+ *
+ * Description:
+ * Process CXD56_GNSS_IOCTL_ERASE_BACKUP_DATA command.
+ * Erase the backup data on a Flash memory.
+ *
+ * Input Parameters:
+ * filep - File structure pointer
+ * arg - Data for command
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+static int cxd56_gnss_erase_backup_data(FAR struct file *filep,
+ unsigned long arg)
+{
+ return unlink(CONFIG_CXD56_GNSS_BACKUP_FILENAME);
+}
+
+/****************************************************************************
+ * Name: cxd56_gnss_open_cep_data
+ *
+ * Description:
+ * Process CXD56_GNSS_IOCTL_OPEN_CEP_DATA command.
+ * Open CEP data file
+ *
+ * Input Parameters:
+ * filep - File structure pointer
+ * arg - Data for command
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+static int cxd56_gnss_open_cep_data(FAR struct file *filep, unsigned long arg)
+{
+ return cxd56_cpu1sigsend(CXD56_CPU1_DATA_TYPE_CEPFILE, TRUE);
+}
+
+/****************************************************************************
+ * Name: cxd56_gnss_close_cep_data
+ *
+ * Description:
+ * Process CXD56_GNSS_IOCTL_CLOSE_CEP_DATA command.
+ * Close CEP data file
+ *
+ * Input Parameters:
+ * filep - File structure pointer
+ * arg - Data for command
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+static int cxd56_gnss_close_cep_data(FAR struct file *filep,
+ unsigned long arg)
+{
+ return cxd56_cpu1sigsend(CXD56_CPU1_DATA_TYPE_CEPFILE, FALSE);
+}
+
+/****************************************************************************
+ * Name: cxd56_gnss_check_cep_data
+ *
+ * Description:
+ * Process CXD56_GNSS_IOCTL_CHECK_CEP_DATA command.
+ * Check CEP data valid
+ *
+ * Input Parameters:
+ * filep - File structure pointer
+ * arg - Data for command
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+static int cxd56_gnss_check_cep_data(FAR struct file *filep,
+ unsigned long arg)
+{
+ return GD_CepCheckAssistData();
+}
+
+/****************************************************************************
+ * Name: cxd56_gnss_get_cep_age
+ *
+ * Description:
+ * Process CXD56_GNSS_IOCTL_GET_CEP_AGE command.
+ * Get CEP valid term
+ *
+ * Input Parameters:
+ * filep - File structure pointer
+ * arg - Data for command
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+static int cxd56_gnss_get_cep_age(FAR struct file *filep, unsigned long arg)
+{
+ FAR struct cxd56_gnss_cep_age_s *age;
+
+ if (!arg)
+ {
+ return -EINVAL;
+ }
+
+ age = (FAR struct cxd56_gnss_cep_age_s *)arg;
+
+ return GD_CepGetAgeData(&age->age, &age->cepi);
+}
+
+/****************************************************************************
+ * Name: cxd56_gnss_reset_cep_flag
+ *
+ * Description:
+ * Process CXD56_GNSS_IOCTL_RESET_CEP_FLAG command.
+ * Reset CEP data init flag & valid flag
+ *
+ * Input Parameters:
+ * filep - File structure pointer
+ * arg - Data for command
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+static int cxd56_gnss_reset_cep_flag(FAR struct file *filep,
+ unsigned long arg)
+{
+ return cxd56_gnss_cpufifo_api(filep,
+ CXD56_GNSS_GD_GNSS_CEPINITASSISTDATA, 0);
+}
+
+/****************************************************************************
+ * Name: cxd56_gnss_set_acquist_data
+ *
+ * Description:
+ * Process CXD56_GNSS_IOCTL_AGPS_SET_ACQUIST command.
+ * AGPS set acquist data
+ *
+ * Input Parameters:
+ * filep - File structure pointer
+ * arg - Data for command
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+static int cxd56_gnss_set_acquist_data(FAR struct file *filep,
+ unsigned long arg)
+{
+ FAR struct cxd56_gnss_agps_acquist_s *acquist;
+
+ if (!arg)
+ {
+ return -EINVAL;
+ }
+
+ acquist = (FAR struct cxd56_gnss_agps_acquist_s *)arg;
+
+ return GD_SetAcquist(acquist->data, acquist->size);
+}
+
+/****************************************************************************
+ * Name: cxd56_gnss_set_frametime
+ *
+ * Description:
+ * Process CXD56_GNSS_IOCTL_AGPS_SET_FRAMETIME command.
+ * AGPS set frame time
+ *
+ * Input Parameters:
+ * filep - File structure pointer
+ * arg - Data for command
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+static int cxd56_gnss_set_frametime(FAR struct file *filep, unsigned long arg)
+{
+ FAR struct cxd56_gnss_agps_frametime_s *frametime;
+
+ if (!arg)
+ {
+ return -EINVAL;
+ }
+
+ frametime = (FAR struct cxd56_gnss_agps_frametime_s *)arg;
+
+ return GD_SetFrameTime(frametime->sec, frametime->frac);
+}
+
+/****************************************************************************
+ * Name: cxd56_gnss_set_tau_gps
+ *
+ * Description:
+ * Process CXD56_GNSS_IOCTL_AGPS_SET_TAU_GPS command.
+ * AGPS set TAU GPS
+ *
+ * Input Parameters:
+ * filep - File structure pointer
+ * arg - Data for command
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+static int cxd56_gnss_set_tau_gps(FAR struct file *filep, unsigned long arg)
+{
+ FAR struct cxd56_gnss_agps_tau_gps_s *taugpstime;
+
+ if (!arg)
+ {
+ return -EINVAL;
+ }
+
+ taugpstime = (FAR struct cxd56_gnss_agps_tau_gps_s *)arg;
+
+ return GD_SetTauGps(&taugpstime->taugps);
+}
+
+/****************************************************************************
+ * Name: cxd56_gnss_set_time_gps
+ *
+ * Description:
+ * Process CXD56_GNSS_IOCTL_AGPS_SET_TIME_GPS command.
+ * Set high precision receiver time
+ *
+ * Input Parameters:
+ * filep - File structure pointer
+ * arg - Data for command
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+static int cxd56_gnss_set_time_gps(FAR struct file *filep, unsigned long arg)
+{
+ FAR struct cxd56_gnss_agps_time_gps_s *time_gps;
+
+ if (!arg)
+ {
+ return -EINVAL;
+ }
+
+ time_gps = (FAR struct cxd56_gnss_agps_time_gps_s *)arg;
+
+ return GD_SetTimeGps(&time_gps->date, &time_gps->time);
+}
+
+/****************************************************************************
+ * Name: cxd56_gnss_clear_receiver_info
+ *
+ * Description:
+ * Process CXD56_GNSS_IOCTL_AGPS_CLEAR_RECEIVER_INFO command.
+ * Clear info(s) for hot start such as ephemeris.
+ *
+ * Input Parameters:
+ * filep - File structure pointer
+ * arg - Data for command
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+static int cxd56_gnss_clear_receiver_info(FAR struct file *filep,
+ unsigned long arg)
+{
+ uint32_t clear_type = arg;
+
+ return GD_ClearReceiverInfo(clear_type);
+}
+
+/****************************************************************************
+ * Name: cxd56_gnss_set_tow_assist
+ *
+ * Description:
+ * Process CXD56_GNSS_IOCTL_AGPS_SET_TOW_ASSIST command.
+ * AGPS set acquist data
+ *
+ * Input Parameters:
+ * filep - File structure pointer
+ * arg - Data for command
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+static int cxd56_gnss_set_tow_assist(FAR struct file *filep,
+ unsigned long arg)
+{
+ FAR struct cxd56_gnss_agps_tow_assist_s *assist;
+
+ if (!arg)
+ {
+ return -EINVAL;
+ }
+
+ assist = (FAR struct cxd56_gnss_agps_tow_assist_s *)arg;
+
+ return GD_SetTowAssist(assist->data, assist->size);
+}
+
+/****************************************************************************
+ * Name: cxd56_gnss_set_utc_model
+ *
+ * Description:
+ * Process CXD56_GNSS_IOCTL_AGPS_SET_UTC_MODEL command.
+ * AGPS set UTC model
+ *
+ * Input Parameters:
+ * filep - File structure pointer
+ * arg - Data for command
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+static int cxd56_gnss_set_utc_model(FAR struct file *filep, unsigned long arg)
+{
+ FAR struct cxd56_gnss_agps_utc_model_s *model;
+
+ if (!arg)
+ {
+ return -EINVAL;
+ }
+
+ model = (FAR struct cxd56_gnss_agps_utc_model_s *)arg;
+
+ return GD_SetUtcModel(model->data, model->size);
+}
+
+/****************************************************************************
+ * Name: cxd56_gnss_control_spectrum
+ *
+ * Description:
+ * Process CXD56_GNSS_IOCTL_SPECTRUM_CONTROL command.
+ * Enable or not to output spectrum data of GNSS signal
+ *
+ * Input Parameters:
+ * filep - File structure pointer
+ * arg - Data for command
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+static int cxd56_gnss_control_spectrum(FAR struct file *filep,
+ unsigned long arg)
+{
+ FAR struct cxd56_gnss_spectrum_control_s *control;
+
+ if (!arg)
+ {
+ return -EINVAL;
+ }
+
+ control = (FAR struct cxd56_gnss_spectrum_control_s *)arg;
+
+ return GD_SpectrumControl(control->time, control->enable, control->point1,
+ control->step1, control->point2, control->step2);
+}
+
+/****************************************************************************
+ * Name: cxd56_gnss_start_test
+ *
+ * Description:
+ * Process CXD56_GNSS_IOCTL_FACTORY_START_TEST command.
+ * Start GPS factory test
+ *
+ * Input Parameters:
+ * filep - File structure pointer
+ * arg - Data for command
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+static int cxd56_gnss_start_test(FAR struct file *filep, unsigned long arg)
+{
+ int ret;
+ int retry = 50;
+ FAR struct cxd56_gnss_test_info_s *info;
+
+ /* check argument */
+
+ if (!arg)
+ {
+ ret = -EINVAL;
+ }
+ else
+ {
+ /* Power on the LNA device */
+
+ ret = board_lna_power_control(true);
+ if (ret < 0)
+ {
+ return ret;
+ }
+
+ while (!g_rtc_enabled && 0 < retry--)
+ {
+ /* GNSS requires stable RTC */
+
+ usleep(100 * 1000);
+ }
+
+ /* set parameter */
+
+ info = (FAR struct cxd56_gnss_test_info_s *)arg;
+ GD_StartGpsTest(info->satellite, info->reserve1,
+ info->reserve2, info->reserve3);
+
+ /* start test */
+
+ ret = GD_Start(CXD56_GNSS_STMOD_COLD);
+ }
+
+ return ret;
+}
+
+/****************************************************************************
+ * Name: cxd56_gnss_stop_test
+ *
+ * Description:
+ * Process CXD56_GNSS_IOCTL_FACTORY_STOP_TEST command.
+ * Stop GPS factory test
+ *
+ * Input Parameters:
+ * filep - File structure pointer
+ * arg - Data for command
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+static int cxd56_gnss_stop_test(FAR struct file *filep, unsigned long arg)
+{
+ int ret;
+
+ /* term test */
+
+ ret = GD_StopGpsTest();
+ if(ret == OK)
+ {
+ /* stop test */
+
+ ret = GD_Stop();
+ }
+
+ /* Power off the LNA device */
+
+ board_lna_power_control(false);
+
+ return ret;
+}
+
+/****************************************************************************
+ * Name: cxd56_gnss_get_test_result
+ *
+ * Description:
+ * Process CXD56_GNSS_IOCTL_FACTORY_GET_TEST_RESULT command.
+ * Get GPS factory test result
+ *
+ * Input Parameters:
+ * filep - File structure pointer
+ * arg - Data for command
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+static int cxd56_gnss_get_test_result(FAR struct file *filep,
+ unsigned long arg)
+{
+ FAR struct cxd56_gnss_test_result_s *result;
+
+ if (!arg)
+ {
+ return -EINVAL;
+ }
+
+ result = (FAR struct cxd56_gnss_test_result_s *)arg;
+
+ return GD_GetGpsTestResult(&result->cn, &result->doppler);
+}
+
+/****************************************************************************
+ * Name: cxd56_gnss_set_signal
+ *
+ * Description:
+ * Process CXD56_GNSS_IOCTL_SIGNAL_SET command.
+ * Set signal information for synchronous reading data
+ *
+ * Input Parameters:
+ * filep - File structure pointer
+ * arg - Data for command
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+static int cxd56_gnss_set_signal(FAR struct file *filep, unsigned long arg)
+{
+ int ret = 0;
+
+#if !defined(CONFIG_DISABLE_SIGNAL) && \
+ (CONFIG_CXD56_GNSS_NSIGNALRECEIVERS != 0)
+ FAR struct inode *inode;
+ FAR struct cxd56_gnss_dev_s *priv;
+ FAR struct cxd56_gnss_signal_setting_s *setting;
+ FAR struct cxd56_gnss_sig_s *sig;
+ FAR struct cxd56_gnss_sig_s *checksig;
+ int pid;
+ int i;
+
+ if (!arg)
+ {
+ return -EINVAL;
+ }
+
+ setting = (FAR struct cxd56_gnss_signal_setting_s *)arg;
+ if (setting->gnsssig >= CXD56_CPU1_DATA_TYPE_MAX)
+ {
+ return -EPROTOTYPE;
+ }
+
+ inode = filep->f_inode;
+ priv = (FAR struct cxd56_gnss_dev_s *)inode->i_private;
+
+ ret = sem_wait(&priv->devsem);
+ if (ret < 0)
+ {
+ return ret;
+ }
+
+ sig = NULL;
+ pid = getpid();
+ for (i = 0; i < CONFIG_CXD56_GNSS_NSIGNALRECEIVERS; i++)
+ {
+ checksig = &priv->sigs[i];
+ if (setting->enable)
+ {
+ if (sig == NULL && !checksig->enable)
+ {
+ sig = checksig;
+ }
+ else if (checksig->info.gnsssig == setting->gnsssig &&
+ checksig->pid == pid)
+ {
+ sig = checksig;
+ break;
+ }
+ }
+ else if (checksig->info.gnsssig == setting->gnsssig &&
+ checksig->pid == pid)
+ {
+ checksig->enable = 0;
+ goto _success;
+ }
+ }
+ if (sig == NULL)
+ {
+ ret = -ENOENT;
+ goto _err;
+ }
+
+ GD_SetNotifyMask(setting->gnsssig, FALSE);
+
+ sig->enable = 1;
+ sig->pid = pid;
+ sig->info.fd = setting->fd;
+ sig->info.gnsssig = setting->gnsssig;
+ sig->info.signo = setting->signo;
+ sig->info.data = setting->data;
+
+_success:
+_err:
+ sem_post(&priv->devsem);
+#endif /* if !defined(CONFIG_DISABLE_SIGNAL) && \
+ (CONFIG_CXD56_GNSS_NSIGNALRECEIVERS != 0) */
+ return ret;
+}
+
+/****************************************************************************
+ * Name: cxd56_gnss_start_pvtlog
+ *
+ * Description:
+ * Process CXD56_GNSS_IOCTL_PVTLOG_START command.
+ * Start saving PVT logs.
+ *
+ * Input Parameters:
+ * filep - File structure pointer
+ * arg - Data for command
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+static int cxd56_gnss_start_pvtlog(FAR struct file *filep, unsigned long arg)
+{
+ FAR struct cxd56_pvtlog_setting_s *setting;
+
+ if (!arg)
+ {
+ return -EINVAL;
+ }
+
+ setting = (FAR struct cxd56_pvtlog_setting_s *)arg;
+
+ return GD_RegisterPvtlog(setting->cycle, setting->threshold);
+}
+
+/****************************************************************************
+ * Name: cxd56_gnss_stop_pvtlog
+ *
+ * Description:
+ * Process CXD56_GNSS_IOCTL_PVTLOG_STOP command.
+ * Stop saving PVT logs.
+ *
+ * Input Parameters:
+ * filep - File structure pointer
+ * arg - Data for command
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+static int cxd56_gnss_stop_pvtlog(FAR struct file *filep, unsigned long arg)
+{
+ return GD_ReleasePvtlog();
+}
+
+/****************************************************************************
+ * Name: cxd56_gnss_delete_pvtlog
+ *
+ * Description:
+ * Process CXD56_GNSS_IOCTL_PVTLOG_STOP command.
+ * Delete stored PVT logs.
+ *
+ * Input Parameters:
+ * filep - File structure pointer
+ * arg - Data for command
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+static int cxd56_gnss_delete_pvtlog(FAR struct file *filep, unsigned long arg)
+{
+ return GD_PvtlogDeleteLog();
+}
+
+/****************************************************************************
+ * Name: cxd56_gnss_get_pvtlog_status
+ *
+ * Description:
+ * Process CXD56_GNSS_IOCTL_PVTLOG_GET_STATUS command.
+ * Get stored log status of PVTLOG.
+ *
+ * Input Parameters:
+ * filep - File structure pointer
+ * arg - Data for command
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+static int cxd56_gnss_get_pvtlog_status(FAR struct file *filep,
+ unsigned long arg)
+{
+ FAR struct cxd56_pvtlog_status_s *status;
+
+ if (!arg)
+ {
+ return -EINVAL;
+ }
+
+ status = (FAR struct cxd56_pvtlog_status_s *)arg;
+
+ return GD_PvtlogGetLogStatus(&status->status);
+}
+
+/****************************************************************************
+ * Name: cxd56_gnss_start_rtk_output
+ *
+ * Description:
+ * Process CXD56_GNSS_IOCTL_RTK_START command.
+ * Start RTK data output
+ *
+ * Input Parameters:
+ * filep - File structure pointer
+ * arg - Data for command
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+static int cxd56_gnss_start_rtk_output(FAR struct file *filep,
+ unsigned long arg)
+{
+ FAR struct cxd56_rtk_setting_s *setting;
+
+ if (!arg)
+ {
+ return -EINVAL;
+ }
+
+ setting = (FAR struct cxd56_rtk_setting_s *)arg;
+ setting->sbasout = 0;
+
+ return GD_RtkStart(setting);
+}
+
+/****************************************************************************
+ * Name: cxd56_gnss_stop_rtk_output
+ *
+ * Description:
+ * Process CXD56_GNSS_IOCTL_RTK_STOP command.
+ * Stop RTK data output
+ *
+ * Input Parameters:
+ * filep - File structure pointer
+ * arg - Data for command
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+static int cxd56_gnss_stop_rtk_output(FAR struct file *filep,
+ unsigned long arg)
+{
+ return GD_RtkStop();
+}
+
+/****************************************************************************
+ * Name: cxd56_gnss_set_rtk_interval
+ *
+ * Description:
+ * Process CXD56_GNSS_IOCTL_RTK_SET_INTERVAL command.
+ * Set RTK data output interval
+ *
+ * Input Parameters:
+ * filep - File structure pointer
+ * arg - Data for command
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+static int cxd56_gnss_set_rtk_interval(FAR struct file *filep,
+ unsigned long arg)
+{
+ int interval = (int)arg;
+
+ return GD_RtkSetOutputInterval(interval);
+}
+
+/****************************************************************************
+ * Name: cxd56_gnss_get_rtk_interval
+ *
+ * Description:
+ * Process CXD56_GNSS_IOCTL_RTK_GET_INTERVAL command.
+ * Get RTK data output interval setting
+ *
+ * Input Parameters:
+ * filep - File structure pointer
+ * arg - Data for command
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+static int cxd56_gnss_get_rtk_interval(FAR struct file *filep,
+ unsigned long arg)
+{
+ int ret;
+ int interval;
+
+ if (!arg)
+ {
+ return -EINVAL;
+ }
+
+ ret = GD_RtkGetOutputInterval(&interval);
+ *(uint32_t *)arg = interval;
+
+ return ret;
+}
+
+/****************************************************************************
+ * Name: cxd56_gnss_select_rtk_satellite
+ *
+ * Description:
+ * Process CXD56_GNSS_IOCTL_RTK_SELECT_SATELLITE_SYSTEM command.
+ * Select RTK satellite type
+ *
+ * Input Parameters:
+ * filep - File structure pointer
+ * arg - Data for command
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+static int cxd56_gnss_select_rtk_satellite(FAR struct file *filep,
+ unsigned long arg)
+{
+ uint32_t gnss = (uint32_t)arg;
+
+ return GD_RtkSetGnss(gnss);
+}
+
+/****************************************************************************
+ * Name: cxd56_gnss_get_rtk_ephemeris_enable
+ *
+ * Description:
+ * Process CXD56_GNSS_IOCTL_RTK_GET_SATELLITE_SYSTEM command.
+ * Get RTK satellite type setting
+ *
+ * Input Parameters:
+ * filep - File structure pointer
+ * arg - Data for command
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+static int cxd56_gnss_get_rtk_satellite(FAR struct file *filep,
+ unsigned long arg)
+{
+ int ret;
+ uint32_t gnss;
+
+ if (!arg)
+ {
+ return -EINVAL;
+ }
+
+ ret = GD_RtkGetGnss(&gnss);
+ *(uint32_t *)arg = gnss;
+
+ return ret;
+}
+
+/****************************************************************************
+ * Name: cxd56_gnss_get_rtk_ephemeris_enable
+ *
+ * Description:
+ * Process CXD56_GNSS_IOCTL_RTK_SET_EPHEMERIS_ENABLER command.
+ * Set RTK ephemeris notify enable setting
+ *
+ * Input Parameters:
+ * filep - File structure pointer
+ * arg - Data for command
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+static int cxd56_gnss_set_rtk_ephemeris_enable(FAR struct file *filep,
+ unsigned long arg)
+{
+ int enable = (int)arg;
+
+ return GD_RtkSetEphNotify(enable);
+}
+
+/****************************************************************************
+ * Name: cxd56_gnss_get_rtk_ephemeris_enable
+ *
+ * Description:
+ * Process CXD56_GNSS_IOCTL_RTK_GET_EPHEMERIS_ENABLER command.
+ * Get RTK ephemeris notify enable setting.
+ *
+ * Input Parameters:
+ * filep - File structure pointer
+ * arg - Data for command
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+static int cxd56_gnss_get_rtk_ephemeris_enable(FAR struct file *filep,
+ unsigned long arg)
+{
+ int ret;
+ int enable;
+
+ if (!arg)
+ {
+ return -EINVAL;
+ }
+
+ ret = GD_RtkGetEphNotify(&enable);
+ *(uint32_t *)arg = enable;
+
+ return ret;
+}
+
+/****************************************************************************
+ * Name: cxd56_gnss_start_navmsg_output
+ *
+ * Description:
+ * Process CXD56_GNSS_IOCTL_NAVMSG_START command.
+ * Start NAVMSG data output
+ *
+ * Input Parameters:
+ * filep - File structure pointer
+ * arg - Data for command
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+static int cxd56_gnss_start_navmsg_output(FAR struct file *filep,
+ unsigned long arg)
+{
+ FAR struct cxd56_rtk_setting_s *setting;
+
+ if (!arg)
+ {
+ return -EINVAL;
+ }
+
+ setting = (FAR struct cxd56_rtk_setting_s *)arg;
+
+ return GD_RtkStart(setting);
+}
+
+/****************************************************************************
+ * Name: cxd56_gnss_set_var_ephemeris
+ *
+ * Description:
+ * Process CXD56_GNSS_IOCTL_SET_VAR_EPHEMERIS command.
+ * Set the Ephemeris data
+ *
+ * Input Parameters:
+ * filep - File structure pointer
+ * arg - Data for command
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+static int cxd56_gnss_set_var_ephemeris(FAR struct file *filep,
+ unsigned long arg)
+{
+ FAR struct cxd56_gnss_set_var_ephemeris_s *param;
+
+ if (!arg)
+ {
+ return -EINVAL;
+ }
+ param = (FAR struct cxd56_gnss_set_var_ephemeris_s *)arg;
+
+ return GD_SetVarEphemeris(param->data, param->size);
+}
+
+/****************************************************************************
+ * Name: cxd56_gnss_get_var_ephemeris
+ *
+ * Description:
+ * Process CXD56_GNSS_IOCTL_GET_VAR_EPHEMERIS command.
+ * Get the Ephemeris data
+ *
+ * Input Parameters:
+ * filep - File structure pointer
+ * arg - Data for command
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+static int cxd56_gnss_get_var_ephemeris(FAR struct file *filep,
+ unsigned long arg)
+{
+ FAR struct cxd56_gnss_get_var_ephemeris_s *param;
+
+ if (!arg)
+ {
+ return -EINVAL;
+ }
+
+ param = (FAR struct cxd56_gnss_get_var_ephemeris_s *)arg;
+
+ return GD_GetVarEphemeris(param->type, param->data, param->size);
+}
+
+/* Synchronized with processes and CPUs
+ * CXD56_GNSS signal handler and utils
+ */
+
+/****************************************************************************
+ * Name: cxd56_gnss_wait_notify
+ *
+ * Description:
+ * Wait notify from GNSS CPU with timeout.
+ *
+ * Input Parameters:
+ * sem - Semaphore for waiting
+ * waitset - Wait time in seconds
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+static int cxd56_gnss_wait_notify(FAR sem_t *sem, time_t waitsec)
+{
+ int ret;
+ struct timespec timeout;
+
+ ret = clock_gettime(CLOCK_REALTIME, &timeout);
+ if (ret < 0)
+ {
+ return ret;
+ }
+
+ timeout.tv_sec += waitsec; /* seconds timeout for wait */
+
+ return sem_timedwait(sem, &timeout);
+}
+
+/****************************************************************************
+ * Name: cxd56_gnss_read_cep_file
+ *
+ * Description:
+ * Read a CEP data packet from file and notify to GNSS CPU.
+ *
+ * Input Parameters:
+ * fp - File pointer
+ * offset - File offset of last read
+ * len - packet size to read
+ * retval - Status to read file
+ *
+ * Returned Value:
+ * Buffer address allocated in this function for reading data.
+ *
+ ****************************************************************************/
+
+static FAR char *cxd56_gnss_read_cep_file(FAR FILE *fp, int32_t offset,
+ size_t len, FAR int *retval)
+{
+ FAR char *buf;
+ size_t n = 0;
+ int ret;
+
+ if (fp == NULL)
+ {
+ ret = -ENOENT;
+ goto _err0;
+ }
+
+ buf = (char *)malloc(len);
+ if (buf == NULL)
+ {
+ ret = -ENOMEM;
+ goto _err0;
+ }
+
+ ret = fseek(fp, offset, SEEK_SET);
+ if (ret < 0)
+ {
+ goto _err1;
+ }
+
+ n = fread(buf, 1, len, fp);
+ if (n <= 0)
+ {
+ ret = n < 0 ? n : ferror(fp) ? -errno : 0;
+ clearerr(fp);
+ goto _err1;
+ }
+
+ *retval = n;
+ cxd56_cpu1sigsend(CXD56_CPU1_DATA_TYPE_CEP, (uint32_t)buf);
+
+ return buf;
+
+ /* send signal to CPU1 in error for just notify completion of read sequence */
+
+_err1:
+ free(buf);
+_err0:
+ *retval = ret;
+ cxd56_cpu1sigsend(CXD56_CPU1_DATA_TYPE_CEP, 0);
+
+ return NULL;
+}
+
+/****************************************************************************
+ * Name: cxd56_gnss_read_backup_file
+ *
+ * Description:
+ * Read a backup data packet from file and notify to GNSS CPU.
+ *
+ * Input Parameters:
+ * retval - Status to read file
+ *
+ * Returned Value:
+ * None
+ *
+ ****************************************************************************/
+
+static void cxd56_gnss_read_backup_file(FAR int *retval)
+{
+ FAR char * buf;
+ FAR FILE * fp;
+ int32_t offset = 0;
+ size_t n;
+ int ret = 0;
+
+ buf = (char *)malloc(CONFIG_CXD56_GNSS_BACKUP_BUFFER_SIZE);
+ if (buf == NULL)
+ {
+ ret = -ENOMEM;
+ goto _err;
+ }
+
+ fp = fopen(CONFIG_CXD56_GNSS_BACKUP_FILENAME, "rb");
+ if (fp == NULL)
+ {
+ free(buf);
+ ret = -ENOENT;
+ goto _err;
+ }
+
+ do
+ {
+ n = fread(buf, 1, CONFIG_CXD56_GNSS_BACKUP_BUFFER_SIZE, fp);
+ if (n <= 0)
+ {
+ ret = n < 0 ? n : ferror(fp) ? -ENFILE : 0;
+ break;
+ }
+ ret = GD_WriteBuffer(CXD56_CPU1_DATA_TYPE_BACKUP, offset, buf, n);
+ if (ret < 0)
+ {
+ break;
+ }
+ offset += n;
+ }
+ while (n > 0);
+
+ fclose(fp);
+ free(buf);
+
+ /* Notify the termination of backup sequence by write zero length data */
+
+_err:
+ *retval = ret;
+ cxd56_cpu1sigsend(CXD56_CPU1_DATA_TYPE_BKUPFILE, 0);
+}
+
+#if !defined(CONFIG_DISABLE_SIGNAL) && \
+ (CONFIG_CXD56_GNSS_NSIGNALRECEIVERS != 0)
+
+/****************************************************************************
+ * Name: cxd56_gnss_common_signalhandler
+ *
+ * Description:
+ * Common signal handler from GNSS CPU.
+ *
+ * Input Parameters:
+ * data - Received data from GNSS CPU
+ * userdata - User data, this is the device information specified by the
+ * second argument of the function cxd56_cpu1siginit.
+ *
+ * Returned Value:
+ * None
+ *
+ ****************************************************************************/
+
+static void cxd56_gnss_common_signalhandler(uint32_t data, FAR void *userdata)
+{
+ FAR struct cxd56_gnss_dev_s *priv = (FAR struct cxd56_gnss_dev_s *)userdata;
+ uint8_t sigtype = CXD56_CPU1_GET_DEV(data);
+ int issetmask = 0;
+ int i;
+ int ret;
+
+ ret = sem_wait(&priv->devsem);
+ if (ret < 0)
+ {
+ return;
+ }
+
+ for (i = 0; i < CONFIG_CXD56_GNSS_NSIGNALRECEIVERS; i++)
+ {
+ struct cxd56_gnss_sig_s *sig = &priv->sigs[i];
+ if (sig->enable && sig->info.gnsssig == sigtype)
+ {
+#ifdef CONFIG_CAN_PASS_STRUCTS
+ union sigval value;
+ value.sival_ptr = &sig->info;
+ (void)sigqueue(sig->pid, sig->info.signo, value);
+#else
+ (void)sigqueue(sig->pid, sig->info.signo, &sig->info);
+#endif
+ issetmask = 1;
+ }
+ }
+
+ if (issetmask)
+ {
+ GD_SetNotifyMask(sigtype, FALSE);
+ }
+
+ sem_post(&priv->devsem);
+}
+
+#endif /* if !defined(CONFIG_DISABLE_SIGNAL) && \
+ (CONFIG_CXD56_GNSS_NSIGNALRECEIVERS != 0) */
+
+/****************************************************************************
+ * Name: cxd56_gnss_default_sighandler
+ *
+ * Description:
+ * Handler for GNSS type notification from GNSS CPU for signal and poll.
+ *
+ * Input Parameters:
+ * data - Received data from GNSS CPU
+ * userdata - User data, this is the device information specified by the
+ * second argument of the function cxd56_cpu1siginit.
+ *
+ * Returned Value:
+ * None
+ *
+ ****************************************************************************/
+
+static void cxd56_gnss_default_sighandler(uint32_t data, FAR void *userdata)
+{
+ FAR struct cxd56_gnss_dev_s *priv = (FAR struct cxd56_gnss_dev_s *)userdata;
+ int i;
+ int ret;
+ int dtype = CXD56_CPU1_GET_DATA(data);
+
+ switch (dtype)
+ {
+ case CXD56_GNSS_NOTIFY_TYPE_REQCEPDAT:
+ {
+ priv->cepbuf = cxd56_gnss_read_cep_file(
+ priv->cepfp, priv->shared_info.argv[GNSS_ARGS_FILE_OFFSET],
+ priv->shared_info.argv[GNSS_ARGS_FILE_LENGTH],
+ &priv->shared_info.retval);
+ return;
+ }
+
+ case CXD56_GNSS_NOTIFY_TYPE_REQCEPBUFFREE:
+ if (priv->cepbuf)
+ {
+ free(priv->cepbuf);
+ }
+ return;
+
+ case CXD56_GNSS_NOTIFY_TYPE_BOOTCOMP:
+ if (priv->num_open == 0)
+ {
+ /* Post to wait-semaphore in cxd56_gnss_open to notify completion
+ * of GNSS core initialization in first device open.
+ */
+
+ priv->notify_data = dtype;
+ sem_post(&priv->syncsem);
+ }
+ return;
+
+ case CXD56_GNSS_NOTIFY_TYPE_REQBKUPDAT:
+ cxd56_gnss_read_backup_file(&priv->shared_info.retval);
+ return;
+
+ case CXD56_GNSS_NOTIFY_TYPE_REQCEPOPEN:
+ if (priv->cepfp != NULL)
+ {
+ fclose(priv->cepfp);
+ }
+ priv->cepfp = fopen(CONFIG_CXD56_GNSS_CEP_FILENAME, "rb");
+ return;
+
+ case CXD56_GNSS_NOTIFY_TYPE_REQCEPCLOSE:
+ if (priv->cepfp != NULL)
+ {
+ fclose(priv->cepfp);
+ priv->cepfp = NULL;
+ }
+ return;
+
+ default:
+ break;
+ }
+
+ ret = sem_wait(&priv->devsem);
+ if (ret < 0)
+ {
+ return;
+ }
+
+ for (i = 0; i < CONFIG_CXD56_GNSS_NPOLLWAITERS; i++)
+ {
+ struct pollfd *fds = priv->fds[i];
+ if (fds)
+ {
+ fds->revents |= POLLIN;
+ gnssinfo("Report events: %02x\n", fds->revents);
+ sem_post(fds->sem);
+ }
+ }
+
+ sem_post(&priv->devsem);
+
+#if !defined(CONFIG_DISABLE_SIGNAL) && \
+ (CONFIG_CXD56_GNSS_NSIGNALRECEIVERS != 0)
+ cxd56_gnss_common_signalhandler(data, userdata);
+#endif
+}
+
+/****************************************************************************
+ * Name: cxd56_gnss_cpufifoapi_signalhandler
+ *
+ * Description:
+ * Handler for API type notification from GNSS CPU.
+ *
+ * Input Parameters:
+ * data - Received data from GNSS CPU
+ * userdata - User data, this is the device information specified by the
+ * second argument of the function cxd56_cpu1siginit.
+ *
+ * Returned Value:
+ * None
+ *
+ ****************************************************************************/
+
+static void cxd56_gnss_cpufifoapi_signalhandler(uint32_t data,
+ FAR void *userdata)
+{
+ FAR struct cxd56_gnss_dev_s *priv = (FAR struct cxd56_gnss_dev_s *)userdata;
+
+ priv->apiret = CXD56_CPU1_GET_DATA((int)data);
+ sem_post(&priv->apiwait);
+
+ return;
+}
+
+/****************************************************************************
+ * Name: cxd56_gnss_cpufifo_api
+ *
+ * Description:
+ * Send API type event to GNSS CPU.
+ *
+ * Input Parameters:
+ * filep - File structure pointer
+ * api - Signal type
+ * data - Any data
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+static int cxd56_gnss_cpufifo_api(FAR struct file *filep, unsigned int api,
+ unsigned int data)
+{
+ FAR struct inode *inode;
+ FAR struct cxd56_gnss_dev_s *priv;
+ unsigned int type;
+ int ret = OK;
+
+ inode = filep->f_inode;
+ priv = (FAR struct cxd56_gnss_dev_s *)inode->i_private;
+
+ type = CXD56_GNSS_CPUFIFOAPI_SET_DATA(api, data);
+ cxd56_cpu1sigsend(CXD56_CPU1_DATA_TYPE_CPUFIFOAPI, type);
+
+ ret = sem_wait(&priv->apiwait);
+ if (ret < 0)
+ {
+ /* If sem_wait returns -EINTR, there is a possibility that the signal
+ * for GNSS set with CXD56_GNSS_IOCTL_SIGNAL_SET is unmasked
+ * by SIG_UNMASK in the signal mask.
+ */
+
+ ret = -errno;
+ _warn("Cannot wait GNSS semaphore %d\n", ret);
+ goto _err;
+ }
+
+ ret = priv->apiret;
+
+_err:
+ return ret;
+}
+
+/****************************************************************************
+ * Name: cxd56_gnss_select_notifytype
+ *
+ * Description:
+ * Decide notify type about data from GNSS device
+ *
+ * Input Parameters:
+ * fpos - file offset indicated about data type
+ * offset - Actual offset value
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+static int8_t cxd56_gnss_select_notifytype(off_t fpos, FAR uint32_t *offset)
+{
+ int8_t type;
+
+ if ((fpos >= CXD56_GNSS_READ_OFFSET_LAST_GNSS) &&
+ (fpos < CXD56_GNSS_READ_OFFSET_AGPS))
+ {
+ type = CXD56_CPU1_DATA_TYPE_GNSS;
+ *offset = fpos;
+ }
+ else if (fpos == CXD56_GNSS_READ_OFFSET_AGPS)
+ {
+ type = CXD56_CPU1_DATA_TYPE_AGPS;
+ *offset = 0;
+ }
+ else if (fpos == CXD56_GNSS_READ_OFFSET_RTK)
+ {
+ type = CXD56_CPU1_DATA_TYPE_RTK;
+ *offset = 0;
+ }
+ else if (fpos == CXD56_GNSS_READ_OFFSET_GPSEPHEMERIS)
+ {
+ type = CXD56_CPU1_DATA_TYPE_GPSEPHEMERIS;
+ *offset = 0;
+ }
+ else if (fpos == CXD56_GNSS_READ_OFFSET_GLNEPHEMERIS)
+ {
+ type = CXD56_CPU1_DATA_TYPE_GLNEPHEMERIS;
+ *offset = 0;
+ }
+ else if ((fpos == CXD56_GNSS_READ_OFFSET_SPECTRUM) ||
+ (fpos == CXD56_GNSS_READ_OFFSET_INFO))
+ {
+ type = CXD56_CPU1_DATA_TYPE_SPECTRUM;
+ *offset = 0;
+ }
+ else if (fpos == CXD56_GNSS_READ_OFFSET_PVTLOG)
+ {
+ type = CXD56_CPU1_DATA_TYPE_PVTLOG;
+ *offset = 0;
+ }
+ else if (fpos == CXD56_GNSS_READ_OFFSET_SBAS)
+ {
+ type = CXD56_CPU1_DATA_TYPE_SBAS;
+ *offset = 0;
+ }
+ else if (fpos == CXD56_GNSS_READ_OFFSET_DCREPORT)
+ {
+ type = CXD56_CPU1_DATA_TYPE_DCREPORT;
+ *offset = 0;
+ }
+ else
+ {
+ type = -1;
+ }
+
+ return type;
+}
+
+/****************************************************************************
+ * Name: cxd56_gnss_initialize
+ *
+ * Description:
+ * initialize gnss device
+ *
+ * Input Parameters:
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+ static int cxd56_gnss_initialize(FAR struct cxd56_gnss_dev_s* dev)
+{
+ int32_t ret = 0;
+
+ return ret;
+}
+
+/****************************************************************************
+ * Name: cxd56_gnss_open
+ *
+ * Description:
+ * Standard character driver open method.
+ *
+ * Input Parameters:
+ * filep - File structure pointer
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+static int cxd56_gnss_open(FAR struct file *filep)
+{
+ FAR struct inode * inode;
+ FAR struct cxd56_gnss_dev_s *priv;
+ int ret = OK;
+
+ inode = filep->f_inode;
+ priv = (FAR struct cxd56_gnss_dev_s *)inode->i_private;
+
+ ret = sem_wait(&priv->devsem);
+ if (ret < 0)
+ {
+ return ret;
+ }
+
+ if (priv->num_open == 0)
+ {
+ ret = sem_init(&priv->syncsem, 0, 0);
+ if (ret < 0)
+ {
+ goto _err0;
+ }
+
+ ret = PM_LoadImage(CXD56_GNSS_GPS_CPUID, CXD56_GNSS_FWNAME);
+ if (ret < 0)
+ {
+ goto _err1;
+ }
+ ret = PM_StartCpu(CXD56_GNSS_GPS_CPUID, 1);
+ if (ret < 0)
+ {
+ goto _err2;
+ }
+
+#ifndef CONFIG_CXD56_GNSS_HOT_SLEEP
+ PM_SleepCpu(CXD56_GNSS_GPS_CPUID, PM_SLEEP_MODE_HOT_DISABLE);
+#endif
+
+ /* Wait the request from GNSS core to restore backup data,
+ * or for completion of initialization of GNSS core here.
+ * It is post the semaphore syncsem from cxd56_gnss_default_sighandler.
+ */
+
+ ret = cxd56_gnss_wait_notify(&priv->syncsem, 5);
+ if (ret < 0)
+ {
+ goto _err2;
+ }
+
+ ret = GD_WriteBuffer(CXD56_CPU1_DATA_TYPE_INFO, 0, &priv->shared_info,
+ sizeof(priv->shared_info));
+ if (ret < 0)
+ {
+ goto _err2;
+ }
+
+ sem_destroy(&priv->syncsem);
+ }
+
+ priv->num_open++;
+ goto _success;
+
+_err2:
+#ifndef CONFIG_CXD56_GNSS_HOT_SLEEP
+ PM_SleepCpu(CXD56_GNSS_GPS_CPUID, PM_SLEEP_MODE_HOT_ENABLE);
+#endif
+ PM_SleepCpu(CXD56_GNSS_GPS_CPUID, PM_SLEEP_MODE_COLD);
+_err1:
+ sem_destroy(&priv->syncsem);
+_err0:
+_success:
+ sem_post(&priv->devsem);
+ return ret;
+}
+
+/****************************************************************************
+ * Name: cxd56_gnss_close
+ *
+ * Description:
+ * Standard character driver close method.
+ *
+ * Input Parameters:
+ * filep - File structure pointer
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+static int cxd56_gnss_close(FAR struct file *filep)
+{
+ FAR struct inode * inode;
+ FAR struct cxd56_gnss_dev_s *priv;
+ int ret = OK;
+
+ inode = filep->f_inode;
+ priv = (FAR struct cxd56_gnss_dev_s *)inode->i_private;
+
+ ret = sem_wait(&priv->devsem);
+ if (ret < 0)
+ {
+ return ret;
+ }
+
+ priv->num_open--;
+ if (priv->num_open == 0)
+ {
+#ifndef CONFIG_CXD56_GNSS_HOT_SLEEP
+ PM_SleepCpu(CXD56_GNSS_GPS_CPUID, PM_SLEEP_MODE_HOT_ENABLE);
+#endif
+
+ ret = PM_SleepCpu(CXD56_GNSS_GPS_CPUID, PM_SLEEP_MODE_COLD);
+ if (ret < 0)
+ {
+ goto errout;
+ }
+ }
+
+errout:
+ sem_post(&priv->devsem);
+ return ret;
+}
+
+/****************************************************************************
+ * Name: cxd56_gnss_read
+ *
+ * Description:
+ * Standard character driver read method.
+ *
+ * Input Parameters:
+ * filep - File structure pointer
+ * buffer - Buffer to read from GNSS device
+ * buflen - The read length of the buffer
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+static ssize_t cxd56_gnss_read(FAR struct file *filep, FAR char *buffer,
+ size_t len)
+{
+ int32_t ret = 0;
+ uint32_t offset = 0;
+ int8_t type;
+
+ if (!buffer)
+ {
+ ret = -EINVAL;
+ goto _err;
+ }
+ if (len == 0)
+ {
+ goto _success;
+ }
+
+ /* setect data type */
+
+ type = cxd56_gnss_select_notifytype(filep->f_pos, &offset);
+ if (type < 0)
+ {
+ ret = -ESPIPE;
+ goto _err;
+ }
+
+ if (type == CXD56_CPU1_DATA_TYPE_GNSS)
+ {
+ /* Trim len if read would go beyond end of device */
+
+ if ((offset + len) > sizeof(struct cxd56_gnss_positiondata_s))
+ {
+ len = sizeof(struct cxd56_gnss_positiondata_s) - offset;
+ }
+ }
+ else if (type == CXD56_CPU1_DATA_TYPE_AGPS)
+ {
+ if ((offset + len) > sizeof(struct cxd56_supl_mesurementdata_s))
+ {
+ len = sizeof(struct cxd56_supl_mesurementdata_s) - offset;
+ }
+ }
+
+ /* GD_ReadBuffer returns copied data size or negative error code */
+
+ ret = GD_ReadBuffer(type, offset, buffer, len);
+
+_err:
+_success:
+ filep->f_pos = 0;
+ return ret;
+}
+
+/****************************************************************************
+ * Name: cxd56_gnss_write
+ *
+ * Description:
+ * Standard character driver write method.
+ *
+ * Input Parameters:
+ * filep - File structure pointer
+ * buffer - Buffer to write
+ * buflen - The write length of the buffer
+ *
+ * Returned Value:
+ * Always returns -ENOENT error.
+ *
+ *****************************************************************************/
+
+static ssize_t cxd56_gnss_write(FAR struct file *filep,
+ FAR const char *buffer, size_t buflen)
+{
+ return -ENOENT;
+}
+
+/****************************************************************************
+ * Name: cxd56_gnss_ioctl
+ *
+ * Description:
+ * Standard character driver ioctl method.
+ *
+ * Input Parameters:
+ * filep - File structure pointer
+ * fds - Array of file descriptor
+ * setup - 1 if start poll, 0 if stop poll
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+static int cxd56_gnss_ioctl(FAR struct file *filep, int cmd,
+ unsigned long arg)
+{
+ FAR struct inode * inode;
+ FAR struct cxd56_gnss_dev_s *priv;
+ int ret;
+
+ inode = filep->f_inode;
+ priv = (FAR struct cxd56_gnss_dev_s *)inode->i_private;
+
+ if (cmd <= CXD56_GNSS_IOCTL_INVAL || cmd >= CXD56_GNSS_IOCTL_MAX)
+ {
+ return -EINVAL;
+ }
+
+ ret = sem_wait(&priv->ioctllock);
+ if (ret < 0)
+ {
+ return ret;
+ }
+
+ ret = g_cmdlist[cmd](filep, arg);
+
+ sem_post(&priv->ioctllock);
+
+ return ret;
+}
+
+/****************************************************************************
+ * Name: cxd56_gnss_poll
+ *
+ * Description:
+ * Standard character driver poll method.
+ *
+ * Input Parameters:
+ * filep - File structure pointer
+ * fds - array of file descriptor
+ * setup - 1 if start poll, 0 if stop poll
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+#ifndef CONFIG_DISABLE_POLL
+static int cxd56_gnss_poll(FAR struct file *filep, FAR struct pollfd *fds,
+ bool setup)
+{
+ FAR struct inode *inode;
+ FAR struct cxd56_gnss_dev_s *priv;
+ int ret = OK;
+ int i;
+
+ inode = filep->f_inode;
+ priv = (FAR struct cxd56_gnss_dev_s *)inode->i_private;
+
+ ret = sem_wait(&priv->devsem);
+ if (ret < 0)
+ {
+ return ret;
+ }
+
+ if (setup)
+ {
+ if ((fds->events & POLLIN) == 0)
+ {
+ ret = -EDEADLK;
+ goto errout;
+ }
+
+ for (i = 0; i < CONFIG_CXD56_GNSS_NPOLLWAITERS; i++)
+ {
+ /* Find an unused slot */
+
+ if (priv->fds[i] == NULL)
+ {
+ /* Bind the poll structure and this slot */
+
+ priv->fds[i] = fds;
+ fds->priv = &priv->fds[i];
+ GD_SetNotifyMask(CXD56_CPU1_DEV_GNSS, FALSE);
+ break;
+ }
+ }
+
+ /* No space in priv fds array for poll handling */
+
+ if (i >= CONFIG_CXD56_GNSS_NPOLLWAITERS)
+ {
+ fds->priv = NULL;
+ ret = -EBUSY;
+ goto errout;
+ }
+ }
+ else if (fds->priv)
+ {
+ /* This is a request to tear down the poll. */
+
+ struct pollfd **slot = (struct pollfd **)fds->priv;
+
+ /* Remove all memory of the poll setup */
+
+ *slot = NULL;
+ fds->priv = NULL;
+ }
+
+errout:
+ sem_post(&priv->devsem);
+ return ret;
+}
+#endif
+
+/****************************************************************************
+ * Name: cxd56_gnss_register
+ *
+ * Description:
+ * Register the GNSS character device as 'devpath'
+ *
+ * Input Parameters:
+ * devpath - The full path to the driver to register. E.g., "/dev/gps"
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+static int cxd56_gnss_register(FAR const char *devpath)
+{
+ FAR struct cxd56_gnss_dev_s *priv;
+ int i;
+ int ret;
+ static struct
+ {
+ uint8_t sigtype;
+ cxd56_cpu1sighandler_t handler;
+ } devsig_table[] =
+ {
+ {
+ CXD56_CPU1_DATA_TYPE_GNSS,
+ cxd56_gnss_default_sighandler
+ },
+ {
+ CXD56_CPU1_DATA_TYPE_AGPS,
+ cxd56_gnss_common_signalhandler
+ },
+ {
+ CXD56_CPU1_DATA_TYPE_RTK,
+ cxd56_gnss_common_signalhandler
+ },
+ {
+ CXD56_CPU1_DATA_TYPE_GPSEPHEMERIS,
+ cxd56_gnss_common_signalhandler
+ },
+ {
+ CXD56_CPU1_DATA_TYPE_GLNEPHEMERIS,
+ cxd56_gnss_common_signalhandler
+ },
+ {
+ CXD56_CPU1_DATA_TYPE_SPECTRUM,
+ cxd56_gnss_common_signalhandler
+ },
+ {
+ CXD56_CPU1_DATA_TYPE_PVTLOG,
+ cxd56_gnss_common_signalhandler
+ },
+ {
+ CXD56_CPU1_DATA_TYPE_CPUFIFOAPI,
+ cxd56_gnss_cpufifoapi_signalhandler
+ },
+ {
+ CXD56_CPU1_DATA_TYPE_SBAS,
+ cxd56_gnss_common_signalhandler
+ },
+ {
+ CXD56_CPU1_DATA_TYPE_DCREPORT,
+ cxd56_gnss_common_signalhandler
+ }
+ };
+
+ priv = (FAR struct cxd56_gnss_dev_s *)kmm_malloc(
+ sizeof(struct cxd56_gnss_dev_s));
+ if (!priv)
+ {
+ gnsserr("Failed to allocate instance\n");
+ return -ENOMEM;
+ }
+
+ memset(priv, 0, sizeof(struct cxd56_gnss_dev_s));
+
+ ret = sem_init(&priv->devsem, 0, 1);
+ if (ret < 0)
+ {
+ gnsserr("Failed to initialize gnss devsem!\n");
+ goto _err0;
+ }
+
+ ret = sem_init(&priv->apiwait, 0, 0);
+ if (ret < 0)
+ {
+ gnsserr("Failed to initialize gnss apiwait!\n");
+ goto _err0;
+ }
+
+ ret = sem_init(&priv->ioctllock, 0, 1);
+ if (ret < 0)
+ {
+ gnsserr("Failed to initialize gnss ioctllock!\n");
+ goto _err0;
+ }
+
+ ret = cxd56_gnss_initialize(priv);
+ if (ret < 0)
+ {
+ gnsserr("Failed to initialize gnss device!\n");
+ goto _err0;
+ }
+
+ ret = register_driver(devpath, &g_gnssfops, 0666, priv);
+ if (ret < 0)
+ {
+ gnsserr("Failed to register driver: %d\n", ret);
+ goto _err0;
+ }
+
+ for (i = 0; i < sizeof(devsig_table) / sizeof(devsig_table[0]); i++)
+ {
+ ret = cxd56_cpu1siginit(devsig_table[i].sigtype, priv);
+ if (ret < 0)
+ {
+ gnsserr("Failed to initialize ICC for GPS CPU: %d,%d\n", ret,
+ devsig_table[i].sigtype);
+ goto _err2;
+ }
+ cxd56_cpu1sigregisterhandler(devsig_table[i].sigtype,
+ devsig_table[i].handler);
+ }
+
+ gnssinfo("GNSS driver loaded successfully!\n");
+
+ return ret;
+
+_err2:
+ unregister_driver(devpath);
+
+_err0:
+ kmm_free(priv);
+ return ret;
+}
+
+/****************************************************************************
+ * Name: cxd56_gnssinitialize
+ *
+ * Description:
+ * Initialize GNSS device
+ *
+ * Input Parameters:
+ * devpath - The full path to the driver to register. E.g., "/dev/gps"
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+int cxd56_gnssinitialize(FAR const char *devpath)
+{
+ int ret;
+
+ gnssinfo("Initializing GNSS..\n");
+
+ ret = cxd56_gnss_register(devpath);
+ if (ret < 0)
+ {
+ gnsserr("Error registering GNSS\n");
+ }
+
+ return ret;
+}
+
+#endif
diff --git a/arch/arm/src/cxd56xx/cxd56_gnss.h b/arch/arm/src/cxd56xx/cxd56_gnss.h
new file mode 100644
index 00000000000..761e1af2b83
--- /dev/null
+++ b/arch/arm/src/cxd56xx/cxd56_gnss.h
@@ -0,0 +1,108 @@
+/****************************************************************************
+ * arch/arm/src/cxd56xx/cxd56_gnss.h
+ *
+ * Copyright 2018 Sony Semiconductor Solutions Corporation
+ *
+ * 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 of Sony Semiconductor Solutions Corporation 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_CXD56XX_CXD56_GNSS_H
+#define __ARCH_ARM_SRC_CXD56XX_CXD56_GNSS_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include
+
+#include
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+#undef EXTERN
+#if defined(__cplusplus)
+#define EXTERN extern "C"
+extern "C"
+{
+#else
+#define EXTERN extern
+#endif
+
+/* GNSS specific debug */
+
+#ifdef CONFIG_CXD56_GNSS_DEBUG_ERROR
+# define gnsserr(fmt, ...) logerr(fmt, ## __VA_ARGS__)
+#else
+# define gnsserr(fmt, ...)
+#endif
+
+#ifdef CONFIG_CXD56_GNSS_DEBUG_WARN
+# define gnsswarn(fmt, ...) logwarn(fmt, ## __VA_ARGS__)
+#else
+# define gnsswarn(fmt, ...)
+#endif
+
+#ifdef CONFIG_CXD56_GNSS_DEBUG_INFO
+# define gnssinfo(fmt, ...) loginfo(fmt, ## __VA_ARGS__)
+#else
+# define gnssinfo(fmt, ...)
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: cxd56_gnssinitialize
+ *
+ * Description:
+ * Initialize GNSS device
+ *
+ * Input Parameters:
+ * devpath - The full path to the driver to register. E.g., "/dev/gps"
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+int cxd56_gnssinitialize(FAR const char *devpath);
+
+#undef EXTERN
+#if defined(__cplusplus)
+}
+#endif
+
+#endif /* __ASSEMBLY__ */
+#endif /* __ARCH_ARM_SRC_CXD56XX_CXD56_GNSS_H */
diff --git a/arch/arm/src/cxd56xx/cxd56_gnss_api.h b/arch/arm/src/cxd56xx/cxd56_gnss_api.h
new file mode 100644
index 00000000000..be4705957ab
--- /dev/null
+++ b/arch/arm/src/cxd56xx/cxd56_gnss_api.h
@@ -0,0 +1,356 @@
+/****************************************************************************
+ * arch/arm/src/cxd56xx/cxd56_gnss_api.h
+ *
+ * Copyright 2018 Sony Semiconductor Solutions Corporation
+ *
+ * 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 of Sony Semiconductor Solutions Corporation 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_CXD56XX_CXD56_GNSS_API_H
+#define __ARCH_ARM_SRC_CXD56XX_CXD56_GNSS_API_H
+
+#include
+#include
+
+/* GD Start mode */
+
+#define CXD56_GNSS_STMOD_COLD 0
+#define CXD56_GNSS_STMOD_WARM 1
+#define CXD56_GNSS_STMOD_WARMACC2 2
+#define CXD56_GNSS_STMOD_HOT 3
+#define CXD56_GNSS_STMOD_HOTACC 4
+#define CXD56_GNSS_STMOD_HOTACC2 5
+#define CXD56_GNSS_STMOD_HOTACC3 6
+#define CXD56_GNSS_STMOD_XTC1 7
+#define CXD56_GNSS_STMOD_XTC2 8
+
+/* GD operation mode */
+
+/* GD_SetOperationMode, GD_GetOperationMode */
+
+#define CXD56_GNSS_OPMOD_NORMAL 1
+#define CXD56_GNSS_OPMOD_LOWPOWER 2
+#define CXD56_GNSS_OPMOD_BALANCE 4
+#define CXD56_GNSS_OPMOD_1PSS 5
+
+/* Start a positioning
+ * begining to search the satellites and measure the receiver position
+ */
+
+int GD_Start(uint8_t startMode);
+
+/* Stop a positioning */
+
+int GD_Stop(void);
+
+/* Select GNSSs to positioning
+ * These are able to specified by CXD56_GNSS_B_SAT_XXX defines.
+ */
+
+int GD_SelectSatelliteSystem(uint32_t system);
+
+/* Get current using GNSSs to positioning
+ * A argument 'satellite' indicates current GNSSs by bit fields defined
+ * by CXD56_GNSS_B_SAT_XXX.
+ */
+
+int GD_GetSatelliteSystem(FAR uint32_t *system);
+
+/* Set the rough receiver position */
+
+int GD_SetReceiverPositionEllipsoidal(FAR double *dLat, FAR double *dLon,
+ FAR double *dHeight);
+
+/* Set the rough receiver position as orgothonal */
+
+int GD_SetReceiverPositionOrthogonal(int32_t dX, int32_t dY, int32_t dZ);
+
+/* Set enable or disable the 1PPS output. */
+
+int GD_Set1ppsOutput(uint32_t enable);
+
+/* Get the current 1PPS output setting. */
+
+int GD_Get1ppsOutput(FAR uint32_t *enable);
+
+/* Set the receiver operation mode
+ * 1st argument 'mode' is a operation mode defined by CXD56_GNSS_OPMOD_XXX.
+ * 2nd argument 'cycle' is a positioning period[ms], default is 1000[ms].
+ */
+
+int GD_SetOperationMode(uint32_t mode, uint32_t cycle);
+
+/* Get the receiver operation mode */
+
+int GD_GetOperationMode(FAR uint32_t *mode, FAR uint32_t *cycle);
+
+/* Set the TCXO offset */
+
+int GD_SetTcxoOffset(int32_t offset);
+
+/* Get the TCXO offset */
+
+int GD_GetTcxoOffset(FAR int32_t *offset);
+
+/* Set the estimated current time of the receiver.
+ * 1st argument date & time are in UTC.
+ */
+
+int GD_SetTime(FAR struct cxd56_gnss_date_s *date,
+ FAR struct cxd56_gnss_time_s *time);
+
+/* Set the network time */
+
+int GD_SetFrameTime(uint16_t sec, uint32_t fracSec);
+
+/* Get the almanac data */
+
+int GD_GetAlmanac(uint32_t satellite, FAR uint32_t* almanac,
+ FAR uint32_t *almanacSize);
+
+/* Set the almanac data */
+
+int GD_SetAlmanac(uint32_t satellite, FAR uint32_t *almanac);
+
+/* Get the Ephemeris data */
+
+int GD_GetEphemeris(uint32_t satellite, FAR uint32_t* ephemeris,
+ FAR uint32_t *ephemerisSize);
+
+/* Set the Ephemeris data */
+
+int GD_SetEphemeris(uint32_t satellite, FAR uint32_t *ephemeris);
+
+/* Select to use or not use the initial position calculation supporting
+ * information of the QZSS L1-SAIF.
+ */
+
+int GD_SetQzssPosAssist(uint32_t enable);
+
+/* Get a setting of the initial position calculation supporting
+ * information of the QZSS L1-SAIF.
+ */
+
+int GD_GetQzssPosAssist(FAR uint32_t *enable);
+
+/* Set IMES bitrates. */
+
+int GD_SetImesBitrate(uint32_t bitrate);
+
+/* Get IMES bitrates. */
+
+int GD_GetImesBitrate(FAR uint32_t *bitrate);
+
+/* Set IMES center frequency offset. */
+
+int GD_SetImesCenterFreqOffset(uint32_t offset);
+
+/* Set IMES preamble. */
+
+int GD_SetImesPreamble(uint32_t preamble);
+
+/* Start GPS test */
+
+void GD_StartGpsTest(uint32_t satellite, uint32_t reserve1,
+ uint32_t reserve2, uint32_t reserve3);
+
+/* Stop GPS test */
+
+int GD_StopGpsTest(void);
+
+/* Get GPS test result */
+
+int GD_GetGpsTestResult(FAR float* cn, FAR float* doppler);
+
+/* Control Spectrum output */
+
+int GD_SpectrumControl(unsigned long time, unsigned int enable,
+ unsigned char moniPoint1, unsigned char step1,
+ unsigned char moniPoint2, unsigned char step2);
+
+/* Save the backup data to a Flash memory. */
+
+int GD_SaveBackupdata(void);
+
+/* CEP Check Assist Data Valid */
+
+int GD_CepCheckAssistData(void);
+
+/* CEP Get Age Data */
+
+int GD_CepGetAgeData(FAR float *age, FAR float *cepi);
+
+/* CEP Reset Assist Data init flag & valid flag */
+
+int GD_CepInitAssistData(void);
+
+/* AGPS Set tau */
+
+int GD_SetTauGps(FAR double *tau);
+
+/* AGPS Set Acquist */
+
+int GD_SetAcquist(FAR uint8_t *pAcquistData, uint16_t acquistSize);
+
+/* Set the estimated current time of the receiver.
+ * 1st argument date & time are in GPS time.
+ */
+
+int GD_SetTimeGps(FAR struct cxd56_gnss_date_s *date,
+ FAR struct cxd56_gnss_time_s *time);
+
+/* Clear Receiver Infomation */
+
+int GD_ClearReceiverInfo(uint32_t type);
+
+/* AGPS Set Tow Assist */
+
+int GD_SetTowAssist(FAR uint8_t *pAssistData, uint16_t dataSize);
+
+/* AGPS Set UTC Model */
+
+int GD_SetUtcModel(FAR uint8_t *pModelData, uint16_t dataSize);
+
+/* Read GNSS data to specified buffer */
+
+int GD_ReadBuffer(uint8_t type, int32_t offset, FAR void *buf,
+ uint32_t length);
+
+/* Write GNSS data from specified buffer */
+
+int GD_WriteBuffer(uint8_t type, int32_t offset, FAR void *buf,
+ uint32_t length);
+
+/* Set notify mask, this mask flag is cleared when notified(poll/signal) */
+
+int GD_SetNotifyMask(uint8_t type, uint8_t clear);
+
+/* Geofence Add Region */
+
+int GD_GeoAddRegion(uint8_t id, long lat, long lon, uint16_t rad);
+
+/* Geofence Modify Region */
+
+int GD_GeoModifyRegion(uint8_t id, long lat, long lon, uint16_t rad);
+
+/* Geofence Delete Region */
+
+int GD_GeoDeleteRegione(uint8_t id);
+
+/* Geofence All delete Region */
+
+int GD_GeoDeleteAllRegion(void);
+
+/* Geofence Region check */
+
+int GD_GeoGetRegionData(uint8_t id, FAR long *lat, FAR long *lon,
+ FAR uint16_t *rad);
+
+/* Geofence Get Used Region ID */
+
+uint32_t GD_GeoGetUsedRegionId(void);
+
+/* Geofence Set mode */
+
+int GD_GeoSetOpMode(uint16_t deadzone, uint16_t dwell_detecttime);
+
+/* Geofence Request All region notify */
+
+int GD_GeoSetAllRgionNotifyRequest(void);
+
+/* Geofence Register to gnss_provider */
+
+int GD_RegisterGeofence(void);
+
+/* Geofence Release from gnss_provider */
+
+int GD_ReleaseGeofence(void);
+
+/* Pvtlog Register to gnss_provider */
+
+int GD_RegisterPvtlog(uint32_t cycle, uint32_t threshold);
+
+/* Pvtlog Release */
+
+int GD_ReleasePvtlog(void);
+
+/* Pvtlog Delete log data */
+
+int GD_PvtlogDeleteLog(void);
+
+/* Pvtlog Get Log status */
+
+int GD_PvtlogGetLogStatus(FAR struct cxd56_gnss_status_s *pLogStatus);
+
+/* Start outputting carrier phase info. */
+
+int GD_RtkStart(FAR struct cxd56_rtk_setting_s *pParam);
+
+/* Stop outputting carrier phase info. */
+
+int GD_RtkStop(void);
+
+/* Set output interval of carrier phase info.
+ *
+ * interval : CXD56_GNSS_RTK_INTERVAL_XXX (gd_type.h)
+ */
+
+int GD_RtkSetOutputInterval(int interval);
+
+/* Get output interval of carrier phase info. [ms] */
+
+int GD_RtkGetOutputInterval(FAR int* interval);
+
+/* Set GNSS of outputting carrier phase info. */
+
+int GD_RtkSetGnss(uint32_t gnss);
+
+/* Get GNSS of outputting carrier phase info. */
+
+int GD_RtkGetGnss(FAR uint32_t* pGnss);
+
+/* Set enable/disable GD to notify updating ephemeris */
+
+int GD_RtkSetEphNotify(int enable);
+
+/* Get enable/disable GD to notify updating ephemeris */
+
+int GD_RtkGetEphNotify(FAR int* enable);
+
+/* Set the Ephemeris data Ephemeris data size is variable. */
+
+int GD_SetVarEphemeris(uint32_t *ephemeris, uint32_t ephemerisSize);
+
+/* Get the Ephemeris data Ephemeris data size is variable. */
+
+int GD_GetVarEphemeris(uint32_t satellite, uint32_t* ephemeris,
+ uint32_t ephemerisSize);
+
+#endif /* __ARCH_ARM_SRC_CXD56XX_CXD56_GNSS_API_H */
diff --git a/arch/arm/src/cxd56xx/cxd56_uart0.c b/arch/arm/src/cxd56xx/cxd56_uart0.c
new file mode 100644
index 00000000000..de7275b92a0
--- /dev/null
+++ b/arch/arm/src/cxd56xx/cxd56_uart0.c
@@ -0,0 +1,325 @@
+/****************************************************************************
+ * arch/arm/src/cxd56xx/cxd56_uart0.c
+ *
+ * Copyright 2018 Sony Semiconductor Solutions Corporation
+ *
+ * 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 of Sony Semiconductor Solutions Corporation 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.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include "up_arch.h"
+#include "chip.h"
+#include "cxd56_pinconfig.h"
+
+#ifdef CONFIG_CXD56_UART0
+
+#include
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+#ifndef CONFIG_CXD56_UART0_BAUD
+# define CONFIG_CXD56_UART0_BAUD 921600
+#endif
+#ifndef CONFIG_CXD56_UART0_BITS
+# define CONFIG_CXD56_UART0_BITS 8
+#endif
+#ifndef CONFIG_CXD56_UART0_PARITY
+# define CONFIG_CXD56_UART0_PARITY 0
+#endif
+#ifndef CONFIG_CXD56_UART0_2STOP
+# define CONFIG_CXD56_UART0_2STOP 0
+#endif
+
+/****************************************************************************
+ * Private Function Prototypes
+ ****************************************************************************/
+
+static int uart0_open(FAR struct file *filep);
+static int uart0_close(FAR struct file *filep);
+static ssize_t uart0_read(FAR struct file *filep,
+ FAR char *buffer, size_t len);
+static ssize_t uart0_write(FAR struct file *filep,
+ FAR const char *buffer, size_t len);
+static int uart0_ioctl(FAR struct file *filep, int cmd, unsigned long arg);
+static int uart0_semtake(sem_t *id);
+static void uart0_semgive(sem_t *id);
+
+/****************************************************************************
+ * FarAPI prototypes
+ ****************************************************************************/
+
+int PD_UartInit(int ch);
+int PD_UartUninit(int ch);
+int PD_UartConfiguration(int ch, int baudrate, int databits,
+ int parity, int stopbit, int flowctrl);
+int PD_UartEnable(int ch);
+int PD_UartDisable(int ch);
+int PD_UartReceive(int ch, void *buf, int size, int leave);
+int PD_UartSend(int ch, void *buf, int size, int leave);
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+static const struct file_operations g_uart0fops =
+{
+ .open = uart0_open,
+ .close = uart0_close,
+ .read = uart0_read,
+ .write = uart0_write,
+ .seek = 0,
+ .ioctl = uart0_ioctl,
+};
+
+static sem_t g_lock;
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: uart0_semtake
+ ****************************************************************************/
+
+static int uart0_semtake(sem_t *id)
+{
+ while (sem_wait(id) != 0)
+ {
+ ASSERT(errno == EINTR);
+ }
+ return OK;
+}
+
+/****************************************************************************
+ * Name: uart0_semgive
+ ****************************************************************************/
+
+static void uart0_semgive(sem_t *id)
+{
+ sem_post(id);
+}
+
+/****************************************************************************
+ * Name: uart0_open
+ ****************************************************************************/
+
+static int uart0_open(FAR struct file *filep)
+{
+ FAR struct inode *inode = filep->f_inode;
+ int flowctl;
+ int bits;
+ int stop;
+ int ret;
+
+ if (inode->i_crefs > 1)
+ {
+ return OK;
+ }
+
+ ret = PD_UartInit(0);
+ if (ret < 0)
+ {
+ set_errno(EFAULT);
+ return ERROR;
+ }
+
+ /* 0 = 5bit, 1 = 6bit, 2 = 7bit, 3 = 8bit */
+
+ bits = CONFIG_CXD56_UART0_BITS - 5;
+
+ /* 1 = 1 stop, 2 = 2 stop bit */
+
+ stop = CONFIG_CXD56_UART0_2STOP + 1;
+
+ /* Enable UART0 pin configuration */
+
+#ifdef CONFIG_UART0_FLOWCONTROL
+ flowctl = 1;
+ CXD56_PIN_CONFIGS(PINCONFS_SPI2_UART0);
+#else
+ flowctl = 0;
+ CXD56_PIN_CONFIGS(PINCONFS_SPI2A_UART0);
+#endif
+
+ ret = PD_UartConfiguration(0, CONFIG_CXD56_UART0_BAUD,
+ bits,
+ CONFIG_CXD56_UART0_PARITY,
+ stop, flowctl);
+ if (ret < 0)
+ {
+ PD_UartUninit(0);
+ set_errno(EINVAL);
+ return ERROR;
+ }
+
+ ret = PD_UartEnable(0);
+ if (ret < 0)
+ {
+ PD_UartUninit(0);
+ set_errno(EFAULT);
+ return ERROR;
+ }
+
+ return OK;
+}
+
+/****************************************************************************
+ * Name: uart0_close
+ ****************************************************************************/
+
+static int uart0_close(FAR struct file *filep)
+{
+ FAR struct inode *inode = filep->f_inode;
+
+ if (inode->i_crefs == 1)
+ {
+ PD_UartDisable(0);
+ PD_UartUninit(0);
+
+ /* Disable UART0 pin by changing Hi-Z GPIO */
+
+#ifdef CONFIG_UART0_FLOWCONTROL
+ CXD56_PIN_CONFIGS(PINCONFS_SPI2_GPIO);
+#else
+ CXD56_PIN_CONFIGS(PINCONFS_SPI2A_GPIO);
+#endif
+ }
+
+ return 0;
+}
+
+/****************************************************************************
+ * Name: uart0_read
+ ****************************************************************************/
+
+static ssize_t uart0_read(FAR struct file *filep,
+ FAR char *buffer, size_t len)
+{
+ int ret;
+
+ uart0_semtake(&g_lock);
+
+ /* Always blocking */
+
+ ret = PD_UartReceive(0, buffer, len, 0);
+
+ uart0_semgive(&g_lock);
+
+ if (ret < 0)
+ {
+ set_errno(-ret);
+ ret = 0; /* Receive no data */
+ }
+
+ return (ssize_t)ret;
+}
+
+/****************************************************************************
+ * Name: uart0_write
+ ****************************************************************************/
+
+static ssize_t uart0_write(FAR struct file *filep,
+ FAR const char *buffer, size_t len)
+{
+ int ret;
+
+ uart0_semtake(&g_lock);
+
+ /* Always blocking */
+
+ ret = PD_UartSend(0, (FAR void *)buffer, len, 0);
+
+ uart0_semgive(&g_lock);
+
+ if (ret < 0)
+ {
+ set_errno(-ret);
+ ret = 0;
+ }
+ return (ssize_t)ret;
+}
+
+/****************************************************************************
+ * Name: uart0_ioctl
+ ****************************************************************************/
+
+static int uart0_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
+{
+ return -ENOTTY;
+}
+
+/****************************************************************************
+ * Name: cxd56_uart0initialize
+ ****************************************************************************/
+
+int cxd56_uart0initialize(FAR const char *devname)
+{
+ int ret;
+
+ sem_init(&g_lock, 0, 1);
+
+ ret = register_driver(devname, &g_uart0fops, 0666, NULL);
+ if (ret != 0)
+ {
+ return ERROR;
+ }
+
+ return OK;
+}
+
+/****************************************************************************
+ * Name: cxd56_uart0uninitialize
+ ****************************************************************************/
+
+void cxd56_uart0uninitialize(FAR const char *devname)
+{
+ unregister_driver(devname);
+ sem_destroy(&g_lock);
+}
+
+#endif /* CONFIG_CXD56_UART0 */
diff --git a/arch/arm/src/imxrt/imxrt_usdhc.c b/arch/arm/src/imxrt/imxrt_usdhc.c
index 8a2b3ebe7c2..3c950f1e42d 100644
--- a/arch/arm/src/imxrt/imxrt_usdhc.c
+++ b/arch/arm/src/imxrt/imxrt_usdhc.c
@@ -3017,7 +3017,7 @@ FAR struct sdio_dev_s *imxrt_usdhc_initialize(int slotno)
imxrt_clockall_usdhc1();
break;
-
+#if defined(CONFIG_IMXRT_USDHC2)
case IMXRT_USDHC2_BASE:
(void)imxrt_config_gpio(PIN_USDHC2_D0);
(void)imxrt_config_gpio(PIN_USDHC2_D1);
@@ -3027,7 +3027,7 @@ FAR struct sdio_dev_s *imxrt_usdhc_initialize(int slotno)
(void)imxrt_config_gpio(PIN_USDHC2_CMD);
imxrt_clockall_usdhc2();
break;
-
+#endif
default:
return NULL;
}
diff --git a/arch/arm/src/lpc11xx/Kconfig b/arch/arm/src/lpc11xx/Kconfig
deleted file mode 100644
index 820ce783cd1..00000000000
--- a/arch/arm/src/lpc11xx/Kconfig
+++ /dev/null
@@ -1,241 +0,0 @@
-#
-# For a description of the syntax of this configuration file,
-# see the file kconfig-language.txt in the NuttX tools repository.
-#
-
-comment "LPC11xx Configuration Options"
-
-choice
- prompt "NXP LPC11XX Chip Selection"
- default ARCH_CHIP_LPC1115
- depends on ARCH_CHIP_LPC11XX
-
-config ARCH_CHIP_LPC1114
- bool "LPC1114"
- select ARCH_FAMILY_LPC111X
-
-config ARCH_CHIP_LPC1115
- bool "LPC1115"
- select ARCH_FAMILY_LPC111X
-
-endchoice
-
-config ARCH_FAMILY_LPC111X
- bool
-
-menu "LPC11xx Peripheral Support"
-
-choice
- prompt "System Clock:"
- default LPC11_INTRCOSC
-
-config LPC11_INTRCOSC
- bool "Internal RC"
-
-config LPC11_MAINOSC
- bool "External Crystal"
-
-endchoice
-
-choice
- prompt "SysTick clock source"
- default LPC11_SYSTICK_CORECLK
-
-config LPC11_SYSTICK_CORECLK
- bool "Cortex-M0 core clock"
-
-config LPC11_SYSTICK_CORECLK_DIV16
- bool "Cortex-M0 core clock divided by 16"
-
-endchoice
-
-config LPC11_PLL
- bool "PLL"
- default y
-
-config LPC11_UART0
- bool "UART0"
- select UART0_SERIALDRIVER
- select ARCH_HAVE_SERIAL_TERMIOS
- default y
-
-config LPC11_CAN0
- bool "CAN0"
- default n
-
-config LPC11_SPI
- bool "SPI"
- default n
-
-config LPC11_SSP0
- bool "SSP0"
- default n
-
-config LPC11_SSP1
- bool "SSP1"
- default n
-
-config LPC11_I2C0
- bool "I2C0"
- default n
-
-config LPC11_TMR0
- bool "Timer 0"
- default n
-
-config LPC11_TMR1
- bool "Timer 1"
- default n
-
-config LPC11_WDT
- bool "WDT"
- default n
-
-config LPC11_ADC
- bool "ADC"
- default n
-
-config LPC11_FLASH
- bool "FLASH"
- default n
-
-endmenu
-
-menu "ADC driver options"
- depends on LPC11_ADC
-
-config LPC11_ADC0_AVERAGE
- int "ADC0 average"
- default 200
-
-config LPC11_ADC0_MASK
- hex "ADC0 mask"
- default 0x01
-
-config LPC11_ADC0_SPS
- int "ADC0 SPS"
- default 1000
-
-config LPC11_ADC_CHANLIST
- bool "Use ADC channel list"
- default n
- ---help---
- The errata that states: "A/D Global Data register should not be used
- with burst mode or hardware triggering". 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.
-
- The ADC interrupt will trigger on conversion complete on the last
- channel listed in the array g_adc_chanlist[] (as opposed to
- triggering interrupt from the global DONE flag).
-
- If this option is enabled, then the platform specific code must do
- two things: (1) define LPC11_ADC_NCHANNELS in the configuration file
- and (2) provide an array g_adc_chanlist[] with the channel numbers
- matching the LPC11_ADC0_MASK within the board-specific library.
-
-config LPC11_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 LPC11_ADC_NCHANNELS
- int "ADC0 number of channels"
- depends on LPC11_ADC_CHANLIST
- default 0
- ---help---
- If LPC11_ADC_CHANLIST is enabled, then the platform specific code
- must do two things: (1) define LPC11_ADC_NCHANNELS in the configuration
- file and (2) provide an array g_adc_chanlist[] with the channel
- numbers matching the LPC11_ADC0_MASK within the board-specific
- library.
-
-endmenu
-
-menu "CAN driver options"
- depends on LPC11_CAN1 || LPC11_CAN2
-
-config LPC11_CAN1_BAUD
- int "CAN1 BAUD"
- depends on LPC11_CAN1
- ---help---
- CAN1 BAUD rate. Required if LPC11_CAN1 is defined.
-
-config LPC11_CAN2_BAUD
- int "CAN2 BAUD"
- depends on LPC11_CAN2
- ---help---
- CAN2 BAUD rate. Required if LPC11_CAN2 is defined.
-
-config LPC11_CAN1_DIVISOR
- int "CAN1 CCLK divisor"
- depends on LPC11_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 LPC11_CAN2_DIVISOR
- int "CAN2 CCLK divisor"
- depends on LPC11_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 LPC11_CAN_TSEG1
- int "TSEG1 quanta"
- default 6
- ---help---
- The number of CAN time quanta in segment 1. Default: 6
-
-config LPC11_CAN_TSEG2
- int "TSEG2 quanta"
- default 4
- ---help---
- The number of CAN time quanta in segment 2. Default: 7
-
-config LPC11_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 CAN_REGDEBUG
- bool "Register level debug"
- depends on DEBUG_CAN_INFO
- default n
- ---help---
- Output detailed register-level CAN debug information. Requires also
- CONFIG_DEBUG_CAN_INFO.
-
-endmenu
-
-config LPC11_GPIOIRQ
- bool "GPIO interrupt support"
- default n
- ---help---
- Enable support for GPIO interrupts
-
-menu "I2C driver options"
- depends on LPC11_I2C0 || LPC11_I2C1 || LPC11_I2C2
-
-config LPC11_I2C0_FREQUENCY
- int "I2C0 frequency"
- depends on LPC11_I2C0
- default 100000
-
-config LPC11_I2C1_FREQUENCY
- int "I2C1 frequency"
- depends on LPC11_I2C1
- default 100000
-
-config LPC11_I2C2_FREQUENCY
- int "I2C2 frequency"
- depends on LPC11_I2C2
- default 100000
-
-endmenu
diff --git a/arch/arm/src/lpc11xx/Make.defs b/arch/arm/src/lpc11xx/Make.defs
deleted file mode 100644
index 180cdf4fca7..00000000000
--- a/arch/arm/src/lpc11xx/Make.defs
+++ /dev/null
@@ -1,101 +0,0 @@
-############################################################################
-# arch/arm/src/lpc11xx/Make.defs
-#
-# Copyright (C) 2015, 2018 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.
-#
-############################################################################
-
-HEAD_ASRC =
-
-CMN_ASRCS = up_exception.S up_saveusercontext.S up_fullcontextrestore.S
-CMN_ASRCS += up_switchcontext.S vfork.S
-
-CMN_CSRCS = up_allocateheap.c up_assert.c up_blocktask.c up_copyfullstate.c
-CMN_CSRCS += up_createstack.c up_mdelay.c up_udelay.c up_exit.c
-CMN_CSRCS += up_initialize.c up_initialstate.c up_interruptcontext.c
-CMN_CSRCS += up_puts.c up_modifyreg8.c up_modifyreg16.c up_modifyreg32.c
-CMN_CSRCS += up_releasepending.c up_releasestack.c up_reprioritizertr.c
-CMN_CSRCS += up_schedulesigaction.c up_sigdeliver.c up_stackframe.c
-CMN_CSRCS += up_systemreset.c up_unblocktask.c up_usestack.c up_doirq.c
-CMN_CSRCS += up_hardfault.c up_svcall.c up_vectors.c up_vfork.c
-
-ifeq ($(CONFIG_BUILD_PROTECTED),y)
-CMN_CSRCS += up_task_start.c up_pthread_start.c
-CMN_CSRCS += up_signal_dispatch.c
-CMN_UASRCS += up_signal_handler.S
-endif
-
-ifeq ($(CONFIG_STACK_COLORATION),y)
-CMN_CSRCS += up_checkstack.c
-endif
-
-ifeq ($(CONFIG_DEBUG_FEATURES),y)
-CMN_CSRCS += up_dumpnvic.c
-endif
-
-CHIP_ASRCS =
-CHIP_CSRCS = lpc11_clockconfig.c lpc11_gpio.c lpc11_i2c.c lpc11_irq.c
-CHIP_CSRCS += lpc11_lowputc.c lpc11_serial.c lpc11_spi.c lpc11_ssp.c
-CHIP_CSRCS += lpc11_start.c
-
-# Configuration-dependent LPC11xx files
-
-ifneq ($(CONFIG_ARCH_IDLE_CUSTOM),y)
-CHIP_CSRCS += lpc11_idle.c
-endif
-
-ifneq ($(CONFIG_SCHED_TICKLESS),y)
-CHIP_CSRCS += lpc11_timerisr.c
-endif
-
-ifeq ($(CONFIG_BUILD_PROTECTED),y)
-CHIP_CSRCS += lpc11_userspace.c
-endif
-
-ifeq ($(CONFIG_LPC11_GPIOIRQ),y)
-CHIP_CSRCS += lpc11_gpioint.c
-endif
-
-ifeq ($(CONFIG_ARCH_IRQPRIO),y)
-CHIP_CSRCS += lpc11_irqprio.c
-endif
-
-ifeq ($(CONFIG_LPC11_SPI0),y)
-CHIP_CSRCS += lpc11_spi.c
-else
-ifeq ($(CONFIG_LPC11_SPI1),y)
-CHIP_CSRCS += lpc11_spi.c
-endif
-endif
-
-ifeq ($(CONFIG_PWM),y)
-CHIP_CSRCS += lpc11_pwm.c
-endif
diff --git a/arch/arm/src/lpc11xx/chip.h b/arch/arm/src/lpc11xx/chip.h
deleted file mode 100644
index e9a8f52c747..00000000000
--- a/arch/arm/src/lpc11xx/chip.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/************************************************************************************
- * arch/arm/src/lpc11xx/chip.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.
- *
- ************************************************************************************/
-
-#ifndef __ARCH_ARM_SRC_LPC11XX_CHIP_H
-#define __ARCH_ARM_SRC_LPC11XX_CHIP_H
-
-/************************************************************************************
- * Included Files
- ************************************************************************************/
-
-#include
-#include "nvic.h"
-
-/* Include the chip capabilities file */
-
-#include
-
-#define ARMV6M_PERIPHERAL_INTERRUPTS 32
-
-/* Include the memory map file. Other chip hardware files should then include
- * this file for the proper setup.
- */
-
-#include "hardware/lpc11_memorymap.h"
-
-/************************************************************************************
- * Pre-processor Definitions
- ************************************************************************************/
-
-/************************************************************************************
- * Public Types
- ************************************************************************************/
-
-/************************************************************************************
- * Public Data
- ************************************************************************************/
-
-/************************************************************************************
- * Public Functions
- ************************************************************************************/
-
-#endif /* __ARCH_ARM_SRC_LPC11XX_CHIP_H */
diff --git a/arch/arm/src/lpc11xx/hardware/lpc111x_iocon.h b/arch/arm/src/lpc11xx/hardware/lpc111x_iocon.h
deleted file mode 100644
index 1836d35dc1e..00000000000
--- a/arch/arm/src/lpc11xx/hardware/lpc111x_iocon.h
+++ /dev/null
@@ -1,269 +0,0 @@
-/************************************************************************************
- * arch/arm/src/lpc11xx/hardware/lpc111x_iocon.h
- *
- * Copyright (C) 2015 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_LPC11XX_HARDWARE_LPC111X_IOCON_H
-#define __ARCH_ARM_SRC_LPC11XX_HARDWARE_LPC111X_IOCON_H
-
-/************************************************************************************
- * Included Files
- ************************************************************************************/
-
-#include
-
-#include "chip.h"
-#include "hardware/lpc11_memorymap.h"
-
-/************************************************************************************
- * Pre-processor Definitions
- ************************************************************************************/
-
-#define IOCON_NPINS 12
-
-/* Register offsets *****************************************************************/
-/* Note: The IOCON offset is not linear. See User manual UM10398 Page 74 */
-
-#define LPC11_IOCON_P0_0_OFFSET 0x00c
-#define LPC11_IOCON_P0_1_OFFSET 0x010
-#define LPC11_IOCON_P0_2_OFFSET 0x01c
-#define LPC11_IOCON_P0_3_OFFSET 0x02C
-#define LPC11_IOCON_P0_4_OFFSET 0x030
-#define LPC11_IOCON_P0_5_OFFSET 0x034
-#define LPC11_IOCON_P0_6_OFFSET 0x04c
-#define LPC11_IOCON_P0_7_OFFSET 0x050
-#define LPC11_IOCON_P0_8_OFFSET 0x060
-#define LPC11_IOCON_P0_9_OFFSET 0x064
-#define LPC11_IOCON_P0_10_OFFSET 0x068
-#define LPC11_IOCON_P0_11_OFFSET 0x074
-
-#define LPC11_IOCON_P1_0_OFFSET 0x078
-#define LPC11_IOCON_P1_1_OFFSET 0x07c
-#define LPC11_IOCON_P1_2_OFFSET 0x080
-#define LPC11_IOCON_P1_3_OFFSET 0x090
-#define LPC11_IOCON_P1_4_OFFSET 0x094
-#define LPC11_IOCON_P1_5_OFFSET 0x0a0
-#define LPC11_IOCON_P1_6_OFFSET 0x0a4
-#define LPC11_IOCON_P1_7_OFFSET 0x0a8
-#define LPC11_IOCON_P1_8_OFFSET 0x014
-#define LPC11_IOCON_P1_9_OFFSET 0x038
-#define LPC11_IOCON_P1_10_OFFSET 0x06c
-#define LPC11_IOCON_P1_11_OFFSET 0x098
-
-#define LPC11_IOCON_P2_0_OFFSET 0x008
-#define LPC11_IOCON_P2_1_OFFSET 0x028
-#define LPC11_IOCON_P2_2_OFFSET 0x05c
-#define LPC11_IOCON_P2_3_OFFSET 0x08c
-#define LPC11_IOCON_P2_4_OFFSET 0x040
-#define LPC11_IOCON_P2_5_OFFSET 0x044
-#define LPC11_IOCON_P2_6_OFFSET 0x000
-#define LPC11_IOCON_P2_7_OFFSET 0x020
-#define LPC11_IOCON_P2_8_OFFSET 0x024
-#define LPC11_IOCON_P2_9_OFFSET 0x054
-#define LPC11_IOCON_P2_10_OFFSET 0x058
-#define LPC11_IOCON_P2_11_OFFSET 0x070
-
-#define LPC11_IOCON_P3_0_OFFSET 0x084
-#define LPC11_IOCON_P3_1_OFFSET 0x088
-#define LPC11_IOCON_P3_2_OFFSET 0x09C
-#define LPC11_IOCON_P3_3_OFFSET 0x0ac
-#define LPC11_IOCON_P3_4_OFFSET 0x03c
-#define LPC11_IOCON_P3_5_OFFSET 0x048
-
-#define LPC11_IOCON_SCK_LOC_OFFSET 0x0b0
-#define LPC11_IOCON_DSR_LOC_OFFSET 0x0b4
-#define LPC11_IOCON_DCD_LOC_OFFSET 0x0b8
-#define LPC11_IOCON_RI_LOC_OFFSET 0x0bc
-
-/* Register addresses ***************************************************************/
-/* Note: The IOCON base is not linear. See User manual UM10398 Page 74 */
-
-#define LPC11_IOCON_P0_0 (LPC11_IOCON_BASE + LPC11_IOCON_P0_0_OFFSET)
-#define LPC11_IOCON_P0_1 (LPC11_IOCON_BASE + LPC11_IOCON_P0_1_OFFSET)
-#define LPC11_IOCON_P0_2 (LPC11_IOCON_BASE + LPC11_IOCON_P0_2_OFFSET)
-#define LPC11_IOCON_P0_3 (LPC11_IOCON_BASE + LPC11_IOCON_P0_3_OFFSET)
-#define LPC11_IOCON_P0_4 (LPC11_IOCON_BASE + LPC11_IOCON_P0_4_OFFSET)
-#define LPC11_IOCON_P0_5 (LPC11_IOCON_BASE + LPC11_IOCON_P0_5_OFFSET)
-#define LPC11_IOCON_P0_6 (LPC11_IOCON_BASE + LPC11_IOCON_P0_6_OFFSET)
-#define LPC11_IOCON_P0_7 (LPC11_IOCON_BASE + LPC11_IOCON_P0_7_OFFSET)
-#define LPC11_IOCON_P0_8 (LPC11_IOCON_BASE + LPC11_IOCON_P0_8_OFFSET)
-#define LPC11_IOCON_P0_9 (LPC11_IOCON_BASE + LPC11_IOCON_P0_9_OFFSET)
-#define LPC11_IOCON_P0_10 (LPC11_IOCON_BASE + LPC11_IOCON_P0_10_OFFSET)
-#define LPC11_IOCON_P0_11 (LPC11_IOCON_BASE + LPC11_IOCON_P0_11_OFFSET)
-
-#define LPC11_IOCON_P1_0 (LPC11_IOCON_BASE + LPC11_IOCON_P1_0_OFFSET)
-#define LPC11_IOCON_P1_1 (LPC11_IOCON_BASE + LPC11_IOCON_P1_1_OFFSET)
-#define LPC11_IOCON_P1_2 (LPC11_IOCON_BASE + LPC11_IOCON_P1_2_OFFSET)
-#define LPC11_IOCON_P1_3 (LPC11_IOCON_BASE + LPC11_IOCON_P1_3_OFFSET)
-#define LPC11_IOCON_P1_4 (LPC11_IOCON_BASE + LPC11_IOCON_P1_4_OFFSET)
-#define LPC11_IOCON_P1_5 (LPC11_IOCON_BASE + LPC11_IOCON_P1_5_OFFSET)
-#define LPC11_IOCON_P1_6 (LPC11_IOCON_BASE + LPC11_IOCON_P1_6_OFFSET)
-#define LPC11_IOCON_P1_7 (LPC11_IOCON_BASE + LPC11_IOCON_P1_7_OFFSET)
-#define LPC11_IOCON_P1_8 (LPC11_IOCON_BASE + LPC11_IOCON_P1_8_OFFSET)
-#define LPC11_IOCON_P1_9 (LPC11_IOCON_BASE + LPC11_IOCON_P1_9_OFFSET)
-#define LPC11_IOCON_P1_10 (LPC11_IOCON_BASE + LPC11_IOCON_P1_10_OFFSET)
-#define LPC11_IOCON_P1_11 (LPC11_IOCON_BASE + LPC11_IOCON_P1_11_OFFSET)
-
-#define LPC11_IOCON_P2_0 (LPC11_IOCON_BASE + LPC11_IOCON_P2_0_OFFSET)
-#define LPC11_IOCON_P2_1 (LPC11_IOCON_BASE + LPC11_IOCON_P2_1_OFFSET)
-#define LPC11_IOCON_P2_2 (LPC11_IOCON_BASE + LPC11_IOCON_P2_2_OFFSET)
-#define LPC11_IOCON_P2_3 (LPC11_IOCON_BASE + LPC11_IOCON_P2_3_OFFSET)
-#define LPC11_IOCON_P2_4 (LPC11_IOCON_BASE + LPC11_IOCON_P2_4_OFFSET)
-#define LPC11_IOCON_P2_5 (LPC11_IOCON_BASE + LPC11_IOCON_P2_5_OFFSET)
-#define LPC11_IOCON_P2_6 (LPC11_IOCON_BASE + LPC11_IOCON_P2_6_OFFSET)
-#define LPC11_IOCON_P2_7 (LPC11_IOCON_BASE + LPC11_IOCON_P2_7_OFFSET)
-#define LPC11_IOCON_P2_8 (LPC11_IOCON_BASE + LPC11_IOCON_P2_8_OFFSET)
-#define LPC11_IOCON_P2_9 (LPC11_IOCON_BASE + LPC11_IOCON_P2_9_OFFSET)
-#define LPC11_IOCON_P2_10 (LPC11_IOCON_BASE + LPC11_IOCON_P2_10_OFFSET)
-#define LPC11_IOCON_P2_11 (LPC11_IOCON_BASE + LPC11_IOCON_P2_11_OFFSET)
-
-#define LPC11_IOCON_P3_0 (LPC11_IOCON_BASE + LPC11_IOCON_P3_0_OFFSET)
-#define LPC11_IOCON_P3_1 (LPC11_IOCON_BASE + LPC11_IOCON_P3_1_OFFSET)
-#define LPC11_IOCON_P3_2 (LPC11_IOCON_BASE + LPC11_IOCON_P3_2_OFFSET)
-#define LPC11_IOCON_P3_3 (LPC11_IOCON_BASE + LPC11_IOCON_P3_3_OFFSET)
-#define LPC11_IOCON_P3_4 (LPC11_IOCON_BASE + LPC11_IOCON_P3_4_OFFSET)
-#define LPC11_IOCON_P3_5 (LPC11_IOCON_BASE + LPC11_IOCON_P3_5_OFFSET)
-
-#define LPC11_IOCON_SCK_LOC (LPC11_IOCON_BASE + LPC11_IOCON_SCK_LOC_OFFSET)
-#define LPC11_IOCON_DSR_LOC (LPC11_IOCON_BASE + LPC11_IOCON_DSR_LOC_OFFSET)
-#define LPC11_IOCON_DCD_LOC (LPC11_IOCON_BASE + LPC11_IOCON_DCD_LOC_OFFSET)
-#define LPC11_IOCON_RI_LOC (LPC11_IOCON_BASE + LPC11_IOCON_RI_LOC_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)
- /* Bit 6-9: Reserved */
-#define IOCON_OD_SHIFT (10) /* Bit 10: Type D,A,W */
-#define IOCON_OD_MASK (1 << IOCON_OD_SHIFT)
- /* Bit 11-31: Reserved */
-
-/* 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 */
-
-/* Analog/Digital mode */
-
-#define IOCON_ADMODE_SHIFT (7)
-#define IOCON_ADMODE_ANALOG (0 << IOCON_ADMODE_SHIFT)
-#define IOCON_ADMODE_DIGITAL (1 << IOCON_ADMODE_SHIFT)
-
-/* I2C modes */
-
-#define IOCON_I2CMODE_SHIFT (8)
-#define IOCON_I2CMODE_MASK (3 << IOCON_I2CMODE_SHIFT)
-# define IOCON_I2CMODE_STANDARD (0 << IOCON_I2CMODE_SHIFT)
-# define IOCON_I2CMODE_STANDIO (1 << IOCON_I2CMODE_SHIFT)
-# define IOCON_I2CMODE_FASTPLUS (2 << IOCON_I2CMODE_SHIFT)
- /*(3 << IOCON_I2CMODE_SHIFT) Reserved */
- /* Bits 10-31: Reserved */
-
-/* SCK location register */
-
-#define IOCON_SCK_LOC_SHIFT (0)
-#define IOCON_SCK_LOC_MASK (3 << IOCON_SCK_LOC_SHIFT)
-# define IOCON_SCK_LOC_SWCLK (0 << IOCON_SCK_LOC_SHIFT)
-# define IOCON_SCK_LOC_PIO2_11 (1 << IOCON_SCK_LOC_SHIFT)
-# define IOCON_SCK_LOC_PIO0_6 (2 << IOCON_SCK_LOC_SHIFT)
- /*(3 << IOCON_SCK_LOC_SHIFT) Reserved */
- /* Bits 2-31: Reserved */
-
-/* DSR location register */
-
-#define IOCON_DSR_LOC_SHIFT (0)
-#define IOCON_DSR_LOC_MASK (3 << IOCON_DSR_LOC_SHIFT)
-# define IOCON_DSR_LOC_PIO2_1 (0 << IOCON_DSR_LOC_SHIFT)
-# define IOCON_DSR_LOC_PIO3_1 (1 << IOCON_DSR_LOC_SHIFT)
- /*(2 << IOCON_DSR_LOC_SHIFT) Reserved */
- /*(3 << IOCON_DSR_LOC_SHIFT) Reserved */
- /* Bits 2-31: Reserved */
-
-/* DCD location register */
-
-#define IOCON_DCD_LOC_SHIFT (0)
-#define IOCON_DCD_LOC_MASK (3 << IOCON_DCD_LOC_SHIFT)
-# define IOCON_DCD_LOC_PIO2_2 (0 << IOCON_DCD_LOC_SHIFT)
-# define IOCON_DCD_LOC_PIO3_2 (1 << IOCON_DCD_LOC_SHIFT)
- /*(2 << IOCON_DCD_LOC_SHIFT) Reserved */
- /*(3 << IOCON_DCD_LOC_SHIFT) Reserved */
- /* Bits 2-31: Reserved */
-
-/* RI location register */
-
-#define IOCON_RI_LOC_SHIFT (0)
-#define IOCON_RI_LOC_MASK (3 << IOCON_RI_LOC_SHIFT)
-# define IOCON_RI_LOC_PIO2_3 (0 << IOCON_RI_LOC_SHIFT)
-# define IOCON_RI_LOC_PIO3_3 (1 << IOCON_RI_LOC_SHIFT)
- /*(2 << IOCON_RI_LOC_SHIFT) Reserved */
- /*(3 << IOCON_RI_LOC_SHIFT) Reserved */
- /* Bits 2-31: Reserved */
-
-/************************************************************************************
- * Public Types
- ************************************************************************************/
-
-/************************************************************************************
- * Public Data
- ************************************************************************************/
-
-/************************************************************************************
- * Public Functions
- ************************************************************************************/
-
-#endif /* __ARCH_ARM_SRC_LPC11XX_HARDWARE_LPC118X_IOCON_H */
diff --git a/arch/arm/src/lpc11xx/hardware/lpc111x_memorymap.h b/arch/arm/src/lpc11xx/hardware/lpc111x_memorymap.h
deleted file mode 100644
index 948d9e89945..00000000000
--- a/arch/arm/src/lpc11xx/hardware/lpc111x_memorymap.h
+++ /dev/null
@@ -1,107 +0,0 @@
-/************************************************************************************
- * arch/arm/src/lpc11xx/hardware/lpc111x_memorymap.h
- *
- * Copyright (C) 2015 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_LPC11XX_HARDWARE_LPC111X_MEMORYMAP_H
-#define __ARCH_ARM_SRC_LPC11XX_HARDWARE_LPC111X_MEMORYMAP_H
-
-/************************************************************************************
- * Included Files
- ************************************************************************************/
-
-#include
-
-#include "chip.h"
-
-/************************************************************************************
- * Pre-processor Definitions
- ************************************************************************************/
-
-/* Memory Map ***********************************************************************/
-
-#define LPC11_FLASH_BASE 0x00000000 /* -0x1fffffff: On-chip non-volatile memory */
-#define LPC11_SRAM_BASE 0x10000000 /* -0x10007fff: On-chip SRAM (devices <=16Kb) */
-#define LPC11_ROM_BASE 0x1fff0000 /* -0x1fffffff: 16Kb Boot ROM with flash services */
-#define LPC11_AHBSRAM_BASE 0x20000000 /* -0x3fffffff: On-chip AHB SRAM (devices >32Kb) */
-#define LPC11_GPIO_BASE 0x50000000 /* -0x2009ffff: GPIO at AHB Peripherals */
-#define LPC11_APB_BASE 0x40000000 /* -0x4007ffff: APB Peripherals */
-#define LPC11_AHB_BASE 0x50000000 /* -0x501fffff: AHB Peripherals */
-#define LPC11_CORTEXM3_BASE 0xe0000000 /* -0xe00fffff: (see armv7-m/nvic.h) */
-#define LPC11_SCS_BASE 0xe000e000
-#define LPC11_DEBUGMCU_BASE 0xe0042000
-
-/* APB Peripherals *****************************************************************/
-
-#define LPC11_I2C0_BASE 0x40000000 /* -0x40003fff: I2C-bus */
-#define LPC11_WDT_BASE 0x40004000 /* -0x40007fff: Watchdog timer */
-#define LPC11_UART0_BASE 0x40008000 /* -0x4000bfff: UART 0 */
-#define LPC11_TMR0_BASE 0x4000c000 /* -0x4000ffff: Timer 0 */
-#define LPC11_TMR1_BASE 0x40010000 /* -0x40013fff: Timer 1 */
-#define LPC11_TMR2_BASE 0x40014000 /* -0x40017fff: Timer 0 */
-#define LPC11_TMR3_BASE 0x40018000 /* -0x4001bfff: Timer 1 */
-#define LPC11_ADC_BASE 0x4001c000 /* -0x4001ffff: ADC */
- /* -0x40037fff: Reserved */
-#define LPC11_PMU_BASE 0x40038000 /* -0x4003bfff: PMU */
- /* -0x40017fff: Reserved */
-#define LPC11_FLASHC_BASE 0x4003c000 /* -0x4003ffff: Flash Controller */
-#define LPC11_SPI0_BASE 0x40040000 /* -0x40043fff: SPI0 */
-#define LPC11_IOCON_BASE 0x40044000 /* -0x40047fff: IOCONFIG */
-#define LPC11_SYSCON_BASE 0x40048000 /* -0x4004bfff: System Control */
- /* -0x4004ffff: Reserved */
-#define LPC11_CAN0_BASE 0x40050000 /* -0x40053fff: CAN0 */
- /* -0x40057ffff: Reserved */
-#define LPC11_SPI1_BASE 0x40058000 /* -0x4005bffff: SPI1 */
- /* -0x4007fffff: Reserved */
-
-/* AHB Peripherals ******************************************************************/
-
-#define LPC11_GPIO_PIO0 (LPC11_GPIO_BASE + 0) /* -0x5000ffff: GPIO PIO0 */
-#define LPC11_GPIO_PIO1 (LPC11_GPIO_BASE + 0x10000) /* -0x5001ffff: GPIO PIO1 */
-#define LPC11_GPIO_PIO2 (LPC11_GPIO_BASE + 0x20000) /* -0x5002ffff: GPIO PIO1 */
-#define LPC11_GPIO_PIO3 (LPC11_GPIO_BASE + 0x30000) /* -0x5003ffff: GPIO PIO1 */
- /* -0x501fffff: Reserved */
-
-/************************************************************************************
- * Public Types
- ************************************************************************************/
-
-/************************************************************************************
- * Public Data
- ************************************************************************************/
-
-/************************************************************************************
- * Public Functions
- ************************************************************************************/
-
-#endif /* __ARCH_ARM_SRC_LPC11XX_HARDWARE_LPC116X_MEMORYMAP_H */
diff --git a/arch/arm/src/lpc11xx/hardware/lpc111x_pinconfig.h b/arch/arm/src/lpc11xx/hardware/lpc111x_pinconfig.h
deleted file mode 100644
index e160b554b67..00000000000
--- a/arch/arm/src/lpc11xx/hardware/lpc111x_pinconfig.h
+++ /dev/null
@@ -1,122 +0,0 @@
-/************************************************************************************
- * arch/arm/src/lpc11xx/hardware/lpc111x_pinconfig.h
- *
- * Copyright (C) 2015 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_LPC11XX_HARDWARE_LPC111X_PINCONFIG_H
-#define __ARCH_ARM_SRC_LPC11XX_HARDWARE_LPC111X_PINCONFIG_H
-
-/************************************************************************************
- * Included Files
- ************************************************************************************/
-
-#include
-
-/************************************************************************************
- * Pre-processor Definitions
- ************************************************************************************/
-/* GPIO pin definitions *************************************************************/
-/* NOTE that functions have a alternate pins that can be selected. These alternates
- * are identified with a numeric suffix like _1, _2, or _3. Your board.h file
- * should select the correct alternative for your board by including definitions
- * such as:
- *
- * #define GPIO_UART1_RXD GPIO_UART1_RXD_1
- *
- * (without the suffix)
- */
-
-#ifdef CONFIG_ARCH_CHIP_LPC1115
-
-#define GPIO_CLKOUT (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN1)
-#define GPIO_CT32B0_MAT2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN1)
-#define GPIO_SPI0_SSEL (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN2)
-#define GPIO_CT16B0_CAP0 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN2)
-#define GPIO_I2C0_SCL (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN4)
-#define GPIO_I2C0_SDA (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN5)
-#define GPIO_SPI0_SCK_1 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN6)
-#define GPIO_UART0_CTS (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN7)
-#define GPIO_SPI0_MISO (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN8)
-#define GPIO_CT16B0_MAT0 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN8)
-#define GPIO_SPI0_MOSI (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN9)
-#define GPIO_CT16B0_MAT1 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN9)
-#define GPIO_JTAG_SWCLK (GPIO_ALT0 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN10)
-#define GPIO_PIO0_10 (GPIO_ALT_GPIO | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN10)
-#define GPIO_SPI0_SCK (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN10)
-#define GPIO_CT16B0_MAT2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN10)
-#define GPIO_PIO0_11 (GPIO_ALT_GPIO | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN11)
-#define GPIO_AD_inp0 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN11)
-#define GPIO_CT32B0_MAT3 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN11)
-#define GPIO_PIO1_0 (GPIO_ALT_GPIO | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN0)
-#define GPIO_AD_inp1 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN0)
-#define GPIO_CT32B1_CAP0 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN0)
-#define GPIO_PIO1_1 (GPIO_ALT_GPIO | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN1)
-#define GPIO_AD_inp2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN1)
-#define GPIO_CT32B1_MAT0 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN1)
-#define GPIO_PIO1_2 (GPIO_ALT_GPIO | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN2)
-#define GPIO_AD_inp3 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN2)
-#define GPIO_CT32B1_MAT1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN2)
-#define GPIO_JTAG_SWDIO (GPIO_ALT0 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN3)
-#define GPIO_PIO1_3 (GPIO_ALT_GPIO | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN3)
-#define GPIO_AD_inp4 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN3)
-#define GPIO_CT32B1_MAT2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN3)
-#define GPIO_AD_inp5 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN4)
-#define GPIO_CT32B1_MAT3 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN4)
-#define GPIO_UART0_RTS (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN5)
-#define GPIO_CT32B0_CAP0 (GPIO_ALT2 | GPIO_PULLDN | GPIO_PORT1 | GPIO_PIN5)
-#define GPIO_UART0_RXD (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN6)
-#define GPIO_CT32B0_MAT0 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN6)
-#define GPIO_UART0_TXD (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN7)
-#define GPIO_CT32B0_MAT1 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN7)
-#define GPIO_CT16B1_CAP0 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN8)
-#define GPIO_CT16B1_MAT0 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN9)
-#define GPIO_AD_inp6 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN10)
-#define GPIO_CT16B1_MAT1 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN10)
-#define GPIO_AD_inp7 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN11)
-#define GPIO_UART0_DTR (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN0)
-
-#endif /* CONFIG_ARCH_CHIP_LPC1115 */
-
-/************************************************************************************
- * Public Types
- ************************************************************************************/
-
-/************************************************************************************
- * Public Data
- ************************************************************************************/
-
-/************************************************************************************
- * Public Function Prototypes
- ************************************************************************************/
-
-#endif /* __ARCH_ARM_SRC_LPC11XX_HARDWARE_LPC116X_PINCONFIG_H */
diff --git a/arch/arm/src/lpc11xx/hardware/lpc11_adc.h b/arch/arm/src/lpc11xx/hardware/lpc11_adc.h
deleted file mode 100644
index a1566b05140..00000000000
--- a/arch/arm/src/lpc11xx/hardware/lpc11_adc.h
+++ /dev/null
@@ -1,171 +0,0 @@
-/************************************************************************************
- * arch/arm/src/lpc11xx/hardware/lpc11_adc.h
- *
- * Copyright (C) 2015 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_LPC11XX_HARDWARE_LPC11_CHIP_ADC_H
-#define __ARCH_ARM_SRC_LPC11XX_HARDWARE_LPC11_CHIP_ADC_H
-
-/************************************************************************************
- * Included Files
- ************************************************************************************/
-
-#include
-
-#include "chip.h"
-#include "hardware/lpc11_memorymap.h"
-
-/************************************************************************************
- * Pre-processor Definitions
- ************************************************************************************/
-
-/* Register offsets *****************************************************************/
-
-#define LPC11_ADC_CR_OFFSET 0x0000 /* A/D Control Register */
-#define LPC11_ADC_GDR_OFFSET 0x0004 /* A/D Global Data Register */
-#define LPC11_ADC_INTEN_OFFSET 0x000c /* A/D Interrupt Enable Register */
-
-#define LPC11_ADC_DR_OFFSET(n) (0x0010+((n) << 2))
-#define LPC11_ADC_DR0_OFFSET 0x0010 /* A/D Channel 0 Data Register */
-#define LPC11_ADC_DR1_OFFSET 0x0014 /* A/D Channel 1 Data Register */
-#define LPC11_ADC_DR2_OFFSET 0x0018 /* A/D Channel 2 Data Register */
-#define LPC11_ADC_DR3_OFFSET 0x001c /* A/D Channel 3 Data Register */
-#define LPC11_ADC_DR4_OFFSET 0x0020 /* A/D Channel 4 Data Register */
-#define LPC11_ADC_DR5_OFFSET 0x0024 /* A/D Channel 5 Data Register */
-#define LPC11_ADC_DR6_OFFSET 0x0028 /* A/D Channel 6 Data Register */
-#define LPC11_ADC_DR7_OFFSET 0x002c /* A/D Channel 7 Data Register */
-
-#define LPC11_ADC_STAT_OFFSET 0x0030 /* A/D Status Register */
-
-/* Register addresses ***************************************************************/
-
-#define LPC11_ADC_CR (LPC11_ADC_BASE+LPC11_ADC_CR_OFFSET)
-#define LPC11_ADC_GDR (LPC11_ADC_BASE+LPC11_ADC_GDR_OFFSET)
-#define LPC11_ADC_INTEN (LPC11_ADC_BASE+LPC11_ADC_INTEN_OFFSET)
-
-#define LPC11_ADC_DR(n) (LPC11_ADC_BASE+LPC11_ADC_DR_OFFSET(n))
-#define LPC11_ADC_DR0 (LPC11_ADC_BASE+LPC11_ADC_DR0_OFFSET)
-#define LPC11_ADC_DR1 (LPC11_ADC_BASE+LPC11_ADC_DR1_OFFSET)
-#define LPC11_ADC_DR2 (LPC11_ADC_BASE+LPC11_ADC_DR2_OFFSET)
-#define LPC11_ADC_DR3 (LPC11_ADC_BASE+LPC11_ADC_DR3_OFFSET)
-#define LPC11_ADC_DR4 (LPC11_ADC_BASE+LPC11_ADC_DR4_OFFSET)
-#define LPC11_ADC_DR5 (LPC11_ADC_BASE+LPC11_ADC_DR5_OFFSET)
-#define LPC11_ADC_DR6 (LPC11_ADC_BASE+LPC11_ADC_DR6_OFFSET)
-#define LPC11_ADC_DR7 (LPC11_ADC_BASE+LPC11_ADC_DR7_OFFSET)
-
-#define LPC11_ADC_STAT (LPC11_ADC_BASE+LPC11_ADC_STAT_OFFSET)
-
-/* Register bit definitions *********************************************************/
-
-/* A/D Control Register */
-
-#define ADC_CR_SEL_SHIFT (0) /* Bits 0-7: Selects pins to be sampled */
-#define ADC_CR_SEL_MASK (0xff << ADC_CR_SEL_MASK)
-#define ADC_CR_CLKDIV_SHIFT (8) /* Bits 8-15: APB clock (PCLK_ADC0) divisor */
-#define ADC_CR_CLKDIV_MASK (0xff << ADC_CR_CLKDIV_SHIFT)
-#define ADC_CR_BURST (1 << 16) /* Bit 16: A/D Repeated conversions */
-#define ADC_CR_CLKS_SHIFT (17) /* Bits 17-19: Clocks used on burst mode conv. */
-#define ADC_CR_CLKS_MASK (3 << ADC_CR_CLKS_SHIFT)
- /* Bits 20-23: Reserved */
-#define ADC_CR_START_SHIFT (24) /* Bits 24-26: Control A/D conversion start */
-#define ADC_CR_START_MASK (7 << ADC_CR_START_SHIFT)
-# define ADC_CR_START_NOSTART (0 << ADC_CR_START_SHIFT) /* No start */
-# define ADC_CR_START_NOW (1 << ADC_CR_START_SHIFT) /* Start now */
-# define ADC_CR_START_P0p2 (2 << ADC_CR_START_SHIFT) /* Start edge on P0.2/SSEL/CT16B0_CAP0 */
-# define ADC_CR_START_P1p5 (3 << ADC_CR_START_SHIFT) /* Start edge on P1.5/DIR/CT32B0_CAP0 */
-# define ADC_CR_START_CT32B0MAT0 (4 << ADC_CR_START_SHIFT) /* Start edge on Counter/Timer32 MAT0 */
-# define ADC_CR_START_CT32B0MAT1 (5 << ADC_CR_START_SHIFT) /* Start edge on Counter/Timer32 MAT1 */
-# define ADC_CR_START_CT16B0MAT0 (6 << ADC_CR_START_SHIFT) /* Start edge on Counter/Timer16 MAT0 */
-# define ADC_CR_START_CT16B0MAT1 (7 << ADC_CR_START_SHIFT) /* Start edge on Counter/Timer16 MAT1 */
-#define ADC_CR_EDGE (1 << 27) /* Bit 27: Start on falling edge */
- /* Bits 28-31: Reserved */
-/* A/D Global Data Register AND Channel 0-7 Data Register */
- /* Bits 0-5: Reserved */
-#define ADC_DR_RESULT_SHIFT (5) /* Bits 6-15: Result of conversion (DONE==1) */
-#define ADC_DR_RESULT_MASK (0x3ff << ADC_DR_RESULT_SHIFT)
- /* Bits 16-23: Reserved */
-#define ADC_DR_CHAN_SHIFT (24) /* Bits 24-26: Channel converted */
-#define ADC_DR_CHAN_MASK (3 << ADC_DR_CHN_SHIFT)
- /* Bits 27-29: Reserved */
-#define ADC_DR_OVERRUN (1 << 30) /* Bit 30: Conversion(s) lost/overwritten*/
-#define ADC_DR_DONE (1 << 31) /* Bit 31: A/D conversion complete*/
-
-/* A/D Interrupt Enable Register */
-
-#define ADC_INTEN_CHAN(n) (1 << (n))
-#define ADC_INTEN_CHAN0 (1 << 0) /* Bit 0: Enable ADC chan 0 complete intterrupt */
-#define ADC_INTEN_CHAN1 (1 << 1) /* Bit 1: Enable ADC chan 1 complete interrupt */
-#define ADC_INTEN_CHAN2 (1 << 2) /* Bit 2: Enable ADC chan 2 complete interrupt */
-#define ADC_INTEN_CHAN3 (1 << 3) /* Bit 3: Enable ADC chan 3 complete interrupt */
-#define ADC_INTEN_CHAN4 (1 << 4) /* Bit 4: Enable ADC chan 4 complete interrupt */
-#define ADC_INTEN_CHAN5 (1 << 5) /* Bit 5: Enable ADC chan 5 complete interrupt */
-#define ADC_INTEN_CHAN6 (1 << 6) /* Bit 6: Enable ADC chan 6 complete interrupt */
-#define ADC_INTEN_CHAN7 (1 << 7) /* Bit 7: Enable ADC chan 7 complete interrupt */
-#define ADC_INTEN_GLOBAL (1 << 8) /* Bit 8: Only the global DONE generates interrupt */
- /* Bits 9-31: Reserved */
-/* A/D Status Register */
-
-#define ADC_STAT_DONE(n) (1 << (n))
-#define ADC_STAT_DONE0 (1 << 0) /* Bit 0: A/D chan 0 DONE */
-#define ADC_STAT_DONE1 (1 << 1) /* Bit 1: A/D chan 1 DONE */
-#define ADC_STAT_DONE2 (1 << 2) /* Bit 2: A/D chan 2 DONE */
-#define ADC_STAT_DONE3 (1 << 3) /* Bit 3: A/D chan 3 DONE */
-#define ADC_STAT_DONE4 (1 << 4) /* Bit 4: A/D chan 4 DONE */
-#define ADC_STAT_DONE5 (1 << 5) /* Bit 5: A/D chan 5 DONE */
-#define ADC_STAT_DONE6 (1 << 6) /* Bit 6: A/D chan 6 DONE */
-#define ADC_STAT_DONE7 (1 << 7) /* Bit 7: A/D chan 7 DONE */
-#define ADC_STAT_OVERRUN(n) ((1 << (n)) + 8)
-#define ADC_STAT_OVERRUN0 (1 << 8) /* Bit 8: A/D chan 0 OVERRUN */
-#define ADC_STAT_OVERRUN1 (1 << 9) /* Bit 9: A/D chan 1 OVERRUN */
-#define ADC_STAT_OVERRUN2 (1 << 10) /* Bit 10: A/D chan 2 OVERRUN */
-#define ADC_STAT_OVERRUN3 (1 << 11) /* Bit 11: A/D chan 3 OVERRUN */
-#define ADC_STAT_OVERRUN4 (1 << 12) /* Bit 12: A/D chan 4 OVERRUN */
-#define ADC_STAT_OVERRUN5 (1 << 13) /* Bit 13: A/D chan 5 OVERRUN */
-#define ADC_STAT_OVERRUN6 (1 << 14) /* Bit 14: A/D chan 6 OVERRUN */
-#define ADC_STAT_OVERRUN7 (1 << 15) /* Bit 15: A/D chan 7 OVERRUN */
-#define ADC_STAT_INT (1 << 16) /* Bit 15: A/D interrupt */
- /* Bits 17-31: Reserved */
-
-/************************************************************************************
- * Public Types
- ************************************************************************************/
-
-/************************************************************************************
- * Public Data
- ************************************************************************************/
-
-/************************************************************************************
- * Public Functions
- ************************************************************************************/
-
-#endif /* __ARCH_ARM_SRC_LPC11XX_HARDWARE_LPC11_CHIP_ADC_H */
diff --git a/arch/arm/src/lpc11xx/hardware/lpc11_gpio.h b/arch/arm/src/lpc11xx/hardware/lpc11_gpio.h
deleted file mode 100644
index 93ae758a090..00000000000
--- a/arch/arm/src/lpc11xx/hardware/lpc11_gpio.h
+++ /dev/null
@@ -1,146 +0,0 @@
-/************************************************************************************
- * arch/arm/src/lpc11xx/hardware/lpc11_gpio.h
- *
- * Copyright (C) 2015 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_LPC11XX_HARDWARE_LPC11_CHIP_GPIO_H
-#define __ARCH_ARM_SRC_LPC11XX_HARDWARE_LPC11_CHIP_GPIO_H
-
-/************************************************************************************
- * Included Files
- ************************************************************************************/
-
-#include
-
-#include "chip.h"
-#include "hardware/lpc11_memorymap.h"
-
-/************************************************************************************
- * Pre-processor Definitions
- ************************************************************************************/
-
-/* Register offsets *****************************************************************/
-/* GPIO block register offsets ******************************************************/
-
-#define LPC11_GPIO0_OFFSET 0x00000
-#define LPC11_GPIO1_OFFSET 0x10000
-#define LPC11_GPIO2_OFFSET 0x20000
-#define LPC11_GPIO3_OFFSET 0x30000
-#define LPC11_GPIO_OFFSET(n) (0x10000*(n))
-
-#define LPC11_GPIO_DATA_OFFSET 0x3FFC
-#define LPC11_GPIO_DIR_OFFSET 0x8000 /* GPIO Port Direction control */
-#define LPC11_GPIO_IS_OFFSET 0x8004 /* Interrupt Sense register */
-#define LPC11_GPIO_IBE_OFFSET 0x8008 /* Interrupt Both Edges register */
-#define LPC11_GPIO_IEV_OFFSET 0x800c /* Interrupt Event register */
-#define LPC11_GPIO_IE_OFFSET 0x8010 /* Interrupt Mask register */
-#define LPC11_GPIO_RIS_OFFSET 0x8014 /* Raw interrupt status register */
-#define LPC11_GPIO_MIS_OFFSET 0x8018 /* Masked interrupt status register */
-#define LPC11_GPIO_IC_OFFSET 0x801c /* Interrupt clear register */
-
-/* Register addresses ***************************************************************/
-/* GPIO block register addresses ****************************************************/
-
-#define LPC11_GPIOn_BASE(n) (LPC11_GPIO_BASE+LPC11_GPIO_OFFSET(n))
-#define LPC11_GPIO0_BASE (LPC11_GPIO_BASE+LPC11_GPIO0_OFFSET)
-#define LPC11_GPIO1_BASE (LPC11_GPIO_BASE+LPC11_GPIO1_OFFSET)
-#define LPC11_GPIO2_BASE (LPC11_GPIO_BASE+LPC11_GPIO2_OFFSET)
-#define LPC11_GPIO3_BASE (LPC11_GPIO_BASE+LPC11_GPIO3_OFFSET)
-
-#define LPC11_GPIO_DIR(n) (LPC11_GPIO_BASE(n)+LPC11_GPIO_DIR_OFFSET) /* GPIO Port Direction register */
-#define LPC11_GPIO_IS(n) (LPC11_GPIO_BASE(n)+LPC11_GPIO_IS_OFFSET) /* GPIO Interrupt Sense register */
-#define LPC11_GPIO_IBE(n) (LPC11_GPIO_BASE(n)+LPC11_GPIO_IBE_OFFSET) /* GPIO Interrupt Both Edges sense register */
-#define LPC11_GPIO_IEV(n) (LPC11_GPIO_BASE(n)+LPC11_GPIO_IVE_OFFSET) /* GPIO Interrupt Event register */
-#define LPC11_GPIO_IE(n) (LPC11_GPIO_BASE(n)+LPC11_GPIO_IE_OFFSET) /* GPIO Interrupt Mask register */
-#define LPC11_GPIO_RIS(n) (LPC11_GPIO_BASE(n)+LPC11_GPIO_RIS_OFFSET) /* GPIO Raw Interrupt Status register */
-#define LPC11_GPIO_MIS(n) (LPC11_GPIO_BASE(n)+LPC11_GPIO_MIS_OFFSET) /* GPIO Masked Interrupt Status register */
-#define LPC11_GPIO_IC(n) (LPC11_GPIO_BASE(n)+LPC11_GPIO_IC_OFFSET) /* GPIO Interrupt Clear register */
-
-#define LPC11_GPIO0_DATA (LPC11_GPIO0_BASE+LPC11_GPIO_DATA_OFFSET)
-#define LPC11_GPIO0_DIR (LPC11_GPIO0_BASE+LPC11_GPIO_DIR_OFFSET)
-#define LPC11_GPIO0_IS (LPC11_GPIO0_BASE+LPC11_GPIO_IS_OFFSET)
-#define LPC11_GPIO0_IBE (LPC11_GPIO0_BASE+LPC11_GPIO_IBE_OFFSET)
-#define LPC11_GPIO0_IEV (LPC11_GPIO0_BASE+LPC11_GPIO_IVE_OFFSET)
-#define LPC11_GPIO0_IE (LPC11_GPIO0_BASE+LPC11_GPIO_IE_OFFSET)
-#define LPC11_GPIO0_RIS (LPC11_GPIO0_BASE+LPC11_GPIO_RIS_OFFSET)
-#define LPC11_GPIO0_MIS (LPC11_GPIO0_BASE+LPC11_GPIO_MIS_OFFSET)
-#define LPC11_GPIO0_IC (LPC11_GPIO0_BASE+LPC11_GPIO_IC_OFFSET)
-
-#define LPC11_GPIO1_DATA (LPC11_GPIO1_BASE+LPC11_GPIO_DATA_OFFSET)
-#define LPC11_GPIO1_DIR (LPC11_GPIO1_BASE+LPC11_GPIO_DIR_OFFSET)
-#define LPC11_GPIO1_IS (LPC11_GPIO1_BASE+LPC11_GPIO_IS_OFFSET)
-#define LPC11_GPIO1_IBE (LPC11_GPIO1_BASE+LPC11_GPIO_IBE_OFFSET)
-#define LPC11_GPIO1_IEV (LPC11_GPIO1_BASE+LPC11_GPIO_IVE_OFFSET)
-#define LPC11_GPIO1_IE (LPC11_GPIO1_BASE+LPC11_GPIO_IE_OFFSET)
-#define LPC11_GPIO1_RIS (LPC11_GPIO1_BASE+LPC11_GPIO_RIS_OFFSET)
-#define LPC11_GPIO1_MIS (LPC11_GPIO1_BASE+LPC11_GPIO_MIS_OFFSET)
-#define LPC11_GPIO1_IC (LPC11_GPIO1_BASE+LPC11_GPIO_IC_OFFSET)
-
-#define LPC11_GPIO2_DATA (LPC11_GPIO2_BASE+LPC11_GPIO_DATA_OFFSET)
-#define LPC11_GPIO2_DIR (LPC11_GPIO2_BASE+LPC11_GPIO_DIR_OFFSET)
-#define LPC11_GPIO2_IS (LPC11_GPIO2_BASE+LPC11_GPIO_IS_OFFSET)
-#define LPC11_GPIO2_IBE (LPC11_GPIO2_BASE+LPC11_GPIO_IBE_OFFSET)
-#define LPC11_GPIO2_IEV (LPC11_GPIO2_BASE+LPC11_GPIO_IVE_OFFSET)
-#define LPC11_GPIO2_IE (LPC11_GPIO2_BASE+LPC11_GPIO_IE_OFFSET)
-#define LPC11_GPIO2_RIS (LPC11_GPIO2_BASE+LPC11_GPIO_RIS_OFFSET)
-#define LPC11_GPIO2_MIS (LPC11_GPIO2_BASE+LPC11_GPIO_MIS_OFFSET)
-#define LPC11_GPIO2_IC (LPC11_GPIO2_BASE+LPC11_GPIO_IC_OFFSET)
-
-#define LPC11_GPIO3_DATA (LPC11_GPIO3_BASE+LPC11_GPIO_DATA_OFFSET)
-#define LPC11_GPIO3_DIR (LPC11_GPIO3_BASE+LPC11_GPIO_DIR_OFFSET)
-#define LPC11_GPIO3_IS (LPC11_GPIO3_BASE+LPC11_GPIO_IS_OFFSET)
-#define LPC11_GPIO3_IBE (LPC11_GPIO3_BASE+LPC11_GPIO_IBE_OFFSET)
-#define LPC11_GPIO3_IEV (LPC11_GPIO3_BASE+LPC11_GPIO_IVE_OFFSET)
-#define LPC11_GPIO3_IE (LPC11_GPIO3_BASE+LPC11_GPIO_IE_OFFSET)
-#define LPC11_GPIO3_RIS (LPC11_GPIO3_BASE+LPC11_GPIO_RIS_OFFSET)
-#define LPC11_GPIO3_MIS (LPC11_GPIO3_BASE+LPC11_GPIO_MIS_OFFSET)
-#define LPC11_GPIO3_IC (LPC11_GPIO3_BASE+LPC11_GPIO_IC_OFFSET)
-
-/* Register bit definitions *********************************************************/
-/* GPIO block register bit definitions **********************************************/
-
-#define GPIO(n) (1 << (n)) /* n=0,1,..11 */
-
-/************************************************************************************
- * Public Types
- ************************************************************************************/
-
-/************************************************************************************
- * Public Data
- ************************************************************************************/
-
-/************************************************************************************
- * Public Functions
- ************************************************************************************/
-
-#endif /* __ARCH_ARM_SRC_LPC11XX_HARDWARE_LPC11_CHIP_GPIO_H */
diff --git a/arch/arm/src/lpc11xx/hardware/lpc11_i2c.h b/arch/arm/src/lpc11xx/hardware/lpc11_i2c.h
deleted file mode 100644
index 84384fca051..00000000000
--- a/arch/arm/src/lpc11xx/hardware/lpc11_i2c.h
+++ /dev/null
@@ -1,208 +0,0 @@
-/************************************************************************************
- * arch/arm/src/lpc11xx/hardware/lpc11_i2c.h
- *
- * Copyright (C) 2015 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_LPC11XX_HARDWARE_LPC11_I2C_H
-#define __ARCH_ARM_SRC_LPC11XX_HARDWARE_LPC11_I2C_H
-
-/************************************************************************************
- * Included Files
- ************************************************************************************/
-
-#include
-
-#include "chip.h"
-#include "hardware/lpc11_memorymap.h"
-
-/************************************************************************************
- * Pre-processor Definitions
- ************************************************************************************/
-
-/* Register offsets *****************************************************************/
-
-#define LPC11_I2C_CONSET_OFFSET 0x0000 /* I2C Control Set Register */
-#define LPC11_I2C_STAT_OFFSET 0x0004 /* I2C Status Register */
-#define LPC11_I2C_DAT_OFFSET 0x0008 /* I2C Data Register */
-#define LPC11_I2C_ADR0_OFFSET 0x000c /* I2C Slave Address Register 0 */
-#define LPC11_I2C_SCLH_OFFSET 0x0010 /* SCH Duty Cycle Register High Half Word */
-#define LPC11_I2C_SCLL_OFFSET 0x0014 /* SCL Duty Cycle Register Low Half Word */
-#define LPC11_I2C_CONCLR_OFFSET 0x0018 /* I2C Control Clear Register */
-#define LPC11_I2C_MMCTRL_OFFSET 0x001c /* Monitor mode control register */
-#define LPC11_I2C_ADR1_OFFSET 0x0020 /* I2C Slave Address Register 1 */
-#define LPC11_I2C_ADR2_OFFSET 0x0024 /* I2C Slave Address Register 2 */
-#define LPC11_I2C_ADR3_OFFSET 0x0028 /* I2C Slave Address Register 3 */
-#define LPC11_I2C_BUFR_OFFSET 0x002c /* Data buffer register */
-#define LPC11_I2C_MASK0_OFFSET 0x0030 /* I2C Slave address mask register 0 */
-#define LPC11_I2C_MASK1_OFFSET 0x0034 /* I2C Slave address mask register 1 */
-#define LPC11_I2C_MASK2_OFFSET 0x0038 /* I2C Slave address mask register 2 */
-#define LPC11_I2C_MASK3_OFFSET 0x003c /* I2C Slave address mask register */
-
-/* Register addresses ***************************************************************/
-
-#define LPC11_I2C0_CONSET (LPC11_I2C0_BASE+LPC11_I2C_CONSET_OFFSET)
-#define LPC11_I2C0_STAT (LPC11_I2C0_BASE+LPC11_I2C_STAT_OFFSET)
-#define LPC11_I2C0_DAT (LPC11_I2C0_BASE+LPC11_I2C_DAT_OFFSET)
-#define LPC11_I2C0_ADR0 (LPC11_I2C0_BASE+LPC11_I2C_ADR0_OFFSET)
-#define LPC11_I2C0_SCLH (LPC11_I2C0_BASE+LPC11_I2C_SCLH_OFFSET)
-#define LPC11_I2C0_SCLL (LPC11_I2C0_BASE+LPC11_I2C_SCLL_OFFSET)
-#define LPC11_I2C0_CONCLR (LPC11_I2C0_BASE+LPC11_I2C_CONCLR_OFFSET)
-#define LPC11_I2C0_MMCTRL (LPC11_I2C0_BASE+LPC11_I2C_MMCTRL_OFFSET)
-#define LPC11_I2C0_ADR1 (LPC11_I2C0_BASE+LPC11_I2C_ADR1_OFFSET)
-#define LPC11_I2C0_ADR2 (LPC11_I2C0_BASE+LPC11_I2C_ADR2_OFFSET)
-#define LPC11_I2C0_ADR3 (LPC11_I2C0_BASE+LPC11_I2C_ADR3_OFFSET)
-#define LPC11_I2C0_BUFR (LPC11_I2C0_BASE+LPC11_I2C_BUFR_OFFSET)
-#define LPC11_I2C0_MASK0 (LPC11_I2C0_BASE+LPC11_I2C_MASK0_OFFSET)
-#define LPC11_I2C0_MASK1 (LPC11_I2C0_BASE+LPC11_I2C_MASK1_OFFSET)
-#define LPC11_I2C0_MASK2 (LPC11_I2C0_BASE+LPC11_I2C_MASK2_OFFSET)
-#define LPC11_I2C0_MASK3 (LPC11_I2C0_BASE+LPC11_I2C_MASK3_OFFSET)
-
-#define LPC11_I2C1_CONSET (LPC11_I2C1_BASE+LPC11_I2C_CONSET_OFFSET)
-#define LPC11_I2C1_STAT (LPC11_I2C1_BASE+LPC11_I2C_STAT_OFFSET)
-#define LPC11_I2C1_DAT (LPC11_I2C1_BASE+LPC11_I2C_DAT_OFFSET)
-#define LPC11_I2C1_ADR0 (LPC11_I2C1_BASE+LPC11_I2C_ADR0_OFFSET)
-#define LPC11_I2C1_SCLH (LPC11_I2C1_BASE+LPC11_I2C_SCLH_OFFSET)
-#define LPC11_I2C1_SCLL (LPC11_I2C1_BASE+LPC11_I2C_SCLL_OFFSET)
-#define LPC11_I2C1_CONCLR (LPC11_I2C1_BASE+LPC11_I2C_CONCLR_OFFSET)
-#define LPC11_I2C1_MMCTRL (LPC11_I2C1_BASE+LPC11_I2C_MMCTRL_OFFSET)
-#define LPC11_I2C1_ADR1 (LPC11_I2C1_BASE+LPC11_I2C_ADR1_OFFSET)
-#define LPC11_I2C1_ADR2 (LPC11_I2C1_BASE+LPC11_I2C_ADR2_OFFSET)
-#define LPC11_I2C1_ADR3 (LPC11_I2C1_BASE+LPC11_I2C_ADR3_OFFSET)
-#define LPC11_I2C1_BUFR (LPC11_I2C1_BASE+LPC11_I2C_BUFR_OFFSET)
-#define LPC11_I2C1_MASK0 (LPC11_I2C1_BASE+LPC11_I2C_MASK0_OFFSET)
-#define LPC11_I2C1_MASK1 (LPC11_I2C1_BASE+LPC11_I2C_MASK1_OFFSET)
-#define LPC11_I2C1_MASK2 (LPC11_I2C1_BASE+LPC11_I2C_MASK2_OFFSET)
-#define LPC11_I2C1_MASK3 (LPC11_I2C1_BASE+LPC11_I2C_MASK3_OFFSET)
-
-#define LPC11_I2C2_CONSET (LPC11_I2C2_BASE+LPC11_I2C_CONSET_OFFSET)
-#define LPC11_I2C2_STAT (LPC11_I2C2_BASE+LPC11_I2C_STAT_OFFSET)
-#define LPC11_I2C2_DAT (LPC11_I2C2_BASE+LPC11_I2C_DAT_OFFSET)
-#define LPC11_I2C2_ADR0 (LPC11_I2C2_BASE+LPC11_I2C_ADR0_OFFSET)
-#define LPC11_I2C2_SCLH (LPC11_I2C2_BASE+LPC11_I2C_SCLH_OFFSET)
-#define LPC11_I2C2_SCLL (LPC11_I2C2_BASE+LPC11_I2C_SCLL_OFFSET)
-#define LPC11_I2C2_CONCLR (LPC11_I2C2_BASE+LPC11_I2C_CONCLR_OFFSET)
-#define LPC11_I2C2_MMCTRL (LPC11_I2C2_BASE+LPC11_I2C_MMCTRL_OFFSET)
-#define LPC11_I2C2_ADR1 (LPC11_I2C2_BASE+LPC11_I2C_ADR1_OFFSET)
-#define LPC11_I2C2_ADR2 (LPC11_I2C2_BASE+LPC11_I2C_ADR2_OFFSET)
-#define LPC11_I2C2_ADR3 (LPC11_I2C2_BASE+LPC11_I2C_ADR3_OFFSET)
-#define LPC11_I2C2_BUFR (LPC11_I2C2_BASE+LPC11_I2C_BUFR_OFFSET)
-#define LPC11_I2C2_MASK0 (LPC11_I2C2_BASE+LPC11_I2C_MASK0_OFFSET)
-#define LPC11_I2C2_MASK1 (LPC11_I2C2_BASE+LPC11_I2C_MASK1_OFFSET)
-#define LPC11_I2C2_MASK2 (LPC11_I2C2_BASE+LPC11_I2C_MASK2_OFFSET)
-#define LPC11_I2C2_MASK3 (LPC11_I2C2_BASE+LPC11_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 "LPC11xx User Manual" (UM10398), 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_LPC11XX_HARDWARE_LPC11_I2C_H */
diff --git a/arch/arm/src/lpc11xx/hardware/lpc11_memorymap.h b/arch/arm/src/lpc11xx/hardware/lpc11_memorymap.h
deleted file mode 100644
index 24f6cdf1cce..00000000000
--- a/arch/arm/src/lpc11xx/hardware/lpc11_memorymap.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/************************************************************************************
- * arch/arm/src/lpc11xx/hardware/lpc11_memorymap.h
- *
- * Copyright (C) 2015 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_LPC11XX_HARDWARE_LPC11_MEMORYMAP_H
-#define __ARCH_ARM_SRC_LPC11XX_HARDWARE_LPC11_MEMORYMAP_H
-
-/************************************************************************************
- * Included Files
- ************************************************************************************/
-
-#include
-
-/* This file is only a thin shell that includes the correct memory map definitions
- * for the selected LPC11xx family.
- */
-
-#include
-
-#if defined(LPC111x)
-# include "hardware/lpc111x_memorymap.h"
-#else
-# error "Unrecognized LPC11xx family"
-#endif
-
-/************************************************************************************
- * Pre-processor Definitions
- ************************************************************************************/
-
-/************************************************************************************
- * Public Types
- ************************************************************************************/
-
-/************************************************************************************
- * Public Data
- ************************************************************************************/
-
-/************************************************************************************
- * Public Function Prototypes
- ************************************************************************************/
-
-#endif /* __ARCH_ARM_SRC_LPC11XX_HARDWARE_LPC11_MEMORYMAP_H */
diff --git a/arch/arm/src/lpc11xx/hardware/lpc11_pinconfig.h b/arch/arm/src/lpc11xx/hardware/lpc11_pinconfig.h
deleted file mode 100644
index 08c6ab11d1e..00000000000
--- a/arch/arm/src/lpc11xx/hardware/lpc11_pinconfig.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/************************************************************************************
- * arch/arm/src/lpc11xx/hardware/lpc11_pinconfig.h
- *
- * Copyright (C) 2015 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_LPC11XX_HARDWARE_LPC11_PINCONFIG_H
-#define __ARCH_ARM_SRC_LPC11XX_HARDWARE_LPC11_PINCONFIG_H
-
-/************************************************************************************
- * Included Files
- ************************************************************************************/
-
-#include
-
-/* This file is only a thin shell that includes the correct pin configuration
- * definitions for the selected LPC11xx family.
- */
-
-#include
-
-#if defined(LPC111x)
-# include "hardware/lpc111x_pinconfig.h"
-#else
-# error "Unrecognized LPC11xx family"
-#endif
-
-/************************************************************************************
- * Pre-processor Definitions
- ************************************************************************************/
-
-/************************************************************************************
- * Public Types
- ************************************************************************************/
-
-/************************************************************************************
- * Public Data
- ************************************************************************************/
-
-/************************************************************************************
- * Public Function Prototypes
- ************************************************************************************/
-
-#endif /* __ARCH_ARM_SRC_LPC11XX_HARDWARE_LPC11_PINCONFIG_H */
diff --git a/arch/arm/src/lpc11xx/hardware/lpc11_pmu.h b/arch/arm/src/lpc11xx/hardware/lpc11_pmu.h
deleted file mode 100644
index 226405bc038..00000000000
--- a/arch/arm/src/lpc11xx/hardware/lpc11_pmu.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/************************************************************************************
- * arch/arm/src/lpc11xx/hardware/lpc11_pmu.h
- *
- * Copyright (C) 2015 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_LPC11XX_HARDWARE_LPC11_PMU_H
-#define __ARCH_ARM_SRC_LPC11XX_HARDWARE_LPC11_PMU_H
-
-/************************************************************************************
- * Included Files
- ************************************************************************************/
-
-#include
-
-#include "chip.h"
-#include "hardware/lpc11_memorymap.h"
-
-/************************************************************************************
- * Pre-processor Definitions
- ************************************************************************************/
-
-/* Register offsets *****************************************************************/
-
-#define LPC11_PMU_PCON_OFFSET 0x0000 /* Power control register */
-#define LPC11_PMU_GPREG0 0x0004 /* General purpose register 0 */
-#define LPC11_PMU_GPREG1 0x0008 /* General purpose register 1 */
-#define LPC11_PMU_GPREG2 0x000C /* General purpose register 2 */
-#define LPC11_PMU_GPREG3 0x0010 /* General purpose register 3 */
-#define LPC11_PMU_GPREG4 0x0014 /* General purpose register 0 */
-
-/* Register addresses ***************************************************************/
-
-#define LPC11_PMU_PCON (LPC11_PMU_BASE+LPC11_PMU_PCON_OFFSET)
-#define LPC11_PMU_GPREG0 (LPC11_PMU_BASE+LPC11_PMU_GPREG0)
-#define LPC11_PMU_GPREG1 (LPC11_PMU_BASE+LPC11_PMU_GPREG1)
-#define LPC11_PMU_GPREG2 (LPC11_PMU_BASE+LPC11_PMU_GPREG2)
-#define LPC11_PMU_GPREG3 (LPC11_PMU_BASE+LPC11_PMU_GPREG3)
-#define LPC11_PMU_GPREG4 (LPC11_PMU_BASE+LPC11_PMU_GPREG4)
-
-/* Register bit definitions *********************************************************/
-
-/* Power control register */
- /* Bit 0: Reserved. Do not write 1 to this bit */
-#define PMU_PCON_DPDEN (1 << 1) /* Deep power-down mode enable */
- /* Bits 2-7: Reserved. Do not write ones to this bit */
-#define PMU_PCON_SLEEPFLAG (1 << 8) /* Sleep mode flag */
- /* Bits 9-10: Reserved. Do not write ones to this bit */
-#define PMU_PCON_DPDFLAG (1 << 11) /* Deep power-down flag. */
- /* Bits 12-31: Reserved. Do not write ones to this bit */
-
-
-/* General Purpose REG */
-
-#define PMU_GPREG03_GPDATA_MASK (0xffffffff) /* Bits 0-31: Data retained during Deep power-down mode */
-
-
-/* General Purpose REG4 Register */
-
- /* Bits 0-9: Reserved. Do not write ones to this bit */
-#define PMU_GPREG4_WAKEUPHYS (1 << 10) /* WAKEUP pin hysteresis enable */
-#define PMU_GPREG4_GPDATA_SHIFT 11 /* Data retained during Deep power-down mode. */
-#define PMU_GPREG4_GPDATA_MASK (0x1fffff << PMU_GPREG4_GPDATA_SHIFT)
-
-/************************************************************************************
- * Public Types
- ************************************************************************************/
-
-/************************************************************************************
- * Public Data
- ************************************************************************************/
-
-/************************************************************************************
- * Public Functions
- ************************************************************************************/
-
-#endif /* __ARCH_ARM_SRC_LPC11XX_HARDWARE_LPC11_PMU_H */
diff --git a/arch/arm/src/lpc11xx/hardware/lpc11_ssp.h b/arch/arm/src/lpc11xx/hardware/lpc11_ssp.h
deleted file mode 100644
index ad64d838408..00000000000
--- a/arch/arm/src/lpc11xx/hardware/lpc11_ssp.h
+++ /dev/null
@@ -1,182 +0,0 @@
-/************************************************************************************
- * arch/arm/src/lpc11xx/hardware/lpc11_ssp.h
- *
- * Copyright (C) 2015 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_LPC11XX_HARDWARE_LPC11_SSP_H
-#define __ARCH_ARM_SRC_LPC11XX_HARDWARE_LPC11_SSP_H
-
-/************************************************************************************
- * Included Files
- ************************************************************************************/
-
-#include
-
-#include "chip.h"
-#include "hardware/lpc11_memorymap.h"
-
-/************************************************************************************
- * Pre-processor Definitions
- ************************************************************************************/
-
-/* Register offsets *****************************************************************/
-
-#define LPC11_SSP_CR0_OFFSET 0x0000 /* Control Register 0 */
-#define LPC11_SSP_CR1_OFFSET 0x0004 /* Control Register 1 */
-#define LPC11_SSP_DR_OFFSET 0x0008 /* Data Register */
-#define LPC11_SSP_SR_OFFSET 0x000c /* Status Register */
-#define LPC11_SSP_CPSR_OFFSET 0x0010 /* Clock Prescale Register */
-#define LPC11_SSP_IMSC_OFFSET 0x0014 /* Interrupt Mask Set/Clear Register */
-#define LPC11_SSP_RIS_OFFSET 0x0018 /* Raw Interrupt Status Register */
-#define LPC11_SSP_MIS_OFFSET 0x001c /* Masked Interrupt Status Register */
-#define LPC11_SSP_ICR_OFFSET 0x0020 /* Interrupt Clear Register */
-
-/* Register addresses ***************************************************************/
-/* SPI 0 */
-#define LPC11_SSP0_CR0 (LPC11_SPI0_BASE+LPC11_SSP_CR0_OFFSET)
-#define LPC11_SSP0_CR1 (LPC11_SPI0_BASE+LPC11_SSP_CR1_OFFSET)
-#define LPC11_SSP0_DR (LPC11_SPI0_BASE+LPC11_SSP_DR_OFFSET)
-#define LPC11_SSP0_SR (LPC11_SPI0_BASE+LPC11_SSP_SR_OFFSET)
-#define LPC11_SSP0_CPSR (LPC11_SPI0_BASE+LPC11_SSP_CPSR_OFFSET)
-#define LPC11_SSP0_IMSC (LPC11_SPI0_BASE+LPC11_SSP_IMSC_OFFSET)
-#define LPC11_SSP0_RIS (LPC11_SPI0_BASE+LPC11_SSP_RIS_OFFSET)
-#define LPC11_SSP0_MIS (LPC11_SPI0_BASE+LPC11_SSP_MIS_OFFSET)
-#define LPC11_SSP0_ICR (LPC11_SPI0_BASE+LPC11_SSP_ICR_OFFSET)
-
-/* SPI 1 */
-#define LPC11_SSP1_CR0 (LPC11_SPI1_BASE+LPC11_SSP_CR0_OFFSET)
-#define LPC11_SSP1_CR1 (LPC11_SPI1_BASE+LPC11_SSP_CR1_OFFSET)
-#define LPC11_SSP1_DR (LPC11_SPI1_BASE+LPC11_SSP_DR_OFFSET)
-#define LPC11_SSP1_SR (LPC11_SPI1_BASE+LPC11_SSP_SR_OFFSET)
-#define LPC11_SSP1_CPSR (LPC11_SPI1_BASE+LPC11_SSP_CPSR_OFFSET)
-#define LPC11_SSP1_IMSC (LPC11_SPI1_BASE+LPC11_SSP_IMSC_OFFSET)
-#define LPC11_SSP1_RIS (LPC11_SPI1_BASE+LPC11_SSP_RIS_OFFSET)
-#define LPC11_SSP1_MIS (LPC11_SPI1_BASE+LPC11_SSP_MIS_OFFSET)
-#define LPC11_SSP1_ICR (LPC11_SPI1_BASE+LPC11_SSP_ICR_OFFSET)
-
-/* Register bit definitions *********************************************************/
-
-/* SPI/SSP Control Register 0 */
-
-#define SSP_CR0_DSS_SHIFT (0) /* Data Size Select */
-#define SSP_CR0_DSS_MASK (15 << SSP_CR0_SHIFT)
-# define SSP_CR0_DSS_4BITS (3 << SSP_CR0_DSS_SHIFT) /* 4 bits per transfer */
-# define SSP_CR0_DSS_5BITS (4 << SSP_CR0_DSS_SHIFT) /* 5 bits per transfer */
-# define SSP_CR0_DSS_6BITS (5 << SSP_CR0_DSS_SHIFT) /* 6 bits per transfer */
-# define SSP_CR0_DSS_7BITS (6 << SSP_CR0_DSS_SHIFT) /* 7 bits per transfer */
-# define SSP_CR0_DSS_8BITS (7 << SSP_CR0_DSS_SHIFT) /* 8 bits per transfer */
-# define SSP_CR0_DSS_9BITS (8 << SSP_CR0_DSS_SHIFT) /* 9 bits per transfer */
-# define SSP_CR0_DSS_10BITS (9 << SSP_CR0_DSS_SHIFT) /* 10 bits per transfer */
-# define SSP_CR0_DSS_11BITS (10 << SSP_CR0_DSS_SHIFT) /* 11 bits per transfer */
-# define SSP_CR0_DSS_12BITS (11 << SSP_CR0_DSS_SHIFT) /* 12 bits per transfer */
-# define SSP_CR0_DSS_13BITS (12 << SSP_CR0_DSS_SHIFT) /* 13 bits per transfer */
-# define SSP_CR0_DSS_14BITS (13 << SSP_CR0_DSS_SHIFT) /* 14 bits per transfer */
-# define SSP_CR0_DSS_15BITS (14 << SSP_CR0_DSS_SHIFT) /* 15 bits per transfer */
-# define SSP_CR0_DSS_16BITS (15 << SSP_CR0_DSS_SHIFT) /* 16 bits per transfer */
-#define SSP_CR0_FRF_SHIFT (4) /* Frame Format */
-#define SSP_CR0_FRF_MASK (3 << SSP_CR0_FRF_SHIFT)
-# define SSP_CR0_FRF_SPI (0 << SSP_CR0_FRF_SHIFT) /* SPI Frame Format */
-# define SSP_CR0_FRF_TI (1 << SSP_CR0_FRF_SHIFT) /* TI Frame Format */
-# define SSP_CR0_FRF_MWIRE (2 << SSP_CR0_FRF_SHIFT) /* Microwire Frame Format */
- /* (3 << SSP_CR0_FRF_SHIFT) format is not supported */
-#define SSP_CR0_CPOL (1 << 6) /* Bit 6: Clock polarity control */
-#define SSP_CR0_CPHA (1 << 7) /* Bit 7: Clock phase control */
-#define SSP_CR0_SCR_SHIFT (8) /* Bit 8-15: Serial Clock Rate. PCLK/(CPSDVSR x [SCR + 1] */
-#define SSP_CR0_SCR_MASK (255 << SSP_CR0_SCR_SHIFT)
-
-/* SPI/SSP Control Register 1 */
-
-#define SSP_CR1_LBM (1 << 0) /* Bit 0: Loop Back Mode */
-#define SSP_CR1_SSE (1 << 1) /* Bit 1: SPI 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 */
-
-/* SPI/SSP Data Register */
-
-#define SSP_DR_MASK (0xffff) /* Bits 0-15: Data */
- /* Bits 16-31: Reserved */
-/* SPI/SSP 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 */
-/* SPI/SSP Clock Prescale Register */
-
-#define SSP_CPSR_DVSR_MASK (0xff) /* Even values between 2 and 254 */
-
-/* SPI/SSP Interrupt Mask Set/Clear Register */
-
-#define SSP_IMSC_RORIM (1 << 0) /* Bit 0: Enable Receive Overrun Interrupt */
-#define SSP_IMSC_RTIM (1 << 1) /* Bit 1: Enable Receive Timeout Interrupt */
-#define SSP_IMSC_RXIM (1 << 2) /* Bit 2: Enable Rx FIFO half full Interrupt */
-#define SSP_IMSC_TXIM (1 << 3) /* Bit 3: Enable Tx FIFO halt empty */
- /* Bits 4-31: Reserved */
-
-/* SPI/SSP Raw Interrupt Status */
-
-#define SSP_RIS_RORIS (1 << 0) /* Bit 0: An Overrun event occurred */
-#define SSP_RIS_RTRIS (1 << 1) /* Bit 1: Rx FIFO has data and MCU didn't read it */
-#define SSP_RIS_RXRIS (1 << 2) /* Bit 2: The Rx FIFO is at least half full */
-#define SSP_RIS_TXRIS (1 << 3) /* Bit 3: Tx FIFO is at least halt empty */
- /* Bits 4-31: Reserved */
-
-/* SPI/SSP Masked Interrupt Status Register */
-
-#define SSP_MIS_RORMIS (1 << 0) /* Bit 0: An Overrun occurred and this interrupt is enabled */
-#define SSP_MIS_RTMIS (1 << 1) /* Bit 1: An Rx FIFO timeout happened and this int is enabled */
-#define SSP_MIS_RXMIS (1 << 2) /* Bit 2: Rx FIFO is at least half empty and this int is enabled */
-#define SSP_MIS_TXMIS (1 << 3) /* Bit 3: Tx FIFO is at least halt full and this int is enabled */
- /* Bits 4-31: Reserved */
-/* SPI/SSP Interrupt Clear Register */
-
-#define SSP_ICR_RORIC (1 << 0) /* Bit 0: Clear Rx FIFO Overrun Interrupt */
-#define SSP_ICR_RTIC (1 << 1) /* Bit 1: Clear Rx FIFO read timeout Interrupt */
- /* Bits 2-31: Reserved */
-
-/************************************************************************************
- * Public Types
- ************************************************************************************/
-
-/************************************************************************************
- * Public Data
- ************************************************************************************/
-
-/************************************************************************************
- * Public Functions
- ************************************************************************************/
-
-#endif /* __ARCH_ARM_SRC_LPC11XX_HARDWARE_LPC11_SPI_H */
diff --git a/arch/arm/src/lpc11xx/hardware/lpc11_syscon.h b/arch/arm/src/lpc11xx/hardware/lpc11_syscon.h
deleted file mode 100644
index ac9a15477c1..00000000000
--- a/arch/arm/src/lpc11xx/hardware/lpc11_syscon.h
+++ /dev/null
@@ -1,449 +0,0 @@
-/********************************************************************************************
- * arch/arm/src/lpc11xx/hardware/lpc11_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_LPC11XX_HARDWARE_LPC11_SYSCON_H
-#define __ARCH_ARM_SRC_LPC11XX_HARDWARE_LPC11_SYSCON_H
-
-/********************************************************************************************
- * Included Files
- ********************************************************************************************/
-
-#include
-
-#include "chip.h"
-#include "hardware/lpc11_memorymap.h"
-
-/********************************************************************************************
- * Pre-processor Definitions
- ********************************************************************************************/
-
-/* Register offsets *************************************************************************/
-
-#define LPC11_SYSCON_SYSMEMREMAP_OFFSET 0x0000 /* System memory remap */
-#define LPC11_SYSCON_PRESETCTRL_OFFSET 0x0004 /* Pefipheral reset control */
-#define LPC11_SYSCON_SYSPLLCTRL_OFFSET 0x0008 /* System PLL control */
-#define LPC11_SYSCON_SYSPLLSTAT_OFFSET 0x000C /* System PLL status */
- /* 0x010 - 0x01c: Reserved */
-
-#define LPC11_SYSCON_SYSOSCCTRL_OFFSET 0x0020 /* System oscillator control */
-#define LPC11_SYSCON_WDTOSCCTRL_OFFSET 0x0024 /* Watchdog oscillator control */
-#define LPC11_SYSCON_IRCCTRL_OFFSET 0x0028 /* IRC control */
- /* 0x02c: Reserved */
-
-#define LPC11_SYSCON_SYSRSTSTAT_OFFSET 0x0030 /* System reset status register */
- /* 0x034 - 0x03c: Reserved */
-
-#define LPC11_SYSCON_SYSPLLCLKSEL_OFFSET 0x0040 /* System PLL clock source select */
-#define LPC11_SYSCON_SYSPLLCLKUEN_OFFSET 0x0044 /* System PLL clock source update enable */
- /* 0x048 - 0x06c: Reserved */
-
-#define LPC11_SYSCON_MAINCLKSEL_OFFSET 0x0070 /* Main clock source select */
-#define LPC11_SYSCON_MAINCLKUEN_OFFSET 0x0074 /* Main clock source update enable */
-#define LPC11_SYSCON_SYSAHBCLKDIV_OFFSET 0x0078 /* System AHB clock divider */
- /* 0x07c: Reserved */
-
-#define LPC11_SYSCON_SYSAHBCLKCTRL_OFFSET 0x0080 /* System AHB clock control */
- /* 0x084 - 0x090: Reserved */
-
-#define LPC11_SYSCON_SSP0CLKDIV_OFFSET 0x0094 /* SPI0 clock divider */
-#define LPC11_SYSCON_UARTCLKDIV_OFFSET 0x0098 /* UART clock divider */
-#define LPC11_SYSCON_SSP1CLKDIV_OFFSET 0x009c /* SPI1 clock divider */
- /* 0x0a0 - 0x0cc: Reserved */
-
-#define LPC11_SYSCON_WDTCLKSEL_OFFSET 0x00d0 /* WDT clock source select */
-#define LPC11_SYSCON_WDTCLKUEN_OFFSET 0x00d4 /* WDT clock source update enable */
-#define LPC11_SYSCON_WDTCLKDIV_OFFSET 0x00d8 /* WDT clock divider */
- /* 0x0dc: Reserved */
-
-#define LPC11_SYSCON_CLKOUTCLKSEL_OFFSET 0x00e0 /* CLKOUT clock source select */
-#define LPC11_SYSCON_CLKOUTUEN_OFFSET 0x00e4 /* CLKOUT clock source update enable */
-#define LPC11_SYSCON_CLKOUTCLKDIV_OFFSET 0x00e8 /* CLKOUT clock divider */
- /* 0x0ec - 0x0fc: Reserved */
-
-#define LPC11_SYSCON_PIOPORCAP0_OFFSET 0x0100 /* POR captured PIO status 0 */
-#define LPC11_SYSCON_PIOPORCAP1_OFFSET 0x0104 /* POR captured PIO status 1 */
- /* 0x108 - 0x14c: Reserved */
-
-#define LPC11_SYSCON_BODCTRL_OFFSET 0x0150 /* BOD control */
-#define LPC11_SYSCON_SYSTCKCAL_OFFSET 0x0154 /* System tick counter calibration */
- /* 0x158 - 0x16c: Reserved */
-
-#define LPC11_SYSCON_IRQLATENCY_OFFSET 0x0170 /* IRQ delay */
-#define LPC11_SYSCON_NMISRC_OFFSET 0x0174 /* NMI source selection */
- /* 0x178 - 0x1fc: Reserved */
-
-#define LPC11_SYSCON_STARTAPRP0_OFFSET 0x0200 /* Start logic edge control register 0 */
-#define LPC11_SYSCON_STARTERP0_OFFSET 0x0204 /* Start logic signal enable register 0 */
-#define LPC11_SYSCON_STARTRSRP0CLR_OFFSET 0x0208 /* Start logic reset register 0 */
-#define LPC11_SYSCON_STARTSRP0_OFFSET 0x020c /* Start logic status register 0 */
- /* 0x210 - 0x22c: Reserved */
-
-#define LPC11_SYSCON_PDSLEEPCFG_OFFSET 0x0230 /* Power-down states in Deep-sleep mode */
-#define LPC11_SYSCON_PDAWAKECFG_OFFSET 0x0234 /* Power-down states after wake-up from Deep-sleep mode */
-#define LPC11_SYSCON_PDRUNCFG_OFFSET 0x0238 /* Power-down configuration register */
- /* 0x023c - 0x3f0: Reserved */
-#define LPC11_SYSCON_DEVICE_ID_OFFSET 0x03f4 /* Device ID register 0 for parts LPC1100, LPC1100C, LPC1100L */
-
-
-/* Register addresses ***********************************************************************/
-
-#define LPC11_SYSCON_SYSMEMREMAP (LPC11_SYSCON_BASE + LPC11_SYSCON_SYSMEMREMAP_OFFSET)
-
-#define LPC11_SYSCON_PRESETCTRL (LPC11_SYSCON_BASE + LPC11_SYSCON_PRESETCTRL_OFFSET)
-#define LPC11_SYSCON_SYSPLLCTRL (LPC11_SYSCON_BASE + LPC11_SYSCON_SYSPLLCTRL_OFFSET)
-#define LPC11_SYSCON_SYSPLLSTAT (LPC11_SYSCON_BASE + LPC11_SYSCON_SYSPLLSTAT_OFFSET)
-
-#define LPC11_SYSCON_SYSOSCCTRL (LPC11_SYSCON_BASE + LPC11_SYSCON_SYSOSCCTRL_OFFSET)
-#define LPC11_SYSCON_WDTOSCCTRL (LPC11_SYSCON_BASE + LPC11_SYSCON_WDTOSCCTRL_OFFSET)
-#define LPC11_SYSCON_IRCCTRL (LPC11_SYSCON_BASE + LPC11_SYSCON_IRCCTRL_OFFSET)
-
-#define LPC11_SYSCON_SYSRSTSTAT (LPC11_SYSCON_BASE + LPC11_SYSCON_SYSRSTSTAT_OFFSET)
-
-#define LPC11_SYSCON_SYSPLLCLKSEL (LPC11_SYSCON_BASE + LPC11_SYSCON_SYSPLLCLKSEL_OFFSET)
-#define LPC11_SYSCON_SYSPLLCLKUEN (LPC11_SYSCON_BASE + LPC11_SYSCON_SYSPLLCLKUEN_OFFSET)
-
-#define LPC11_SYSCON_MAINCLKSEL (LPC11_SYSCON_BASE + LPC11_SYSCON_MAINCLKSEL_OFFSET)
-#define LPC11_SYSCON_MAINCLKUEN (LPC11_SYSCON_BASE + LPC11_SYSCON_MAINCLKUEN_OFFSET)
-
-#define LPC11_SYSCON_SYSAHBCLKDIV (LPC11_SYSCON_BASE + LPC11_SYSCON_SYSAHBCLKDIV_OFFSET)
-#define LPC11_SYSCON_SYSAHBCLKCTRL (LPC11_SYSCON_BASE + LPC11_SYSCON_SYSAHBCLKCTRL_OFFSET)
-
-#define LPC11_SYSCON_SSP0CLKDIV (LPC11_SYSCON_BASE + LPC11_SYSCON_SSP0CLKDIV_OFFSET)
-#define LPC11_SYSCON_UARTCLKDIV (LPC11_SYSCON_BASE + LPC11_SYSCON_UARTCLKDIV_OFFSET)
-#define LPC11_SYSCON_SSP1CLKDIV (LPC11_SYSCON_BASE + LPC11_SYSCON_SSP1CLKDIV_OFFSET)
-
-#define LPC11_SYSCON_WDTCLKSEL (LPC11_SYSCON_BASE + LPC11_SYSCON_WDTCLKSEL_OFFSET)
-#define LPC11_SYSCON_WDTCLKUEN (LPC11_SYSCON_BASE + LPC11_SYSCON_WDTCLKUEN_OFFSET)
-#define LPC11_SYSCON_WDTCLKDIV (LPC11_SYSCON_BASE + LPC11_SYSCON_WDTCLKDIV_OFFSET)
-
-#define LPC11_SYSCON_CLKOUTCLKSEL (LPC11_SYSCON_BASE + LPC11_SYSCON_CLKOUTCLKSEL_OFFSET)
-#define LPC11_SYSCON_CLKOUTUEN (LPC11_SYSCON_BASE + LPC11_SYSCON_CLKOUTUEN_OFFSET_OFFSET)
-#define LPC11_SYSCON_CLKOUTCLKDIV (LPC11_SYSCON_BASE + LPC11_SYSCON_CLKOUTCLKDIV_OFFSET)
-
-#define LPC11_SYSCON_PIOPORCAP0 (LPC11_SYSCON_BASE + LPC11_SYSCON_PIOPORCAP0_OFFSET)
-#define LPC11_SYSCON_PIOPORCAP1 (LPC11_SYSCON_BASE + LPC11_SYSCON_PIOPORCAP1_OFFSET)
-
-#define LPC11_SYSCON_BODCTRL (LPC11_SYSCON_BASE + LPC11_SYSCON_BODCTRL_OFFSET)
-#define LPC11_SYSCON_SYSTCKCAL (LPC11_SYSCON_BASE + LPC11_SYSCON_SYSTCKCAL_OFFSET)
-
-#define LPC11_SYSCON_IRQLATENCY (LPC11_SYSCON_BASE + LPC11_SYSCON_IRQLATENCY_OFFSET)
-#define LPC11_SYSCON_NMISRC (LPC11_SYSCON_BASE + LPC11_SYSCON_NMISRC_OFFSET)
-
-#define LPC11_SYSCON_STARTAPRP0 (LPC11_SYSCON_BASE + LPC11_SYSCON_STARTAPRP0_OFFSET)
-#define LPC11_SYSCON_STARTERP0 (LPC11_SYSCON_BASE + LPC11_SYSCON_STARTERP0_OFFSET)
-#define LPC11_SYSCON_STARTRSRP0CLR (LPC11_SYSCON_BASE + LPC11_SYSCON_STARTRSRP0CLR_OFFSET)
-#define LPC11_SYSCON_STARTSRP0 (LPC11_SYSCON_BASE + LPC11_SYSCON_STARTSRP0_OFFSET)
-
-#define LPC11_SYSCON_PDSLEEPCFG (LPC11_SYSCON_BASE + LPC11_SYSCON_PDSLEEPCFG_OFFSET)
-#define LPC11_SYSCON_PDAWAKECFG (LPC11_SYSCON_BASE + LPC11_SYSCON_PDAWAKECFG_OFFSET)
-#define LPC11_SYSCON_PDRUNCFG (LPC11_SYSCON_BASE + LPC11_SYSCON_PDRUNCFG_OFFSET)
-
-#define LPC11_SYSCON_DEVICE_ID (LPC11_SYSCON_BASE + LPC11_SYSCON_DEVICE_ID_OFFSET)
-
-/* Register bit definitions *****************************************************************/
-
-#define SYSCON_SYSMEMREMAP_MAP_SHIFT (0) /* Bits 0-1: System memory remap register */
-#define SYSCON_SYSMEMREMAP_MAP_MASK (3 << SYSCON_SYSMEMREMAP_MAP_SHIFT)
-# define SYSCON_SYSMEMREMAP_MAP_BOOTLOADER (0 << SYSCON_SYSMEMREMAP_MAP_SHIFT) /* Interrupt vectors are re-mapped to Boot ROM */
-# define SYSCON_SYSMEMREMAP_MAP_RAM (1 << SYSCON_SYSMEMREMAP_MAP_SHIFT) /* Interrupt vectors are re-mapped to Static RAM */
-# define SYSCON_SYSMEMREMAP_MAP_FLASH (2 << SYSCON_SYSMEMREMAP_MAP_SHIFT) /* Interrupt vectors are keeped in flash */
- /* Bits 2-31: Reserved */
-
-#define SYSCON_PRESETCTRL_SSP0_RST_N (1 << 0) /* SPI0 reset control */
-#define SYSCON_PRESETCTRL_I2C0_RST_N (1 << 1) /* I2C0 reset control */
-#define SYSCON_PRESETCTRL_SSP1_RST_N (1 << 2) /* SPI1 reset control */
-#define SYSCON_PRESETCTRL_CAN_RST_N (1 << 3) /* C_CAN reset control */
- /* Bits 4-31: Reserved */
-
-#define SYSCON_SYSPLLCTRL_MSEL_SHIFT (0) /* Bits 0-4: Feedback divider value. */
-#define SYSCON_SYSPLLCTRL_MSEL_MASK (0x1f << SYSCON_SYSPLLCTRL_MSEL_SHIFT)
-# define SYSCON_SYSPLLCTRL_MSEL_DIV(n) ((n-1) << SYSCON_SYSPLLCTRL_MSEL_SHIFT) /* n=1,2,3,..32 */
-#define SYSCON_SYSPLLCTRL_PSEL_SHIFT (5) /* Bits 5-6: Post divider ratio P. The division ratio is 2 x P */
-#define SYSCON_SYSPLLCTRL_PSEL_MASK (3 << SYSCON_SYSPLLCTRL_PSEL_SHIFT)
-# define SYSCON_SYSPLLCTRL_PSEL_DIV1 (0 << SYSCON_SYSPLLCTRL_PSEL_SHIFT)
-# define SYSCON_SYSPLLCTRL_PSEL_DIV2 (1 << SYSCON_SYSPLLCTRL_PSEL_SHIFT)
-# define SYSCON_SYSPLLCTRL_PSEL_DIV4 (2 << SYSCON_SYSPLLCTRL_PSEL_SHIFT)
-# define SYSCON_SYSPLLCTRL_PSEL_DIV8 (3 << SYSCON_SYSPLLCTRL_PSEL_SHIFT)
- /* Bits 7-31: Reserved */
-
-#define SYSCON_SYSPLLSTAT_LOCK (1 << 0) /* PLL lock status. 0 = PLL not locked, 1 = PLL locked */
- /* Bits 1-31: Reserved */
-
-#define SYSCON_SYSOSCCTRL_BYPASS (1 << 0) /* Bypass system oscillator */
-#define SYSCON_SYSOSCCTRL_FREQRANGE (1 << 1) /* Determines freq. range for low-power oscillator */
- /* Bits 2-31: Reserved */
-#define SYSCON_WDTOSCCTRL_DIVSEL_SHIFT (0) /* Bits 0-4: Select divider for Fclkana. wdt_osc_clk = Fclkana/(2x(1+DIVSEL)) */
-#define SYSCON_WDTOSCCTRL_DIVSEL_MASK (0x1f << SYSCON_WDTOSCCTRL_DIVSEL_SHIFT)
-# define SYSCON_WDTOSCCTRL_DIVSEL(n) (((n-2)/2) << SYSCON_WDTOSCCTRL_DIVSEL_SHIFT) /* n = 2,4,8,..64 */
-#define SYSCON_WDTOSCCTRL_FREQSEL_SHIFT (5) /* Bits 5-8: Select watchdog oscillator analog output frequency */
-#define SYSCON_WDTOSCCTRL_FREQSEL_MASK (15 << SYSCON_WDTOSCCTRL_FREQSEL_SHIFT)
-# define SYSCON_WDTOSCCTRL_FREQSEL_0p6Mhz (1 << SYSCON_WDTOSCCTRL_FREQSEL_SHIFT) /* Select watchdog osc analog freq 0.6 MHz */
-# define SYSCON_WDTOSCCTRL_FREQSEL_1p05Mhz (2 << SYSCON_WDTOSCCTRL_FREQSEL_SHIFT) /* Select watchdog osc analog freq 1.05 MHz */
-# define SYSCON_WDTOSCCTRL_FREQSEL_1p4Mhz (3 << SYSCON_WDTOSCCTRL_FREQSEL_SHIFT) /* Select watchdog osc analog freq 1.4 MHz */
-# define SYSCON_WDTOSCCTRL_FREQSEL_1p75Mhz (4 << SYSCON_WDTOSCCTRL_FREQSEL_SHIFT) /* Select watchdog osc analog freq 1.75 MHz */
-# define SYSCON_WDTOSCCTRL_FREQSEL_2p1Mhz (5 << SYSCON_WDTOSCCTRL_FREQSEL_SHIFT) /* Select watchdog osc analog freq 2.1 MHz */
-# define SYSCON_WDTOSCCTRL_FREQSEL_2p4Mhz (6 << SYSCON_WDTOSCCTRL_FREQSEL_SHIFT) /* Select watchdog osc analog freq 2.4 MHz */
-# define SYSCON_WDTOSCCTRL_FREQSEL_2p7Mhz (7 << SYSCON_WDTOSCCTRL_FREQSEL_SHIFT) /* Select watchdog osc analog freq 2.7 MHz */
-# define SYSCON_WDTOSCCTRL_FREQSEL_3Mhz (8 << SYSCON_WDTOSCCTRL_FREQSEL_SHIFT) /* Select watchdog osc analog freq 3.0 MHz */
-# define SYSCON_WDTOSCCTRL_FREQSEL_3p25Mhz (9 << SYSCON_WDTOSCCTRL_FREQSEL_SHIFT) /* Select watchdog osc analog freq 3.25 MHz */
-# define SYSCON_WDTOSCCTRL_FREQSEL_3p5Mhz (10 << SYSCON_WDTOSCCTRL_FREQSEL_SHIFT) /* Select watchdog osc analog freq 3.5 MHz */
-# define SYSCON_WDTOSCCTRL_FREQSEL_3p75Mhz (11 << SYSCON_WDTOSCCTRL_FREQSEL_SHIFT) /* Select watchdog osc analog freq 3.75 MHz */
-# define SYSCON_WDTOSCCTRL_FREQSEL_4Mhz (12 << SYSCON_WDTOSCCTRL_FREQSEL_SHIFT) /* Select watchdog osc analog freq 4 MHz */
-# define SYSCON_WDTOSCCTRL_FREQSEL_4p2Mhz (13 << SYSCON_WDTOSCCTRL_FREQSEL_SHIFT) /* Select watchdog osc analog freq 4.2 MHz */
-# define SYSCON_WDTOSCCTRL_FREQSEL_4p4Mhz (14 << SYSCON_WDTOSCCTRL_FREQSEL_SHIFT) /* Select watchdog osc analog freq 4.4 MHz */
-# define SYSCON_WDTOSCCTRL_FREQSEL_4p6Mhz (15 << SYSCON_WDTOSCCTRL_FREQSEL_SHIFT) /* Select watchdog osc analog freq 4.6 MHz */
- /* Bits 9-31: Reserved */
-
-#define SYSCON_IRCCTRL_TRIM_MASK (0xff) /* Bits 0-7: Trim value used to adjust on-chip 12 MHz oscillator */
- /* Bits 8-31: Reserved */
-
-#define SYSCON_SYSRSTSTAT_POR (1 << 0) /* POR reset status */
-#define SYSCON_SYSRSTSTAT_EXTRST (1 << 1) /* Status of the external /RESET pin */
-#define SYSCON_SYSRSTSTAT_WDT (1 << 2) /* Status of the Watchdog reset */
-#define SYSCON_SYSRSTSTAT_BOD (1 << 3) /* Status of Brown-out detect reset */
-#define SYSCON_SYSRSTSTAT_SYSRST (1 << 4) /* Status of the software system reset */
- /* Bits 5-31: Reserved */
-
-#define SYSCON_SYSPLLCLKSEL_SHIFT (0) /* Bits 0-1: System PLL clock source */
-#define SYSCON_SYSPLLCLKSEL_MASK (3 << SYSCON_SYSPLLCLKSEL_SHIFT)
-# define SYSCON_SYSPLLCLKSEL_IRCOSC (0 << SYSCON_SYSPLLCLKSEL_SHIFT)
-# define SYSCON_SYSPLLCLKSEL_SYSOSC (1 << SYSCON_SYSPLLCLKSEL_SHIFT)
- /* Bits 2-31: Reserved */
-
-#define SYSCON_SYSPLLCLKUEN_ENA (1 << 0) /* Bit 0: Enable system PLL clock source update */
- /* Bits 1-31: Reserved */
-
-#define SYSCON_MAINCLKSEL_SHIFT (0) /* Bits 0-1: Clock source for main clock */
-#define SYSCON_MAINCLKSEL_MASK (3 << SYSCON_MAINCLKSEL_SHIFT)
-# define SYSCON_MAINCLKSEL_IRCOSC (0 << SYSCON_MAINCLKSEL_SHIFT) /* IRC oscillator */
-# define SYSCON_MAINCLKSEL_PLLOSC (1 << SYSCON_MAINCLKSEL_SHIFT) /* Input clock to system PLL */
-# define SYSCON_MAINCLKSEL_WDTOSC (2 << SYSCON_MAINCLKSEL_SHIFT) /* WDT oscillator */
-# define SYSCON_MAINCLKSEL_SYSPLLCLKOUT (3 << SYSCON_MAINCLKSEL_SHIFT) /* System PLL clock out */
- /* Bits 2-31: Reserved */
-
-#define SYSCON_MAINCLKUEN_ENA (1 << 0) /* Bit 0: Enable main clock source update */
- /* Bits 1-31: Reserved */
-
-#define SYSCON_SYSAHBCLKDIV_SHIFT (0) /* Bits 0-7: 0=System clock disabled, 1=Divide by 1 ... 255 = Divide by 255 */
-#define SYSCON_SYSAHBCLKDIV_MASK (0xff << SYSCON_SYSAHBCLKDIV_SHIFT)
- /* Bits 8-31: Reserved */
-//# define SYSCON_CCLKCFG_DIV(n) ((n-1) << SYSCON_CCLKCFG_SHIFT) /* n=2,3,..255 */
-
-#define SYSCON_SYSAHBCLKCTRL_SYS (1 << 0) /* Bit 0: Enables clock for AHB to APB bridge */
-#define SYSCON_SYSAHBCLKCTRL_ROM (1 << 1) /* Bit 1: Enables clock for ROM */
-#define SYSCON_SYSAHBCLKCTRL_RAM (1 << 2) /* Bit 2: Enables clock for RAM */
-#define SYSCON_SYSAHBCLKCTRL_FLASHREG (1 << 3) /* Bit 3: Enables clock for flash register interface */
-#define SYSCON_SYSAHBCLKCTRL_FLASHARRAY (1 << 4) /* Bit 4: Enables clock for flash array access */
-#define SYSCON_SYSAHBCLKCTRL_I2C0 (1 << 5) /* Bit 5: Enables clock for I2C0 */
-#define SYSCON_SYSAHBCLKCTRL_GPIO (1 << 6) /* Bit 6: Enables clock for GPIO */
-#define SYSCON_SYSAHBCLKCTRL_CT16B0 (1 << 7) /* Bit 7: Enables clock for 16-bit counter/timer 0 */
-#define SYSCON_SYSAHBCLKCTRL_CT16B1 (1 << 8) /* Bit 8: Enables clock for 16-bit counter/timer 1 */
-#define SYSCON_SYSAHBCLKCTRL_CT32B0 (1 << 9) /* Bit 9: Enables clock for 32-bit counter/timer 0 */
-#define SYSCON_SYSAHBCLKCTRL_CT32B1 (1 << 10) /* Bit 10: Enables clock for 32-bit counter/timer 1 */
-#define SYSCON_SYSAHBCLKCTRL_SSP0 (1 << 11) /* Bit 11: Enables clock for SPI0 */
-#define SYSCON_SYSAHBCLKCTRL_UART (1 << 12) /* Bit 12: Enables clock for UART */
-#define SYSCON_SYSAHBCLKCTRL_ADC (1 << 13) /* Bit 13: Enables clock for ADC */
- /* Bit 14: Reserved */
-#define SYSCON_SYSAHBCLKCTRL_WDT (1 << 15) /* Bit 15: Enables clock for WDT */
-#define SYSCON_SYSAHBCLKCTRL_IOCON (1 << 16) /* Bit 16: Enables clock for I/O configuration block */
-#define SYSCON_SYSAHBCLKCTRL_CAN (1 << 17) /* Bit 17: Enables clock for C_CAN */
-#define SYSCON_SYSAHBCLKCTRL_SSP1 (1 << 18) /* Bit 18: Enables clock for SPI1 */
- /* Bits 19-31: Reserved */
-
-#define SYSCON_SSP0CLKDIV_MASK (0xff) /* Bits 0-7: 0=Disable SPI0_PCLK, 1=Divide by 1 ... 255 = Divide by 255 */
- /* Bits 8-31: Reserved */
-
-#define SYSCON_UARTCLKDIV_MASK (0xff) /* Bits 0-7: 0=Disable UART_PCLK, 1=Divide by 1 ... 255 = Divide by 255 */
- /* Bits 8-31: Reserved */
-
-#define SYSCON_SSP1CLKDIV_MASK (0xff) /* Bits 0-7: 0=Disable SPI1_PCLK, 1=Divide by 1 ... 255 = Divide by 255 */
- /* Bits 8-31: Reserved */
-
-#define SYSCON_WDTCLKSEL_SHIFT (0) /* Bits 0-1: WDT clock source */
-#define SYSCON_WDTCLKSEL_MASK (3 << SYSCON_WDTCLKSEL_SHIFT)
-# define SYSCON_WDTCLKSEL_IRCOSC (0 << SYSCON_WDTCLKSEL_SHIFT) /* IRC oscillator */
-# define SYSCON_WDTCLKSEL_MAINCLK (1 << SYSCON_WDTCLKSEL_SHIFT) /* Main clock */
-# define SYSCON_WDTCLKSEL_WDTOSC (2 << SYSCON_WDTCLKSEL_SHIFT) /* Watchdog oscillator */
- /* Bits 2-31: reserved */
-
-#define SYSCON_WDTCLKUEN_ENA (1 << 0) /* Bit 0: Enable WDT clock source update */
- /* Bits 1-31: Reserved */
-
-#define SYSCON_WDTCLKDIV_MASK (0xff) /* Bits 0-7: 0=Disable WDCLK, 1=Divide by 1 ... 255 = Divide by 255 */
- /* Bits 8-31: Reserved */
-
-#define SYSCON_CLKOUTCLKSEL_SHIFT (0) /* Bits 0-1: CLKOUT clock source */
-#define SYSCON_CLKOUTCLKSEL_MASK (3 << SYSCON_CLKOUTCLKSEL_SHIFT)
-# define SYSCON_CLKOUTCLKSEL_IRCOSC (0 << SYSCON_CLKOUTCLKSEL_SHIFT) /* IRC oscillator */
-# define SYSCON_CLKOUTCLKSEL_SYSOSC (1 << SYSCON_CLKOUTCLKSEL_SHIFT) /* System oscillator */
-# define SYSCON_CLKOUTCLKSEL_WDTOSC (2 << SYSCON_CLKOUTCLKSEL_SHIFT) /* Watchdog oscillator */
-# define SYSCON_CLKOUTCLKSEL_MAINCLK (3 << SYSCON_CLKOUTCLKSEL_SHIFT) /* Main clock */
- /* Bits 2-31: Reserved */
-
-#define SYSCON_CLKOUTUEN_ENA (1 << 0) /* Bit 0: Enable CLKOUT clock source update */
- /* Bits 1-31: Reserved */
-
-#define SYSCON_CLKOUTCLKDIV_MASK (0xff) /* Bits 0-7: 0=Disable CLKOUT, 1=Divide by 1 ... 255 = Divide by 255 */
- /* Bits 1-31: Reserved */
-
-#define SYSCON_PIOPORCAP0_CAPPIO0_SHIFT (0) /* Bits 0-11: Raw reset stats input PIO0_n: PIO0_11 to PIO0_0 */
-#define SYSCON_PIOPORCAP0_CAPPIO0_MASK (0xfff << SYSCON_PIOPORCAP0_CAPPIO0_SHIFT)
-# define SYSCON_PIOPORCAP0_CAPPIO0_BIT(n) ((1 << n) << SYSCON_PIOPORCAP0_CAPPIO0_SHIFT) /* n = 0 to 11 */
-
-#define SYSCON_PIOPORCAP0_CAPPIO1_SHIFT (12) /* Bits 12-23: Raw reset stats input PIO0_n: PIO1_11 to PIO1_0 */
-#define SYSCON_PIOPORCAP0_CAPPIO1_MASK (0xfff << SYSCON_PIOPORCAP0_CAPPIO1_SHIFT)
-# define SYSCON_PIOPORCAP0_CAPPIO1_BIT(n) ((1 << n) << SYSCON_PIOPORCAP0_CAPPIO1_SHIFT) /* n = 0 to 11 */
-
-#define SYSCON_PIOPORCAP0_CAPPIO2_SHIFT (24) /* Bits 24-31: Raw reset stats input PIO0_n: PIO2_11 to PIO2_0 */
-#define SYSCON_PIOPORCAP0_CAPPIO2_MASK (0xfff << SYSCON_PIOPORCAP0_CAPPIO2_SHIFT)
-# define SYSCON_PIOPORCAP0_CAPPIO2_BIT(n) ((1 << n) << SYSCON_PIOPORCAP0_CAPPIO2_SHIFT) /* n = 0 to 11 */
-
-
-#define SYSCON_PIOPORCAP1_CAPPIO2_8 (1 << 0) /* Bit 0: Raw reset status input PIO2_8 */
-#define SYSCON_PIOPORCAP1_CAPPIO2_9 (1 << 1) /* Bit 1: Raw reset status input PIO2_9 */
-#define SYSCON_PIOPORCAP1_CAPPIO2_10 (1 << 2) /* Bit 2: Raw reset status input PIO2_10 */
-#define SYSCON_PIOPORCAP1_CAPPIO2_11 (1 << 3) /* Bit 3: Raw reset status input PIO2_11 */
-#define SYSCON_PIOPORCAP1_CAPPIO3_0 (1 << 4) /* Bit 4: Raw reset status input PIO3_0 */
-#define SYSCON_PIOPORCAP1_CAPPIO3_1 (1 << 5) /* Bit 5: Raw reset status input PIO3_1 */
-#define SYSCON_PIOPORCAP1_CAPPIO3_2 (1 << 6) /* Bit 6: Raw reset status input PIO3_2 */
-#define SYSCON_PIOPORCAP1_CAPPIO3_3 (1 << 7) /* Bit 7: Raw reset status input PIO3_3 */
-#define SYSCON_PIOPORCAP1_CAPPIO3_4 (1 << 8) /* Bit 8: Raw reset status input PIO3_4 */
-#define SYSCON_PIOPORCAP1_CAPPIO3_5 (1 << 9) /* Bit 9: Raw reset status input PIO3_5 */
- /* Bits 10-31: Reserved */
-
-#define SYSCON_BODCTRL_BODRSTLEV_SHIFT (0) /* Bits 0-1: BOD reset level */
-#define SYSCON_BODCTRL_BODRSTLEV_MASK (3 << SYSCON_BODCTRL_BODRSTLEV_SHIFT)
-# define SYSCON_BODCTRL_BODRSTLEV_LEVEL0 (0 << SYSCON_BODCTRL_BODRSTLEV_SHIFT) /* Level 0: assert 1.46V, de-assert 1.63V */
-# define SYSCON_BODCTRL_BODRSTLEV_LEVEL1 (1 << SYSCON_BODCTRL_BODRSTLEV_SHIFT) /* Level 1: assert 2.06V, de-assert 2.15V */
-# define SYSCON_BODCTRL_BODRSTLEV_LEVEL2 (2 << SYSCON_BODCTRL_BODRSTLEV_SHIFT) /* Level 2: assert 2.35V, de-assert 2.43V */
-# define SYSCON_BODCTRL_BODRSTLEV_LEVEL3 (3 << SYSCON_BODCTRL_BODRSTLEV_SHIFT) /* Level 3: assert 2.63V, de-assert 2.71V */
-#define SYSCON_BODCTRL_BODINTVAL_SHIFT (2) /* Bits 2-3: BOD interrupt level */
-#define SYSCON_BODCTRL_BODINTVAL_MASK (3 << SYSCON_BODCTRL_BODRSTLEV_BODINTVAL_SHIFT)
-# define SYSCON_BODCTRL_BODINTVAL_LEVEL0 (0 << SYSCON_BODCTRL_BODINTVAL_SHIFT) /* Level 0: Reserved */
-# define SYSCON_BODCTRL_BODINTVAL_LEVEL1 (1 << SYSCON_BODCTRL_BODINTVAL_SHIFT) /* Level 1: int. assert 2.22V,de-a. 2.35V */
-# define SYSCON_BODCTRL_BODINTVAL_LEVEL2 (2 << SYSCON_BODCTRL_BODINTVAL_SHIFT) /* Level 2: int. assert 2.52V,de-a. 2.66V */
-# define SYSCON_BODCTRL_BODINTVAL_LEVEL3 (3 << SYSCON_BODCTRL_BODINTVAL_SHIFT) /* Level 3: int. assert 2.80V,de-a. 2.90V */
-#define SYSCON_BODCTRL_BODRSTENA (1 << 4) /* BOD reset enable */
- /* Bits 5-31: Reserved */
-
-#define SYSCON_SYSTCKCAL_CAL 0x3ffffff /* Bits 0-25: System tick timer calibration value */
- /* Bits 26-31: Reserved */
-
-#define SYSCON_IRQLATENCY_LATENCY_MASK (0xff) /* Bits 0-7: 8-bit latency value */
- /* Bits 8-31: Reserved */
-
-#define SYSCON_NMISRC_IRQNO_SHIFT (0) /* Bits 0-4: The IRQ number of interrupt that acts as NMI if bit 31 is 1 */
-#define SYSCON_NMISRC_IRQNO_MASK (31 << SYSCON_NMISRC_IRQNO_SHIFT)
- /* Bits 5-30: Reserved */
-#define SYSCON_NMISRC_NMIEN (1 << 31) /* Write 1 to this bit to enable NMI source selected by bits 4:0 */
-
-#define SYSCON_STARTAPRP0_APRPIO0_SHIFT (0) /* Bits 0-11: Edge select for start logic input PIO0_[0-11], 0=fall/1=rise */
-#define SYSCON_STARTAPRP0_APRPIO0_MASK (0xfff << SYSCON_STARTAPRP0_APRPIO0_SHIFT)
-# define SYSCON_STARTAPRP0_APRPIO0_BIT(n) ((1 << n) << SYSCON_STARTAPRP0_APRPIO0_SHIFT) /* n = 0 to 11 */
-#define SYSCON_STARTAPRP0_APRPIO1_0 (1 << 12) /* Bit 12: Edge select start logic input PIO1_0, 0=falling/1=rising */
- /* Bits 13-31: Reserved */
-
-#define SYSCON_STARTERP0_ERPIO0_SHIFT (0) /* Bits 0-11: Enable start signal for start logic input PIO0[0-11] */
-#define SYSCON_STARTERP0_ERPIO0_MASK (0xfff << SYSCON_STARTERP0_ERPIO0_SHIFT)
-# define SYSCON_STARTERP0_ERPIO0_BIT(n) ((1 << n) << SYSCON_STARTERP0_ERPIO0_SHIFT) /* n = 0 to 11 */
-#define SYSCON_STARTERP0_ERPIO1_0 (1 << 12) /* Bit 12: Enable start signal for start logic input PIO1_0 */
- /* Bits 13-31: Reserved */
-
-#define SYSCON_STARTRSRP0CLR_RSRPIO0_SHIFT (0) /* Bits 0-11: Start logic reset register 0 */
-#define SYSCON_STARTRSRP0CLR_RSRPIO0_MASK (0xfff << SYSCON_STARTRSRP0CLR_RSRPIO0_SHIFT)
-# define SYSCON_STARTRSRP0CLR_RSRPIO0_BIT(n) ((1 << n) << SYSCON_STARTRSRP0CLR_RSRPIO0_SHIFT) /* n = 0 to 11 */
-#define SYSCON_STARTRSRP0CLR_RSRPIO1_0 (1 << 12) /* Bit 12: Start signal reset for start logic input PIO1_0 */
- /* Bits 13-31: Reserved */
-
-#define SYSCON_STARTSRP0_SRPIO0_SHIFT (0) /* Bits 0-11: Start logic status register 0 */
-#define SYSCON_STARTSRP0_SRPIO0_MASK (0xfff << SYSCON_STARTSRP0_SRPIO0_SHIFT)
-# define SYSCON_STARTSRP0_SRPIO0_BIT(n) ((1 << n) << SYSCON_STARTSRP0_SRPIO0_SHIFT) /* n = 0 to 11 */
-#define SYSCON_STARTSRP0_SRPIO1_0 (1 << 12) /* Bit 12: Start signal status for start logic input PIO1_0 */
- /* Bits 13-31: Reserved */
-
- /* Bits 0-2: Reserved. NOTE: Always write these bits as 111 */
-#define SYSCON_PDSLEEPCFG_BOD_PD (1 << 3) /* BOD power-down control in Deep-sleep mode */
- /* Bits 4-5: Reserved. NOTE: Always write these bits as 11 */
-#define SYSCON_PDSLEEPCFG_WDTOSC_PD (1 << 6) /* Watchdog oscillator power control in Deep-sleep mode */
- /* Bit 7: Reserved. NOTE: Always write this bit as 1 */
- /* Bits 8-10: Reserved NOTE: Always write these bits as 000 */
- /* Bits 11-12: Reserved. NOTE: Always write these bits as 11 */
- /* Bits 13-31: Reserved */
-
-#define SYSCON_PDAWAKECFG_IRCOUT_PD (1 << 0) /* Bit 0: IRC oscillator output wake-up configuration */
-#define SYSCON_PDAWAKECFG_IRC_PD (1 << 1) /* Bit 1: IRC oscillator wake-up configuration */
-#define SYSCON_PDAWAKECFG_FLASH_PD (1 << 2) /* Bit 2: Flash wake-up configuration */
-#define SYSCON_PDAWAKECFG_BOD_PD (1 << 3) /* Bit 3: Brownout Detection wake-up configuration */
-#define SYSCON_PDAWAKECFG_ADC_PD (1 << 4) /* Bit 4: ADC wake-up configuration */
-#define SYSCON_PDAWAKECFG_SYSOSC_PD (1 << 5) /* Bit 5: System oscillator wake-up configuration */
-#define SYSCON_PDAWAKECFG_WDTOSC_PD (1 << 6) /* Bit 6: Watchdog oscillator wake-up configuration */
-#define SYSCON_PDAWAKECFG_SYSPLL_PD (1 << 7) /* Bit 7: System PLL wake-up configuration */
- /* Bit 8: Reserved. NOTE: Always write this bit as 1 */
- /* Bit 9: Reserved. NOTE: Always write this bit as 0 */
- /* Bit 10: Reserved. NOTE: Always write this bit as 1 */
- /* Bit 11: Reserved. NOTE: Always write this bit as 1 */
- /* Bit 12: Reserved. NOTE: Always write this bit as 0 */
- /* Bits 13-15: Reserved. NOTE: Always write these bits as 111 */
- /* Bits 16-31: Reserved */
-
-#define SYSCON_PDRUNCFG_IRCOUT_PD (1 << 0) /* Bit 0: IRC oscillator output power-down */
-#define SYSCON_PDRUNCFG_IRC_PD (1 << 1) /* Bit 1: IRC oscillator power-down */
-#define SYSCON_PDRUNCFG_FLASH_PD (1 << 2) /* Bit 2: Flash power-down */
-#define SYSCON_PDRUNCFG_BOD_PD (1 << 3) /* Bit 3: Brownout Detection power-down */
-#define SYSCON_PDRUNCFG_ADC_PD (1 << 4) /* Bit 4: ADC power-down */
-#define SYSCON_PDRUNCFG_SYSOSC_PD (1 << 5) /* Bit 5: System oscillator power-down */
-#define SYSCON_PDRUNCFG_WDTOSC_PD (1 << 6) /* Bit 6: Watchdog oscillator power-down */
-#define SYSCON_PDRUNCFG_SYSPLL_PD (1 << 7) /* Bit 7: System PLL power-down */
- /* Bit 8: Reserved. NOTE: Always write this bit as 1 */
- /* Bit 9: Reserved. NOTE: Always write this bit as 0 */
- /* Bit 10: Reserved. NOTE: Always write this bit as 1 */
- /* Bit 11: Reserved. NOTE: Always write this bit as 1 */
- /* Bit 12: Reserved. NOTE: Always write this bit as 0 */
- /* Bits 13-15: Reserved. NOTE: Always write these bits as 111 */
- /* Bits 16-31: Reserved */
-
-/********************************************************************************************
- * Public Types
- ********************************************************************************************/
-
-/********************************************************************************************
- * Public Data
- ********************************************************************************************/
-
-/********************************************************************************************
- * Public Functions
- ********************************************************************************************/
-
-#endif /* __ARCH_ARM_SRC_LPC11XX_HARDWARE_LPC11_SYSCON_H */
diff --git a/arch/arm/src/lpc11xx/hardware/lpc11_timer.h b/arch/arm/src/lpc11xx/hardware/lpc11_timer.h
deleted file mode 100644
index cc343f28c0a..00000000000
--- a/arch/arm/src/lpc11xx/hardware/lpc11_timer.h
+++ /dev/null
@@ -1,271 +0,0 @@
-/************************************************************************************
- * arch/arm/src/lpc11xx/hardware/lpc11_timer.h
- *
- * Copyright (C) 2015 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_LPC11XX_HARDWARE_LPC11_TIMER_H
-#define __ARCH_ARM_SRC_LPC11XX_HARDWARE_LPC11_TIMER_H
-
-/************************************************************************************
- * Included Files
- ************************************************************************************/
-
-#include
-
-#include "chip.h"
-#include "hardware/lpc11_memorymap.h"
-
-/************************************************************************************
- * Pre-processor Definitions
- ************************************************************************************/
-
-/* Register offsets *****************************************************************/
-
-#define LPC11_TMR_IR_OFFSET 0x0000 /* Interrupt Register */
-#define LPC11_TMR_TCR_OFFSET 0x0004 /* Timer Control Register */
-#define LPC11_TMR_TC_OFFSET 0x0008 /* Timer Counter */
-#define LPC11_TMR_PR_OFFSET 0x000c /* Prescale Register */
-#define LPC11_TMR_PC_OFFSET 0x0010 /* Prescale Counter */
-#define LPC11_TMR_MCR_OFFSET 0x0014 /* Match Control Register */
-#define LPC11_TMR_MR0_OFFSET 0x0018 /* Match Register 0 */
-#define LPC11_TMR_MR1_OFFSET 0x001c /* Match Register 1 */
-#define LPC11_TMR_MR2_OFFSET 0x0020 /* Match Register 2 */
-#define LPC11_TMR_MR3_OFFSET 0x0024 /* Match Register 3 */
-#define LPC11_TMR_CCR_OFFSET 0x0028 /* Capture Control Register */
-#define LPC11_TMR_CR0_OFFSET 0x002c /* Capture Register 0 */
-#define LPC11_TMR_CR1_OFFSET 0x0030 /* Capture Register 1 */
-#define LPC11_TMR_EMR_OFFSET 0x003c /* External Match Register */
-#define LPC11_TMR_CTCR_OFFSET 0x0070 /* Count Control Register */
-#define LPC11_TMR_PWMC_OFFSET 0x0074 /* PWM Control Register */
-
-/* Register addresses ***************************************************************/
-
-#define LPC11_TMR16B0IR (LPC11_TMR16B0_BASE+LPC11_TMR_IR_OFFSET)
-#define LPC11_TMR16B0TCR (LPC11_TMR16B0_BASE+LPC11_TMR_TCR_OFFSET)
-#define LPC11_TMR16B0TC (LPC11_TMR16B0_BASE+LPC11_TMR_TC_OFFSET)
-#define LPC11_TMR16B0PR (LPC11_TMR16B0_BASE+LPC11_TMR_PR_OFFSET)
-#define LPC11_TMR16B0PC (LPC11_TMR16B0_BASE+LPC11_TMR_PC_OFFSET)
-#define LPC11_TMR16B0MCR (LPC11_TMR16B0_BASE+LPC11_TMR_MCR_OFFSET)
-#define LPC11_TMR16B0MR0 (LPC11_TMR16B0_BASE+LPC11_TMR_MR0_OFFSET)
-#define LPC11_TMR16B0MR1 (LPC11_TMR16B0_BASE+LPC11_TMR_MR1_OFFSET)
-#define LPC11_TMR16B0MR2 (LPC11_TMR16B0_BASE+LPC11_TMR_MR2_OFFSET)
-#define LPC11_TMR16B0MR3 (LPC11_TMR16B0_BASE+LPC11_TMR_MR3_OFFSET)
-#define LPC11_TMR16B0CCR (LPC11_TMR16B0_BASE+LPC11_TMR_CCR_OFFSET)
-#define LPC11_TMR16B0CR0 (LPC11_TMR16B0_BASE+LPC11_TMR_CR0_OFFSET)
-#define LPC11_TMR16B0CR1 (LPC11_TMR16B0_BASE+LPC11_TMR_CR1_OFFSET)
-#define LPC11_TMR16B0EMR (LPC11_TMR16B0_BASE+LPC11_TMR_EMR_OFFSET)
-#define LPC11_TMR16B0CTCR (LPC11_TMR16B0_BASE+LPC11_TMR_CTCR_OFFSET)
-#define LPC11_TMR16B0PWMC (LPC11_TMR16B0_BASE+LPC11_TMR_PWMC_OFFSET)
-
-#define LPC11_TMR16B1IR (LPC11_TMR16B1_BASE+LPC11_TMR_IR_OFFSET)
-#define LPC11_TMR16B1TCR (LPC11_TMR16B1_BASE+LPC11_TMR_TCR_OFFSET)
-#define LPC11_TMR16B1TC (LPC11_TMR16B1_BASE+LPC11_TMR_TC_OFFSET)
-#define LPC11_TMR16B1PR (LPC11_TMR16B1_BASE+LPC11_TMR_PR_OFFSET)
-#define LPC11_TMR16B1PC (LPC11_TMR16B1_BASE+LPC11_TMR_PC_OFFSET)
-#define LPC11_TMR16B1MCR (LPC11_TMR16B1_BASE+LPC11_TMR_MCR_OFFSET)
-#define LPC11_TMR16B1MR0 (LPC11_TMR16B1_BASE+LPC11_TMR_MR0_OFFSET)
-#define LPC11_TMR16B1MR1 (LPC11_TMR16B1_BASE+LPC11_TMR_MR1_OFFSET)
-#define LPC11_TMR16B1MR2 (LPC11_TMR16B1_BASE+LPC11_TMR_MR2_OFFSET)
-#define LPC11_TMR16B1MR3 (LPC11_TMR16B1_BASE+LPC11_TMR_MR3_OFFSET)
-#define LPC11_TMR16B1CCR (LPC11_TMR16B1_BASE+LPC11_TMR_CCR_OFFSET)
-#define LPC11_TMR16B1CR0 (LPC11_TMR16B1_BASE+LPC11_TMR_CR0_OFFSET)
-#define LPC11_TMR16B1CR1 (LPC11_TMR16B1_BASE+LPC11_TMR_CR1_OFFSET)
-#define LPC11_TMR16B1EMR (LPC11_TMR16B1_BASE+LPC11_TMR_EMR_OFFSET)
-#define LPC11_TMR16B1CTCR (LPC11_TMR16B1_BASE+LPC11_TMR_CTCR_OFFSET)
-#define LPC11_TMR16B1PWMC (LPC11_TMR16B1_BASE+LPC11_TMR_PWMC_OFFSET)
-
-#define LPC11_TMR32B0IR (LPC11_TMR32B0_BASE+LPC11_TMR_IR_OFFSET)
-#define LPC11_TMR32B0TCR (LPC11_TMR32B0_BASE+LPC11_TMR_TCR_OFFSET)
-#define LPC11_TMR32B0TC (LPC11_TMR32B0_BASE+LPC11_TMR_TC_OFFSET)
-#define LPC11_TMR32B0PR (LPC11_TMR32B0_BASE+LPC11_TMR_PR_OFFSET)
-#define LPC11_TMR32B0PC (LPC11_TMR32B0_BASE+LPC11_TMR_PC_OFFSET)
-#define LPC11_TMR32B0MCR (LPC11_TMR32B0_BASE+LPC11_TMR_MCR_OFFSET)
-#define LPC11_TMR32B0MR0 (LPC11_TMR32B0_BASE+LPC11_TMR_MR0_OFFSET)
-#define LPC11_TMR32B0MR1 (LPC11_TMR32B0_BASE+LPC11_TMR_MR1_OFFSET)
-#define LPC11_TMR32B0MR2 (LPC11_TMR32B0_BASE+LPC11_TMR_MR2_OFFSET)
-#define LPC11_TMR32B0MR3 (LPC11_TMR32B0_BASE+LPC11_TMR_MR3_OFFSET)
-#define LPC11_TMR32B0CCR (LPC11_TMR32B0_BASE+LPC11_TMR_CCR_OFFSET)
-#define LPC11_TMR32B0CR0 (LPC11_TMR32B0_BASE+LPC11_TMR_CR0_OFFSET)
-#define LPC11_TMR32B0CR1 (LPC11_TMR32B0_BASE+LPC11_TMR_CR1_OFFSET)
-#define LPC11_TMR32B0EMR (LPC11_TMR32B0_BASE+LPC11_TMR_EMR_OFFSET)
-#define LPC11_TMR32B0CTCR (LPC11_TMR32B0_BASE+LPC11_TMR_CTCR_OFFSET)
-#define LPC11_TMR32B0PWMC (LPC11_TMR32B0_BASE+LPC11_TMR_PWMC_OFFSET)
-
-#define LPC11_TMR32B1IR (LPC11_TMR32B1_BASE+LPC11_TMR_IR_OFFSET)
-#define LPC11_TMR32B1TCR (LPC11_TMR32B1_BASE+LPC11_TMR_TCR_OFFSET)
-#define LPC11_TMR32B1TC (LPC11_TMR32B1_BASE+LPC11_TMR_TC_OFFSET)
-#define LPC11_TMR32B1PR (LPC11_TMR32B1_BASE+LPC11_TMR_PR_OFFSET)
-#define LPC11_TMR32B1PC (LPC11_TMR32B1_BASE+LPC11_TMR_PC_OFFSET)
-#define LPC11_TMR32B1MCR (LPC11_TMR32B1_BASE+LPC11_TMR_MCR_OFFSET)
-#define LPC11_TMR32B1MR0 (LPC11_TMR32B1_BASE+LPC11_TMR_MR0_OFFSET)
-#define LPC11_TMR32B1MR1 (LPC11_TMR32B1_BASE+LPC11_TMR_MR1_OFFSET)
-#define LPC11_TMR32B1MR2 (LPC11_TMR32B1_BASE+LPC11_TMR_MR2_OFFSET)
-#define LPC11_TMR32B1MR3 (LPC11_TMR32B1_BASE+LPC11_TMR_MR3_OFFSET)
-#define LPC11_TMR32B1CCR (LPC11_TMR32B1_BASE+LPC11_TMR_CCR_OFFSET)
-#define LPC11_TMR32B1CR0 (LPC11_TMR32B1_BASE+LPC11_TMR_CR0_OFFSET)
-#define LPC11_TMR32B1CR1 (LPC11_TMR32B1_BASE+LPC11_TMR_CR1_OFFSET)
-#define LPC11_TMR32B1EMR (LPC11_TMR32B1_BASE+LPC11_TMR_EMR_OFFSET)
-#define LPC11_TMR32B1CTCR (LPC11_TMR32B1_BASE+LPC11_TMR_CTCR_OFFSET)
-#define LPC11_TMR32B1PWMC (LPC11_TMR32B1_BASE+LPC11_TMR_PWMC_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_MR0INT (1 << 0) /* Bit 0: Match channel 0 interrupt */
-#define TMR_MR1INT (1 << 1) /* Bit 1: Match channel 1 interrupt */
-#define TMR_MR2INT (1 << 2) /* Bit 2: Match channel 2 interrupt */
-#define TMR_MR3INT (1 << 3) /* Bit 3: Match channel 3 interrupt */
-#define TMR_CR0INT (1 << 4) /* Bit 4: Capture channel 0 interrupt */
-#define TMR_CR1INT (1 << 5) /* Bit 5: Capture channel 1 interrupt */
- /* Bits 6-31: Reserved */
-/* Timer Control Register */
-
-#define TMR_TCR_CEN (1 << 0) /* Bit 0: Counter Enable */
-#define TMR_TCR_CRST (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 */
-#define TMR_CTCR_ENCC (1 << 4) /* Enable Clear Timer/Prescale when capture event happens */
-#define TMR_CTCR_SELCC_SHIFT (5) /* Bits 5-7: Selects which capture event will clear Timer/Prescale */
-#define TMR_CTCR_SELCC_MASK (3 << TMR_CTCR_SELCC_SHIFT)
-# define TMR_CTCR_SELCC_RECAP0 (0 << TMR_CTCR_SELCC_SHIFT) /* Rising edge CAP0 clears timer (if bit 4 is set) */
-# define TMR_CTCR_SELCC_FECAP0 (1 << TMR_CTCR_SELCC_SHIFT) /* Falling edge CAP0 clears timer (if bit 4 is set) */
-# define TMR_CTCR_SELCC_RECAP1 (2 << TMR_CTCR_SELCC_SHIFT) /* Rising edge CAP1 clears timer (if bit 4 is set) */
-# define TMR_CTCR_SELCC_FECAP1 (3 << TMR_CTCR_SELCC_SHIFT) /* Falling edge CAP1 clears timer (if bit 4 is set) */
- /* Bits 8-31: Reserved */
-
-/* PWM Control register */
-
-#define TMR_PWMC_PWMEN0 (1 << 0) /* PWM channel0 enable */
-#define TMR_PWMC_PWMEN1 (1 << 1) /* PWM channel1 enable */
-#define TMR_PWMC_PWMEN2 (1 << 2) /* PWM channel2 enable */
-#define TMR_PWMC_PWMEN3 (1 << 3) /* PWM channel3 enable */
- /* Bits 4-31: Reserved */
-
-/************************************************************************************
- * Public Types
- ************************************************************************************/
-
-/************************************************************************************
- * Public Data
- ************************************************************************************/
-
-/************************************************************************************
- * Public Functions
- ************************************************************************************/
-
-#endif /* __ARCH_ARM_SRC_LPC11XX_HARDWARE_LPC11_TIMER_H */
diff --git a/arch/arm/src/lpc11xx/hardware/lpc11_uart.h b/arch/arm/src/lpc11xx/hardware/lpc11_uart.h
deleted file mode 100644
index a8be2e9bbe0..00000000000
--- a/arch/arm/src/lpc11xx/hardware/lpc11_uart.h
+++ /dev/null
@@ -1,261 +0,0 @@
-/************************************************************************************
- * arch/arm/src/lpc11xx/hardware/lpc11_uart.h
- *
- * Copyright (C) 2015 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_LPC11XX_HARDWARE_LPC11_UART_H
-#define __ARCH_ARM_SRC_LPC11XX_HARDWARE_LPC11_UART_H
-
-/************************************************************************************
- * Included Files
- ************************************************************************************/
-
-#include
-
-#include "chip.h"
-#include "hardware/lpc11_memorymap.h"
-
-/************************************************************************************
- * Pre-processor Definitions
- ************************************************************************************/
-
-/* Register offsets *****************************************************************/
-
-#define LPC11_UART_RBR_OFFSET 0x0000 /* (DLAB =0) Receiver Buffer Register (all) */
-#define LPC11_UART_THR_OFFSET 0x0000 /* (DLAB =0) Transmit Holding Register (all) */
-#define LPC11_UART_DLL_OFFSET 0x0000 /* (DLAB =1) Divisor Latch LSB (all) */
-#define LPC11_UART_DLM_OFFSET 0x0004 /* (DLAB =1) Divisor Latch MSB (all) */
-#define LPC11_UART_IER_OFFSET 0x0004 /* (DLAB =0) Interrupt Enable Register (all) */
-#define LPC11_UART_IIR_OFFSET 0x0008 /* Interrupt ID Register (all) */
-#define LPC11_UART_FCR_OFFSET 0x0008 /* FIFO Control Register (all) */
-#define LPC11_UART_LCR_OFFSET 0x000c /* Line Control Register (all) */
-#define LPC11_UART_MCR_OFFSET 0x0010 /* Modem Control Register (UART1 only) */
-#define LPC11_UART_LSR_OFFSET 0x0014 /* Line Status Register (all) */
-#define LPC11_UART_MSR_OFFSET 0x0018 /* Modem Status Register (UART1 only) */
-#define LPC11_UART_SCR_OFFSET 0x001c /* Scratch Pad Register (all) */
-#define LPC11_UART_ACR_OFFSET 0x0020 /* Auto-baud Control Register (all) */
-#define LPC11_UART_FDR_OFFSET 0x0028 /* Fractional Divider Register (all) */
-#define LPC11_UART_TER_OFFSET 0x0030 /* Transmit Enable Register (all) */
-#define LPC11_UART_RS485CTRL_OFFSET 0x004c /* RS-485/EIA-485 Control (UART1 only) */
-#define LPC11_UART_ADRMATCH_OFFSET 0x0050 /* RS-485/EIA-485 address match (UART1 only) */
-#define LPC11_UART_RS485DLY_OFFSET 0x0054 /* RS-485/EIA-485 direction control delay (UART1 only) */
-
-/* Register addresses ***************************************************************/
-
-#define LPC11_UART0_RBR (LPC11_UART0_BASE+LPC11_UART_RBR_OFFSET)
-#define LPC11_UART0_THR (LPC11_UART0_BASE+LPC11_UART_THR_OFFSET)
-#define LPC11_UART0_DLL (LPC11_UART0_BASE+LPC11_UART_DLL_OFFSET)
-#define LPC11_UART0_DLM (LPC11_UART0_BASE+LPC11_UART_DLM_OFFSET)
-#define LPC11_UART0_IER (LPC11_UART0_BASE+LPC11_UART_IER_OFFSET)
-#define LPC11_UART0_IIR (LPC11_UART0_BASE+LPC11_UART_IIR_OFFSET)
-#define LPC11_UART0_FCR (LPC11_UART0_BASE+LPC11_UART_FCR_OFFSET)
-#define LPC11_UART0_LCR (LPC11_UART0_BASE+LPC11_UART_LCR_OFFSET)
-#define LPC11_UART0_MCR (LPC11_UART0_BASE+LPC11_UART_MCR_OFFSET)
-#define LPC11_UART0_LSR (LPC11_UART0_BASE+LPC11_UART_LSR_OFFSET)
-#define LPC11_UART0_SCR (LPC11_UART0_BASE+LPC11_UART_SCR_OFFSET)
-#define LPC11_UART0_ACR (LPC11_UART0_BASE+LPC11_UART_ACR_OFFSET)
-#define LPC11_UART0_ICR (LPC11_UART0_BASE+LPC11_UART_ICR_OFFSET)
-#define LPC11_UART0_FDR (LPC11_UART0_BASE+LPC11_UART_FDR_OFFSET)
-#define LPC11_UART0_TER (LPC11_UART0_BASE+LPC11_UART_TER_OFFSET)
-#define LPC11_UART0_RS485CTRL (LPC11_UART0_BASE+LPC11_UART_RS485CTRL_OFFSET)
-#define LPC11_UART0_ADRMATCH (LPC11_UART0_BASE+LPC11_UART_ADRMATCH_OFFSET)
-#define LPC11_UART0_RS485DLY (LPC11_UART0_BASE+LPC11_UART_RS485DLY_OFFSET)
-
-/* 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_RXLIE (1 << 2) /* Bit 2: RX Line Interrupt Enable */
- /* Bits 3-7: Reserved */
-#define UART_IER_ABEOINTEN (1 << 8) /* Bit 8: Enables the end of auto-baud interrupt */
-#define UART_IER_ABTOINTEN (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 Interrupt */
-# 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 */
- /* Bits 3-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 */
-
-/* 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 */
-
-#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 */
-
-#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 */
-/************************************************************************************
- * Public Types
- ************************************************************************************/
-
-/************************************************************************************
- * Public Data
- ************************************************************************************/
-
-/************************************************************************************
- * Public Functions
- ************************************************************************************/
-
-#endif /* __ARCH_ARM_SRC_LPC11XX_HARDWARE_LPC11_UART_H */
diff --git a/arch/arm/src/lpc11xx/hardware/lpc11_wdt.h b/arch/arm/src/lpc11xx/hardware/lpc11_wdt.h
deleted file mode 100644
index 9f3f5a99dc4..00000000000
--- a/arch/arm/src/lpc11xx/hardware/lpc11_wdt.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/************************************************************************************
- * arch/arm/src/lpc11xx/hardware/lpc11_wdt.h
- *
- * Copyright (C) 2015 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_LPC11XX_HARDWARE_LPC11_WDT_H
-#define __ARCH_ARM_SRC_LPC11XX_HARDWARE_LPC11_WDT_H
-
-/************************************************************************************
- * Included Files
- ************************************************************************************/
-
-#include
-
-#include "chip.h"
-#include "hardware/lpc11_memorymap.h"
-
-/************************************************************************************
- * Pre-processor Definitions
- ************************************************************************************/
-
-/* Register offsets *****************************************************************/
-
-#define LPC11_WDT_MOD_OFFSET 0x0000 /* Watchdog mode register */
-#define LPC11_WDT_TC_OFFSET 0x0004 /* Watchdog timer constant register */
-#define LPC11_WDT_FEED_OFFSET 0x0008 /* Watchdog feed sequence register */
-#define LPC11_WDT_TV_OFFSET 0x000c /* Watchdog timer value register */
-
-/* Register addresses ***************************************************************/
-
-#define LPC11_WDT_MOD (LPC11_WDT_BASE+LPC11_WDT_MOD_OFFSET)
-#define LPC11_WDT_TC (LPC11_WDT_BASE+LPC11_WDT_TC_OFFSET)
-#define LPC11_WDT_FEED (LPC11_WDT_BASE+LPC11_WDT_FEED_OFFSET)
-#define LPC11_WDT_TV (LPC11_WDT_BASE+LPC11_WDT_TV_OFFSET)
-
-/* 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 */
- /* Bits 4-31: Reserved */
-/* Watchdog timer constant register */
-
-#define WDT_TC (0x00ffffff) /* Bits 0-23: Watchdog time-out interval */
- /* Bits 24-31: Reserved */
-
-/* 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 */
-
-#define WDT_TV (0x00ffffff) /* Bits 0-23: Watchdog timer value */
- /* Bits 24-31: Reserved */
-
-/************************************************************************************
- * Public Types
- ************************************************************************************/
-
-/************************************************************************************
- * Public Data
- ************************************************************************************/
-
-/************************************************************************************
- * Public Functions
- ************************************************************************************/
-
-#endif /* __ARCH_ARM_SRC_LPC11XX_HARDWARE_LPC11_WDT_H */
diff --git a/arch/arm/src/lpc11xx/lpc111x_gpio.c b/arch/arm/src/lpc11xx/lpc111x_gpio.c
deleted file mode 100644
index 630d68f9b16..00000000000
--- a/arch/arm/src/lpc11xx/lpc111x_gpio.c
+++ /dev/null
@@ -1,725 +0,0 @@
-/****************************************************************************
- * arch/arm/src/lpc11xx/lpc111x_gpio.c
- *
- * Copyright (C) 2015 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.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include
-
-#include
-#include
-#include
-#include
-#include
-
-#include
-
-#include "up_arch.h"
-#include "chip.h"
-#include "hardware/lpc111x_iocon.h"
-#include "lpc11_gpio.h"
-
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-
-/* Default input pin configuration */
-
-#define DEFAULT_INPUT (GPIO_INPUT|GPIO_PULLUP)
-
-/****************************************************************************
- * Private Types
- ****************************************************************************/
-
-/****************************************************************************
- * Private Data
- ****************************************************************************/
-
-/****************************************************************************
- * Public Data
- ****************************************************************************/
-/* These tables have global scope because they are also used in
- * lpc11_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_LPC11_GPIOIRQ
-uint64_t g_intedge0;
-uint64_t g_intedge2;
-#endif
-
-/* GPIO register base addresses */
-
-const uint32_t g_gpiobase[GPIO_NPORTS] =
-{
- LPC11_GPIO0_BASE,
- LPC11_GPIO1_BASE,
- LPC11_GPIO2_BASE,
- LPC11_GPIO3_BASE
-};
-
-/* Port 0 and Port 2 can provide a single interrupt for any combination of
- * port pins
- */
-
-const uint32_t g_intbase[GPIO_NPORTS] =
-{
-};
-
-/* Note: The IOCON offset is not linear. See User manual UM10398 Page 74 */
-/* Note: The IOCON base is not linear. See User manual UM10398 Page 74 */
-
-const uint8_t iocon_port0[IOCON_NPINS] =
-{
- LPC11_IOCON_P0_0_OFFSET,
- LPC11_IOCON_P0_1_OFFSET,
- LPC11_IOCON_P0_2_OFFSET,
- LPC11_IOCON_P0_3_OFFSET,
- LPC11_IOCON_P0_4_OFFSET,
- LPC11_IOCON_P0_5_OFFSET,
- LPC11_IOCON_P0_6_OFFSET,
- LPC11_IOCON_P0_7_OFFSET,
- LPC11_IOCON_P0_8_OFFSET,
- LPC11_IOCON_P0_9_OFFSET,
- LPC11_IOCON_P0_10_OFFSET,
- LPC11_IOCON_P0_11_OFFSET
-};
-
-const uint8_t iocon_port1[IOCON_NPINS] =
-{
- LPC11_IOCON_P1_0_OFFSET,
- LPC11_IOCON_P1_1_OFFSET,
- LPC11_IOCON_P1_2_OFFSET,
- LPC11_IOCON_P1_3_OFFSET,
- LPC11_IOCON_P1_4_OFFSET,
- LPC11_IOCON_P1_5_OFFSET,
- LPC11_IOCON_P1_6_OFFSET,
- LPC11_IOCON_P1_7_OFFSET,
- LPC11_IOCON_P1_8_OFFSET,
- LPC11_IOCON_P1_9_OFFSET,
- LPC11_IOCON_P1_10_OFFSET,
- LPC11_IOCON_P1_11_OFFSET
-};
-
-const uint8_t iocon_port2[IOCON_NPINS] =
-{
- LPC11_IOCON_P2_0_OFFSET,
- LPC11_IOCON_P2_1_OFFSET,
- LPC11_IOCON_P2_2_OFFSET,
- LPC11_IOCON_P2_3_OFFSET,
- LPC11_IOCON_P2_4_OFFSET,
- LPC11_IOCON_P2_5_OFFSET,
- LPC11_IOCON_P2_6_OFFSET,
- LPC11_IOCON_P2_7_OFFSET,
- LPC11_IOCON_P2_8_OFFSET,
- LPC11_IOCON_P2_9_OFFSET,
- LPC11_IOCON_P2_10_OFFSET,
- LPC11_IOCON_P2_11_OFFSET
-};
-
-/* There is only IOCON_P3_[0-5] */
-const uint8_t iocon_port3[IOCON_NPINS - 6] =
-{
- LPC11_IOCON_P3_0_OFFSET,
- LPC11_IOCON_P3_1_OFFSET,
- LPC11_IOCON_P3_2_OFFSET,
- LPC11_IOCON_P3_3_OFFSET,
- LPC11_IOCON_P3_4_OFFSET,
- LPC11_IOCON_P3_5_OFFSET
-};
-
-/****************************************************************************
- * Private Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: lpc11_pinfunc
- *
- * Description:
- * Set the PIN function in the IOCON register.
- *
- ****************************************************************************/
-
-static int lpc11_pinfunc(unsigned int port, unsigned int pin,
- unsigned int value)
-{
- const uint8_t *table = NULL;
- uint32_t regaddr;
- uint32_t regval;
-
- switch (port)
- {
- case 0:
- table = iocon_port0;
- break;
- case 1:
- table = iocon_port1;
- break;
- case 2:
- table = iocon_port2;
- break;
- case 3:
- table = iocon_port3;
- break;
- }
-
- regaddr = LPC11_IOCON_BASE + table[pin];
- if (regaddr != 0)
- {
- /* Set the requested value in the IOCON register */
-
- regval = getreg32(regaddr);
- regval &= ~(IOCON_FUNC_MASK);
- regval |= (value << IOCON_FUNC_SHIFT);
- putreg32(regval, regaddr);
- return OK;
-
- }
-
- return -EINVAL;
-}
-
-/****************************************************************************
- * Name: lpc11_pullup
- *
- * Description:
- * Get the address of the PINMODE register corresponding to this port and
- * pin number.
- *
- ****************************************************************************/
-
-static int lpc11_pullup(lpc11_pinset_t cfgset, unsigned int port,
- unsigned int pin)
-{
- const uint8_t *table = NULL;
- uint32_t regaddr;
- uint32_t regval;
- uint32_t value;
-
- switch (cfgset & GPIO_PUMODE_MASK)
- {
- default:
- case GPIO_PULLUP: /* Pull-up resistor enabled */
- value = IOCON_MODE_PU;
- break;
-
- case GPIO_REPEATER: /* Repeater mode enabled */
- value = IOCON_MODE_RM;
- break;
-
- case GPIO_FLOAT: /* Neither pull-up nor -down */
- value = IOCON_MODE_FLOAT;
- break;
-
- case GPIO_PULLDN: /* Pull-down resistor enabled */
- value = IOCON_MODE_PD;
- break;
- }
-
- switch (port)
- {
- case 0:
- table = iocon_port0;
- break;
- case 1:
- table = iocon_port1;
- break;
- case 2:
- table = iocon_port2;
- break;
- case 3:
- table = iocon_port3;
- break;
- }
-
-
- /* Fetch the IOCON register address for this port/pin combination */
-
- regaddr = LPC11_IOCON_BASE + table[pin];
- if (regaddr != 0)
- {
- /* Set the requested value in the IOCON register */
-
- regval = getreg32(regaddr);
- regval &= ~(IOCON_MODE_MASK);
- regval |= (value << IOCON_MODE_SHIFT);
- putreg32(regval, regaddr);
- return OK;
- }
-
- return -EINVAL;
-}
-
-/****************************************************************************
- * Name: lpc11_setintedge
- *
- * Description:
- * Remember the configured interrupt edge. We can't actually enable the
- * the edge interrupts until the called calls IRQ enabled function.
- *
- ****************************************************************************/
-
-#ifdef CONFIG_LPC11_GPIOIRQ
-static void lpc11_setintedge(unsigned int port, unsigned int pin,
- unsigned int value)
-{
- uint64_t *intedge;
- unsigned int shift;
-
- /* Which word to we use? */
-
- if (port == 0)
- {
- intedge = &g_intedge0;
- }
- else if (port == 2)
- {
- intedge = &g_intedge2;
- }
- else
- {
- return;
- }
-
- /* Set the requested value in the IOCON register */
-
- shift = pin << 1;
- *intedge &= ~((uint64_t)3 << shift);
- *intedge |= ((uint64_t)value << shift);
-}
-#endif /* CONFIG_LPC11_GPIOIRQ */
-
-/****************************************************************************
- * Name: lpc11_setopendrain
- *
- * Description:
- * Set the ODMODE register for open drain mode
- *
- ****************************************************************************/
-
-static void lpc11_setopendrain(unsigned int port, unsigned int pin)
-{
- const uint8_t *table = NULL;
- uint32_t regaddr;
- uint32_t regval;
-
- switch (port)
- {
- case 0:
- table = iocon_port0;
- break;
- case 1:
- table = iocon_port1;
- break;
- case 2:
- table = iocon_port2;
- break;
- case 3:
- table = iocon_port3;
- break;
- }
-
- regaddr = LPC11_IOCON_BASE + table[pin];
- if (regaddr != 0)
- {
- /* Set the requested value in the IOCON register */
-
- regval = getreg32(regaddr);
- regval &= ~(IOCON_OD_MASK);
- regval |= (1 << IOCON_OD_SHIFT);
- putreg32(regval, regaddr);
- }
-}
-
-/****************************************************************************
- * Name: lpc11_clropendrain
- *
- * Description:
- * Reset the ODMODE register to disable open drain mode
- *
- ****************************************************************************/
-
-static void lpc11_clropendrain(unsigned int port, unsigned int pin)
-{
- const uint8_t *table = NULL;
- uint32_t regaddr;
- uint32_t regval;
-
- switch (port)
- {
- case 0:
- table = iocon_port0;
- break;
- case 1:
- table = iocon_port1;
- break;
- case 2:
- table = iocon_port2;
- break;
- case 3:
- table = iocon_port3;
- break;
- }
-
- regaddr = LPC11_IOCON_BASE + table[pin];
- if (regaddr != 0)
- {
- /* Set the requested value in the IOCON register */
-
- regval = getreg32(regaddr);
- regval &= ~(1 << IOCON_OD_SHIFT);
- putreg32(regval, regaddr);
- }
-}
-
-/****************************************************************************
- * Name: lpc11_configinput
- *
- * Description:
- * Configure a GPIO input pin based on bit-encoded description of the pin.
- *
- ****************************************************************************/
-
-static inline int lpc11_configinput(lpc11_pinset_t cfgset, unsigned int port,
- unsigned int pin)
-{
- uint32_t regval;
- uint32_t gpiobase;
- uint32_t intbase;
- uint32_t pinmask = (1 << pin);
-
- /* Set up GPIO registers */
-
- gpiobase = g_gpiobase[port];
-
- /* Set as input */
-
- regval = getreg32(gpiobase + LPC11_GPIO_DIR_OFFSET);
- regval &= ~pinmask;
- putreg32(regval, gpiobase + LPC11_GPIO_DIR_OFFSET);
-
- /* Set up interrupt registers */
-
- intbase = g_intbase[port];
- if (intbase != 0)
- {
- /* Disable any rising edge interrupts */
-
- regval = getreg32(intbase + LPC11_GPIO_DIR_OFFSET);
- regval &= ~pinmask;
- putreg32(regval, intbase + LPC11_GPIO_DIR_OFFSET);
-
- /* Disable any falling edge interrupts */
-
- regval = getreg32(intbase + LPC11_GPIO_DIR_OFFSET);
- regval &= ~pinmask;
- putreg32(regval, intbase + LPC11_GPIO_DIR_OFFSET);
-
- /* Forget about any falling/rising edge interrupt enabled */
-
-#ifdef CONFIG_LPC11_GPIOIRQ
- lpc11_setintedge(port, pin, 0);
-#endif
- }
-
- /* Set up IOCON registers */
- /* Configure as GPIO */
-
- lpc11_pinfunc(port, pin, IOCON_FUNC_GPIO);
-
- /* Set pull-up mode */
-
- lpc11_pullup(cfgset, port, pin);
-
- /* Open drain only applies to outputs */
-
- lpc11_clropendrain(port, pin);
-
- return OK;
-}
-
-/****************************************************************************
- * Name: lpc11_configinterrupt
- *
- * Description:
- * Configure a GPIO interrupt pin based on bit-encoded description of the
- * pin.
- *
- ****************************************************************************/
-
-static inline int lpc11_configinterrupt(lpc11_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)lpc11_configinput(cfgset, port, pin);
-
- /* Then just remember the rising/falling edge interrupt enabled */
-
- DEBUGASSERT(port == 0 || port == 2);
-#ifdef CONFIG_LPC11_GPIOIRQ
- lpc11_setintedge(port, pin, (cfgset & GPIO_EDGE_MASK) >> GPIO_EDGE_SHIFT);
-#endif
- return OK;
-}
-
-/****************************************************************************
- * Name: lpc11_configoutput
- *
- * Description:
- * Configure a GPIO output pin based on bit-encoded description of the pin.
- *
- ****************************************************************************/
-
-static inline int lpc11_configoutput(lpc11_pinset_t cfgset, unsigned int port,
- unsigned int pin)
-{
- uint32_t gpiobase;
- uint32_t regval;
-
- /* First, configure the port as a generic input so that we have a known
- * starting point and consistent behavior during the re-configuration.
- */
-
- (void)lpc11_configinput(DEFAULT_INPUT, port, pin);
-
- /* Now, reconfigure the pin as an output */
-
- gpiobase = g_gpiobase[port];
- regval = getreg32(gpiobase + LPC11_GPIO_DIR_OFFSET);
- regval |= (1 << pin);
- putreg32(regval, gpiobase + LPC11_GPIO_DIR_OFFSET);
-
- /* Check for open drain output */
-
- if ((cfgset & GPIO_OPEN_DRAIN) != 0)
- {
- /* Set pull-up mode. This normally only applies to input pins, but does have
- * meaning if the port is an open drain output.
- */
-
- lpc11_pullup(cfgset, port, pin);
-
- /* Select open drain output */
-
- lpc11_setopendrain(port, pin);
- }
-
- /* Set the initial value of the output */
-
- lpc11_gpiowrite(cfgset, ((cfgset & GPIO_VALUE) != GPIO_VALUE_ZERO));
-
- return OK;
-}
-
-/****************************************************************************
- * Name: lpc11_configalternate
- *
- * Description:
- * Configure a GPIO alternate function pin based on bit-encoded description
- * of the pin.
- *
- ****************************************************************************/
-
-static int lpc11_configalternate(lpc11_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)lpc11_configinput(DEFAULT_INPUT, port, pin);
-
- /* Set up IOCON registers */
- /* Configure as GPIO */
-
- lpc11_pinfunc(port, pin, alt);
-
- /* Set pull-up mode */
-
- lpc11_pullup(cfgset, port, pin);
-
- /* Check for open drain output */
-
- if ((cfgset & GPIO_OPEN_DRAIN) != 0)
- {
- /* Select open drain output */
-
- lpc11_setopendrain(port, pin);
- }
-
- return OK;
-}
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: lpc11_configgpio
- *
- * Description:
- * Configure a GPIO pin based on bit-encoded description of the pin.
- *
- ****************************************************************************/
-
-int lpc11_configgpio(lpc11_pinset_t cfgset)
-{
- unsigned int port;
- unsigned int pin;
- int ret = -EINVAL;
-
- /* Verify that this hardware supports the select GPIO port */
-
- port = (cfgset & GPIO_PORT_MASK) >> GPIO_PORT_SHIFT;
- if (port < GPIO_NPORTS)
- {
- /* Get the pin number and select the port configuration register for
- * that pin.
- */
-
- pin = (cfgset & GPIO_PIN_MASK) >> GPIO_PIN_SHIFT;
-
- /* Handle according to pin function */
-
- switch (cfgset & GPIO_FUNC_MASK)
- {
- case GPIO_INPUT: /* GPIO input pin */
- ret = lpc11_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 = lpc11_configinterrupt(cfgset, port, pin);
- break;
-
- case GPIO_OUTPUT: /* GPIO outpout pin */
- ret = lpc11_configoutput(cfgset, port, pin);
- break;
-
- case GPIO_ALT1: /* Alternate function 1 */
- ret = lpc11_configalternate(cfgset, port, pin, IOCON_FUNC_ALT1);
- break;
-
- case GPIO_ALT2: /* Alternate function 2 */
- ret = lpc11_configalternate(cfgset, port, pin, IOCON_FUNC_ALT2);
- break;
-
- case GPIO_ALT3: /* Alternate function 3 */
- ret = lpc11_configalternate(cfgset, port, pin, IOCON_FUNC_ALT3);
- break;
-
- default:
- break;
- }
- }
-
- return ret;
-}
-
-/****************************************************************************
- * Name: lpc11_gpiowrite
- *
- * Description:
- * Write one or zero to the selected GPIO pin
- *
- ****************************************************************************/
-
-void lpc11_gpiowrite(lpc11_pinset_t pinset, bool value)
-{
- uint32_t gpiobase;
- uint32_t offset;
- uint32_t regval;
- unsigned int port;
- unsigned int pin;
-
- port = (pinset & GPIO_PORT_MASK) >> GPIO_PORT_SHIFT;
- if (port < GPIO_NPORTS)
- {
- /* Get the port base address */
-
- gpiobase = g_gpiobase[port];
-
- /* Get the pin number */
-
- pin = (pinset & GPIO_PIN_MASK) >> GPIO_PIN_SHIFT;
-
- /* Set or clear the output on the pin */
-
- offset = LPC11_GPIO_DATA_OFFSET;
-
- regval = getreg32(gpiobase + offset);
- regval &= ~(1 << pin);
- regval |= (value << pin);
- putreg32(regval, gpiobase + offset);
- }
-}
-
-/****************************************************************************
- * Name: lpc11_gpioread
- *
- * Description:
- * Read one or zero from the selected GPIO pin
- *
- ****************************************************************************/
-
-bool lpc11_gpioread(lpc11_pinset_t pinset)
-{
- uint32_t gpiobase;
- unsigned int port;
- unsigned int pin;
-
- port = (pinset & GPIO_PORT_MASK) >> GPIO_PORT_SHIFT;
- if (port < GPIO_NPORTS)
- {
- /* Get the port base address */
-
- gpiobase = g_gpiobase[port];
-
- /* Get the pin number and return the input state of that pin */
-
- pin = (pinset & GPIO_PIN_MASK) >> GPIO_PIN_SHIFT;
- return ((getreg32(gpiobase + LPC11_GPIO_DATA_OFFSET) & (1 << pin)) != 0);
- }
-
- return false;
-}
diff --git a/arch/arm/src/lpc11xx/lpc111x_gpio.h b/arch/arm/src/lpc11xx/lpc111x_gpio.h
deleted file mode 100644
index aec89ce4f73..00000000000
--- a/arch/arm/src/lpc11xx/lpc111x_gpio.h
+++ /dev/null
@@ -1,178 +0,0 @@
-/************************************************************************************
- * arch/arm/src/lpc11xx/lpc111x_gpio.h
- *
- * Copyright (C) 2015 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_LPC11XX_LPC111X_GPIO_H
-#define __ARCH_ARM_SRC_LPC11XX_LPC111X_GPIO_H
-
-/************************************************************************************
- * Included Files
- ************************************************************************************/
-
-/************************************************************************************
- * Pre-processor Definitions
- ************************************************************************************/
-/* Bit-encoded input to lpc11_configgpio() ******************************************/
-
-/* Encoding: FFFF xxMM OVPP NNNN
- *
- * Pin Function: FFF
- * Pin Mode bits: MM
- * Open drain: O (output pins)
- * Initial value: V (output pins)
- * Port number: PP (0-3)
- * Pin number: NNNN (0-11)
- */
-
-/* Pin Function bits: FFF
- * Only meaningful when the GPIO function is GPIO_PIN
- */
-
-#define GPIO_FUNC_SHIFT (12) /* Bits 12-15: GPIO mode */
-#define GPIO_FUNC_MASK (15 << GPIO_FUNC_SHIFT)
-# define GPIO_INPUT (0 << GPIO_FUNC_SHIFT) /* 0000 GPIO input pin */
-# define GPIO_INTFE (1 << GPIO_FUNC_SHIFT) /* 0001 GPIO interrupt falling edge */
-# define GPIO_INTRE (2 << GPIO_FUNC_SHIFT) /* 0010 GPIO interrupt rising edge */
-# define GPIO_INTBOTH (3 << GPIO_FUNC_SHIFT) /* 0011 GPIO interrupt both edges */
-# define GPIO_OUTPUT (4 << GPIO_FUNC_SHIFT) /* 0100 GPIO output pin */
-# define GPIO_ALT_GPIO (5 << GPIO_FUNC_SHIFT) /* 0101 Alternate function is a GPIO */
-# define GPIO_ALT0 (5 << GPIO_FUNC_SHIFT) /* 1000 Alternate function 0 */
-# define GPIO_ALT1 (5 << GPIO_FUNC_SHIFT) /* 1001 Alternate function 1 */
-# define GPIO_ALT2 (6 << GPIO_FUNC_SHIFT) /* 1010 Alternate function 2 */
-# define GPIO_ALT3 (7 << GPIO_FUNC_SHIFT) /* 1011 Alternate function 3 */
-
-#define GPIO_EDGE_SHIFT (13) /* Bits 13-14: Interrupt edge bits */
-#define GPIO_EDGE_MASK (3 << GPIO_EDGE_SHIFT)
-
-#define GPIO_INOUT_MASK GPIO_OUTPUT
-#define GPIO_FE_MASK GPIO_INTFE
-#define GPIO_RE_MASK GPIO_INTRE
-
-#define GPIO_ISGPIO(ps) ((uint16_t(ps) & GPIO_FUNC_MASK) < GPIO_ALT0)
-#define GPIO_ISALT(ps) ((uint16_t(ps) & GPIO_FUNC_MASK) >= GPIO_ALT0)
-#define GPIO_ISINPUT(ps) (((ps) & GPIO_FUNC_MASK) == GPIO_INPUT)
-#define GPIO_ISOUTPUT(ps) (((ps) & GPIO_FUNC_MASK) == GPIO_OUTPUT)
-#define GPIO_ISINORINT(ps) (((ps) & GPIO_INOUT_MASK) == 0)
-#define GPIO_ISOUTORALT(ps) (((ps) & GPIO_INOUT_MASK) != 0)
-#define GPIO_ISINTERRUPT(ps) (GPIO_ISOUTPUT(ps) && !GPIO_ISINPUT(ps))
-#define GPIO_ISFE(ps) (((ps) & GPIO_FE_MASK) != 0)
-#define GPIO_ISRE(ps) (((ps) & GPIO_RE_MASK) != 0)
-
-/* Pin Mode: MM */
-
-#define GPIO_PUMODE_SHIFT (8) /* Bits 8-9: Pin pull-up mode */
-#define GPIO_PUMODE_MASK (3 << GPIO_PUMODE_SHIFT)
-# define GPIO_FLOAT (0 << GPIO_PUMODE_SHIFT) /* Neither pull-up nor -down */
-# define GPIO_PULLDN (1 << GPIO_PUMODE_SHIFT) /* Pull-down resistor enabled */
-# define GPIO_PULLUP (2 << GPIO_PUMODE_SHIFT) /* Pull-up resistor enabled */
-# define GPIO_REPEATER (3 << GPIO_PUMODE_SHIFT) /* Repeater mode enabled */
-
-/* Open drain: O */
-
-#define GPIO_OPEN_DRAIN (1 << 7) /* Bit 7: Open drain mode */
-
-/* Initial value: V */
-
-#define GPIO_VALUE (1 << 6) /* Bit 6: Initial GPIO output value */
-#define GPIO_VALUE_ONE GPIO_VALUE
-#define GPIO_VALUE_ZERO (0)
-
-/* Port number: PP (0-3) */
-
-#define GPIO_PORT_SHIFT (4) /* Bit 4-5: Port number */
-#define GPIO_PORT_MASK (3 << GPIO_PORT_SHIFT)
-# define GPIO_PORT0 (0 << GPIO_PORT_SHIFT)
-# define GPIO_PORT1 (1 << GPIO_PORT_SHIFT)
-# define GPIO_PORT2 (2 << GPIO_PORT_SHIFT)
-# define GPIO_PORT3 (3 << GPIO_PORT_SHIFT)
-
-#define GPIO_NPORTS 4
-
-/* Pin number: NNNN (0-11) */
-
-#define GPIO_PIN_SHIFT 0 /* Bits 0-3: GPIO number: 0-11 */
-#define GPIO_PIN_MASK (15 << GPIO_PIN_SHIFT)
-# define GPIO_PIN0 (0 << GPIO_PIN_SHIFT)
-# define GPIO_PIN1 (1 << GPIO_PIN_SHIFT)
-# define GPIO_PIN2 (2 << GPIO_PIN_SHIFT)
-# define GPIO_PIN3 (3 << GPIO_PIN_SHIFT)
-# define GPIO_PIN4 (4 << GPIO_PIN_SHIFT)
-# define GPIO_PIN5 (5 << GPIO_PIN_SHIFT)
-# define GPIO_PIN6 (6 << GPIO_PIN_SHIFT)
-# define GPIO_PIN7 (7 << GPIO_PIN_SHIFT)
-# define GPIO_PIN8 (8 << GPIO_PIN_SHIFT)
-# define GPIO_PIN9 (9 << GPIO_PIN_SHIFT)
-# define GPIO_PIN10 (10 << GPIO_PIN_SHIFT)
-# define GPIO_PIN11 (11 << GPIO_PIN_SHIFT)
-
-/************************************************************************************
- * Public Types
- ************************************************************************************/
-
-typedef uint16_t lpc11_pinset_t;
-
-/************************************************************************************
- * Public Data
- ************************************************************************************/
-
-#ifndef __ASSEMBLY__
-#undef EXTERN
-#if defined(__cplusplus)
-#define EXTERN extern "C"
-extern "C"
-{
-#else
-#define EXTERN extern
-#endif
-
-/* These tables have global scope only because they are shared between lpc11_gpio.c,
- * lpc11_gpioint.c, and lpc11_gpiodbg.c
- */
-
-EXTERN const uint32_t g_lopinsel[GPIO_NPORTS];
-EXTERN const uint32_t g_hipinsel[GPIO_NPORTS];
-EXTERN const uint32_t g_lopinmode[GPIO_NPORTS];
-EXTERN const uint32_t g_hipinmode[GPIO_NPORTS];
-EXTERN const uint32_t g_odmode[GPIO_NPORTS];
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* __ASSEMBLY__ */
-
-#endif /* __ARCH_ARM_SRC_LPC11XX_LPC111X_GPIO_H */
diff --git a/arch/arm/src/lpc11xx/lpc11_clockconfig.h b/arch/arm/src/lpc11xx/lpc11_clockconfig.h
deleted file mode 100644
index ebec697945a..00000000000
--- a/arch/arm/src/lpc11xx/lpc11_clockconfig.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/************************************************************************************
- * arch/arm/src/lpc11xx/lpc11_clockconfig.h
- *
- * Copyright (C) 2015 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_LPC11XX_LPC11_CLOCKCONFIG_H
-#define __ARCH_ARM_SRC_LPC11XX_LPC11_CLOCKCONFIG_H
-
-/************************************************************************************
- * Included Files
- ************************************************************************************/
-
-#include
-
-/************************************************************************************
- * Pre-processor Definitions
- ************************************************************************************/
-
-/************************************************************************************
- * Public Types
- ************************************************************************************/
-
-/************************************************************************************
- * Public Data
- ************************************************************************************/
-
-#ifndef __ASSEMBLY__
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-/************************************************************************************
- * Public Functions
- ************************************************************************************/
-
-/************************************************************************************
- * Name: lpc11_clockconfig
- *
- * Description:
- * Called to initialize the LPC11XX. 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 lpc11_clockconfig(void);
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* __ASSEMBLY__ */
-
-#endif /* __ARCH_ARM_SRC_LPC11XX_LPC11_CLOCKCONFIG_H */
diff --git a/arch/arm/src/lpc11xx/lpc11_gpio.h b/arch/arm/src/lpc11xx/lpc11_gpio.h
deleted file mode 100644
index dea2a0cef8f..00000000000
--- a/arch/arm/src/lpc11xx/lpc11_gpio.h
+++ /dev/null
@@ -1,194 +0,0 @@
-/************************************************************************************
- * arch/arm/src/lpc11xx/lpc11_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_LPC11XX_LPC11_GPIO_H
-#define __ARCH_ARM_SRC_LPC11XX_LPC11_GPIO_H
-
-/************************************************************************************
- * Included Files
- ************************************************************************************/
-
-#include
-
-#ifndef __ASSEMBLY__
-# include
-# include
-#endif
-
-#include
-
-#include "hardware/lpc11_gpio.h"
-#include "hardware/lpc11_pinconfig.h"
-
-/* Include the GPIO definitions for the selected LPC17xx family. */
-
-#if defined(LPC111x)
-# include "lpc111x_gpio.h"
-#elif defined(LPC11C)
-# include "lpc11c_gpio.h"
-#else
-# error "Unrecognized LPC11xx family"
-#endif
-
-/************************************************************************************
- * Pre-processor Definitions
- ************************************************************************************/
-
-/************************************************************************************
- * Public Types
- ************************************************************************************/
-
-/************************************************************************************
- * Public Data
- ************************************************************************************/
-
-#ifndef __ASSEMBLY__
-#undef EXTERN
-#if defined(__cplusplus)
-#define EXTERN extern "C"
-extern "C"
-{
-#else
-#define EXTERN extern
-#endif
-
-/* These tables have global scope only because they are shared between lpc11_gpio.c,
- * lpc11_gpioint.c, and lpc11_gpiodbg.c
- */
-
-#ifdef CONFIG_LPC11_GPIOIRQ
-EXTERN uint64_t g_intedge0;
-EXTERN uint64_t g_intedge2;
-#endif
-
-EXTERN const uint32_t g_fiobase[GPIO_NPORTS];
-EXTERN const uint32_t g_intbase[GPIO_NPORTS];
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/************************************************************************************
- * Name: lpc11_gpioirqinitialize
- *
- * Description:
- * Initialize logic to support a second level of interrupt decoding for GPIO pins.
- *
- ************************************************************************************/
-
-#ifdef CONFIG_LPC11_GPIOIRQ
-void lpc11_gpioirqinitialize(void);
-#else
-# define lpc11_gpioirqinitialize()
-#endif
-
-/************************************************************************************
- * Name: lpc11_configgpio
- *
- * Description:
- * Configure a GPIO pin based on bit-encoded description of the pin.
- *
- ************************************************************************************/
-
-int lpc11_configgpio(lpc11_pinset_t cfgset);
-
-/************************************************************************************
- * Name: lpc11_gpiowrite
- *
- * Description:
- * Write one or zero to the selected GPIO pin
- *
- ************************************************************************************/
-
-void lpc11_gpiowrite(lpc11_pinset_t pinset, bool value);
-
-/************************************************************************************
- * Name: lpc11_gpioread
- *
- * Description:
- * Read one or zero from the selected GPIO pin
- *
- ************************************************************************************/
-
-bool lpc11_gpioread(lpc11_pinset_t pinset);
-
-/************************************************************************************
- * Name: lpc11_gpioirqenable
- *
- * Description:
- * Enable the interrupt for specified GPIO IRQ
- *
- ************************************************************************************/
-
-#ifdef CONFIG_LPC11_GPIOIRQ
-void lpc11_gpioirqenable(int irq);
-#else
-# define lpc11_gpioirqenable(irq)
-#endif
-
-/************************************************************************************
- * Name: lpc11_gpioirqdisable
- *
- * Description:
- * Disable the interrupt for specified GPIO IRQ
- *
- ************************************************************************************/
-
-#ifdef CONFIG_LPC11_GPIOIRQ
-void lpc11_gpioirqdisable(int irq);
-#else
-# define lpc11_gpioirqdisable(irq)
-#endif
-
-/************************************************************************************
- * Function: lpc11_dumpgpio
- *
- * Description:
- * Dump all GPIO registers associated with the base address of the provided pinset.
- *
- ************************************************************************************/
-
-#ifdef CONFIG_DEBUG_GPIO_INFO
-int lpc11_dumpgpio(lpc11_pinset_t pinset, const char *msg);
-#else
-# define lpc11_dumpgpio(p,m)
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* __ASSEMBLY__ */
-
-#endif /* __ARCH_ARM_SRC_LPC11XX_LPC11_GPIO_H */
diff --git a/arch/arm/src/lpc11xx/lpc11_gpiodbg.c b/arch/arm/src/lpc11xx/lpc11_gpiodbg.c
deleted file mode 100644
index 86b3098dcda..00000000000
--- a/arch/arm/src/lpc11xx/lpc11_gpiodbg.c
+++ /dev/null
@@ -1,179 +0,0 @@
-/****************************************************************************
- * arch/arm/src/lpc11xx/lpc11_gpiodbg.c
- *
- * Copyright (C) 2010-2011, 2013, 2016 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.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include
-
-/* Output debug info even if debug output is not selected. */
-
-#undef CONFIG_DEBUG_INFO
-#define CONFIG_DEBUG_INFO 1
-
-#include
-#include
-#include
-#include
-#include
-
-#include "up_arch.h"
-#include "chip.h"
-#include "lpc11_gpio.h"
-
-#ifdef CONFIG_DEBUG_GPIO_INFO
-
-/****************************************************************************
- * Private Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: lpc11_pinsel
- *
- * Description:
- * Get the address of the PINSEL register corresponding to this port and
- * pin number.
- *
- ****************************************************************************/
-
-#ifdef LPC176x
-static uint32_t lpc11_pinsel(unsigned int port, unsigned int pin)
-{
- if (pin < 16)
- {
- return g_lopinsel[port];
- }
- else
- {
- return g_hipinsel[port];
- }
-}
-#endif /* LPC176x */
-
-/****************************************************************************
- * Name: lpc11_pinmode
- *
- * Description:
- * Get the address of the PINMODE register corresponding to this port and
- * pin number.
- *
- ****************************************************************************/
-
-#ifdef LPC176x
-static uint32_t lpc11_pinmode(unsigned int port, unsigned int pin)
-{
- if (pin < 16)
- {
- return g_lopinmode[port];
- }
- else
- {
- return g_hipinmode[port];
- }
-}
-#endif /* LPC176x */
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Function: lpc11_dumpgpio
- *
- * Description:
- * Dump all GPIO registers associated with the provided base address
- *
- ****************************************************************************/
-
-int lpc11_dumpgpio(lpc11_pinset_t pinset, const char *msg)
-{
- irqstate_t flags;
- uint32_t base;
-#if defined(LPC176x)
- uint32_t pinsel;
- uint32_t pinmode;
-#elif defined(LPC178x)
- uint32_t iocon;
-#endif /* LPC176x */
- unsigned int port;
- unsigned int pin;
-
- /* Get the base address associated with the GPIO port */
-
- port = (pinset & GPIO_PORT_MASK) >> GPIO_PORT_SHIFT;
- pin = (pinset & GPIO_PIN_MASK) >> GPIO_PIN_SHIFT;
-
-#if defined(LPC176x)
- pinsel = lpc11_pinsel(port, pin);
- pinmode = lpc11_pinmode(port, pin);
-#elif defined(LPC178x)
- iocon = LPC11_IOCON_P(port, pin);
-#endif /* LPC176x */
-
- /* The following requires exclusive access to the GPIO registers */
-
- flags = enter_critical_section();
- gpioinfo("GPIO%c pin%d (pinset: %08x) -- %s\n",
- port + '0', pin, pinset, msg);
-
-#if defined(LPC176x)
- gpioinfo(" PINSEL[%08x]: %08x PINMODE[%08x]: %08x ODMODE[%08x]: %08x\n",
- pinsel, pinsel ? getreg32(pinsel) : 0,
- pinmode, pinmode ? getreg32(pinmode) : 0,
- g_odmode[port], getreg32(g_odmode[port]));
-#elif defined(LPC178x)
- 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+LPC11_FIO_DIR_OFFSET, getreg32(base+LPC11_FIO_DIR_OFFSET),
- base+LPC11_FIO_MASK_OFFSET, getreg32(base+LPC11_FIO_MASK_OFFSET),
- base+LPC11_FIO_PIN_OFFSET, getreg32(base+LPC11_FIO_PIN_OFFSET));
-
- base = g_intbase[port];
- gpioinfo(" IOINTSTATUS[%08x]: %08x INTSTATR[%08x]: %08x INSTATF[%08x]: %08x\n",
- LPC11_GPIOINT_IOINTSTATUS, getreg32(LPC11_GPIOINT_IOINTSTATUS),
- base+LPC11_GPIOINT_INTSTATR_OFFSET, getreg32(base+LPC11_GPIOINT_INTSTATR_OFFSET),
- base+LPC11_GPIOINT_INTSTATF_OFFSET, getreg32(base+LPC11_GPIOINT_INTSTATF_OFFSET));
- gpioinfo(" INTENR[%08x]: %08x INTENF[%08x]: %08x\n",
- base+LPC11_GPIOINT_INTENR_OFFSET, getreg32(base+LPC11_GPIOINT_INTENR_OFFSET),
- base+LPC11_GPIOINT_INTENF_OFFSET, getreg32(base+LPC11_GPIOINT_INTENF_OFFSET));
-
- leave_critical_section(flags);
- return OK;
-}
-#endif /* CONFIG_DEBUG_GPIO_INFO */
diff --git a/arch/arm/src/lpc11xx/lpc11_gpioint.c b/arch/arm/src/lpc11xx/lpc11_gpioint.c
deleted file mode 100644
index 5327b9e9ff8..00000000000
--- a/arch/arm/src/lpc11xx/lpc11_gpioint.c
+++ /dev/null
@@ -1,547 +0,0 @@
-/****************************************************************************
- * arch/arm/src/lpc11xx/lpc11_gpioint.c
- *
- * 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.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include
-
-#include
-#include
-#include
-#include
-
-#include
-#include
-
-#include "up_arch.h"
-#include "chip.h"
-#include "lpc11_gpio.h"
-
-#ifdef CONFIG_LPC11_GPIOIRQ
-
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-
-/****************************************************************************
- * Private Types
- ****************************************************************************/
-
-/****************************************************************************
- * Private Data
- ****************************************************************************/
-
-/****************************************************************************
- * Public Data
- ****************************************************************************/
-
-/****************************************************************************
- * Private Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: lpc11_getintedge
- *
- * Description:
- * Get the stored interrupt edge configuration.
- *
- ****************************************************************************/
-
-static unsigned int lpc11_getintedge(unsigned int port, unsigned int pin)
-{
- uint64_t *intedge;
-
- /* Which word to we use? */
-
- if (port == 0)
- {
- intedge = &g_intedge0;
- }
- else if (port == 2)
- {
- intedge = &g_intedge2;
- }
- else
- {
- return 0;
- }
-
- /* Return the value for the PINSEL */
-
- return (unsigned int)(((*intedge) >> (pin << 1)) & 3);
-}
-
-/****************************************************************************
- * Name: lpc11_setintedge
- *
- * Description:
- * Set the edge interrupt enabled bits for this pin.
- *
- ****************************************************************************/
-
-static void lpc11_setintedge(uint32_t intbase, unsigned int pin,
- unsigned int edges)
-{
- irqstate_t flags;
- int regval;
-
- /* These must be atomic */
-
- flags = enter_critical_section();
-
- /* Set/clear the rising edge enable bit */
-
- regval = getreg32(intbase + LPC11_GPIOINT_INTENR_OFFSET);
- if ((edges & 2) != 0)
- {
- regval |= GPIOINT(pin);
- }
- else
- {
- regval &= ~GPIOINT(pin);
- }
-
- putreg32(regval, intbase + LPC11_GPIOINT_INTENR_OFFSET);
-
- /* Set/clear the falling edge enable bit */
-
- regval = getreg32(intbase + LPC11_GPIOINT_INTENF_OFFSET);
- if ((edges & 1) != 0)
- {
- regval |= GPIOINT(pin);
- }
- else
- {
- regval &= ~GPIOINT(pin);
- }
-
- putreg32(regval, intbase + LPC11_GPIOINT_INTENF_OFFSET);
- leave_critical_section(flags);
-}
-
-/****************************************************************************
- * Name: lpc11_irq2port
- *
- * Description:
- * Given an IRQ number, return the GPIO port number (0 or 2) of the interrupt.
- *
- ****************************************************************************/
-
-static int lpc11_irq2port(int irq)
-{
- /* Set 1:
- * LPC176x: 12 interrupts p0.0-p0.11
- * LPC178x: 16 interrupts p0.0-p0.15
- */
-
- if (irq >= LPC11_VALID_FIRST0L &&
- irq < (LPC11_VALID_FIRST0L + LPC11_VALID_NIRQS0L))
- {
- return 0;
- }
-
- /* Set 2:
- * LPC176x: 16 interrupts p0.15-p0.30
- * LPC178x: 16 interrupts p0.16-p0.31
- */
-
- else if (irq >= LPC11_VALID_FIRST0H &&
- irq < (LPC11_VALID_FIRST0H + LPC11_VALID_NIRQS0H))
- {
- return 0;
- }
-
-#if defined (LPC176x)
- /* Set 3:
- * LPC17x: 14 interrupts p2.0-p2.13
- */
-
- else if (irq >= LPC11_VALID_FIRST2 &&
- irq < (LPC11_VALID_FIRST2 + LPC11_VALID_NIRQS2))
- {
- return 2;
- }
-
-#elif defined (LPC178x)
- /* Set 3:
- * LPC18x: 16 interrupts p2.0-p2.15
- */
-
- else if (irq >= LPC11_VALID_FIRST2L &&
- irq < (LPC11_VALID_FIRST2L + LPC11_VALID_NIRQS2L))
- {
- return 2;
- }
-
- /* Set 4:
- * LPC178x: 16 interrupts p2.16-p2.31
- */
-
- else if (irq >= LPC11_VALID_FIRST2H &&
- irq < (LPC11_VALID_FIRST2H + LPC11_VALID_NIRQS2H))
- {
- return 2;
- }
-
-#endif
-
- return -EINVAL;
-}
-
-/****************************************************************************
- * Name: lpc11_irq2pin
- *
- * Description:
- * Given an IRQ number, return the GPIO pin number (0..31) of the interrupt.
- *
- ****************************************************************************/
-
-static int lpc11_irq2pin(int irq)
-{
- /* Set 1:
- * LPC17x: 12 interrupts p0.0-p0.11
- * LPC18x: 16 interrupts p0.0-p0.15
- *
- * See arch/arm/include/lpc11xx/irq.h:
- * LPC11_VALID_SHIFT0L 0 - Bit 0 is thre first bit in the group of
- * 12/16 interrupts
- * LPC11_VALID_FIRST0L irq - IRQ number associated with p0.0
- * LPC11_VALID_NIRQS0L 12/16 - Number of interrupt bits in the group
- */
-
- if (irq >= LPC11_VALID_FIRST0L &&
- irq < (LPC11_VALID_FIRST0L + LPC11_VALID_NIRQS0L))
- {
- return irq - LPC11_VALID_FIRST0L + LPC11_VALID_SHIFT0L;
- }
-
- /* Set 2:
- * LPC176x: 16 interrupts p0.15-p0.30
- * LPC178x: 16 interrupts p0.16-p0.31
- *
- * LPC11_VALID_SHIFT0H 15/16 - Bit number of the first bit in a group
- * of 16 interrupts
- * LPC11_VALID_FIRST0L irq - IRQ number associated with p0.15/16
- * LPC11_VALID_NIRQS0L 16 - 16 interrupt bits in the group
- */
-
- else if (irq >= LPC11_VALID_FIRST0H &&
- irq < (LPC11_VALID_FIRST0H + LPC11_VALID_NIRQS0H))
- {
- return irq - LPC11_VALID_FIRST0H + LPC11_VALID_SHIFT0H;
- }
-
-#if defined(LPC176x)
- /* Set 3:
- * LPC17x: 14 interrupts p2.0-p2.13
- *
- * LPC11_VALID_SHIFT2 0 - Bit 0 is the first bit in a group of 14
- * interrupts
- * LPC11_VALID_FIRST2 irq - IRQ number associated with p2.0
- * LPC11_VALID_NIRQS2 14 - 14 interrupt bits in the group
- */
-
- else if (irq >= LPC11_VALID_FIRST2 &&
- irq < (LPC11_VALID_FIRST2 + LPC11_VALID_NIRQS2))
- {
- return irq - LPC11_VALID_FIRST2 + LPC11_VALID_SHIFT2;
- }
-
-#elif defined(LPC178x)
-
- /* Set 3:
- * LPC18x: 16 interrupts p2.0-p2.15
- *
- * LPC11_VALID_SHIFT2L 0 - Bit 0 is the first bit in a group of 16
- * interrupts
- * LPC11_VALID_FIRST2L irq - IRQ number associated with p2.0
- * LPC11_VALID_NIRQS2L 16 - 16 interrupt bits in the group
- */
-
- else if (irq >= LPC11_VALID_FIRST2L &&
- irq < (LPC11_VALID_FIRST2L + LPC11_VALID_NIRQS2L))
- {
- return irq - LPC11_VALID_FIRST2L + LPC11_VALID_SHIFT2L;
- }
-
- /* Set 3:
- * LPC18x: 16 interrupts p2.16-p2.31
- *
- * LPC11_VALID_SHIFT2L 16 - Bit 16 is the first bit in a group of 16
- * interrupts
- * LPC11_VALID_FIRST2L irq - IRQ number associated with p2.0
- * LPC11_VALID_NIRQS2L 16 - 16 interrupt bits in the group
- */
-
- else if (irq >= LPC11_VALID_FIRST2H &&
- irq < (LPC11_VALID_FIRST2H + LPC11_VALID_NIRQS2H))
- {
- return irq - LPC11_VALID_FIRST2H + LPC11_VALID_SHIFT2H;
- }
-
-#endif
-
- return -EINVAL;
-}
-
-/****************************************************************************
- * Name: lpc11_gpiodemux
- *
- * Description:
- * Demux all interrupts on one GPIO interrupt status register.
- *
- ****************************************************************************/
-
-static void lpc11_gpiodemux(uint32_t intbase, uint32_t intmask,
- int irqbase, void *context)
-{
- uint32_t intstatr;
- uint32_t intstatf;
- uint32_t intstatus;
- uint32_t bit;
- int irq;
-
- /* Get the interrupt rising and falling edge status and mask out only the
- * interrupts that are enabled.
- */
-
- intstatr = getreg32(intbase + LPC11_GPIOINT_INTSTATR_OFFSET);
- intstatr &= getreg32(intbase + LPC11_GPIOINT_INTENR_OFFSET);
-
- intstatf = getreg32(intbase + LPC11_GPIOINT_INTSTATF_OFFSET);
- intstatf &= getreg32(intbase + LPC11_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
- * the ability to handle them differently if needed).
- */
-
- intstatus = intstatr | intstatf;
-
- /* Now march through the (valid) bits and dispatch each interrupt */
-
- irq = irqbase;
- bit = 1;
- while (intstatus != 0)
- {
- /* Does this pin support an interrupt? If no, skip over it WITHOUT
- * incrementing irq.
- */
-
- if ((intmask & bit) != 0)
- {
- /* This pin can support an interrupt. Is there an interrupt pending
- * and enabled?
- */
-
- if ((intstatus & bit) != 0)
- {
- /* Clear the interrupt status */
-
- putreg32(bit, intbase + LPC11_GPIOINT_INTCLR_OFFSET);
-
- /* And dispatch the interrupt */
-
- irq_dispatch(irq, context);
- }
-
- /* Increment the IRQ number on each interrupt pin */
-
- irq++;
- }
-
- /* Next bit */
-
- intstatus &= ~bit;
- bit <<= 1;
- }
-}
-
-/****************************************************************************
- * Name: lpc11_gpiointerrupt
- *
- * Description:
- * Handle the GPIO interrupt. For the LPC176x family, that interrupt could
- * also that also indicates that an EINT3 interrupt has occurred. NOTE:
- * This logic would have to be extended if EINT3 is actually used for
- * External Interrupt 3 on an LPC176x platform.
- *
- ****************************************************************************/
-
-static int lpc11_gpiointerrupt(int irq, void *context, FAR void *arg)
-{
- /* Get the GPIO interrupt status */
-
- uint32_t intstatus = getreg32(LPC11_GPIOINT_IOINTSTATUS);
-
- /* Check for an interrupt on GPIO0 */
-
- if ((intstatus & GPIOINT_IOINTSTATUS_P0INT) != 0)
- {
- lpc11_gpiodemux(LPC11_GPIOINT0_BASE, LPC11_VALID_GPIOINT0,
- LPC11_VALID_FIRST0L, context);
- }
-
-#if defined(LPC176x)
- /* Check for an interrupt on GPIO2 */
-
- if ((intstatus & GPIOINT_IOINTSTATUS_P2INT) != 0)
- {
- lpc11_gpiodemux(LPC11_GPIOINT2_BASE, LPC11_VALID_GPIOINT2,
- LPC11_VALID_FIRST2, context);
- }
-
-#elif defined(LPC178x)
- /* Check for an interrupt on GPIO2 */
-
- if ((intstatus & GPIOINT_IOINTSTATUS_P2INT) != 0)
- {
- lpc11_gpiodemux(LPC11_GPIOINT2_BASE, LPC11_VALID_GPIOINT2,
- LPC11_VALID_FIRST2L, context);
- }
-
-#endif
-
- return OK;
-}
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: lpc11_gpioirqinitialize
- *
- * Description:
- * Initialize logic to support a second level of interrupt decoding for
- * GPIO pins.
- *
- ****************************************************************************/
-
-void lpc11_gpioirqinitialize(void)
-{
- /* Disable all GPIO interrupts */
-
- putreg32(0, LPC11_GPIOINT0_INTENR);
- putreg32(0, LPC11_GPIOINT0_INTENF);
- putreg32(0, LPC11_GPIOINT2_INTENR);
- putreg32(0, LPC11_GPIOINT2_INTENF);
-
- /* Attach and enable the GPIO IRQ. */
-
-#if defined(LPC176x)
- /* For the LPC176x family, GPIO0 and GPIO2 interrupts share the same
- * position in the NVIC with External Interrupt 3
- */
-
- (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
- * GPIO2.
- */
-
- (void)irq_attach(LPC11_IRQ_GPIO, lpc11_gpiointerrupt, NULL);
- up_enable_irq(LPC11_IRQ_GPIO);
-
-#endif
-}
-
-/****************************************************************************
- * Name: lpc11_gpioirqenable
- *
- * Description:
- * Enable the interrupt for specified GPIO IRQ
- *
- ****************************************************************************/
-
-void lpc11_gpioirqenable(int irq)
-{
- /* Map the IRQ number to a port number */
-
- int port = lpc11_irq2port(irq);
- if (port >= 0)
- {
- /* The IRQ number does correspond to an interrupt port. Now get the base
- * address of the GPIOINT registers for the port.
- */
-
- uint32_t intbase = g_intbase[port];
- if (intbase != 0)
- {
- /* And get the pin number associated with the port */
-
- unsigned int pin = lpc11_irq2pin(irq);
- unsigned int edges = lpc11_getintedge(port, pin);
- lpc11_setintedge(intbase, pin, edges);
- }
- }
-}
-
-/****************************************************************************
- * Name: lpc11_gpioirqdisable
- *
- * Description:
- * Disable the interrupt for specified GPIO IRQ
- *
- ****************************************************************************/
-
-void lpc11_gpioirqdisable(int irq)
-{
- /* Map the IRQ number to a port number */
-
- int port = lpc11_irq2port(irq);
- if (port >= 0)
- {
- /* The IRQ number does correspond to an interrupt port. Now get the base
- * address of the GPIOINT registers for the port.
- */
-
- uint32_t intbase = g_intbase[port];
- if (intbase != 0)
- {
- /* And get the pin number associated with the port */
-
- unsigned int pin = lpc11_irq2pin(irq);
- lpc11_setintedge(intbase, pin, 0);
- }
- }
-}
-
-#endif /* CONFIG_LPC11_GPIOIRQ */
-
diff --git a/arch/arm/src/lpc11xx/lpc11_i2c.c b/arch/arm/src/lpc11xx/lpc11_i2c.c
deleted file mode 100644
index 0fee3d96025..00000000000
--- a/arch/arm/src/lpc11xx/lpc11_i2c.c
+++ /dev/null
@@ -1,632 +0,0 @@
-/****************************************************************************
- * arch/arm/src/lpc11xx/lpc11_i2c.c
- *
- * Copyright (C) 2012, 2014-2016 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt
- *
- * Copyright (C) 2011 Li Zhuoyi. All rights reserved.
- * Author: Li Zhuoyi (Original author)
- *
- * Derived from arch/arm/src/lpc31xx/lpc31_i2c.c
- *
- * Author: David Hewson
- *
- * Copyright (C) 2010-2011 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.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include
-#include
-#include
-#include
-
-#include
-#include
-
-#include "chip.h"
-#include "up_arch.h"
-#include "up_internal.h"
-
-#include "chip.h"
-#include "hardware/lpc11_syscon.h"
-#include "lpc11_gpio.h"
-#include "lpc11_i2c.h"
-
-#if defined(CONFIG_LPC11_I2C0) || defined(CONFIG_LPC11_I2C1) || defined(CONFIG_LPC11_I2C2)
-
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-
-#ifndef GPIO_I2C1_SCL
-# define GPIO_I2C1_SCL GPIO_I2C1_SCL_1
-# define GPIO_I2C1_SDA GPIO_I2C1_SDA_1
-#endif
-
-#ifndef CONFIG_LPC11_I2C0_FREQUENCY
-# define CONFIG_LPC11_I2C0_FREQUENCY 100000
-#endif
-
-#ifndef CONFIG_LPC11_I2C1_FREQUENCY
-# define CONFIG_LPC11_I2C1_FREQUENCY 100000
-#endif
-
-#ifndef CONFIG_LPC11_I2C2_FREQUENCY
-# define CONFIG_LPC11_I2C2_FREQUENCY 100000
-#endif
-
-#define I2C_TIMEOUT (20 * 1000/CONFIG_USEC_PER_TICK) /* 20 mS */
-#define LPC11_I2C1_FREQUENCY 400000
-
-/****************************************************************************
- * Private Types
- ****************************************************************************/
-
-struct lpc11_i2cdev_s
-{
- struct i2c_master_s dev; /* Generic I2C device */
- unsigned int base; /* Base address of registers */
- uint16_t irqid; /* IRQ for this device */
-
- sem_t mutex; /* Only one thread can access at a time */
- sem_t wait; /* Place to wait for state machine completion */
- volatile uint8_t state; /* State of state machine */
- WDOG_ID timeout; /* Watchdog to timeout when bus hung */
- uint32_t frequency; /* Current I2C frequency */
-
- struct i2c_msg_s *msgs; /* Remaining transfers - first one is in progress */
- unsigned int nmsg; /* Number of transfer remaining */
-
- uint16_t wrcnt; /* Number of bytes sent to tx fifo */
- uint16_t rdcnt; /* Number of bytes read from rx fifo */
-};
-
-/****************************************************************************
- * Private Function Prototypes
- ****************************************************************************/
-
-static int lpc11_i2c_start(struct lpc11_i2cdev_s *priv);
-static void lpc11_i2c_stop(struct lpc11_i2cdev_s *priv);
-static int lpc11_i2c_interrupt(int irq, FAR void *context, void *arg);
-static void lpc11_i2c_timeout(int argc, uint32_t arg, ...);
-static void lpc11_i2c_setfrequency(struct lpc11_i2cdev_s *priv,
- uint32_t frequency);
-static void lpc11_stopnext(struct lpc11_i2cdev_s *priv);
-
-/* I2C device operations */
-
-static int lpc11_i2c_transfer(FAR struct i2c_master_s *dev,
- FAR struct i2c_msg_s *msgs, int count);
-#ifdef CONFIG_I2C_RESET
-static int lpc11_i2c_reset(FAR struct i2c_master_s * dev);
-#endif
-
-/****************************************************************************
- * Private Data
- ****************************************************************************/
-
-#ifdef CONFIG_LPC11_I2C0
-static struct lpc11_i2cdev_s g_i2c0dev;
-#endif
-#ifdef CONFIG_LPC11_I2C1
-static struct lpc11_i2cdev_s g_i2c1dev;
-#endif
-#ifdef CONFIG_LPC11_I2C2
-static struct lpc11_i2cdev_s g_i2c2dev;
-#endif
-
-struct i2c_ops_s lpc11_i2c_ops =
-{
- .transfer = lpc11_i2c_transfer
-#ifdef CONFIG_I2C_RESET
- , .reset = lpc11_i2c_reset
-#endif
-};
-
-/****************************************************************************
- * Name: lpc11_i2c_setfrequency
- *
- * Description:
- * Set the frequency for the next transfer
- *
- ****************************************************************************/
-
-static void lpc11_i2c_setfrequency(struct lpc11_i2cdev_s *priv,
- uint32_t frequency)
-{
- if (frequency != priv->frequency)
- {
- if (frequency > 100000)
- {
- /* Asymetric per 400Khz I2C spec */
-
- putreg32(LPC11_MCLK / (83 + 47) * 47 / frequency,
- priv->base + LPC11_I2C_SCLH_OFFSET);
- putreg32(LPC11_MCLK / (83 + 47) * 83 / frequency,
- priv->base + LPC11_I2C_SCLL_OFFSET);
- }
- else
- {
- /* 50/50 mark space ratio */
-
- putreg32(LPC11_MCLK / 100 * 50 / frequency,
- priv->base + LPC11_I2C_SCLH_OFFSET);
- putreg32(LPC11_MCLK / 100 * 50 / frequency,
- priv->base + LPC11_I2C_SCLL_OFFSET);
- }
-
- priv->frequency = frequency;
- }
-}
-
-/****************************************************************************
- * Name: lpc11_i2c_start
- *
- * Description:
- * Perform a I2C transfer start
- *
- ****************************************************************************/
-
-static int lpc11_i2c_start(struct lpc11_i2cdev_s *priv)
-{
- putreg32(I2C_CONCLR_STAC | I2C_CONCLR_SIC,
- priv->base + LPC11_I2C_CONCLR_OFFSET);
- putreg32(I2C_CONSET_STA, priv->base + LPC11_I2C_CONSET_OFFSET);
-
- (void)wd_start(priv->timeout, I2C_TIMEOUT, lpc11_i2c_timeout, 1,
- (uint32_t)priv);
- nxsem_wait(&priv->wait);
-
- wd_cancel(priv->timeout);
-
- return priv->nmsg;
-}
-
-/****************************************************************************
- * Name: lpc11_i2c_stop
- *
- * Description:
- * Perform a I2C transfer stop
- *
- ****************************************************************************/
-
-static void lpc11_i2c_stop(struct lpc11_i2cdev_s *priv)
-{
- if (priv->state != 0x38)
- {
- putreg32(I2C_CONSET_STO | I2C_CONSET_AA,
- priv->base + LPC11_I2C_CONSET_OFFSET);
- }
-
- nxsem_post(&priv->wait);
-}
-
-/****************************************************************************
- * Name: lpc11_i2c_timeout
- *
- * Description:
- * Watchdog timer for timeout of I2C operation
- *
- ****************************************************************************/
-
-static void lpc11_i2c_timeout(int argc, uint32_t arg, ...)
-{
- struct lpc11_i2cdev_s *priv = (struct lpc11_i2cdev_s *)arg;
-
- irqstate_t flags = enter_critical_section();
- priv->state = 0xff;
- nxsem_post(&priv->wait);
- leave_critical_section(flags);
-}
-
-/****************************************************************************
- * Name: lpc11_i2c_transfer
- *
- * Description:
- * Perform a sequence of I2C transfers
- *
- ****************************************************************************/
-
-static int lpc11_i2c_transfer(FAR struct i2c_master_s *dev,
- FAR struct i2c_msg_s *msgs, int count)
-{
- struct lpc11_i2cdev_s *priv = (struct lpc11_i2cdev_s *)dev;
- int ret;
-
- DEBUGASSERT(dev != NULL && msgs != NULL && count > 0);
-
- /* Get exclusive access to the I2C bus */
-
- nxsem_wait(&priv->mutex);
-
- /* Set up for the transfer */
-
- priv->wrcnt = 0;
- priv->rdcnt = 0;
- priv->msgs = msgs;
- priv->nmsg = count;
-
- /* Configure the I2C frequency.
- * REVISIT: Note that the frequency is set only on the first message.
- * This could be extended to support different transfer frequencies for
- * each message segment.
- */
-
- lpc11_i2c_setfrequency(priv, msgs->frequency);
-
- /* Perform the transfer */
-
- ret = lpc11_i2c_start(priv);
-
- nxsem_post(&priv->mutex);
- return ret;
-}
-
-/****************************************************************************
- * Name: lpc11_stopnext
- *
- * Description:
- * Check if we need to issue STOP at the next message
- *
- ****************************************************************************/
-
-static void lpc11_stopnext(struct lpc11_i2cdev_s *priv)
-{
- priv->nmsg--;
-
- if (priv->nmsg > 0)
- {
- priv->msgs++;
- putreg32(I2C_CONSET_STA, priv->base + LPC11_I2C_CONSET_OFFSET);
- }
- else
- {
- lpc11_i2c_stop(priv);
- }
-}
-
-/****************************************************************************
- * Name: lpc11_i2c_interrupt
- *
- * Description:
- * The I2C Interrupt Handler
- *
- ****************************************************************************/
-
-static int lpc11_i2c_interrupt(int irq, FAR void *context, void *arg)
-{
- struct lpc11_i2cdev_s *priv = (struct lpc11_i2cdev_s *)arg;
- struct i2c_msg_s *msg;
- uint32_t state;
-
- DEBUGASSERT(priv != NULL);
-
- /* Reference UM10360 19.10.5 */
-
- state = getreg32(priv->base + LPC11_I2C_STAT_OFFSET);
- msg = priv->msgs;
-
- priv->state = state;
- state &= 0xf8; /* state mask, only 0xX8 is possible */
- switch (state)
- {
-
- case 0x08: /* A START condition has been transmitted. */
- case 0x10: /* A Repeated START condition has been transmitted. */
- /* Set address */
-
- putreg32(((I2C_M_READ & msg->flags) == I2C_M_READ) ?
- I2C_READADDR8(msg->addr) :
- I2C_WRITEADDR8(msg->addr), priv->base + LPC11_I2C_DAT_OFFSET);
-
- /* Clear start bit */
-
- putreg32(I2C_CONCLR_STAC, priv->base + LPC11_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 + LPC11_I2C_DAT_OFFSET); /* put first byte */
- break;
-
- case 0x28: /* Data byte in DAT has been transmitted; ACK has been received. */
- priv->wrcnt++;
-
- if (priv->wrcnt < msg->length)
- {
- putreg32(msg->buffer[priv->wrcnt], priv->base + LPC11_I2C_DAT_OFFSET); /* Put next byte */
- }
- else
- {
- lpc11_stopnext(priv);
- }
- break;
-
- /* Read cases */
-
- case 0x40: /* SLA+R has been transmitted; ACK has been received */
- priv->rdcnt = 0;
- if (msg->length > 1)
- {
- putreg32(I2C_CONSET_AA, priv->base + LPC11_I2C_CONSET_OFFSET); /* Set ACK next read */
- }
- else
- {
- putreg32(I2C_CONCLR_AAC, priv->base + LPC11_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 + LPC11_I2C_BUFR_OFFSET);
-
- if (priv->rdcnt >= (msg->length - 1))
- {
- putreg32(I2C_CONCLR_AAC, priv->base + LPC11_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 + LPC11_I2C_BUFR_OFFSET);
- lpc11_stopnext(priv);
- break;
-
- default:
- lpc11_i2c_stop(priv);
- break;
- }
-
- putreg32(I2C_CONCLR_SIC, priv->base + LPC11_I2C_CONCLR_OFFSET); /* clear interrupt */
-
- return OK;
-}
-
-/************************************************************************************
- * Name: lpc11_i2c_reset
- *
- * Description:
- * Perform an I2C bus reset in an attempt to break loose stuck I2C devices.
- *
- * Input Parameters:
- * dev - Device-specific state data
- *
- * Returned Value:
- * Zero (OK) on success; a negated errno value on failure.
- *
- ************************************************************************************/
-
-#ifdef CONFIG_I2C_RESET
-static int lpc11_i2c_reset(FAR struct i2c_master_s * dev)
-{
- return OK;
-}
-#endif /* CONFIG_I2C_RESET */
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: lpc11_i2cbus_initialize
- *
- * Description:
- * Initialise an I2C device
- *
- ****************************************************************************/
-
-struct i2c_master_s *lpc11_i2cbus_initialize(int port)
-{
- struct lpc11_i2cdev_s *priv;
-
- if (port > 1)
- {
- i2cerr("ERROR: LPC I2C only supports ports 0 and 1\n");
- return NULL;
- }
-
- irqstate_t flags;
- uint32_t regval;
-
- flags = enter_critical_section();
-
-#ifdef CONFIG_LPC11_I2C0
- if (port == 0)
- {
- priv = &g_i2c0dev;
- priv->base = LPC11_I2C0_BASE;
- priv->irqid = LPC11_IRQ_I2C0;
-
- /* Enable clocking */
-
- regval = getreg32(LPC11_SYSCON_SYSAHBCLKCTRL);
- regval |= SYSCON_SYSAHBCLKCTRL_I2C0;
- putreg32(regval, LPC11_SYSCON_SYSAHBCLKCTRL);
-
- /* Pin configuration */
-
- lpc11_configgpio(GPIO_I2C0_SCL);
- lpc11_configgpio(GPIO_I2C0_SDA);
-
- /* Set default frequency */
-
- lpc11_i2c_setfrequency(priv, CONFIG_LPC11_I2C0_FREQUENCY);
- }
- else
-#endif
-#ifdef CONFIG_LPC11_I2C1
- if (port == 1)
- {
- priv = &g_i2c1dev;
- priv->base = LPC11_I2C1_BASE;
- priv->irqid = LPC11_IRQ_I2C1;
-
- /* Enable clocking */
-
- regval = getreg32(LPC11_SYSCON_SYSAHBCLKCTRL);
- regval |= SYSCON_SYSAHBCLKCTRL_I2C1;
- putreg32(regval, LPC11_SYSCON_SYSAHBCLKCTRL);
-
- regval = getreg32(LPC11_SYSCON_PCLKSEL1);
- regval &= ~SYSCON_PCLKSEL1_I2C1_MASK;
- regval |= (SYSCON_PCLKSEL_CCLK << SYSCON_PCLKSEL1_I2C1_SHIFT);
- putreg32(regval, LPC11_SYSCON_PCLKSEL1);
-
- /* Pin configuration */
-
- lpc11_configgpio(GPIO_I2C1_SCL);
- lpc11_configgpio(GPIO_I2C1_SDA);
-
- /* Set default frequency */
-
- lpc11_i2c_setfrequency(priv, CONFIG_LPC11_I2C1_FREQUENCY);
- }
- else
-#endif
-#ifdef CONFIG_LPC11_I2C2
- if (port == 2)
- {
- priv = &g_i2c2dev;
- priv->base = LPC11_I2C2_BASE;
- priv->irqid = LPC11_IRQ_I2C2;
-
- /* Enable clocking */
-
- regval = getreg32(LPC11_SYSCON_SYSAHBCLKCTRL);
- regval |= SYSCON_SYSAHBCLKCTRL_I2C2;
- putreg32(regval, LPC11_SYSCON_SYSAHBCLKCTRL);
-
- regval = getreg32(LPC11_SYSCON_PCLKSEL1);
- regval &= ~SYSCON_PCLKSEL1_I2C2_MASK;
- regval |= (SYSCON_PCLKSEL_CCLK << SYSCON_PCLKSEL1_I2C2_SHIFT);
- putreg32(regval, LPC11_SYSCON_PCLKSEL1);
-
- /* Pin configuration */
-
- lpc11_configgpio(GPIO_I2C2_SCL);
- lpc11_configgpio(GPIO_I2C2_SDA);
-
- /* Set default frequency */
-
- lpc11_i2c_setfrequency(priv, CONFIG_LPC11_I2C2_FREQUENCY);
- }
- else
-#endif
- {
- return NULL;
- }
-
- leave_critical_section(flags);
-
- putreg32(I2C_CONSET_I2EN, priv->base + LPC11_I2C_CONSET_OFFSET);
-
- /* Initialize semaphores */
-
- nxsem_init(&priv->mutex, 0, 1);
- nxsem_init(&priv->wait, 0, 0);
-
- /* The wait semaphore is used for signaling and, hence, should not have
- * priority inheritance enabled.
- */
-
- nxsem_setprotocol(&priv->wait, SEM_PRIO_NONE);
-
- /* Allocate a watchdog timer */
-
- priv->timeout = wd_create();
- DEBUGASSERT(priv->timeout != 0);
-
- /* Attach Interrupt Handler */
-
- irq_attach(priv->irqid, lpc11_i2c_interrupt, priv);
-
- /* Enable Interrupt Handler */
-
- up_enable_irq(priv->irqid);
-
- /* Install our operations */
-
- priv->dev.ops = &lpc11_i2c_ops;
- return &priv->dev;
-}
-
-/****************************************************************************
- * Name: lpc11_i2cbus_uninitialize
- *
- * Description:
- * Uninitialise an I2C device
- *
- ****************************************************************************/
-
-int lpc11_i2cbus_uninitialize(FAR struct i2c_master_s * dev)
-{
- struct lpc11_i2cdev_s *priv = (struct lpc11_i2cdev_s *) dev;
-
- /* Disable I2C */
-
- putreg32(I2C_CONCLRT_I2ENC, priv->base + LPC11_I2C_CONCLR_OFFSET);
-
- /* Reset data structures */
-
- nxsem_destroy(&priv->mutex);
- nxsem_destroy(&priv->wait);
-
- /* Free the watchdog timer */
-
- wd_delete(priv->timeout);
- priv->timeout = NULL;
-
- /* Disable interrupts */
-
- up_disable_irq(priv->irqid);
-
- /* Detach Interrupt Handler */
-
- irq_detach(priv->irqid);
- return OK;
-}
-
-#endif /* CONFIG_LPC11_I2C0 || CONFIG_LPC11_I2C1 || CONFIG_LPC11_I2C2 */
diff --git a/arch/arm/src/lpc11xx/lpc11_idle.c b/arch/arm/src/lpc11xx/lpc11_idle.c
deleted file mode 100644
index 1ac0d7d9ba2..00000000000
--- a/arch/arm/src/lpc11xx/lpc11_idle.c
+++ /dev/null
@@ -1,118 +0,0 @@
-/****************************************************************************
- * arch/arm/src/lpc11/lpc11_idle.c
- *
- * Copyright (C) 2015 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.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include
-#include
-
-#include
-
-#include "up_internal.h"
-
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-
-/* Does the board support an IDLE LED to indicate that the board is in the
- * IDLE state?
- */
-
-#if defined(CONFIG_ARCH_LEDS) && defined(LED_IDLE)
-# define BEGIN_IDLE() board_autoled_on(LED_IDLE)
-# define END_IDLE() board_autoled_off(LED_IDLE)
-#else
-# define BEGIN_IDLE()
-# define END_IDLE()
-#endif
-
-/****************************************************************************
- * Private Data
- ****************************************************************************/
-
-/****************************************************************************
- * Private Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: up_idle
- *
- * Description:
- * up_idle() is the logic that will be executed when their is no other
- * ready-to-run task. This is processor idle time and will continue until
- * some interrupt occurs to cause a context switch from the idle task.
- *
- * Processing in this state may be processor-specific. e.g., this is where
- * power management operations might be performed.
- *
- ****************************************************************************/
-
-void up_idle(void)
-{
-#if defined(CONFIG_SUPPRESS_INTERRUPTS) || defined(CONFIG_SUPPRESS_TIMER_INTS)
- /* If the system is idle and there are no timer interrupts, then process
- * "fake" timer interrupts. Hopefully, something will wake up.
- */
-
- nxsched_process_timer();
-#else
-
-/* If the g_dma_inprogress is zero, then there is no DMA in progress. This
- * value is needed in the IDLE loop to determine if the IDLE loop should
- * go into lower power power consumption modes. According to the LPC17xx
- * User Manual: "The DMA controller can continue to work in Sleep mode, and
- * has access to the peripheral SRAMs and all peripheral registers. The
- * flash memory and the Main SRAM are not available in Sleep mode, they are
- * disabled in order to save power."
- */
-
-#ifdef CONFIG_LPC11_GPDMA
- if (g_dma_inprogress == 0)
-#endif
- {
- /* Sleep until an interrupt occurs in order to save power */
-
- BEGIN_IDLE();
- asm("WFI");
- END_IDLE();
- }
-#endif
-}
diff --git a/arch/arm/src/lpc11xx/lpc11_irq.c b/arch/arm/src/lpc11xx/lpc11_irq.c
deleted file mode 100644
index df2fde8405c..00000000000
--- a/arch/arm/src/lpc11xx/lpc11_irq.c
+++ /dev/null
@@ -1,340 +0,0 @@
-/****************************************************************************
- * arch/arm/src/lpc11xx/lpc11_irq.c
- *
- * Copyright (C) 2015-2016 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.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include
-
-#include
-#include
-
-#include
-#include
-#include
-
-#include "nvic.h"
-#include "up_arch.h"
-#include "up_internal.h"
-
-//#include "lpc11_irq.h"
-
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-
-/* Get a 32-bit version of the default priority */
-
-#define DEFPRIORITY32 \
- (NVIC_SYSH_PRIORITY_DEFAULT << 24 | NVIC_SYSH_PRIORITY_DEFAULT << 16 | \
- NVIC_SYSH_PRIORITY_DEFAULT << 8 | NVIC_SYSH_PRIORITY_DEFAULT)
-
-/****************************************************************************
- * Public Data
- ****************************************************************************/
-
-/* g_current_regs[] holds a references to the current interrupt level
- * register storage structure. If is non-NULL only during interrupt
- * processing. Access to g_current_regs[] must be through the macro
- * CURRENT_REGS for portability.
- */
-
-volatile uint32_t *g_current_regs[1];
-
-/****************************************************************************
- * Private Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: lpc11_dumpnvic
- *
- * Description:
- * Dump some interesting NVIC registers
- *
- ****************************************************************************/
-
-#if defined(CONFIG_DEBUG_IRQ_INFO)
-static void lpc11_dumpnvic(const char *msg, int irq)
-{
- irqstate_t flags;
-
- flags = enter_critical_section();
-
- irqinfo("NVIC (%s, irq=%d):\n", msg, irq);
- irqinfo(" ISER: %08x ICER: %08x\n",
- getreg32(ARMV6M_NVIC_ISER), getreg32(ARMV6M_NVIC_ICER));
- irqinfo(" ISPR: %08x ICPR: %08x\n",
- getreg32(ARMV6M_NVIC_ISPR), getreg32(ARMV6M_NVIC_ICPR));
- irqinfo(" IRQ PRIO: %08x %08x %08x %08x\n",
- getreg32(ARMV6M_NVIC_IPR0), getreg32(ARMV6M_NVIC_IPR1),
- getreg32(ARMV6M_NVIC_IPR2), getreg32(ARMV6M_NVIC_IPR3));
- irqinfo(" %08x %08x %08x %08x\n",
- getreg32(ARMV6M_NVIC_IPR4), getreg32(ARMV6M_NVIC_IPR5),
- getreg32(ARMV6M_NVIC_IPR6), getreg32(ARMV6M_NVIC_IPR7));
-
- irqinfo("SYSCON:\n");
- irqinfo(" CPUID: %08x\n",
- getreg32(ARMV6M_SYSCON_CPUID));
- irqinfo(" ICSR: %08x AIRCR: %08x\n",
- getreg32(ARMV6M_SYSCON_ICSR), getreg32(ARMV6M_SYSCON_AIRCR));
- irqinfo(" SCR: %08x CCR: %08x\n",
- getreg32(ARMV6M_SYSCON_SCR), getreg32(ARMV6M_SYSCON_CCR));
- irqinfo(" SHPR2: %08x SHPR3: %08x\n",
- getreg32(ARMV6M_SYSCON_SHPR2), getreg32(ARMV6M_SYSCON_SHPR3));
-
- leave_critical_section(flags);
-}
-
-#else
-# define lpc11_dumpnvic(msg, irq)
-#endif
-
-/****************************************************************************
- * Name: lpc11_nmi, lpc11_busfault, lpc11_usagefault, lpc11_pendsv,
- * lpc11_dbgmonitor, lpc11_pendsv, lpc11_reserved
- *
- * Description:
- * Handlers for various execptions. None are handled and all are fatal
- * error conditions. The only advantage these provided over the default
- * unexpected interrupt handler is that they provide a diagnostic output.
- *
- ****************************************************************************/
-
-#ifdef CONFIG_DEBUG_FEATURES
-static int lpc11_nmi(int irq, FAR void *context, FAR void *arg)
-{
- (void)up_irq_save();
- _err("PANIC!!! NMI received\n");
- PANIC();
- return 0;
-}
-
-static int lpc11_pendsv(int irq, FAR void *context, FAR void *arg)
-{
- (void)up_irq_save();
- _err("PANIC!!! PendSV received\n");
- PANIC();
- return 0;
-}
-
-static int lpc11_reserved(int irq, FAR void *context, FAR void *arg)
-{
- (void)up_irq_save();
- _err("PANIC!!! Reserved interrupt\n");
- PANIC();
- return 0;
-}
-#endif
-
-/****************************************************************************
- * Name: lpc11_clrpend
- *
- * Description:
- * Clear a pending interrupt at the NVIC.
- *
- ****************************************************************************/
-
-static inline void lpc11_clrpend(int irq)
-{
- /* This will be called on each interrupt exit whether the interrupt can be
- * enambled or not. So this assertion is necessarily lame.
- */
-
- DEBUGASSERT((unsigned)irq < NR_IRQS);
-
- /* Check for an external interrupt */
-
- if (irq >= LPC11_IRQ_EXTINT && irq < (LPC11_IRQ_EXTINT + 32))
- {
- /* Set the appropriate bit in the ISER register to enable the
- * interrupt
- */
-
- putreg32((1 << (irq - LPC11_IRQ_EXTINT)), ARMV6M_NVIC_ICPR);
- }
-}
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: up_irqinitialize
- ****************************************************************************/
-
-void up_irqinitialize(void)
-{
- uint32_t regaddr;
- int i;
-
- /* Disable all interrupts */
-
- putreg32(0xffffffff, ARMV6M_NVIC_ICER);
-
- /* Set all interrupts (and exceptions) to the default priority */
-
- putreg32(DEFPRIORITY32, ARMV6M_SYSCON_SHPR2);
- putreg32(DEFPRIORITY32, ARMV6M_SYSCON_SHPR3);
-
- /* Now set all of the interrupt lines to the default priority */
-
- for (i = 0; i < 8; i++)
- {
- regaddr = ARMV6M_NVIC_IPR(i);
- putreg32(DEFPRIORITY32, regaddr);
- }
-
- /* currents_regs is non-NULL only while processing an interrupt */
-
- CURRENT_REGS = NULL;
-
- /* Attach the SVCall and Hard Fault exception handlers. The SVCall
- * exception is used for performing context switches; The Hard Fault
- * must also be caught because a SVCall may show up as a Hard Fault
- * under certain conditions.
- */
-
- irq_attach(LPC11_IRQ_SVCALL, up_svcall, NULL);
- irq_attach(LPC11_IRQ_HARDFAULT, up_hardfault, NULL);
-
- /* Attach all other processor exceptions (except reset and sys tick) */
-
-#ifdef CONFIG_DEBUG_FEATURES
- irq_attach(LPC11_IRQ_NMI, lpc11_nmi, NULL);
- irq_attach(LPC11_IRQ_PENDSV, lpc11_pendsv, NULL);
- irq_attach(LPC11_IRQ_RESERVED, lpc11_reserved, NULL);
-#endif
-
- lpc11_dumpnvic("initial", NR_IRQS);
-
- /* Initialize logic to support a second level of interrupt decoding for
- * configured pin interrupts.
- */
-
-#ifdef CONFIG_LPC11_GPIOIRQ
- lpc11_gpioirqinitialize();
-#endif
-
-#ifndef CONFIG_SUPPRESS_INTERRUPTS
-
- /* And finally, enable interrupts */
-
- up_irq_enable();
-#endif
-}
-
-/****************************************************************************
- * Name: up_disable_irq
- *
- * Description:
- * Disable the IRQ specified by 'irq'
- *
- ****************************************************************************/
-
-void up_disable_irq(int irq)
-{
- DEBUGASSERT((unsigned)irq < NR_IRQS);
-
- /* Check for an external interrupt */
-
- if (irq >= LPC11_IRQ_EXTINT && irq < (LPC11_IRQ_EXTINT + 32))
- {
- /* Set the appropriate bit in the ICER register to disable the
- * interrupt
- */
-
- putreg32((1 << (irq - LPC11_IRQ_EXTINT)), ARMV6M_NVIC_ICER);
- }
-
- /* Handle processor exceptions. Only SysTick can be disabled */
-
- else if (irq == LPC11_IRQ_SYSTICK)
- {
- modifyreg32(ARMV6M_SYSTICK_CSR, SYSTICK_CSR_ENABLE, 0);
- }
-
- lpc11_dumpnvic("disable", irq);
-}
-
-/****************************************************************************
- * Name: up_enable_irq
- *
- * Description:
- * Enable the IRQ specified by 'irq'
- *
- ****************************************************************************/
-
-void up_enable_irq(int irq)
-{
- /* This will be called on each interrupt exit whether the interrupt can be
- * enabled or not. So this assertion is necessarily lame.
- */
-
- DEBUGASSERT((unsigned)irq < NR_IRQS);
-
- /* Check for external interrupt */
-
- if (irq >= LPC11_IRQ_EXTINT && irq < (LPC11_IRQ_EXTINT + 32))
- {
- /* Set the appropriate bit in the ISER register to enable the
- * interrupt
- */
-
- putreg32((1 << (irq - LPC11_IRQ_EXTINT)), ARMV6M_NVIC_ISER);
- }
-
- /* Handle processor exceptions. Only SysTick can be disabled */
-
- else if (irq == LPC11_IRQ_SYSTICK)
- {
- modifyreg32(ARMV6M_SYSTICK_CSR, 0, SYSTICK_CSR_ENABLE);
- }
-
- lpc11_dumpnvic("enable", irq);
-}
-
-/****************************************************************************
- * Name: up_ack_irq
- *
- * Description:
- * Acknowledge the IRQ
- *
- ****************************************************************************/
-
-void up_ack_irq(int irq)
-{
- lpc11_clrpend(irq);
-}
diff --git a/arch/arm/src/lpc11xx/lpc11_lowputc.c b/arch/arm/src/lpc11xx/lpc11_lowputc.c
deleted file mode 100644
index 8bf3759f488..00000000000
--- a/arch/arm/src/lpc11xx/lpc11_lowputc.c
+++ /dev/null
@@ -1,306 +0,0 @@
-/****************************************************************************
- * arch/arm/src/lpc11xx/lpc11_lowputc.c
- *
- * Copyright (C) 2015 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.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include
-
-#include
-
-#include
-#include
-
-#include "up_internal.h"
-#include "up_arch.h"
-
-#include "hardware/lpc11_syscon.h"
-#include "hardware/lpc11_uart.h"
-
-#include "lpc11_gpio.h"
-#include "lpc11_lowputc.h"
-#include "lpc11_serial.h"
-
-/****************************************************************************
- * Private Definitions
- ****************************************************************************/
-
-/* Select UART parameters for the selected console */
-
-#if defined(CONFIG_UART0_SERIAL_CONSOLE)
-# define CONSOLE_BASE LPC11_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(HAVE_SERIAL_CONSOLE)
-# error "No CONFIG_UART0_SERIAL_CONSOLE Setting"
-#endif
-
-/* Get word length setting for the console */
-
-#if CONSOLE_BITS == 5
-# define CONSOLE_LCR_WLS UART_LCR_WLS_5BIT
-#elif CONSOLE_BITS == 6
-# define CONSOLE_LCR_WLS UART_LCR_WLS_6BIT
-#elif CONSOLE_BITS == 7
-# define CONSOLE_LCR_WLS UART_LCR_WLS_7BIT
-#elif CONSOLE_BITS == 8
-# define CONSOLE_LCR_WLS UART_LCR_WLS_8BIT
-#elif defined(HAVE_SERIAL_CONSOLE)
-# error "Invalid CONFIG_UARTn_BITS setting for console "
-#endif
-
-/* Get parity setting for the console */
-
-#if CONSOLE_PARITY == 0
-# define CONSOLE_LCR_PAR 0
-#elif CONSOLE_PARITY == 1
-# define CONSOLE_LCR_PAR (UART_LCR_PE|UART_LCR_PS_ODD)
-#elif CONSOLE_PARITY == 2
-# define CONSOLE_LCR_PAR (UART_LCR_PE|UART_LCR_PS_EVEN)
-#elif CONSOLE_PARITY == 3
-# define CONSOLE_LCR_PAR (UART_LCR_PE|UART_LCR_PS_STICK1)
-#elif CONSOLE_PARITY == 4
-# define CONSOLE_LCR_PAR (UART_LCR_PE|UART_LCR_PS_STICK0)
-#elif defined(HAVE_SERIAL_CONSOLE)
-# error "Invalid CONFIG_UARTn_PARITY setting for CONSOLE"
-#endif
-
-/* Get stop-bit setting for the console and UART0-3 */
-
-#if CONSOLE_2STOP != 0
-# define CONSOLE_LCR_STOP UART_LCR_STOP
-#else
-# define CONSOLE_LCR_STOP 0
-#endif
-
-/* LCR and FCR values for the console */
-
-#define CONSOLE_LCR_VALUE (CONSOLE_LCR_WLS | CONSOLE_LCR_PAR | CONSOLE_LCR_STOP)
-#define CONSOLE_FCR_VALUE (UART_FCR_RXTRIGGER_8 | UART_FCR_TXRST |\
- UART_FCR_RXRST | UART_FCR_FIFOEN)
-
-/****************************************************************************
- * 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
- * fine in the LPC11xx as well.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Private Types
- ****************************************************************************/
-
-/****************************************************************************
- * Private Function Prototypes
- ****************************************************************************/
-
-/****************************************************************************
- * Public Data
- ****************************************************************************/
-
-/****************************************************************************
- * Private Data
- ****************************************************************************/
-
-/****************************************************************************
- * Private Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: up_lowputc
- *
- * Description:
- * Output one byte on the serial console
- *
- ****************************************************************************/
-
-void up_lowputc(char ch)
-{
-#if defined HAVE_UART && defined HAVE_SERIAL_CONSOLE
- /* Wait for the transmitter to be available */
-
- while ((getreg32(CONSOLE_BASE+LPC11_UART_LSR_OFFSET) & UART_LSR_THRE) == 0);
-
- /* Send the character */
-
- putreg32((uint32_t)ch, CONSOLE_BASE+LPC11_UART_THR_OFFSET);
-#endif
-}
-
-/****************************************************************************
- * Name: lpc11_lowsetup
- *
- * Description:
- * This performs basic initialization of the UART used for the serial
- * console. Its purpose is to get the console output available as soon
- * as possible.
- *
- * The UART peripheral is configured using the following registers:
- * 1. Pins: For the LPC111x/101/201/301 parts, the UART pins must be
- * configured in the IOCONFIG register block before the UART clocks can
- * be enabled in the SYSAHBCLKCTRL register. For all other parts, no
- * special enabling sequence is required.
- * 2. Power: In the SYSAHBCLKCTRL register, set bit 12.
- * On reset, UART is disabled.
- * 3. Peripheral clock: Enable the UART peripheral clock by writing to the
- * UARTCLKDIV register.
- *
- ****************************************************************************/
-
-void lpc11_lowsetup(void)
-{
-#ifdef HAVE_UART
- uint32_t regval;
- uint32_t coreclk = LPC11_MCLK;
- uint32_t rate16 = 16 * CONSOLE_BAUD;
- uint32_t dval;
- uint32_t mval;
- uint32_t dl;
-
- /* Enable clock for GPIO and I/O block */
-
- regval = getreg32(LPC11_SYSCON_SYSAHBCLKCTRL);
- regval |= (SYSCON_SYSAHBCLKCTRL_GPIO | SYSCON_SYSAHBCLKCTRL_IOCON);
- putreg32(regval, LPC11_SYSCON_SYSAHBCLKCTRL);
-
-#if defined(CONFIG_UART0_SERIAL_CONSOLE)
- /* Step 1: Pins configuration */
-
- lpc11_configgpio(GPIO_UART0_TXD);
- lpc11_configgpio(GPIO_UART0_RXD);
-#endif
-
- /* Step 2: Enable power for all console UART and disable power for
- * other UARTs.
- */
-
- regval = getreg32(LPC11_SYSCON_SYSAHBCLKCTRL);
-#if defined(CONFIG_UART0_SERIAL_CONSOLE)
- regval |= SYSCON_SYSAHBCLKCTRL_UART;
-#endif
- putreg32(regval, LPC11_SYSCON_SYSAHBCLKCTRL);
-
- /* Step 3: Enable peripheral clocking for the console UART and disable
- * clocking for all other UARTs
- */
-
- /* Don't divide the UART Clock it is be equal to Peripheral Clock */
-
- putreg32(1, LPC11_SYSCON_UARTCLKDIV);
-
- /* Configure the console (only) */
-
-#if defined(HAVE_SERIAL_CONSOLE) && !defined(CONFIG_SUPPRESS_UART_CONFIG)
-
- /* Clear fifos */
-
- putreg32(UART_FCR_RXRST | UART_FCR_TXRST,
- CONSOLE_BASE + LPC11_UART_FCR_OFFSET);
-
- /* Set trigger */
-
- putreg32(UART_FCR_FIFOEN | UART_FCR_RXTRIGGER_8,
- CONSOLE_BASE + LPC11_UART_FCR_OFFSET);
-
- /* Set up the LCR and set DLAB=1 */
-
- putreg32(CONSOLE_LCR_VALUE | UART_LCR_DLAB,
- CONSOLE_BASE + LPC11_UART_LCR_OFFSET);
-
- /* Configure the Baud rate
- *
- * The fractional is calculated as
- * (PCLK % (16 * Baudrate)) / (16 * Baudrate)
- */
-
- dval = coreclk % rate16;
-
- /* The PCLK / (16 * Baudrate) is fractional
- * dval = pclk % rate16
- * mval = rate16
- * now normalize the ratio
- * dval / mval = 1 / new_mval
- * new_mval = mval / dval;
- * new_dval = 1
- */
-
- if (dval > 0)
- {
- mval = rate16 / dval;
- dval = 1;
-
- if (mval > 12)
- {
- dval = 0;
- }
- }
-
- dval &= 0xf;
- mval &= 0xf;
-
- dl = coreclk / (rate16 + rate16 * dval / mval);
-
- /* Set the BAUD divisor */
-
- putreg32(dl & 0xff, CONSOLE_BASE + LPC11_UART_DLL_OFFSET);
- putreg32(dl >> 8, CONSOLE_BASE + LPC11_UART_DLM_OFFSET);
-
- /* Set the BAUD fractional */
-
- putreg32((mval << UART_FDR_MULVAL_SHIFT) |
- (dval << UART_FDR_DIVADDVAL_SHIFT),
- CONSOLE_BASE + LPC11_UART_FDR_OFFSET);
-
- /* Clear DLAB */
-
- putreg32(CONSOLE_LCR_VALUE, CONSOLE_BASE + LPC11_UART_LCR_OFFSET);
-
- /* Configure the FIFOs */
-
- putreg32(UART_FCR_RXTRIGGER_8 | UART_FCR_TXRST | UART_FCR_RXRST |
- UART_FCR_FIFOEN,
- CONSOLE_BASE + LPC11_UART_FCR_OFFSET);
-#endif
-#endif /* HAVE_UART */
-}
diff --git a/arch/arm/src/lpc11xx/lpc11_serial.c b/arch/arm/src/lpc11xx/lpc11_serial.c
deleted file mode 100644
index 00ec359fb2f..00000000000
--- a/arch/arm/src/lpc11xx/lpc11_serial.c
+++ /dev/null
@@ -1,1033 +0,0 @@
-/****************************************************************************
- * arch/arm/src/lpc11xx/lpc11_serial.c
- *
- * Copyright (C) 2015 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.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#ifdef CONFIG_SERIAL_TERMIOS
-# include
-#endif
-
-#include
-#include
-#include
-#include
-
-#include
-
-#include "up_arch.h"
-#include "up_internal.h"
-
-#include "chip.h"
-#include "hardware/lpc11_uart.h"
-#include "lpc11_gpio.h"
-#include "lpc11_serial.h"
-
-/****************************************************************************
- * Pre-processor definitions
- ****************************************************************************/
-
-/* If we are not using the serial driver for the console, then we still must
- * provide some minimal implementation of up_putc.
- */
-
-#if defined(USE_SERIALDRIVER) && defined(HAVE_UART)
-
-/* Configuration ************************************************************/
-
-/****************************************************************************
- * Private Types
- ****************************************************************************/
-
-struct up_dev_s
-{
- uint32_t uartbase; /* Base address of UART registers */
- uint32_t baud; /* Configured baud */
- uint32_t ier; /* Saved IER value */
- uint8_t irq; /* IRQ associated with this UART */
- uint8_t parity; /* 0=none, 1=odd, 2=even */
- uint8_t bits; /* Number of bits (7 or 8) */
-#ifdef LPC111x
- uint8_t cclkdiv; /* Divisor needed to get PCLK from CCLK */
-#endif
- bool stopbits2; /* true: Configure with 2 stop bits instead of 1 */
-};
-
-/****************************************************************************
- * Private Function Prototypes
- ****************************************************************************/
-
-static int up_setup(struct uart_dev_s *dev);
-static void up_shutdown(struct uart_dev_s *dev);
-static int up_attach(struct uart_dev_s *dev);
-static void up_detach(struct uart_dev_s *dev);
-static int up_interrupt(int irq, void *context, void *arg);
-static int up_ioctl(struct file *filep, int cmd, unsigned long arg);
-static int up_receive(struct uart_dev_s *dev, uint32_t *status);
-static void up_rxint(struct uart_dev_s *dev, bool enable);
-static bool up_rxavailable(struct uart_dev_s *dev);
-static void up_send(struct uart_dev_s *dev, int ch);
-static void up_txint(struct uart_dev_s *dev, bool enable);
-static bool up_txready(struct uart_dev_s *dev);
-static bool up_txempty(struct uart_dev_s *dev);
-
-/****************************************************************************
- * Private Data
- ****************************************************************************/
-
-static const struct uart_ops_s g_uart_ops =
-{
- .setup = up_setup,
- .shutdown = up_shutdown,
- .attach = up_attach,
- .detach = up_detach,
- .ioctl = up_ioctl,
- .receive = up_receive,
- .rxint = up_rxint,
- .rxavailable = up_rxavailable,
-#ifdef CONFIG_SERIAL_IFLOWCONTROL
- .rxflowcontrol = NULL,
-#endif
- .send = up_send,
- .txint = up_txint,
- .txready = up_txready,
- .txempty = up_txempty,
-};
-
-/* I/O buffers */
-
-#ifdef CONFIG_LPC11_UART0
-static char g_uart0rxbuffer[CONFIG_UART0_RXBUFSIZE];
-static char g_uart0txbuffer[CONFIG_UART0_TXBUFSIZE];
-#endif
-
-/* This describes the state of the LPC11xx uart0 port. */
-
-#ifdef CONFIG_LPC11_UART0
-static struct up_dev_s g_uart0priv =
-{
- .uartbase = LPC11_UART0_BASE,
- .baud = CONFIG_UART0_BAUD,
- .irq = LPC11_IRQ_UART,
- .parity = CONFIG_UART0_PARITY,
- .bits = CONFIG_UART0_BITS,
- .stopbits2 = CONFIG_UART0_2STOP,
-};
-
-static uart_dev_t g_uart0port =
-{
- .recv =
- {
- .size = CONFIG_UART0_RXBUFSIZE,
- .buffer = g_uart0rxbuffer,
- },
- .xmit =
- {
- .size = CONFIG_UART0_TXBUFSIZE,
- .buffer = g_uart0txbuffer,
- },
- .ops = &g_uart_ops,
- .priv = &g_uart0priv,
-};
-#endif
-
-/* Which UART with be tty0/console and which tty1? tty2? tty3? */
-
-#ifdef HAVE_SERIAL_CONSOLE
-# if defined(CONFIG_UART0_SERIAL_CONSOLE)
-# define CONSOLE_DEV g_uart0port /* UART0=console */
-# define TTYS0_DEV g_uart0port /* UART0=ttyS0 */
-# endif
-#else /* No console */
-# define TTYS0_DEV g_uart0port /* UART0=ttyS0 */
-#endif /* HAVE_SERIAL_CONSOLE */
-
-/****************************************************************************
- * Inline Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: up_serialin
- ****************************************************************************/
-
-static inline uint32_t up_serialin(struct up_dev_s *priv, int offset)
-{
- return getreg32(priv->uartbase + offset);
-}
-
-/****************************************************************************
- * Name: up_serialout
- ****************************************************************************/
-
-static inline void up_serialout(struct up_dev_s *priv, int offset, uint32_t value)
-{
- putreg32(value, priv->uartbase + offset);
-}
-
-/****************************************************************************
- * Name: up_disableuartint
- ****************************************************************************/
-
-static inline void up_disableuartint(struct up_dev_s *priv, uint32_t *ier)
-{
- if (ier)
- {
- *ier = priv->ier & UART_IER_ALLIE;
- }
-
- priv->ier &= ~UART_IER_ALLIE;
- up_serialout(priv, LPC11_UART_IER_OFFSET, priv->ier);
-}
-
-/****************************************************************************
- * Name: up_restoreuartint
- ****************************************************************************/
-
-static inline void up_restoreuartint(struct up_dev_s *priv, uint32_t ier)
-{
- priv->ier |= ier & UART_IER_ALLIE;
- up_serialout(priv, LPC11_UART_IER_OFFSET, priv->ier);
-}
-
-/****************************************************************************
- * Name: up_enablebreaks
- ****************************************************************************/
-
-static inline void up_enablebreaks(struct up_dev_s *priv, bool enable)
-{
- uint32_t lcr = up_serialin(priv, LPC11_UART_LCR_OFFSET);
-
- if (enable)
- {
- lcr |= UART_LCR_BRK;
- }
- else
- {
- lcr &= ~UART_LCR_BRK;
- }
-
- up_serialout(priv, LPC11_UART_LCR_OFFSET, lcr);
-}
-
-/************************************************************************************
- * Name: lpc11_uartcclkdiv
- *
- * Description:
- * Select a CCLK divider to produce the UART PCLK. The strategy is to select the
- * smallest divisor that results in an solution within range of the 16-bit
- * DLM and DLL divisor:
- *
- * PCLK = MCLK / divisor
- * BAUD = PCLK / (16 * DL)
- *
- * Ignoring the fractional divider for now. (If you want to extend this driver
- * to support the fractional divider, see lpc43xx_uart.c. The LPC43xx uses
- * the same peripheral and that logic could easily leveraged here).
- *
- * For the LPC111x the PCLK is determined by the UART-specific divisor in
- * PCLKSEL0 or PCLKSEL1:
- *
- * PCLK = MCLK / divisor
- *
- * For the LPC111x, 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
- * a constant is provided for the desired frequency, then most of the following
- * logic will be optimized away.
- *
- ************************************************************************************/
-
-#ifdef LPC111x
-static inline uint32_t lpc11_uartcclkdiv(uint32_t baud)
-{
- /* Ignoring the fractional divider, the BAUD is given by:
- *
- * BAUD = PCLK / (16 * DL), or
- * DL = PCLK / BAUD / 16
- *
- * Where for the LPC111x the PCLK is determined by the UART-specific divisor in
- * :
- *
- * UART_PCLK = MAIN_CLOCK / divisor
- *
- */
-
- /* Calculate and optimal PCLKSEL0/1 divisor.
- * First, check divisor == 1. This works if the upper limit is met:
- *
- * DL < 0xffff, or
- * PCLK / BAUD / 16 < 0xffff, or
- * MCLK / BAUD / 16 < 0xffff, or
- * MCLK < BAUD * 0xffff * 16
- * BAUD > MCLK / 0xffff / 16
- *
- * And the lower limit is met (we can't allow DL to get very close to one).
- *
- * DL >= MinDL
- * MCLK / BAUD / 16 >= MinDL, or
- * BAUD <= CCLK / 16 / MinDL
- */
-
- return 1;
-}
-#endif /* LPC111x */
-
-/************************************************************************************
- * Name: lpc11_uart0config
- *
- * Description:
- * Configure the UART. UART0 peripherals are configured using the following
- * registers:
- *
- * 1. Power: In the PCONP register, set bits PCUART0.
- * On reset, UART0 and UART 1 are enabled (PCUART0 = 1 and PCUART1 = 1)
- * and UART2/3 are disabled (PCUART1 = 0 and PCUART3 = 0).
- * 2. Peripheral clock: In the PCLKSEL0 register, select PCLK_UART0 and
- * PCLK_UART1; in the PCLKSEL1 register, select PCLK_UART2 and PCLK_UART3.
- * 3. Pins: Select UART pins through the PINSEL registers and pin modes
- * through the PINMODE registers. UART receive pins should not have
- * pull-down resistors enabled.
- *
- ************************************************************************************/
-
-#ifdef CONFIG_LPC11_UART0
-static inline void lpc11_uart0config(void)
-{
- uint32_t regval;
- irqstate_t flags;
-
- /* Step 1: Pins configuration */
-
- flags = enter_critical_section();
- lpc11_configgpio(GPIO_UART0_TXD);
- lpc11_configgpio(GPIO_UART0_RXD);
-
- /* Step 2: Enable power on UART0 */
-
- regval = getreg32(LPC11_SYSCON_SYSAHBCLKCTRL);
- regval |= SYSCON_SYSAHBCLKCTRL_UART;
- putreg32(regval, LPC11_SYSCON_SYSAHBCLKCTRL);
-
- /* Step 3: Enable clocking UART */
-
- putreg32(1, LPC11_SYSCON_UARTCLKDIV);
- leave_critical_section(flags);
-};
-#endif
-
-/************************************************************************************
- * Name: lpc11_uartdl
- *
- * Description:
- * Select a divider to produce the BAUD from the UART PCLK.
- *
- * BAUD = PCLK / (16 * DL), or
- * DL = PCLK / BAUD / 16
- *
- * Ignoring the fractional divider for now. (If you want to extend this driver
- * to support the fractional divider, see lpc43xx_uart.c. The LPC43xx uses
- * the same peripheral and that logic could easily leveraged here).
- *
- ************************************************************************************/
-
-#ifdef LPC111x
-static inline uint32_t lpc11_uartdl(uint32_t baud, uint8_t divcode)
-{
- /* TODO: Calculate DL automatically */
-
- uint32_t num = 312;
-
- return num;
-}
-#else
-static inline uint32_t lpc11_uartdl(uint32_t baud)
-{
- return (uint32_t)BOARD_PCLK_FREQUENCY / (baud << 4);
-}
-#endif
-
-/****************************************************************************
- * Private Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: up_setup
- *
- * Description:
- * Configure the UART baud, bits, parity, fifos, etc. This method is
- * called the first time that the serial port is opened.
- *
- ****************************************************************************/
-
-static int up_setup(struct uart_dev_s *dev)
-{
-#ifndef CONFIG_SUPPRESS_UART_CONFIG
- struct up_dev_s *priv = (struct up_dev_s *)dev->priv;
- uint16_t dl;
- uint32_t lcr;
-
- /* Clear fifos */
-
- up_serialout(priv, LPC11_UART_FCR_OFFSET, (UART_FCR_RXRST | UART_FCR_TXRST));
-
- /* Set trigger */
-
- up_serialout(priv, LPC11_UART_FCR_OFFSET, (UART_FCR_FIFOEN | UART_FCR_RXTRIGGER_8));
-
- /* Set up the IER */
-
- priv->ier = up_serialin(priv, LPC11_UART_IER_OFFSET);
-
- /* Set up the LCR */
-
- lcr = 0;
-
- if (priv->bits == 7)
- {
- lcr |= UART_LCR_WLS_7BIT;
- }
- else
- {
- lcr |= UART_LCR_WLS_8BIT;
- }
-
- if (priv->stopbits2)
- {
- lcr |= UART_LCR_STOP;
- }
-
- if (priv->parity == 1)
- {
- lcr |= (UART_LCR_PE | UART_LCR_PS_ODD);
- }
- else if (priv->parity == 2)
- {
- lcr |= (UART_LCR_PE | UART_LCR_PS_EVEN);
- }
-
- /* Enter DLAB=1 */
-
- up_serialout(priv, LPC11_UART_LCR_OFFSET, (lcr | UART_LCR_DLAB));
-
- /* Set the BAUD divisor */
-
-#ifdef LPC111x
- dl = lpc11_uartdl(priv->baud, priv->cclkdiv);
-#else
- dl = lpc11_uartdl(priv->baud);
-#endif
- up_serialout(priv, LPC11_UART_DLM_OFFSET, dl >> 8);
- up_serialout(priv, LPC11_UART_DLL_OFFSET, dl & 0xff);
-
- /* Clear DLAB */
-
- up_serialout(priv, LPC11_UART_LCR_OFFSET, lcr);
-
- /* Configure the FIFOs */
-
- up_serialout(priv, LPC11_UART_FCR_OFFSET,
- (UART_FCR_RXTRIGGER_8 | UART_FCR_TXRST | UART_FCR_RXRST |
- UART_FCR_FIFOEN));
-
-#endif
-
- return OK;
-}
-
-/****************************************************************************
- * Name: up_shutdown
- *
- * Description:
- * Disable the UART. This method is called when the serial port is closed
- *
- ****************************************************************************/
-
-static void up_shutdown(struct uart_dev_s *dev)
-{
- struct up_dev_s *priv = (struct up_dev_s *)dev->priv;
- up_disableuartint(priv, NULL);
-}
-
-/****************************************************************************
- * Name: up_attach
- *
- * Description:
- * Configure the UART to operation in interrupt driven mode. This method
- * is called when the serial port is opened. Normally, this is just after
- * the setup() method is called, however, the serial console may
- * operate in a non-interrupt driven mode during the boot phase.
- *
- * RX and TX interrupts are not enabled when by the attach method (unless
- * the hardware supports multiple levels of interrupt enabling). The RX
- * and TX interrupts are not enabled until the txint() and rxint() methods
- * are called.
- *
- ****************************************************************************/
-
-static int up_attach(struct uart_dev_s *dev)
-{
- struct up_dev_s *priv = (struct up_dev_s *)dev->priv;
- int ret;
-
- /* Attach and enable the IRQ */
-
- ret = irq_attach(priv->irq, up_interrupt, dev);
- if (ret == OK)
- {
- /* Enable the interrupt (RX and TX interrupts are still disabled
- * in the UART
- */
-
- up_enable_irq(priv->irq);
- }
-
- return ret;
-}
-
-/****************************************************************************
- * Name: up_detach
- *
- * Description:
- * Detach UART interrupts. This method is called when the serial port is
- * closed normally just before the shutdown method is called. The
- * exception is the serial console which is never shutdown.
- *
- ****************************************************************************/
-
-static void up_detach(struct uart_dev_s *dev)
-{
- struct up_dev_s *priv = (struct up_dev_s *)dev->priv;
- up_disable_irq(priv->irq);
- irq_detach(priv->irq);
-}
-
-/****************************************************************************
- * Name: up_interrupt
- *
- * Description:
- * This is the UART interrupt handler. It will be invoked when an
- * interrupt received on the 'irq' It should call uart_transmitchars or
- * uart_receivechar to perform the appropriate data transfers. The
- * interrupt handling logic must be able to map the 'irq' number into the
- * appropriate uart_dev_s structure in order to call these functions.
- *
- ****************************************************************************/
-
-static int up_interrupt(int irq, void *context, void *arg)
-{
- struct uart_dev_s *dev = (struct uart_dev_s *)arg;
- struct up_dev_s *priv;
- uint32_t status;
- int passes;
-
- DEBUGASSERT(dev != NULL && dev->priv != NULL);
- priv = (struct up_dev_s *)dev->priv;
-
- /* Loop until there are no characters to be transferred or,
- * until we have been looping for a long time.
- */
-
- for (passes = 0; passes < 256; passes++)
- {
- /* Get the current UART status and check for loop
- * termination conditions
- */
-
- status = up_serialin(priv, LPC11_UART_IIR_OFFSET);
-
- /* The UART_IIR_INTSTATUS bit should be zero if there are pending
- * interrupts
- */
-
- if ((status & UART_IIR_INTSTATUS) != 0)
- {
- /* Break out of the loop when there is no longer a
- * pending interrupt
- */
-
- break;
- }
-
- /* Handle the interrupt by its interrupt ID field */
-
- switch (status & UART_IIR_INTID_MASK)
- {
- /* Handle incoming, receive bytes (with or without timeout) */
-
- case UART_IIR_INTID_RDA:
- case UART_IIR_INTID_CTI:
- {
- uart_recvchars(dev);
- break;
- }
-
- /* Handle outgoing, transmit bytes */
-
- case UART_IIR_INTID_THRE:
- {
- uart_xmitchars(dev);
- break;
- }
-
- /* Just clear any line status interrupts */
-
- case UART_IIR_INTID_RLS:
- {
- /* Read the line status register (LSR) to clear */
-
- status = up_serialin(priv, LPC11_UART_LSR_OFFSET);
- _info("LSR: %02x\n", status);
- break;
- }
-
- /* There should be no other values */
-
- default:
- {
- _err("ERROR: Unexpected IIR: %02x\n", status);
- break;
- }
- }
- }
- return OK;
-}
-
-/****************************************************************************
- * Name: up_ioctl
- *
- * Description:
- * All ioctl calls will be routed through this method
- *
- ****************************************************************************/
-
-static int up_ioctl(struct file *filep, int cmd, unsigned long arg)
-{
- struct inode *inode = filep->f_inode;
- struct uart_dev_s *dev = inode->i_private;
- struct up_dev_s *priv = (struct up_dev_s *)dev->priv;
- int ret = OK;
-
- switch (cmd)
- {
-#ifdef CONFIG_SERIAL_TIOCSERGSTRUCT
- case TIOCSERGSTRUCT:
- {
- struct up_dev_s *user = (struct up_dev_s *)arg;
- if (!user)
- {
- ret = -EINVAL;
- }
- else
- {
- memcpy(user, dev, sizeof(struct up_dev_s));
- }
- }
- break;
-#endif
-
- case TIOCSBRK: /* BSD compatibility: Turn break on, unconditionally */
- {
- irqstate_t flags = enter_critical_section();
- up_enablebreaks(priv, true);
- leave_critical_section(flags);
- }
- break;
-
- case TIOCCBRK: /* BSD compatibility: Turn break off, unconditionally */
- {
- irqstate_t flags;
- flags = enter_critical_section();
- up_enablebreaks(priv, false);
- leave_critical_section(flags);
- }
- break;
-
-#ifdef CONFIG_SERIAL_TERMIOS
- case TCGETS:
- {
- struct termios *termiosp = (struct termios *)arg;
-
- if (!termiosp)
- {
- ret = -EINVAL;
- break;
- }
-
- /* TODO: Other termios fields are not yet returned.
- * Note that cfsetospeed is not necessary because we have
- * knowledge that only one speed is supported.
- * Both cfset(i|o)speed() translate to cfsetspeed.
- */
-
- cfsetispeed(termiosp, priv->baud);
- }
- break;
-
- case TCSETS:
- {
- struct termios *termiosp = (struct termios *)arg;
- uint32_t lcr; /* Holds current values of line control register */
- uint16_t dl; /* Divisor latch */
-
- if (!termiosp)
- {
- ret = -EINVAL;
- break;
- }
-
- /* TODO: Handle other termios settings.
- * Note that only cfgetispeed is used because we have knowledge
- * that only one speed is supported.
- */
-
- /* Get the c_speed field in the termios struct */
-
- priv->baud = cfgetispeed(termiosp);
-
- /* TODO: Re-calculate the optimal CCLK divisor for the new baud and
- * and reset the divider in the CLKSEL0/1 register.
- */
-
-#ifdef LPC111x
- priv->cclkdiv = lpc11_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 + LPC11_UART_LCR_OFFSET);
- up_serialout(priv, LPC11_UART_LCR_OFFSET, (lcr | UART_LCR_DLAB));
-
- /* Set the BAUD divisor */
-
-#ifdef LPC111x
- dl = lpc11_uartdl(priv->baud, priv->cclkdiv);
-#else
- dl = lpc11_uartdl(priv->baud);
-#endif
- up_serialout(priv, LPC11_UART_DLM_OFFSET, dl >> 8);
- up_serialout(priv, LPC11_UART_DLL_OFFSET, dl & 0xff);
-
- /* Clear DLAB */
-
- up_serialout(priv, LPC11_UART_LCR_OFFSET, lcr);
- }
- break;
-#endif
-
- default:
- ret = -ENOTTY;
- break;
- }
-
- return ret;
-}
-
-/****************************************************************************
- * Name: up_receive
- *
- * Description:
- * Called (usually) from the interrupt level to receive one
- * character from the UART. Error bits associated with the
- * receipt are provided in the return 'status'.
- *
- ****************************************************************************/
-
-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, LPC11_UART_LSR_OFFSET);
- rbr = up_serialin(priv, LPC11_UART_RBR_OFFSET);
- return rbr;
-}
-
-/****************************************************************************
- * Name: up_rxint
- *
- * Description:
- * Call to enable or disable RX interrupts
- *
- ****************************************************************************/
-
-static void up_rxint(struct uart_dev_s *dev, bool enable)
-{
- struct up_dev_s *priv = (struct up_dev_s *)dev->priv;
- if (enable)
- {
-#ifndef CONFIG_SUPPRESS_SERIAL_INTS
- priv->ier |= UART_IER_RBRIE;
-#endif
- }
- else
- {
- priv->ier &= ~UART_IER_RBRIE;
- }
-
- up_serialout(priv, LPC11_UART_IER_OFFSET, priv->ier);
-}
-
-/****************************************************************************
- * Name: up_rxavailable
- *
- * Description:
- * Return true if the receive fifo is not empty
- *
- ****************************************************************************/
-
-static bool up_rxavailable(struct uart_dev_s *dev)
-{
- struct up_dev_s *priv = (struct up_dev_s *)dev->priv;
- return ((up_serialin(priv, LPC11_UART_LSR_OFFSET) & UART_LSR_RDR) != 0);
-}
-
-/****************************************************************************
- * Name: up_send
- *
- * Description:
- * This method will send one byte on the UART
- *
- ****************************************************************************/
-
-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, LPC11_UART_THR_OFFSET, (uint32_t)ch);
-}
-
-/****************************************************************************
- * Name: up_txint
- *
- * Description:
- * Call to enable or disable TX interrupts
- *
- ****************************************************************************/
-
-static void up_txint(struct uart_dev_s *dev, bool enable)
-{
- struct up_dev_s *priv = (struct up_dev_s *)dev->priv;
- irqstate_t flags;
-
- flags = enter_critical_section();
- if (enable)
- {
-#ifndef CONFIG_SUPPRESS_SERIAL_INTS
- priv->ier |= UART_IER_THREIE;
- up_serialout(priv, LPC11_UART_IER_OFFSET, priv->ier);
-
- /* Fake a TX interrupt here by just calling uart_xmitchars() with
- * interrupts disabled (note this may recurse).
- */
-
- uart_xmitchars(dev);
-#endif
- }
- else
- {
- priv->ier &= ~UART_IER_THREIE;
- up_serialout(priv, LPC11_UART_IER_OFFSET, priv->ier);
- }
-
- leave_critical_section(flags);
-}
-
-/****************************************************************************
- * Name: up_txready
- *
- * Description:
- * Return true if the transmit fifo is not full
- *
- ****************************************************************************/
-
-static bool up_txready(struct uart_dev_s *dev)
-{
- struct up_dev_s *priv = (struct up_dev_s *)dev->priv;
- return ((up_serialin(priv, LPC11_UART_LSR_OFFSET) & UART_LSR_THRE) != 0);
-}
-
-/****************************************************************************
- * Name: up_txempty
- *
- * Description:
- * Return true if the transmit fifo is empty
- *
- ****************************************************************************/
-
-static bool up_txempty(struct uart_dev_s *dev)
-{
- struct up_dev_s *priv = (struct up_dev_s *)dev->priv;
- return ((up_serialin(priv, LPC11_UART_LSR_OFFSET) & UART_LSR_THRE) != 0);
-}
-
-/****************************************************************************
- * Public Funtions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: up_serialinit
- *
- * Description:
- * Performs the low level UART initialization early in debug so that the
- * serial console will be available during bootup. This must be called
- * before up_serialinit.
- *
- * NOTE: Configuration of the CONSOLE UART was performed by up_lowsetup()
- * very early in the boot sequence.
- *
- ****************************************************************************/
-
-void up_earlyserialinit(void)
-{
- /* Configure all UARTs (except the CONSOLE UART) and disable interrupts */
-
-#ifdef CONFIG_LPC11_UART0
-#ifdef LPC111x
- g_uart0priv.cclkdiv = lpc11_uartcclkdiv(CONFIG_UART0_BAUD);
-#endif
-#ifndef CONFIG_UART0_SERIAL_CONSOLE
- lpc11_uart0config();
-#endif
- up_disableuartint(&g_uart0priv, NULL);
-#endif
-
- /* Configuration whichever one is the console */
-
-#ifdef CONSOLE_DEV
- CONSOLE_DEV.isconsole = true;
- up_setup(&CONSOLE_DEV);
-#endif
-}
-
-/****************************************************************************
- * Name: up_serialinit
- *
- * Description:
- * Register serial console and serial ports. This assumes that
- * up_earlyserialinit was called previously.
- *
- ****************************************************************************/
-
-void up_serialinit(void)
-{
-#ifdef CONSOLE_DEV
- (void)uart_register("/dev/console", &CONSOLE_DEV);
-#endif
-#ifdef TTYS0_DEV
- (void)uart_register("/dev/ttyS0", &TTYS0_DEV);
-#endif
-#ifdef TTYS1_DEV
- (void)uart_register("/dev/ttyS1", &TTYS1_DEV);
-#endif
-#ifdef TTYS2_DEV
- (void)uart_register("/dev/ttyS2", &TTYS2_DEV);
-#endif
-#ifdef TTYS3_DEV
- (void)uart_register("/dev/ttyS3", &TTYS3_DEV);
-#endif
-}
-
-/****************************************************************************
- * Name: up_putc
- *
- * Description:
- * Provide priority, low-level access to support OS debug writes
- *
- ****************************************************************************/
-
-int up_putc(int ch)
-{
-#ifdef HAVE_SERIAL_CONSOLE
- struct up_dev_s *priv = (struct up_dev_s *)CONSOLE_DEV.priv;
- uint32_t ier;
- up_disableuartint(priv, &ier);
-#endif
-
- /* Check for LF */
-
- if (ch == '\n')
- {
- /* Add CR */
-
- up_lowputc('\r');
- }
-
- up_lowputc(ch);
-#ifdef HAVE_SERIAL_CONSOLE
- up_restoreuartint(priv, ier);
-#endif
-
- return ch;
-}
-
-#else /* USE_SERIALDRIVER */
-
-/****************************************************************************
- * Name: up_putc
- *
- * Description:
- * Provide priority, low-level access to support OS debug writes
- *
- ****************************************************************************/
-
-int up_putc(int ch)
-{
-#ifdef HAVE_UART
- /* Check for LF */
-
- if (ch == '\n')
- {
- /* Add CR */
-
- up_lowputc('\r');
- }
-
- up_lowputc(ch);
-#endif
- return ch;
-}
-
-#endif /* USE_SERIALDRIVER */
diff --git a/arch/arm/src/lpc11xx/lpc11_serial.h b/arch/arm/src/lpc11xx/lpc11_serial.h
deleted file mode 100644
index 82d4e59051a..00000000000
--- a/arch/arm/src/lpc11xx/lpc11_serial.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/************************************************************************************
- * arch/arm/src/lpc11xx/lpc11_serial.h
- *
- * Copyright (C) 2015 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_LPC11XX_LPC11_SERIAL_H
-#define __ARCH_ARM_SRC_LPC11XX_LPC11_SERIAL_H
-
-/************************************************************************************
- * Included Files
- ************************************************************************************/
-
-#include
-#include
-
-#include "hardware/lpc11_uart.h"
-#include "hardware/lpc11_syscon.h"
-
-#include "lpc11_gpio.h"
-
-/************************************************************************************
- * Pre-processor Definitions
- ************************************************************************************/
-
-/* Configuration *********************************************************************/
-
-/* Are any UARTs enabled? */
-
-#undef HAVE_UART
-#if defined(CONFIG_LPC11_UART0)
-# define HAVE_UART 1
-#endif
-
-/* Is there a serial console? There should be at most one defined. It could be on
- * any UARTn, n=0,1,2,3
- */
-
-#if defined(CONFIG_UART0_SERIAL_CONSOLE) && defined(CONFIG_LPC11_UART0)
-# define HAVE_SERIAL_CONSOLE 1
-#else
-# undef CONFIG_UART0_SERIAL_CONSOLE
-# undef HAVE_SERIAL_CONSOLE
-#endif
-
-/* We cannot allow the DLM/DLL divisor to become to small or will will lose too
- * much accuracy. This following is a "fudge factor" that represents the minimum
- * value of the divisor that we will permit.
- */
-
-#define UART_MINDL 32
-
-/************************************************************************************
- * Public Types
- ************************************************************************************/
-
-/************************************************************************************
- * Public Data
- ************************************************************************************/
-
-/************************************************************************************
- * Inline Functions
- ************************************************************************************/
-
-/************************************************************************************
- * Public Functions
- ************************************************************************************/
-
-#endif /* __ARCH_ARM_SRC_LPC11XX_LPC11_SERIAL_H */
diff --git a/arch/arm/src/lpc11xx/lpc11_spi.c b/arch/arm/src/lpc11xx/lpc11_spi.c
deleted file mode 100644
index 78b306549ba..00000000000
--- a/arch/arm/src/lpc11xx/lpc11_spi.c
+++ /dev/null
@@ -1,592 +0,0 @@
-/****************************************************************************
- * arch/arm/src/lpc11xx/lpc11_spi.c
- *
- * Copyright (C) 2015-2017 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.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include
-
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include
-#include
-#include
-#include
-
-#include "up_internal.h"
-#include "up_arch.h"
-
-#include "chip.h"
-#include "hardware/lpc11_syscon.h"
-#include "lpc11_gpio.h"
-#include "lpc11_spi.h"
-
-#ifdef CONFIG_LPC11_SPI
-
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-/* Configuration ************************************************************/
-/* This driver does not support the SPI exchange method. */
-
-#ifdef CONFIG_SPI_EXCHANGE
-# error "CONFIG_SPI_EXCHANGE must not be defined in the configuration"
-#endif
-
-/* SSP Clocking *************************************************************/
-/* The CPU clock by 1, 2, 4, or 8 to get the SPI peripheral clock (SPI_CLOCK).
- * SPI_CLOCK may be further divided by 8-254 to get the SPI clock. If we
- * want a usable range of 4KHz to 25MHz for the SPI, then:
- *
- * 1. SPICLK must be greater than (8*25MHz) = 200MHz (so we can't reach 25MHz),
- * and
- * 2. SPICLK must be less than (254*40Khz) = 101.6MHz.
- *
- * If we assume that CCLK less than or equal to 100MHz, we can just
- * use the CCLK undivided to get the SPI_CLOCK.
- */
-
-#define SPI_PCLKSET_DIV SYSCON_PCLKSEL_CCLK
-#define SPI_CLOCK LPC11_CCLK
-
-/****************************************************************************
- * Private Types
- ****************************************************************************/
-
-/* This structure describes the state of the SSP driver */
-
-struct lpc11_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 */
- uint32_t frequency; /* Requested clock frequency */
- uint32_t actual; /* Actual clock frequency */
- uint8_t nbits; /* Width of word in bits (8 to 16) */
- uint8_t mode; /* Mode 0,1,2,3 */
-};
-
-/****************************************************************************
- * Private Function Prototypes
- ****************************************************************************/
-
-/* SPI methods */
-
-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);
-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);
-static uint16_t spi_send(FAR struct spi_dev_s *dev, uint16_t ch);
-static void spi_sndblock(FAR struct spi_dev_s *dev,
- FAR const void *buffer, size_t nwords);
-static void spi_recvblock(FAR struct spi_dev_s *dev, FAR void *buffer,
- size_t nwords);
-
-/****************************************************************************
- * Private Data
- ****************************************************************************/
-
-static const struct spi_ops_s g_spiops =
-{
- .lock = spi_lock,
- .select = lpc11_spiselect,
- .setfrequency = spi_setfrequency,
- .setmode = spi_setmode,
- .setbits = spi_setbits,
-#ifdef CONFIG_SPI_HWFEATURES
- .hwfeatures = 0, /* Not supported */
-#endif
- .status = lpc11_spistatus,
-#ifdef CONFIG_SPI_CMDDATA
- .cmddata = lpc11_spicmddata,
-#endif
- .send = spi_send,
- .sndblock = spi_sndblock,
- .recvblock = spi_recvblock,
-#ifdef CONFIG_SPI_CALLBACK
- .registercallback = lpc11_spiregister, /* Provided externally */
-#else
- .registercallback = 0, /* Not implemented */
-#endif
-};
-
-static struct lpc11_spidev_s g_spidev =
-{
- .spidev = { &g_spiops },
-};
-
-/****************************************************************************
- * Public Data
- ****************************************************************************/
-
-/****************************************************************************
- * Private Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: spi_lock
- *
- * Description:
- * On SPI buses where there are multiple devices, it will be necessary to
- * lock SPI to have exclusive access to the buses for a sequence of
- * transfers. The bus should be locked before the chip is selected. After
- * locking the SPI bus, the caller should then also call the setfrequency,
- * setbits, and setmode methods to make sure that the SPI is properly
- * configured for the device. If the SPI buss is being shared, then it
- * may have been left in an incompatible state.
- *
- * Input Parameters:
- * dev - Device-specific state data
- * lock - true: Lock spi bus, false: unlock SPI bus
- *
- * Returned Value:
- * None
- *
- ****************************************************************************/
-
-static int spi_lock(FAR struct spi_dev_s *dev, bool lock)
-{
- FAR struct lpc11_spidev_s *priv = (FAR struct lpc11_spidev_s *)dev;
- int ret;
-
- if (lock)
- {
- /* Take the semaphore (perhaps waiting) */
-
- do
- {
- ret = nxsem_wait(&priv->exclsem);
-
- /* The only case that an error should occur here is if the wait
- * was awakened by a signal.
- */
-
- DEBUGASSERT(ret == OK || ret == -EINTR);
- }
- while (ret == -EINTR);
- }
- else
- {
- (void)nxsem_post(&priv->exclsem);
- ret = 0
- }
-
- return ret;
-}
-
-/****************************************************************************
- * Name: spi_setfrequency
- *
- * Description:
- * Set the SPI frequency.
- *
- * Input Parameters:
- * dev - Device-specific state data
- * frequency - The SPI frequency requested
- *
- * Returned Value:
- * Returns the actual frequency selected
- *
- ****************************************************************************/
-
-static uint32_t spi_setfrequency(FAR struct spi_dev_s *dev,
- uint32_t frequency)
-{
- FAR struct lpc11_spidev_s *priv = (FAR struct lpc11_spidev_s *)dev;
- uint32_t divisor;
- uint32_t actual;
-
- /* Check if the requested frequence is the same as the frequency selection */
-
- DEBUGASSERT(priv && frequency <= SPI_CLOCK / 2);
-
- if (priv->frequency == frequency)
- {
- /* We are already at this frequency. Return the actual. */
-
- return priv->actual;
- }
-
- /* frequency = SPI_CLOCK / divisor, or divisor = SPI_CLOCK / frequency */
-
- divisor = SPI_CLOCK / frequency;
-
- /* The SPI CCR register must contain an even number greater than or equal
- * to 8.
- */
-
- if (divisor < 8)
- {
- divisor = 8;
- }
- else if (divisor > 254)
- {
- divisor = 254;
- }
-
- divisor = (divisor + 1) & ~1;
-
- /* Save the new divisor value */
-
- putreg32(divisor, LPC11_SPI_CCR);
-
- /* Calculate the new actual */
-
- actual = SPI_CLOCK / divisor;
-
- /* Save the frequency setting */
-
- priv->frequency = frequency;
- priv->actual = actual;
-
- spiinfo("Frequency %d->%d\n", frequency, actual);
- return actual;
-}
-
-/****************************************************************************
- * Name: spi_setmode
- *
- * Description:
- * Set the SPI mode. Optional. See enum spi_mode_e for mode definitions
- *
- * Input Parameters:
- * dev - Device-specific state data
- * mode - The SPI mode requested
- *
- * Returned Value:
- * none
- *
- ****************************************************************************/
-
-static void spi_setmode(FAR struct spi_dev_s *dev, enum spi_mode_e mode)
-{
- FAR struct lpc11_spidev_s *priv = (FAR struct lpc11_spidev_s *)dev;
- uint32_t regval;
-
- /* Has the mode changed? */
-
- if (mode != priv->mode)
- {
- /* Yes... Set CR appropriately */
-
- regval = getreg32(LPC11_SPI_CR);
- regval &= ~(SPI_CR_CPOL | SPI_CR_CPHA);
-
- switch (mode)
- {
- case SPIDEV_MODE0: /* CPOL=0; CPHA=0 */
- break;
-
- case SPIDEV_MODE1: /* CPOL=0; CPHA=1 */
- regval |= SPI_CR_CPHA;
- break;
-
- case SPIDEV_MODE2: /* CPOL=1; CPHA=0 */
- regval |= SPI_CR_CPOL;
- break;
-
- case SPIDEV_MODE3: /* CPOL=1; CPHA=1 */
- regval |= (SPI_CR_CPOL | SPI_CR_CPHA);
- break;
-
- default:
- DEBUGASSERT(FALSE);
- return;
- }
-
- putreg32(regval, LPC11_SPI_CR);
-
- /* Save the mode so that subsequent re-configurations will be faster */
-
- priv->mode = mode;
- }
-}
-
-/****************************************************************************
- * Name: spi_setbits
- *
- * Description:
- * Set the number if bits per word.
- *
- * Input Parameters:
- * dev - Device-specific state data
- * nbits - The number of bits requests
- *
- * Returned Value:
- * none
- *
- ****************************************************************************/
-
-static void spi_setbits(FAR struct spi_dev_s *dev, int nbits)
-{
- FAR struct lpc11_spidev_s *priv = (FAR struct lpc11_spidev_s *)dev;
- uint32_t regval;
-
- /* Has the number of bits changed? */
-
- DEBUGASSERT(priv && nbits > 7 && nbits < 17);
-
- if (nbits != priv->nbits)
- {
- /* Yes... Set CR appropriately */
-
- regval = getreg32(LPC11_SPI_CR);
- regval &= ~SPI_CR_BITS_MASK;
- regval |= (nbits << SPI_CR_BITS_SHIFT) & SPI_CR_BITS_MASK;
- regval |= SPI_CR_BITENABLE;
- regval = getreg32(LPC11_SPI_CR);
-
- /* Save the selection so the subsequence re-configurations will be faster */
-
- priv->nbits = nbits;
- }
-}
-
-/****************************************************************************
- * Name: spi_send
- *
- * Description:
- * Exchange one word on SPI
- *
- * Input Parameters:
- * dev - Device-specific state data
- * wd - The word to send. the size of the data is determined by the
- * number of bits selected for the SPI interface.
- *
- * Returned Value:
- * response
- *
- ****************************************************************************/
-
-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, LPC11_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(LPC11_SPI_SR) & SPI_SR_SPIF) == 0);
-
- /* Read the SPI Status Register again to clear the status bit */
-
- (void)getreg32(LPC11_SPI_SR);
- return (uint16_t)getreg32(LPC11_SPI_DR);
-}
-
-/****************************************************************************
- * Name: spi_sndblock
- *
- * Description:
- * Send a block of data on SPI
- *
- * Input Parameters:
- * dev - Device-specific state data
- * buffer - A pointer to the buffer of data to be sent
- * nwords - the length of data to send from the buffer in number of words.
- * The wordsize is determined by the number of bits-per-word
- * selected for the SPI interface. If nbits <= 8, the data is
- * packed into uint8_t's; if nbits >8, the data is packed into
- * uint16_t's
- *
- * Returned Value:
- * None
- *
- ****************************************************************************/
-
-static void spi_sndblock(FAR struct spi_dev_s *dev, FAR const void *buffer,
- size_t nwords)
-{
- FAR uint8_t *ptr = (FAR uint8_t *)buffer;
- uint8_t data;
-
- spiinfo("nwords: %d\n", nwords);
- while (nwords)
- {
- /* Write the data to transmitted to the SPI Data Register */
-
- data = *ptr++;
- putreg32((uint32_t)data, LPC11_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(LPC11_SPI_SR) & SPI_SR_SPIF) == 0);
-
- /* Read the SPI Status Register again to clear the status bit */
-
- (void)getreg32(LPC11_SPI_SR);
- nwords--;
- }
-}
-
-/****************************************************************************
- * Name: spi_recvblock
- *
- * Description:
- * Revice a block of data from SPI
- *
- * Input Parameters:
- * dev - Device-specific state data
- * buffer - A pointer to the buffer in which to receive data
- * nwords - the length of data that can be received in the buffer in
- * number of words. The wordsize is determined by the number of
- * bits-per-word selected for the SPI interface. If nbits <= 8,
- * the data is packed into uint8_t's; if nbits >8, the data is
- * packed into uint16_t's
- *
- * Returned Value:
- * None
- *
- ****************************************************************************/
-
-static void spi_recvblock(FAR struct spi_dev_s *dev, FAR void *buffer,
- size_t nwords)
-{
- FAR uint8_t *ptr = (FAR uint8_t *)buffer;
-
- spiinfo("nwords: %d\n", nwords);
- while (nwords)
- {
- /* Write some dummy data to the SPI Data Register in order to clock the
- * read data.
- */
-
- putreg32(0xff, LPC11_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(LPC11_SPI_SR) & SPI_SR_SPIF) == 0);
-
- /* Read the SPI Status Register again to clear the status bit */
-
- (void)getreg32(LPC11_SPI_SR);
-
- /* Read the received data from the SPI Data Register */
-
- *ptr++ = (uint8_t)getreg32(LPC11_SPI_DR);
- nwords--;
- }
-}
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: lpc11_spibus_initialize
- *
- * Description:
- * Initialize the selected SPI port.
- *
- * Input Parameters:
- * Port number (for hardware that has multiple SPI interfaces)
- *
- * Returned Value:
- * Valid SPI device structure reference on success; a NULL on failure
- *
- ****************************************************************************/
-
-FAR struct spi_dev_s *lpc11_spibus_initialize(int port)
-{
- FAR struct lpc11_spidev_s *priv = &g_spidev;
- irqstate_t flags;
- uint32_t regval;
-
- /* Configure multiplexed pins as connected on the board. Chip select
- * pins must be configured by board-specific logic. All SPI pins and
- * one SPI1 pin (SCK) have multiple, alternative pin selection.
- * Definitions in the board.h file must be provided to resolve the
- * board-specific pin configuration like:
- *
- * #define GPIO_SPI_SCK GPIO_SPI_SCK_1
- */
-
- flags = enter_critical_section();
- lpc11_configgpio(GPIO_SPI_SCK);
- lpc11_configgpio(GPIO_SPI_MISO);
- lpc11_configgpio(GPIO_SPI_MOSI);
-
- /* Configure clocking */
-
- regval = getreg32(LPC11_SYSCON_PCLKSEL0);
- regval &= ~SYSCON_PCLKSEL0_SPI_MASK;
- regval |= (SPI_PCLKSET_DIV << SYSCON_PCLKSEL0_SPI_SHIFT);
- putreg32(regval, LPC11_SYSCON_PCLKSEL0);
-
- /* Enable peripheral clocking to SPI and SPI1 */
-
- regval = getreg32(LPC11_SYSCON_PCONP);
- regval |= SYSCON_PCONP_PCSPI;
- putreg32(regval, LPC11_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,
- LPC11_SPI_CR);
-
- /* Set the initial SPI configuration */
-
- priv->frequency = 0;
- priv->nbits = 8;
- priv->mode = SPIDEV_MODE0;
-
- /* Select a default frequency of approx. 400KHz */
-
- spi_setfrequency((FAR struct spi_dev_s *)priv, 400000);
-
- /* Initialize the SPI semaphore that enforces mutually exclusive access */
-
- nxsem_init(&priv->exclsem, 0, 1);
- return &priv->spidev;
-}
-
-#endif /* CONFIG_LPC11_SPI */
diff --git a/arch/arm/src/lpc11xx/lpc11_spi.h b/arch/arm/src/lpc11xx/lpc11_spi.h
deleted file mode 100644
index b17f5215080..00000000000
--- a/arch/arm/src/lpc11xx/lpc11_spi.h
+++ /dev/null
@@ -1,160 +0,0 @@
-/************************************************************************************
- * arch/arm/src/lpc11xx/lpc11_spi.h
- *
- * Copyright (C) 2015 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_LPC11XX_LPC11_SPI_H
-#define __ARCH_ARM_SRC_LPC11XX_LPC11_SPI_H
-
-/************************************************************************************
- * Included Files
- ************************************************************************************/
-
-#include
-
-#include
-
-/************************************************************************************
- * Public Data
- ************************************************************************************/
-
-#ifdef CONFIG_LPC11_SPI
-
-#ifndef __ASSEMBLY__
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-/************************************************************************************
- * Public Functions
- ************************************************************************************/
-
-/************************************************************************************
- * Name: lpc11_spibus_initialize
- *
- * Description:
- * Initialize the selected SPI port.
- *
- * Input Parameters:
- * Port number (for hardware that has mutiple SPI interfaces)
- *
- * Returned Value:
- * Valid SPI device structure reference on succcess; a NULL on failure
- *
- ************************************************************************************/
-
-FAR struct spi_dev_s *lpc11_spibus_initialize(int port);
-
-/************************************************************************************
- * Name: lpc11_spiselect, lpc11_status, and lpc11_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 lpc11_spibus_initialize()) are provided by common LPC11xx logic. To use
- * this common SPI logic on your board:
- *
- * 1. Provide logic in lpc11_boardinitialize() to configure SPI chip select pins.
- * 2. Provide lpc11_spiselect() and lpc11_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
- * lpc11_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 lpc11_spibus_initialize() in your low level application
- * initialization logic
- * 4. The handle returned by lpc11_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 lpc11_spiselect(FAR struct spi_dev_s *dev, uint32_t devid, bool selected);
-uint8_t lpc11_spistatus(FAR struct spi_dev_s *dev, uint32_t devid);
-#ifdef CONFIG_SPI_CMDDATA
-int lpc11_spicmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
-#endif
-
-/************************************************************************************
- * Name: spi_flush
- *
- * Description:
- * Flush and discard any words left in the RX fifo. This can be called
- * from spiselect after a device is deselected (if you worry about such
- * things).
- *
- * Input Parameters:
- * dev - Device-specific state data
- *
- * Returned Value:
- * None
- *
- ************************************************************************************/
-
-void spi_flush(FAR struct spi_dev_s *dev);
-
-/************************************************************************************
- * Name: lpc11_spiregister
- *
- * Description:
- * If the board supports a card detect callback to inform the SPI-based
- * MMC/SD drvier when an SD card is inserted or removed, then
- * CONFIG_SPI_CALLBACK should be defined and the following function must
- * must be implemented. These functions implements the registercallback
- * method of the SPI interface (see include/nuttx/spi/spi.h for details)
- *
- * Input Parameters:
- * dev - Device-specific state data
- * callback - The funtion to call on the media change
- * arg - A caller provided value to return with the callback
- *
- * Returned Value:
- * 0 on success; negated errno on failure.
- *
- ************************************************************************************/
-
-#ifdef CONFIG_SPI_CALLBACK
-int lpc11_spiregister(FAR struct spi_dev_s *dev, spi_mediachange_t callback,
- FAR void *arg);
-#endif
-
-#if defined(__cplusplus)
-}
-#endif
-
-#endif /* __ASSEMBLY__ */
-#endif /* CONFIG_LPC11_SPI */
-#endif /* __ARCH_ARM_SRC_LPC11XX_LPC11_SPI_H */
diff --git a/arch/arm/src/lpc11xx/lpc11_ssp.c b/arch/arm/src/lpc11xx/lpc11_ssp.c
deleted file mode 100644
index 780a8945626..00000000000
--- a/arch/arm/src/lpc11xx/lpc11_ssp.c
+++ /dev/null
@@ -1,1057 +0,0 @@
-/****************************************************************************
- * arch/arm/src/lpc11xx/lpc11_ssp.c
- *
- * Copyright (C) 2015-2017 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.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include
-
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include
-#include
-#include
-#include
-
-#include "up_internal.h"
-#include "up_arch.h"
-
-#include "chip.h"
-#include "hardware/lpc11_syscon.h"
-#include "lpc11_gpio.h"
-#include "lpc11_ssp.h"
-
-#if defined(CONFIG_LPC11_SSP0) || defined(CONFIG_LPC11_SSP1) || \
- defined(CONFIG_LPC11_SSP2)
-
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-/* Configuration ************************************************************/
-/* This driver does not support the SPI exchange method. */
-
-#ifdef CONFIG_SPI_EXCHANGE
-# error "CONFIG_SPI_EXCHANGE must not be defined in the configuration"
-#endif
-
-/* SSP Clocking *************************************************************/
-
-#if defined(LPC111x)
-/* The CPU clock by 1, 2, 4, or 8 to get the SSP peripheral clock (SSP_CLOCK).
- * SSP_CLOCK may be further divided by 2-254 to get the SSP clock. If we
- * want a usable range of 4KHz to 25MHz for the SSP, then:
- *
- * 1. SSPCLK must be greater than (2*25MHz) = 50MHz, and
- * 2. SSPCLK must be less than (254*40Khz) = 101.6MHz.
- *
- * If we assume that CCLK less than or equal to 100MHz, we can just
- * use the CCLK undivided to get the SSP_CLOCK.
- */
-
-# if LPC11_CCLK > 100000000
-# error "CCLK <= 100,000,000 assumed"
-# endif
-
-# define SSP_PCLKSET_DIV SYSCON_PCLKSEL_CCLK
-# define SSP_CLOCK LPC11_CCLK
-
-#elif defined(LPC111x)
-/* All peripherals are clocked by the same peripheral clock in the LPC111x
- * family.
- */
-
-# define SSP_CLOCK BOARD_PCLK_FREQUENCY
-
-#endif
-
-/****************************************************************************
- * Private Types
- ****************************************************************************/
-
-/* This structure descibes the state of the SSP driver */
-
-struct lpc11_sspdev_s
-{
- struct spi_dev_s spidev; /* Externally visible part of the SPI interface */
- uint32_t sspbase; /* SPIn base address */
-#ifdef CONFIG_LPC11_SSP_INTERRUPTS
- uint8_t sspirq; /* SPI IRQ number */
-#endif
- sem_t exclsem; /* Held while chip is selected for mutual exclusion */
- uint32_t frequency; /* Requested clock frequency */
- uint32_t actual; /* Actual clock frequency */
- uint8_t nbits; /* Width of word in bits (4 to 16) */
- uint8_t mode; /* Mode 0,1,2,3 */
-};
-
-/****************************************************************************
- * Private Function Prototypes
- ****************************************************************************/
-
-/* Helpers */
-
-static inline uint32_t ssp_getreg(FAR struct lpc11_sspdev_s *priv,
- uint8_t offset);
-static inline void ssp_putreg(FAR struct lpc11_sspdev_s *priv,
- uint8_t offset, uint32_t value);
-
-/* SPI methods */
-
-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);
-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);
-static uint16_t ssp_send(FAR struct spi_dev_s *dev, uint16_t ch);
-static void ssp_sndblock(FAR struct spi_dev_s *dev,
- FAR const void *buffer, size_t nwords);
-static void ssp_recvblock(FAR struct spi_dev_s *dev, FAR void *buffer,
- size_t nwords);
-
-/* Initialization */
-
-#ifdef CONFIG_LPC11_SSP0
-static inline FAR struct lpc11_sspdev_s *lpc11_ssp0initialize(void);
-#endif
-#ifdef CONFIG_LPC11_SSP1
-static inline FAR struct lpc11_sspdev_s *lpc11_ssp1initialize(void);
-#endif
-
-/****************************************************************************
- * Private Data
- ****************************************************************************/
-
-#ifdef CONFIG_LPC11_SSP0
-static const struct spi_ops_s g_spi0ops =
-{
- .lock = ssp_lock,
- .select = lpc11_ssp0select, /* Provided externally */
- .setfrequency = ssp_setfrequency,
- .setmode = ssp_setmode,
- .setbits = ssp_setbits,
-#ifdef CONFIG_SPI_HWFEATURES
- .hwfeatures = 0, /* Not supported */
-#endif
- .status = lpc11_ssp0status, /* Provided externally */
-#ifdef CONFIG_SPI_CMDDATA
- .cmddata = lpc11_ssp0cmddata, /* Provided externally */
-#endif
- .send = ssp_send,
- .sndblock = ssp_sndblock,
- .recvblock = ssp_recvblock,
-#ifdef CONFIG_SPI_CALLBACK
- .registercallback = lpc11_ssp0register, /* Provided externally */
-#else
- .registercallback = 0, /* Not implemented */
-#endif
-};
-
-static struct lpc11_sspdev_s g_ssp0dev =
-{
- .spidev = { &g_spi0ops },
- .sspbase = LPC11_SSP0_BASE,
-#ifdef CONFIG_LPC11_SSP_INTERRUPTS
- .sspirq = LPC11_IRQ_SSP0,
-#endif
-};
-#endif /* CONFIG_LPC11_SSP0 */
-
-#ifdef CONFIG_LPC11_SSP1
-static const struct spi_ops_s g_spi1ops =
-{
- .lock = ssp_lock,
- .select = lpc11_ssp1select, /* Provided externally */
- .setfrequency = ssp_setfrequency,
- .setmode = ssp_setmode,
- .setbits = ssp_setbits,
- .status = lpc11_ssp1status, /* Provided externally */
-#ifdef CONFIG_SPI_CMDDATA
- .cmddata = lpc11_ssp1cmddata, /* Provided externally */
-#endif
- .send = ssp_send,
- .sndblock = ssp_sndblock,
- .recvblock = ssp_recvblock,
-#ifdef CONFIG_SPI_CALLBACK
- .registercallback = lpc11_ssp1register, /* Provided externally */
-#else
- .registercallback = 0, /* Not implemented */
-#endif
-};
-
-static struct lpc11_sspdev_s g_ssp1dev =
-{
- .spidev = { &g_spi1ops },
- .sspbase = LPC11_SSP1_BASE,
-#ifdef CONFIG_LPC11_SSP_INTERRUPTS
- .sspirq = LPC11_IRQ_SSP1,
-#endif
-};
-#endif /* CONFIG_LPC11_SSP1 */
-
-#ifdef CONFIG_LPC11_SSP2
-static const struct spi_ops_s g_spi2ops =
-{
- .lock = ssp_lock,
- .select = lpc11_ssp2select, /* Provided externally */
- .setfrequency = ssp_setfrequency,
- .setmode = ssp_setmode,
- .setbits = ssp_setbits,
- .status = lpc11_ssp2status, /* Provided externally */
-#ifdef CONFIG_SPI_CMDDATA
- .cmddata = lpc11_ssp2cmddata, /* Provided externally */
-#endif
- .send = ssp_send,
- .sndblock = ssp_sndblock,
- .recvblock = ssp_recvblock,
-#ifdef CONFIG_SPI_CALLBACK
- .registercallback = lpc11_ssp2register, /* Provided externally */
-#else
- .registercallback = 0, /* Not implemented */
-#endif
-};
-
-static struct lpc11_sspdev_s g_ssp2dev =
-{
- .spidev = { &g_spi2ops },
- .sspbase = LPC11_SSP2_BASE,
-#ifdef CONFIG_LPC11_SSP_INTERRUPTS
- .sspirq = LPC11_IRQ_SSP2,
-#endif
-};
-#endif /* CONFIG_LPC11_SSP2 */
-
-/****************************************************************************
- * Public Data
- ****************************************************************************/
-
-/****************************************************************************
- * Private Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: ssp_getreg
- *
- * Description:
- * Get the contents of the SPI register at offset
- *
- * Input Parameters:
- * priv - private SPI device structure
- * offset - offset to the register of interest
- *
- * Returned Value:
- * The contents of the 32-bit register
- *
- ****************************************************************************/
-
-static inline uint32_t ssp_getreg(FAR struct lpc11_sspdev_s *priv,
- uint8_t offset)
-{
- return getreg32(priv->sspbase + (uint32_t)offset);
-}
-
-/****************************************************************************
- * Name: ssp_putreg
- *
- * Description:
- * Write a 32-bit value to the SPI register at offset
- *
- * Input Parameters:
- * priv - private SPI device structure
- * offset - offset to the register of interest
- * value - the 16-bit value to be written
- *
- * Returned Value:
- * None
- *
- ****************************************************************************/
-
-static inline void ssp_putreg(FAR struct lpc11_sspdev_s *priv,
- uint8_t offset, uint32_t value)
-{
- putreg32(value, priv->sspbase + (uint32_t)offset);
-}
-
-/****************************************************************************
- * Name: ssp_lock
- *
- * Description:
- * On SPI buses where there are multiple devices, it will be necessary to
- * lock SPI to have exclusive access to the buses for a sequence of
- * transfers. The bus should be locked before the chip is selected. After
- * locking the SPI bus, the caller should then also call the setfrequency,
- * setbits, and setmode methods to make sure that the SPI is properly
- * configured for the device. If the SPI buss is being shared, then it
- * may have been left in an incompatible state.
- *
- * Input Parameters:
- * dev - Device-specific state data
- * lock - true: Lock spi bus, false: unlock SPI bus
- *
- * Returned Value:
- * None
- *
- ****************************************************************************/
-
-static int ssp_lock(FAR struct spi_dev_s *dev, bool lock)
-{
- FAR struct lpc11_sspdev_s *priv = (FAR struct lpc11_sspdev_s *)dev;
- int ret
-
- if (lock)
- {
- /* Take the semaphore (perhaps waiting) */
-
- do
- {
- ret = nxsem_wait(&priv->exclsem);
-
- /* The only case that an error should occur here is if the wait
- * was awakened by a signal.
- */
-
- DEBUGASSERT(ret == OK || ret == -EINTR);
- }
- while (ret == -EINTR);
- }
- else
- {
- (void)nxsem_post(&priv->exclsem);
- ret = OK;
- }
-
- return ret;
-}
-
-/****************************************************************************
- * Name: ssp_setfrequency
- *
- * Description:
- * Set the SPI frequency.
- *
- * Input Parameters:
- * dev - Device-specific state data
- * frequency - The SPI frequency requested
- *
- * Returned Value:
- * Returns the actual frequency selected
- *
- ****************************************************************************/
-
-static uint32_t ssp_setfrequency(FAR struct spi_dev_s *dev, uint32_t frequency)
-{
- FAR struct lpc11_sspdev_s *priv = (FAR struct lpc11_sspdev_s *)dev;
- uint32_t cpsdvsr;
- uint32_t scr;
- uint32_t regval;
- uint32_t actual;
-
- /* Check if the requested frequency is the same as the frequency selection */
-
- DEBUGASSERT(priv && frequency <= SSP_CLOCK / 2);
-
- if (priv->frequency == frequency)
- {
- /* We are already at this frequency. Return the actual. */
-
- return priv->actual;
- }
-
- /* The SSP bit frequency is given by:
- *
- * frequency = SSP_CLOCK / (CPSDVSR * (SCR+1)).
- *
- * 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 LPC11xx parts, SCR
- * will probably always be zero.
- */
-
- for (scr = 1; scr <= 256; scr++)
- {
- /* CPSDVSR = SSP_CLOCK / (SCR + 1) / frequency */
-
- cpsdvsr = SSP_CLOCK / (scr * frequency);
-
- /* Break out on the first solution we find with the smallest value
- * of SCR and with CPSDVSR within the maximum range or 254.
- */
-
- if (cpsdvsr < 255)
- {
- break;
- }
- }
-
- DEBUGASSERT(scr <= 256 && cpsdvsr <= 255);
-
- /* "In master mode, CPSDVSRmin = 2 or larger (even numbers only)" */
-
- if (cpsdvsr < 2)
- {
- /* Clip to the minimum value. */
-
- cpsdvsr = 2;
- }
- else if (cpsdvsr > 254)
- {
- /* This should never happen */
-
- cpsdvsr = 254;
- }
-
- /* Force even */
-
- cpsdvsr = (cpsdvsr + 1) & ~1;
-
- /* Save the new CPSDVSR and SCR values */
-
- ssp_putreg(priv, LPC11_SSP_CPSR_OFFSET, cpsdvsr);
-
- regval = ssp_getreg(priv, LPC11_SSP_CR0_OFFSET);
- regval &= ~SSP_CR0_SCR_MASK;
- regval |= ((scr - 1) << SSP_CR0_SCR_SHIFT);
- ssp_putreg(priv, LPC11_SSP_CR0_OFFSET, regval);
-
- /* Calculate the new actual */
-
- actual = SSP_CLOCK / (cpsdvsr * scr);
-
- /* Save the frequency setting */
-
- priv->frequency = frequency;
- priv->actual = actual;
-
- spiinfo("Frequency %d->%d\n", frequency, actual);
- return actual;
-}
-
-/****************************************************************************
- * Name: ssp_setmode
- *
- * Description:
- * Set the SPI mode. Optional. See enum spi_mode_e for mode definitions
- *
- * Input Parameters:
- * dev - Device-specific state data
- * mode - The SPI mode requested
- *
- * Returned Value:
- * none
- *
- ****************************************************************************/
-
-static void ssp_setmode(FAR struct spi_dev_s *dev, enum spi_mode_e mode)
-{
- FAR struct lpc11_sspdev_s *priv = (FAR struct lpc11_sspdev_s *)dev;
- uint32_t regval;
-
- /* Has the mode changed? */
-
- if (mode != priv->mode)
- {
- /* Yes... Set CR0 appropriately */
-
- regval = ssp_getreg(priv, LPC11_SSP_CR0_OFFSET);
- regval &= ~(SSP_CR0_CPOL | SSP_CR0_CPHA);
-
- switch (mode)
- {
- case SPIDEV_MODE0: /* CPOL=0; CPHA=0 */
- break;
-
- case SPIDEV_MODE1: /* CPOL=0; CPHA=1 */
- regval |= SSP_CR0_CPHA;
- break;
-
- case SPIDEV_MODE2: /* CPOL=1; CPHA=0 */
- regval |= SSP_CR0_CPOL;
- break;
-
- case SPIDEV_MODE3: /* CPOL=1; CPHA=1 */
- regval |= (SSP_CR0_CPOL | SSP_CR0_CPHA);
- break;
-
- default:
- spierr("ERROR: Bad mode: %d\n", mode);
- DEBUGASSERT(FALSE);
- return;
- }
-
- ssp_putreg(priv, LPC11_SSP_CR0_OFFSET, regval);
-
- /* Save the mode so that subsequent re-configurations will be faster */
-
- priv->mode = mode;
- }
-}
-
-/****************************************************************************
- * Name: ssp_setbits
- *
- * Description:
- * Set the number if bits per word.
- *
- * Input Parameters:
- * dev - Device-specific state data
- * nbits - The number of bits requests
- *
- * Returned Value:
- * none
- *
- ****************************************************************************/
-
-static void ssp_setbits(FAR struct spi_dev_s *dev, int nbits)
-{
- FAR struct lpc11_sspdev_s *priv = (FAR struct lpc11_sspdev_s *)dev;
- uint32_t regval;
-
- /* Has the number of bits changed? */
-
- DEBUGASSERT(priv && nbits > 3 && nbits < 17);
-
- if (nbits != priv->nbits)
- {
- /* Yes... Set CR1 appropriately */
-
- regval = ssp_getreg(priv, LPC11_SSP_CR0_OFFSET);
- regval &= ~SSP_CR0_DSS_MASK;
- regval |= ((nbits - 1) << SSP_CR0_DSS_SHIFT);
- ssp_putreg(priv, LPC11_SSP_CR0_OFFSET, regval);
-
- /* Save the selection so the subsequence re-configurations will be faster */
-
- priv->nbits = nbits;
- }
-}
-
-/****************************************************************************
- * Name: ssp_send
- *
- * Description:
- * Exchange one word on SPI
- *
- * Input Parameters:
- * dev - Device-specific state data
- * wd - The word to send. the size of the data is determined by the
- * number of bits selected for the SPI interface.
- *
- * Returned Value:
- * response
- *
- ****************************************************************************/
-
-static uint16_t ssp_send(FAR struct spi_dev_s *dev, uint16_t wd)
-{
- FAR struct lpc11_sspdev_s *priv = (FAR struct lpc11_sspdev_s *)dev;
- register uint32_t regval;
-
- /* Wait while the TX FIFO is full */
-
- while (!(ssp_getreg(priv, LPC11_SSP_SR_OFFSET) & SSP_SR_TNF));
-
- /* Write the byte to the TX FIFO */
-
- ssp_putreg(priv, LPC11_SSP_DR_OFFSET, (uint32_t)wd);
-
- /* Wait for the RX FIFO not empty */
-
- while (!(ssp_getreg(priv, LPC11_SSP_SR_OFFSET) & SSP_SR_RNE));
-
- /* Get the value from the RX FIFO and return it */
-
- regval = ssp_getreg(priv, LPC11_SSP_DR_OFFSET);
- spiinfo("%04x->%04x\n", wd, regval);
- return (uint16_t)regval;
-}
-
-/****************************************************************************
- * Name: ssp_sndblock
- *
- * Description:
- * Send a block of data on SPI
- *
- * Input Parameters:
- * dev - Device-specific state data
- * buffer - A pointer to the buffer of data to be sent
- * nwords - the length of data to send from the buffer in number of words.
- * The wordsize is determined by the number of bits-per-word
- * selected for the SPI interface. If nbits <= 8, the data is
- * packed into uint8_t's; if nbits >8, the data is packed into uint16_t's
- *
- * Returned Value:
- * None
- *
- ****************************************************************************/
-
-static void ssp_sndblock(FAR struct spi_dev_s *dev, FAR const void *buffer,
- size_t nwords)
-{
- FAR struct lpc11_sspdev_s *priv = (FAR struct lpc11_sspdev_s *)dev;
- union
- {
- FAR const uint8_t *p8;
- FAR const uint16_t *p16;
- FAR const void *pv;
- } u;
- uint32_t data;
- uint32_t sr;
-
- /* Loop while thre are bytes remaining to be sent */
-
- spiinfo("nwords: %d\n", nwords);
- u.pv = buffer;
- while (nwords > 0)
- {
- /* While the TX FIFO is not full and there are bytes left to send */
-
- while ((ssp_getreg(priv, LPC11_SSP_SR_OFFSET) & SSP_SR_TNF) && nwords)
- {
- /* Fetch the data to send */
-
- if (priv->nbits > 8)
- {
- data = (uint32_t)*u.p16++;
- }
- else
- {
- data = (uint32_t)*u.p8++;
- }
-
- /* Send the data */
-
- ssp_putreg(priv, LPC11_SSP_DR_OFFSET, data);
- nwords--;
- }
- }
-
- /* Then discard all card responses until the RX & TX FIFOs are emptied. */
-
- spiinfo("discarding\n");
- do
- {
- /* Is there anything in the RX fifo? */
-
- sr = ssp_getreg(priv, LPC11_SSP_SR_OFFSET);
- if ((sr & SSP_SR_RNE) != 0)
- {
- /* Yes.. Read and discard */
-
- (void)ssp_getreg(priv, LPC11_SSP_DR_OFFSET);
- }
-
- /* There is a race condition where TFE may go true just before
- * RNE goes true and this loop terminates prematurely. The nasty
- * little delay in the following solves that (it could probably be
- * tuned to improve performance).
- */
-
- else if ((sr & SSP_SR_TFE) != 0)
- {
- up_udelay(100);
- sr = ssp_getreg(priv, LPC11_SSP_SR_OFFSET);
- }
- }
- while ((sr & SSP_SR_RNE) != 0 || (sr & SSP_SR_TFE) == 0);
-}
-
-/****************************************************************************
- * Name: ssp_recvblock
- *
- * Description:
- * Receive a block of data from SPI
- *
- * Input Parameters:
- * dev - Device-specific state data
- * buffer - A pointer to the buffer in which to recieve data
- * nwords - the length of data that can be received in the buffer in
- * number of words. The wordsize is determined by the number of
- * bits-per-word selected for the SPI interface. If nbits <= 8,
- * the data is packed into uint8_t's; if nbits >8, the data is
- * packed into uint16_t's
- *
- * Returned Value:
- * None
- *
- ****************************************************************************/
-
-static void ssp_recvblock(FAR struct spi_dev_s *dev, FAR void *buffer,
- size_t nwords)
-{
- FAR struct lpc11_sspdev_s *priv = (FAR struct lpc11_sspdev_s *)dev;
- union
- {
- FAR uint8_t *p8;
- FAR uint16_t *p16;
- FAR void *pv;
- } u;
- uint32_t data;
- uint32_t rxpending = 0;
-
- /* While there is remaining to be sent (and no synchronization error has
- * occurred).
- */
-
- spiinfo("nwords: %d\n", nwords);
- u.pv = buffer;
- while (nwords || rxpending)
- {
- /* Fill the transmit FIFO with 0xffff...
- * Write 0xff to the data register while (1) the TX FIFO is
- * not full, (2) we have not exceeded the depth of the TX FIFO,
- * and (3) there are more bytes to be sent.
- */
-
- spiinfo("TX: rxpending: %d nwords: %d\n", rxpending, nwords);
- while ((ssp_getreg(priv, LPC11_SSP_SR_OFFSET) & SSP_SR_TNF) &&
- (rxpending < LPC11_SSP_FIFOSZ) && nwords)
- {
- ssp_putreg(priv, LPC11_SSP_DR_OFFSET, 0xffff);
- nwords--;
- rxpending++;
- }
-
- /* 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, LPC11_SSP_SR_OFFSET) & SSP_SR_RNE)
- {
- data = (uint8_t)ssp_getreg(priv, LPC11_SSP_DR_OFFSET);
- if (priv->nbits > 8)
- {
- *u.p16++ = (uint16_t)data;
- }
- else
- {
- *u.p8++ = (uint8_t)data;
- }
- rxpending--;
- }
- }
-}
-
-/****************************************************************************
- * Name: lpc11_ssp0initialize
- *
- * Description:
- * Initialize the SSP0
- *
- * Input Parameters:
- * None
- *
- * Returned Value:
- * Valid SPI device structure reference on success; a NULL on failure
- *
- ****************************************************************************/
-
-#ifdef CONFIG_LPC11_SSP0
-static inline FAR struct lpc11_sspdev_s *lpc11_ssp0initialize(void)
-{
- irqstate_t flags;
- uint32_t regval;
-
- /* Configure multiplexed pins as connected on the board. Chip select
- * pins must be configured by board-specific logic. All SSP0 pins and
- * one SSP1 pin (SCK) have multiple, alternative pin selection.
- * Definitions in the board.h file must be provided to resolve the
- * board-specific pin configuration like:
- *
- * #define GPIO_SSP0_SCK GPIO_SSP0_SCK_1
- */
-
- flags = enter_critical_section();
- lpc11_configgpio(GPIO_SSP0_SCK);
- lpc11_configgpio(GPIO_SSP0_MISO);
- lpc11_configgpio(GPIO_SSP0_MOSI);
-
- /* Configure clocking */
-
-#ifdef LPC111x
- regval = getreg32(LPC11_SYSCON_PCLKSEL1);
- regval &= ~SYSCON_PCLKSEL1_SSP0_MASK;
- regval |= (SSP_PCLKSET_DIV << SYSCON_PCLKSEL1_SSP0_SHIFT);
- putreg32(regval, LPC11_SYSCON_PCLKSEL1);
-#endif
-
- /* Enable peripheral clocking to SSP0 */
-
- regval = getreg32(LPC11_SYSCON_PCONP);
- regval |= SYSCON_PCONP_PCSSP0;
- putreg32(regval, LPC11_SYSCON_PCONP);
- leave_critical_section(flags);
-
- return &g_ssp0dev;
-}
-#endif
-
-/****************************************************************************
- * Name: lpc11_ssp1initialize
- *
- * Description:
- * Initialize the SSP1
- *
- * Input Parameters:
- * None
- *
- * Returned Value:
- * Valid SPI device structure reference on success; a NULL on failure
- *
- ****************************************************************************/
-
-#ifdef CONFIG_LPC11_SSP1
-static inline FAR struct lpc11_sspdev_s *lpc11_ssp1initialize(void)
-{
- irqstate_t flags;
- uint32_t regval;
-
- /* Configure multiplexed pins as connected on the board. Chip select
- * pins must be configured by board-specific logic. All SSP0 pins and
- * one SSP1 pin (SCK) have multiple, alternative pin selection.
- * Definitions in the board.h file must be provided to resolve the
- * board-specific pin configuration like:
- *
- * #define GPIO_SSP0_SCK GPIO_SSP0_SCK_1
- */
-
- flags = enter_critical_section();
- lpc11_configgpio(GPIO_SSP1_SCK);
- lpc11_configgpio(GPIO_SSP1_MISO);
- lpc11_configgpio(GPIO_SSP1_MOSI);
-
- /* Configure clocking */
-
-#ifdef LPC111x
- regval = getreg32(LPC11_SYSCON_PCLKSEL0);
- regval &= ~SYSCON_PCLKSEL0_SSP1_MASK;
- regval |= (SSP_PCLKSET_DIV << SYSCON_PCLKSEL0_SSP1_SHIFT);
- putreg32(regval, LPC11_SYSCON_PCLKSEL0);
-#endif
-
- /* Enable peripheral clocking to SSP0 and SSP1 */
-
- regval = getreg32(LPC11_SYSCON_PCONP);
- regval |= SYSCON_PCONP_PCSSP1;
- putreg32(regval, LPC11_SYSCON_PCONP);
- leave_critical_section(flags);
-
- return &g_ssp1dev;
-}
-#endif
-
-/****************************************************************************
- * Name: lpc11_ssp2initialize
- *
- * Description:
- * Initialize the SSP2
- *
- * Input Parameters:
- * None
- *
- * Returned Value:
- * Valid SPI device structure reference on success; a NULL on failure
- *
- ****************************************************************************/
-
-#ifdef CONFIG_LPC11_SSP2
-static inline FAR struct lpc11_sspdev_s *lpc11_ssp2initialize(void)
-{
- irqstate_t flags;
- uint32_t regval;
-
- /* Configure multiplexed pins as connected on the board. Chip select
- * pins must be configured by board-specific logic. All SSP2 pins have
- * multiple, alternative pin selection. Definitions in the board.h file
- * must be provided to resolve the board-specific pin configuration like:
- *
- * #define GPIO_SSP2_SCK GPIO_SSP2_SCK_1
- */
-
- flags = enter_critical_section();
- lpc11_configgpio(GPIO_SSP2_SCK);
- lpc11_configgpio(GPIO_SSP2_MISO);
- lpc11_configgpio(GPIO_SSP2_MOSI);
-
- /* Configure clocking */
-
-#ifdef LPC111x
- regval = getreg32(LPC11_SYSCON_PCLKSEL0);
- regval &= ~SYSCON_PCLKSEL0_SSP2_MASK;
- regval |= (SSP_PCLKSET_DIV << SYSCON_PCLKSEL0_SSP2_SHIFT);
- putreg32(regval, LPC11_SYSCON_PCLKSEL0);
-#endif
-
- /* Enable peripheral clocking to SSP0 and SSP1 */
-
- regval = getreg32(LPC11_SYSCON_PCONP);
- regval |= SYSCON_PCONP_PCSSP2;
- putreg32(regval, LPC11_SYSCON_PCONP);
- leave_critical_section(flags);
-
- return &g_ssp2dev;
-}
-#endif
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: lpc11_sspbus_initialize
- *
- * Description:
- * Initialize the selected SSP port.
- *
- * Input Parameters:
- * Port number (for hardware that has multiple SPI interfaces)
- *
- * Returned Value:
- * Valid SPI device structure reference on success; a NULL on failure
- *
- ****************************************************************************/
-
-FAR struct spi_dev_s *lpc11_sspbus_initialize(int port)
-{
- FAR struct lpc11_sspdev_s *priv;
- uint32_t regval;
- int i;
-
- /* Only the SSP0 and SSP1 interfaces are supported */
-
- switch (port)
- {
-#ifdef CONFIG_LPC11_SSP0
- case 0:
- priv = lpc11_ssp0initialize();
- break;
-#endif
-#ifdef CONFIG_LPC11_SSP1
- case 1:
- priv = lpc11_ssp1initialize();
- break;
-#endif
-#ifdef CONFIG_LPC11_SSP2
- case 2:
- priv = lpc11_ssp2initialize();
- break;
-#endif
- default:
- return NULL;
- }
-
- /* Configure 8-bit SPI mode */
-
- ssp_putreg(priv, LPC11_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, LPC11_SSP_CR1_OFFSET, 0);
- ssp_putreg(priv, LPC11_SSP_IMSC_OFFSET, 0);
-
- /* Set the initial SSP configuration */
-
- priv->frequency = 0;
- priv->nbits = 8;
- priv->mode = SPIDEV_MODE0;
-
- /* Select a default frequency of approx. 400KHz */
-
- ssp_setfrequency((FAR struct spi_dev_s *)priv, 400000);
-
- /* Initialize the SPI semaphore that enforces mutually exclusive access */
-
- nxsem_init(&priv->exclsem, 0, 1);
-
- /* Enable the SPI */
-
- regval = ssp_getreg(priv, LPC11_SSP_CR1_OFFSET);
- ssp_putreg(priv, LPC11_SSP_CR1_OFFSET, regval | SSP_CR1_SSE);
- for (i = 0; i < LPC11_SSP_FIFOSZ; i++)
- {
- (void)ssp_getreg(priv, LPC11_SSP_DR_OFFSET);
- }
-
- return &priv->spidev;
-}
-
-/****************************************************************************
- * Name: ssp_flush
- *
- * Description:
- * Flush and discard any words left in the RX fifo. This can be done
- * after a device is deselected if you worry about such things.
- *
- * Input Parameters:
- * dev - Device-specific state data
- *
- * Returned Value:
- * None
- *
- ****************************************************************************/
-
-void ssp_flush(FAR struct spi_dev_s *dev)
-{
- FAR struct lpc11_sspdev_s *priv = (FAR struct lpc11_sspdev_s *)dev;
-
- /* Wait for the TX FIFO not full indication */
-
- while (!(ssp_getreg(priv, LPC11_SSP_SR_OFFSET) & SSP_SR_TNF));
- ssp_putreg(priv, LPC11_SSP_DR_OFFSET, 0xff);
-
- /* Wait until TX FIFO and TX shift buffer are empty */
-
- while (ssp_getreg(priv, LPC11_SSP_SR_OFFSET) & SSP_SR_BSY);
-
- /* Wait until RX FIFO is not empty */
-
- while (!(ssp_getreg(priv, LPC11_SSP_SR_OFFSET) & SSP_SR_RNE));
-
- /* Then read and discard bytes until the RX FIFO is empty */
-
- do
- {
- (void)ssp_getreg(priv, LPC11_SSP_DR_OFFSET);
- }
- while (ssp_getreg(priv, LPC11_SSP_SR_OFFSET) & SSP_SR_RNE);
-}
-
-#endif /* CONFIG_LPC11_SSP0/1 */
diff --git a/arch/arm/src/lpc11xx/lpc11_ssp.h b/arch/arm/src/lpc11xx/lpc11_ssp.h
deleted file mode 100644
index c38b4dbdf2f..00000000000
--- a/arch/arm/src/lpc11xx/lpc11_ssp.h
+++ /dev/null
@@ -1,189 +0,0 @@
-/************************************************************************************
- * arch/arm/src/lpc11xx/lpc11_ssp.h
- *
- * Copyright (C) 2015 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_LPC11XX_LPC11_SSP_H
-#define __ARCH_ARM_SRC_LPC11XX_LPC11_SSP_H
-
-/************************************************************************************
- * Included Files
- ************************************************************************************/
-
-#include
-
-#include
-
-#include "hardware/lpc11_ssp.h"
-
-#if defined(CONFIG_LPC11_SSP0) || defined(CONFIG_LPC11_SSP1)
-
-/************************************************************************************
- * Pre-processor Definitions
- ************************************************************************************/
-
-/************************************************************************************
- * Public Types
- ************************************************************************************/
-
-#ifndef __ASSEMBLY__
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-/************************************************************************************
- * Public Data
- ************************************************************************************/
-
-/************************************************************************************
- * Public Functions
- ************************************************************************************/
-
-/************************************************************************************
- * Name: lpc11_sspbus_initialize
- *
- * Description:
- * Initialize the selected SSP port.
- *
- * Input Parameters:
- * Port number (for hardware that has multiple SPI interfaces)
- *
- * Returned Value:
- * Valid SPI device structure reference on success; a NULL on failure
- *
- ************************************************************************************/
-
-FAR struct spi_dev_s *lpc11_sspbus_initialize(int port);
-
-/************************************************************************************
- * Name: lpc11_ssp0/ssp1select, lpc11_ssp0/ssp1status, and lpc11_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 lpc11_sspbus_initialize()) are provided by common LPC11xx logic. To use
- * this common SPI logic on your board:
- *
- * 1. Provide logic in lpc11_boardinitialize() to configure SSP chip select pins.
- * 2. Provide lpc11_ssp0/ssp1select() and lpc11_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
- * lpc11_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 lpc11_sspbus_initialize() in your low level application
- * initialization logic
- * 4. The handle returned by lpc11_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_LPC11_SSP0
-void lpc11_ssp0select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected);
-uint8_t lpc11_ssp0status(FAR struct spi_dev_s *dev, uint32_t devid);
-#ifdef CONFIG_SPI_CMDDATA
-int lpc11_ssp0cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
-#endif
-#endif
-
-#ifdef CONFIG_LPC11_SSP1
-void lpc11_ssp1select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected);
-uint8_t lpc11_ssp1status(FAR struct spi_dev_s *dev, uint32_t devid);
-#ifdef CONFIG_SPI_CMDDATA
-int lpc11_ssp1cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
-#endif
-#endif
-
-/************************************************************************************
- * Name: ssp_flush
- *
- * Description:
- * Flush and discard any words left in the RX fifo. This can be called
- * from ssp0/1select after a device is deselected (if you worry about such
- * things).
- *
- * Input Parameters:
- * dev - Device-specific state data
- *
- * Returned Value:
- * None
- *
- ************************************************************************************/
-
-#if defined(CONFIG_LPC11_SSP0) || defined(CONFIG_LPC11_SSP1)
-void ssp_flush(FAR struct spi_dev_s *dev);
-#endif
-
-/************************************************************************************
- * Name: lpc11_ssp0/1register
- *
- * Description:
- * If the board supports a card detect callback to inform the SPI-based
- * MMC/SD drvier when an SD card is inserted or removed, then
- * CONFIG_SPI_CALLBACK should be defined and the following function(s) must
- * must be implemented. These functiosn implements the registercallback
- * method of the SPI interface (see include/nuttx/spi/spi.h for details)
- *
- * Input Parameters:
- * dev - Device-specific state data
- * callback - The funtion to call on the media change
- * arg - A caller provided value to return with the callback
- *
- * Returned Value:
- * 0 on success; negated errno on failure.
- *
- ************************************************************************************/
-
-#ifdef CONFIG_SPI_CALLBACK
-#ifdef CONFIG_LPC11_SSP0
-int lpc11_ssp0register(FAR struct spi_dev_s *dev, spi_mediachange_t callback,
- FAR void *arg);
-#endif
-
-#ifdef CONFIG_LPC11_SSP1
-int lpc11_ssp1register(FAR struct spi_dev_s *dev, spi_mediachange_t callback,
- FAR void *arg);
-#endif
-#endif
-
-#if defined(__cplusplus)
-}
-#endif
-
-#endif /* __ASSEMBLY__ */
-#endif /* CONFIG_LPC11_SSP0 || CONFIG_LPC11_SSP1 */
-#endif /* __ARCH_ARM_SRC_LPC11XX_LPC11_SSP_H */
diff --git a/arch/arm/src/lpc11xx/lpc11_start.c b/arch/arm/src/lpc11xx/lpc11_start.c
deleted file mode 100644
index a54dfee8e26..00000000000
--- a/arch/arm/src/lpc11xx/lpc11_start.c
+++ /dev/null
@@ -1,173 +0,0 @@
-/****************************************************************************
- * arch/arm/src/lpc11xx/lpc11_start.c
- *
- * Copyright (C) 2015, 2017 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.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include
-
-#include
-#include
-#include
-
-#include
-
-#include "up_arch.h"
-#include "up_internal.h"
-#include "nvic.h"
-
-#include "lpc11_clockconfig.h"
-#include "lpc11_lowputc.h"
-#include "lpc11_userspace.h"
-
-#include "lpc11_start.h"
-
-/****************************************************************************
- * Private Definitions
- ****************************************************************************/
-
-/****************************************************************************
- * Private Data
- ****************************************************************************/
-
-#define IDLE_STACK ((uint32_t)&_ebss+CONFIG_IDLETHREAD_STACKSIZE-4)
-#define HEAP_BASE ((uint32_t)&_ebss+CONFIG_IDLETHREAD_STACKSIZE)
-
-/****************************************************************************
- * Public Data
- ****************************************************************************/
-
-const uint32_t g_idle_topstack = IDLE_STACK;
-
-/****************************************************************************
- * Private Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: showprogress
- *
- * Description:
- * Print a character on the UART to show boot status.
- *
- ****************************************************************************/
-
-#ifdef CONFIG_DEBUG_FEATURES
-# define showprogress(c) up_lowputc(c)
-#else
-# define showprogress(c)
-#endif
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: _start
- *
- * Description:
- * This is the reset entry point.
- *
- ****************************************************************************/
-
-void __start(void)
-{
- const uint32_t *src;
- uint32_t *dest;
-
- /* Configure the uart so that we can get debug output as soon as possible */
-
- lpc11_clockconfig();
- lpc11_lowsetup();
- showprogress('A');
-
- /* Clear .bss. We'll do this inline (vs. calling memset) just to be
- * certain that there are no issues with the state of global variables.
- */
-
- for (dest = &_sbss; dest < &_ebss; )
- {
- *dest++ = 0;
- }
-
- showprogress('B');
-
- /* Move the initialized data section from his temporary holding spot in
- * FLASH into the correct place in SRAM. The correct place in SRAM is
- * give by _sdata and _edata. The temporary location is in FLASH at the
- * end of all of the other read-only data (.text, .rodata) at _eronly.
- */
-
- for (src = &_eronly, dest = &_sdata; dest < &_edata; )
- {
- *dest++ = *src++;
- }
-
- showprogress('C');
-
- /* Perform early serial initialization */
-
-#ifdef USE_EARLYSERIALINIT
- up_earlyserialinit();
-#endif
- showprogress('D');
-
- /* For the case of the separate user-/kernel-space build, perform whatever
- * platform specific initialization of the user memory is required.
- * Normally this just means initializing the user space .data and .bss
- * segments.
- */
-
-#ifdef CONFIG_BUILD_PROTECTED
- lpc11_userspace();
- showprogress('E');
-#endif
-
- /* Initialize onboard resources */
-
- lpc11_boardinitialize();
- showprogress('F');
-
- /* Then start NuttX */
-
- showprogress('\r');
- showprogress('\n');
-
- nx_start();
-
- /* Shouldn't get here */
-
- for (; ; );
-}
diff --git a/arch/arm/src/lpc11xx/lpc11_timer.c b/arch/arm/src/lpc11xx/lpc11_timer.c
deleted file mode 100644
index 3af6342cd58..00000000000
--- a/arch/arm/src/lpc11xx/lpc11_timer.c
+++ /dev/null
@@ -1,614 +0,0 @@
-/****************************************************************************
- * arch/arm/src/lpc11xx/lpc11_timer.c
- *
- * Copyright (C) 2015-2016 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.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include
-
-#include
-#include
-#include
-#include
-#include
-
-#include
-#include
-#include
-#include
-
-#include "up_internal.h"
-#include "up_arch.h"
-
-#include "chip.h"
-#include "hardware/lpc11_syscon.h"
-#include "lpc11_timer.h"
-#include "hardware/lpc116x_pinconfig.h"
-#include "lpc11_gpio.h"
-#include "lpc116x_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_LPC11_TMR0)
-
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-/* PWM/Timer Definitions ****************************************************/
-/* The following definitions are used to identify the various time types */
-
-#define TIMTYPE_BASIC 0 /* Basic timers: TIM6-7 */
-#define TIMTYPE_GENERAL16 1 /* General 16-bit timers: TIM2-5 on F1 */
-#define TIMTYPE_COUNTUP16 2 /* General 16-bit count-up timers: TIM9-14 on F4 */
-#define TIMTYPE_GENERAL32 3 /* General 32-bit timers: TIM2-5 on F4 */
-#define TIMTYPE_ADVANCED 4 /* Advanced timers: TIM1-8 */
-
-#define TIMTYPE_TIM1 TIMTYPE_ADVANCED
-
-/* Debug ********************************************************************/
-
-#ifdef CONFIG_DEBUG_PWM_INFO
-# define pwm_dumpgpio(p,m) stm32_dumpgpio(p,m)
-#else
-# define pwm_dumpgpio(p,m)
-#endif
-
-/****************************************************************************
- * Private Types
- ****************************************************************************/
-/* This structure represents the state of one PWM timer */
-
-struct lpc11_timer_s
-{
- FAR const struct pwm_ops_s *ops; /* PWM operations */
- uint8_t timid; /* Timer ID {0,...,7} */
- uint8_t channel; /* Timer output channel: {1,..4} */
- uint8_t timtype; /* See the TIMTYPE_* definitions */
- uint32_t base; /* The base address of the timer */
- uint32_t pincfg; /* Output pin configuration */
- uint32_t pclk; /* The frequency of the peripheral clock
- * that drives the timer module. */
-};
-
-/****************************************************************************
- * Static Function Prototypes
- ****************************************************************************/
-/* Register access */
-
-static uint32_t timer_getreg(struct lpc11_timer_s *priv, int offset);
-static void timer_putreg(struct lpc11_timer_s *priv, int offset, uint32_t value);
-
-#ifdef CONFIG_DEBUG_PWM_INFO
-static void timer_dumpregs(struct lpc11_timer_s *priv, FAR const char *msg);
-#else
-# define timer_dumpregs(priv,msg)
-#endif
-
-/* Timer management */
-
-static int timer_timer(FAR struct lpc11_timer_s *priv,
- FAR const struct pwm_info_s *info);
-
-/* PWM driver methods */
-
-static int timer_setup(FAR struct pwm_lowerhalf_s *dev);
-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);
-
-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);
-
-/****************************************************************************
- * Private Data
- ****************************************************************************/
-/* This is the list of lower half PWM driver methods used by the upper half driver */
-
-static const struct pwm_ops_s g_pwmops =
-{
- .setup = timer_setup,
- .shutdown = timer_shutdown,
- .start = timer_start,
- .stop = timer_stop,
- .ioctl = timer_ioctl,
-};
-
-#ifdef CONFIG_LPC11_TMR0
-static struct lpc11_timer_s g_pwm1dev =
-{
- .ops = &g_pwmops,
- .timid = 1,
- .channel = CONFIG_LPC11_MAT0_PIN,
- .timtype = TIMTYPE_TIM1,
- .base = LPC11_TMR1_BASE,
- .pincfg = GPIO_MAT0p1_2,
- .pclk = (0x1 << 12),
-};
-#endif
-
-/****************************************************************************
- * Private Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: timer_getreg
- *
- * Description:
- * Read the value of an PWM timer register.
- *
- * Input Parameters:
- * priv - A reference to the PWM block status
- * offset - The offset to the register to read
- *
- * Returned Value:
- * The current contents of the specified register
- *
- ****************************************************************************/
-
-static uint32_t timer_getreg(struct lpc11_timer_s *priv, int offset)
-{
- return getreg32(priv->base + offset);
-}
-
-/****************************************************************************
- * Name: timer_putreg
- *
- * Description:
- * Read the value of an PWM timer register.
- *
- * Input Parameters:
- * priv - A reference to the PWM block status
- * offset - The offset to the register to read
- *
- * Returned Value:
- * None
- *
- ****************************************************************************/
-
-static void timer_putreg(struct lpc11_timer_s *priv, int offset,
- uint32_t value)
-{
- putreg32(value, priv->base + offset);
-}
-
-/****************************************************************************
- * Name: timer_dumpregs
- *
- * Description:
- * Dump all timer registers.
- *
- * Input Parameters:
- * priv - A reference to the PWM block status
- *
- * Returned Value:
- * None
- *
- ****************************************************************************/
-
-#ifdef CONFIG_DEBUG_PWM_INFO
-static void timer_dumpregs(struct lpc11_timer_s *priv, FAR const char *msg)
-{
- pwminfo("%s:\n", msg);
- pwminfo(" CR1: %04x CR2: %04x SMCR: %04x DIER: %04x\n",
- timer_getreg(priv, LPC11_PWM_MR0_OFFSET),
- timer_getreg(priv, LPC11_PWM_MR1_OFFSET),
- timer_getreg(priv, LPC11_PWM_MR2_OFFSET),
- timer_getreg(priv, LPC11_PWM_MR3_OFFSET));
-#if defined(CONFIG_LPC11_TMR0)
- if (priv->timtype == TIMTYPE_ADVANCED)
- {
- pwminfo(" RCR: %04x BDTR: %04x DCR: %04x DMAR: %04x\n",
- timer_getreg(priv, LPC11_PWM_MR0_OFFSET),
- timer_getreg(priv, LPC11_PWM_MR1_OFFSET),
- timer_getreg(priv, LPC11_PWM_MR2_OFFSET),
- timer_getreg(priv, LPC11_PWM_MR3_OFFSET));
- }
- else
-#endif
- {
- pwminfo(" DCR: %04x DMAR: %04x\n",
- timer_getreg(priv, LPC11_PWM_MR2_OFFSET),
- timer_getreg(priv, LPC11_PWM_MR3_OFFSET));
- }
-}
-#endif
-
-/****************************************************************************
- * Name: timer_timer
- *
- * Description:
- * (Re-)initialize the timer resources and start the pulsed output
- *
- * Input Parameters:
- * priv - A reference to the lower half PWM driver state structure
- * info - A reference to the characteristics of the pulsed output
- *
- * Returned Value:
- * Zero on success; a negated errno value on failure
- *
- ****************************************************************************/
-
-static int timer_timer(FAR struct lpc11_timer_s *priv,
- FAR const struct pwm_info_s *info)
-{
- irqstate_t flags;
- uint32_t regval;
-
- flags = enter_critical_section();
-
- putreg32(info->frequency, LPC11_TMR0_MR1); /* Set TIMER0 MR1 = number of counts */
- putreg32(info->frequency, LPC11_TMR1_MR0); /* Set TIMER1 MR0 = number of counts */
-
- putreg32(1, LPC11_TMR0_TCR); /* Start timer0 */
- putreg32(1, LPC11_TMR1_TCR); /* Start timer1 */
-
- leave_critical_section(flags);
- timer_dumpregs(priv, "After starting");
- return OK;
-}
-
-#ifdef XXXXX
-/****************************************************************************
- * Name: timer_interrupt
- *
- * Description:
- * Handle timer interrupts.
- *
- * Input Parameters:
- * priv - A reference to the lower half PWM driver state structure
- *
- * Returned Value:
- * Zero on success; a negated errno value on failure
- *
- ****************************************************************************/
-
-static int timer_interrupt(struct lpc11_timer_s *priv)
-{
- uint16_t regval;
-
- /* Verify that this is an update interrupt. Nothing else is expected. */
-
- regval = timer_getreg(priv, STM32_ATIM_SR_OFFSET);
- DEBUGASSERT((regval & ATIM_SR_UIF) != 0);
-
- /* Clear the UIF interrupt bit */
-
- timer_putreg(priv, STM32_ATIM_SR_OFFSET, regval & ~ATIM_SR_UIF);
-
- /* Calculate the new count by subtracting the number of pulses
- * since the last interrupt.
- */
-
- return OK;
-}
-
-/****************************************************************************
- * Name: timer_tim1/8interrupt
- *
- * Description:
- * Handle timer 1 and 8 interrupts.
- *
- * Input Parameters:
- * Standard NuttX interrupt inputs
- *
- * Returned Value:
- * Zero on success; a negated errno value on failure
- *
- ****************************************************************************/
-
-static int timer_tim1interrupt(int irq, void *context)
-{
- return timer_interrupt(&g_pwm1dev);
-}
-
-#endif /* XXXXX */
-
-/****************************************************************************
- * Name: timer_setup
- *
- * Description:
- * This method is called when the driver is opened. The lower half driver
- * should configure and initialize the device so that it is ready for use.
- * It should not, however, output pulses until the start method is called.
- *
- * Input Parameters:
- * dev - A reference to the lower half PWM driver state structure
- *
- * Returned Value:
- * Zero on success; a negated errno value on failure
- *
- * Assumptions:
- * APB1 or 2 clocking for the GPIOs has already been configured by the RCC
- * logic at power up.
- *
- ****************************************************************************/
-
-static int timer_setup(FAR struct pwm_lowerhalf_s *dev)
-{
- FAR struct lpc11_timer_s *priv = (FAR struct lpc11_timer_s *)dev;
- irqstate_t flags;
- uint32_t regval;
-
- flags = enter_critical_section();
-
- /* Power on the timer peripherals */
-
- regval = getreg32(LPC11_SYSCON_PCONP);
- regval |= SYSCON_PCONP_PCTIM0;
- regval |= SYSCON_PCONP_PCTIM1;
- regval |= SYSCON_PCONP_PCTIM2;
- regval |= SYSCON_PCONP_PCTIM3;
- putreg32(regval, LPC11_SYSCON_PCONP);
-
- /* Select clock for the timer peripheral */
-
- regval = getreg32(LPC11_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, LPC11_SYSCON_PCLKSEL0);
- regval = getreg32(LPC11_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, LPC11_SYSCON_PCLKSEL1);
- priv->pclk = (0x1 << 12) | (0x1 << 4);
-
- putreg32(1000, LPC11_TMR0_MR1); /* Set TIMER0 MR1 = number of counts */
-
- putreg32(1, LPC11_TMR0_PR); /* Prescaler count frequency: Fpclk/1 */
- putreg32(~(0x3 << 0), LPC11_TMR0_CCR); /* Prescaler count frequency: Fpclk/1 */
- putreg32(~(0x3 << 0), LPC11_TMR0_CTCR); /* Prescaler count frequency: Fpclk/1 */
- putreg32((2 << 3), LPC11_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)), LPC11_TMR0_EMR);
- putreg32((1 << 0), LPC11_TMR0_TCR); /* Start timer0 */
-
- /* Configure the output pins GPIO3.26 */
-
- lpc11_configgpio(GPIO_MAT0p1_2);
-
- putreg32(500, LPC11_TMR1_MR0); /* Set TIMER1 MR0 = number of counts */
-
- putreg32(1, LPC11_TMR1_PR); /* Prescaler count frequency:Fpclk/1 */
- putreg32(~(0x3 << 0), LPC11_TMR1_CCR); /* Prescaler count frequency:Fpclk/1 */
- putreg32(~(0x3 << 0), LPC11_TMR1_CTCR); /* Prescaler count frequency:Fpclk/1 */
- putreg32((2 << 0), LPC11_TMR1_MCR); /* Reset on match register MR0 */
-// putreg32(((1 << 0) | (3 << 4)), LPC11_TMR1_EMR); /* Output bit toggle on external match event MAT0 */
- putreg32((1 << 0), LPC11_TMR1_TCR); /* Start timer1 */
-
- /* configure the output pins GPIO3.26 */
-// lpc11_configgpio(GPIO_MAT0p1_2);
-
- leave_critical_section(flags);
- pwm_dumpgpio(priv->pincfg, "TIMER setup");
- return OK;
-}
-
-/****************************************************************************
- * Name: timer_shutdown
- *
- * Description:
- * This method is called when the driver is closed. The lower half driver
- * stop pulsed output, free any resources, disable the timer hardware, and
- * put the system into the lowest possible power usage state
- *
- * Input Parameters:
- * dev - A reference to the lower half TIMER driver state structure
- *
- * Returned Value:
- * Zero on success; a negated errno value on failure
- *
- ****************************************************************************/
-
-static int timer_shutdown(FAR struct pwm_lowerhalf_s *dev)
-{
- FAR struct lpc11_timer_s *priv = (FAR struct lpc11_timer_s *)dev;
- uint32_t pincfg;
-
- pwminfo("TIM%d pincfg: %08x\n", priv->timid, priv->pincfg);
-
- /* Make sure that the output has been stopped */
-
- return OK;
-}
-
-/****************************************************************************
- * Name: timer_start
- *
- * Description:
- * (Re-)initialize the timer resources and start the pulsed output
- *
- * Input Parameters:
- * dev - A reference to the lower half TIMER driver state structure
- * info - A reference to the characteristics of the pulsed output
- *
- * Returned Value:
- * Zero on success; a negated errno value on failure
- *
- ****************************************************************************/
-
-static int timer_start(FAR struct pwm_lowerhalf_s *dev,
- FAR const struct pwm_info_s *info)
-{
- FAR struct lpc11_timer_s *priv = (FAR struct lpc11_timer_s *)dev;
- return timer_timer(priv, info);
-}
-
-/****************************************************************************
- * Name: timer_stop
- *
- * Description:
- * Stop the pulsed output and reset the timer resources
- *
- * Input Parameters:
- * dev - A reference to the lower half TIMER driver state structure
- *
- * Returned Value:
- * Zero on success; a negated errno value on failure
- *
- * Assumptions:
- * This function is called to stop the pulsed output at anytime. This
- * method is also called from the timer interrupt handler when a repetition
- * count expires... automatically stopping the timer.
- *
- ****************************************************************************/
-
-static int timer_stop(FAR struct pwm_lowerhalf_s *dev)
-{
- FAR struct lpc11_timer_s *priv = (FAR struct lpc11_timer_s *)dev;
- uint32_t resetbit;
- uint32_t regaddr;
- uint32_t regval;
- irqstate_t flags;
-
- pwminfo("TIM%d\n", priv->timid);
-
- /* Disable interrupts momentary to stop any ongoing timer processing and
- * to prevent any concurrent access to the reset register.
- */
-
- flags = enter_critical_section();
-
- /* Disable further interrupts and stop the timer */
-
- /* Determine which timer to reset */
-
- switch (priv->timid)
- {
-#ifdef CONFIG_LPC11_TMR0
- case 1:
- break;
-#endif
- }
-
- /* Reset the timer - stopping the output and putting the timer back
- * into a state where timer_start() can be called.
- */
-
- leave_critical_section(flags);
-
- pwminfo("regaddr: %08x resetbit: %08x\n", regaddr, resetbit);
- timer_dumpregs(priv, "After stop");
- return OK;
-}
-
-/****************************************************************************
- * Name: timer_ioctl
- *
- * Description:
- * Lower-half logic may support platform-specific ioctl commands
- *
- * Input Parameters:
- * dev - A reference to the lower half TIMER driver state structure
- * cmd - The ioctl command
- * arg - The argument accompanying the ioctl command
- *
- * Returned Value:
- * Zero on success; a negated errno value on failure
- *
- ****************************************************************************/
-
-static int timer_ioctl(FAR struct pwm_lowerhalf_s *dev, int cmd,
- unsigned long arg)
-{
-#ifdef CONFIG_DEBUG_PWM_INFO
- FAR struct lpc11_timer_s *priv = (FAR struct lpc11_timer_s *)dev;
-
- /* There are no platform-specific ioctl commands */
-
- pwminfo("TIM%d\n", priv->timid);
-#endif
- return -ENOTTY;
-}
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: lpc11_timerinitialize
- *
- * Description:
- * Initialize one timer for use with the upper_level TIMER driver.
- *
- * Input Parameters:
- * timer - A number identifying the timer use. The number of valid timer
- * IDs varies with the STM32 MCU and MCU family but is somewhere in
- * the range of {1,..,14}.
- *
- * Returned Value:
- * On success, a pointer to the STM32 lower half TIMER driver is returned.
- * NULL is returned on any failure.
- *
- ****************************************************************************/
-
-FAR struct pwm_lowerhalf_s *lpc11_timerinitialize(int timer)
-{
- FAR struct lpc11_timer_s *lower;
-
- pwminfo("TIM%d\n", timer);
-
- switch (timer)
- {
-#ifdef CONFIG_LPC11_TMR0
- case 0:
- lower = &g_pwm1dev;
-
- /* Attach but disable the TIM1 update interrupt */
-
- break;
-#endif
-
- default:
- pwmerr("ERROR: No such timer configured\n");
- return NULL;
- }
-
- return (FAR struct pwm_lowerhalf_s *)lower;
-}
-
-#endif /* CONFIG_LPC11_TIMn_TIMER, n = 1,...,14 */
diff --git a/arch/arm/src/lpc11xx/lpc11_timerisr.c b/arch/arm/src/lpc11xx/lpc11_timerisr.c
deleted file mode 100644
index 2ec0600981d..00000000000
--- a/arch/arm/src/lpc11xx/lpc11_timerisr.c
+++ /dev/null
@@ -1,163 +0,0 @@
-/****************************************************************************
- * arch/arm/src/lpc11xx/lpc11_timerisr.c
- *
- * Copyright (C) 2015, 2017 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.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include
-
-#include
-#include
-#include
-#include
-#include
-
-#include "nvic.h"
-#include "clock/clock.h"
-#include "up_internal.h"
-#include "up_arch.h"
-
-#include "chip.h"
-
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-/* "The CLKSOURCE bit in SysTick Control and Status register selects either
- * the core clock (when CLKSOURCE = 1) or a divide-by-16 of the core clock
- * (when CLKSOURCE = 0). ..."
- */
-
-#if defined(CONFIG_LPC11_SYSTICK_CORECLK)
-# define SYSTICK_CLOCK LPC11_MCLK /* Core clock */
-#elif defined(CONFIG_LPC11_SYSTICK_CORECLK_DIV16)
-# define SYSTICK_CLOCK (LPC11_MCLK / 16) /* Core clock divided by 16 */
-#endif
-
-/* The desired timer interrupt frequency is provided by the definition
- * CLK_TCK (see include/time.h). CLK_TCK defines the desired number of
- * system clock ticks per second. That value is a user configurable setting
- * that defaults to 100 (100 ticks per second = 10 MS interval).
- *
- * Then, for example, if the external high speed crystal is the SysTick
- * clock source and BOARD_XTALHI_FREQUENCY is 12MHz and CLK_TCK is 100, then
- * the reload value would be:
- *
- * SYSTICK_RELOAD = (12,000,000 / 100) - 1
- * = 119,999
- * = 0x1d4bf
- *
- * Which fits within the maximum 24-bit reload value.
- */
-
-#define SYSTICK_RELOAD ((SYSTICK_CLOCK / CLK_TCK) - 1)
-
-/* The size of the reload field is 24 bits. Verify that the reload value
- * will fit in the reload register.
- */
-
-#if SYSTICK_RELOAD > 0x00ffffff
-# error SYSTICK_RELOAD exceeds the range of the RELOAD register
-#endif
-
-/****************************************************************************
- * Private Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Function: lpc11_timerisr
- *
- * Description:
- * The timer ISR will perform a variety of services for various portions
- * of the systems.
- *
- ****************************************************************************/
-
-static int lpc11_timerisr(int irq, uint32_t *regs, FAR void *arg)
-{
- /* Process timer interrupt */
-
- nxsched_process_timer();
- return 0;
-}
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Function: arm_timer_initialize
- *
- * Description:
- * This function is called during start-up to initialize
- * the timer interrupt.
- *
- ****************************************************************************/
-
-void arm_timer_initialize(void)
-{
- uint32_t regval;
-
- /* Set the SysTick interrupt to the default priority */
-
- regval = getreg32(ARMV6M_SYSCON_SHPR3);
- regval &= ~SYSCON_SHPR3_PRI_15_MASK;
- regval |= (NVIC_SYSH_PRIORITY_DEFAULT << SYSCON_SHPR3_PRI_15_SHIFT);
- putreg32(regval, ARMV6M_SYSCON_SHPR3);
-
- /* Configure SysTick to interrupt at the requested rate */
-
- putreg32(SYSTICK_RELOAD, ARMV6M_SYSTICK_RVR);
-
- /* Attach the timer interrupt vector */
-
- (void)irq_attach(LPC11_IRQ_SYSTICK, (xcpt_t)lpc11_timerisr, NULL);
-
- /* Enable SysTick interrupts. "The CLKSOURCE bit in SysTick Control and
- * Status register selects either the core clock (when CLKSOURCE = 1) or
- * a divide-by-16 of the core clock (when CLKSOURCE = 0). ..."
- */
-
-#ifdef CONFIG_LPC11_SYSTICK_CORECLK
- putreg32((SYSTICK_CSR_CLKSOURCE | SYSTICK_CSR_TICKINT | SYSTICK_CSR_ENABLE),
- ARMV6M_SYSTICK_CSR);
-#else
- putreg32((SYSTICK_CSR_TICKINT | SYSTICK_CSR_ENABLE), ARMV6M_SYSTICK_CSR);
-#endif
-
- /* And enable the timer interrupt */
-
- up_enable_irq(LPC11_IRQ_SYSTICK);
-}
diff --git a/arch/arm/src/lpc11xx/lpc11_userspace.c b/arch/arm/src/lpc11xx/lpc11_userspace.c
deleted file mode 100644
index 6ee07ad6b51..00000000000
--- a/arch/arm/src/lpc11xx/lpc11_userspace.c
+++ /dev/null
@@ -1,118 +0,0 @@
-/****************************************************************************
- * arch/arm/src/lpc11xx/lpc11_userspace.c
- *
- * Copyright (C) 2015 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.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include
-
-#include
-#include
-
-#include
-
-#include "lpc11_mpuinit.h"
-#include "lpc11_userspace.h"
-
-#ifdef CONFIG_BUILD_PROTECTED
-
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-
-/****************************************************************************
- * Private Data
- ****************************************************************************/
-
-/****************************************************************************
- * Private Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: lpc11_userspace
- *
- * Description:
- * For the case of the separate user-/kernel-space build, perform whatever
- * platform specific initialization of the user memory is required.
- * Normally this just means initializing the user space .data and .bss
- * segments.
- *
- ****************************************************************************/
-
-void lpc11_userspace(void)
-{
- uint8_t *src;
- uint8_t *dest;
- uint8_t *end;
-
- /* Clear all of user-space .bss */
-
- DEBUGASSERT(USERSPACE->us_bssstart != 0 && USERSPACE->us_bssend != 0 &&
- USERSPACE->us_bssstart <= USERSPACE->us_bssend);
-
- dest = (uint8_t *)USERSPACE->us_bssstart;
- end = (uint8_t *)USERSPACE->us_bssend;
-
- while (dest != end)
- {
- *dest++ = 0;
- }
-
- /* Initialize all of user-space .data */
-
- DEBUGASSERT(USERSPACE->us_datasource != 0 &&
- USERSPACE->us_datastart != 0 && USERSPACE->us_dataend != 0 &&
- USERSPACE->us_datastart <= USERSPACE->us_dataend);
-
- src = (uint8_t *)USERSPACE->us_datasource;
- dest = (uint8_t *)USERSPACE->us_datastart;
- end = (uint8_t *)USERSPACE->us_dataend;
-
- while (dest != end)
- {
- *dest++ = *src++;
- }
-
- /* Configure the MPU to permit user-space access to its FLASH and RAM */
-
- lpc11_mpuinitialize();
-}
-
-#endif /* CONFIG_BUILD_PROTECTED */
diff --git a/arch/arm/src/lpc11xx/lpc11_userspace.h b/arch/arm/src/lpc11xx/lpc11_userspace.h
deleted file mode 100644
index a515654ce98..00000000000
--- a/arch/arm/src/lpc11xx/lpc11_userspace.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/************************************************************************************
- * arch/arm/src/lpc17xx/lpc11_userspace.h
- *
- * Copyright (C) 2015 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt