diff --git a/COPYING b/COPYING
index ae47afc7cac37d3caa90445c0be39eab9b7d0003..62662be709ba2df3c42004783f0d3ac573681be3 100644
--- a/COPYING
+++ b/COPYING
@@ -14,7 +14,7 @@ individual files will vary):
/*************************************************************************
*
- * Copyright (C) 2015 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2007-2018 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt
*
* Redistribution and use in source and binary forms, with or without
diff --git a/ChangeLog b/ChangeLog
index 3bceb86d3bf3795ceaebe67465ed8db2e192c72e..055d540aeafde0c8c9216b0883fea13828185dc2 100755
--- a/ChangeLog
+++ b/ChangeLog
@@ -14350,7 +14350,7 @@
* drivers/lcd/st7565.c: Use ST7565_POWERCTRL_INT instead of
ST7565_POWERCTRL_BRF. From Masayuki Ishikawa (2017-03-21).
* SMP Kconfig: Change the minimum SMP_NCPUS to 1. From Masayuki
- Ishikawa (2017-03-xx).
+ Ishikawa (2017-03-21).
* SMP: Setting CONFIG_SMP_NCPUS=1 should only be permitted in a debug
configuration (2017-03-22).
* Clicker2-STM32: Create src/, kernel/, and scripts/ directories
@@ -14457,7 +14457,7 @@
Assis (2017-03-27).
* AT86RF23x: Clean-up, standardize lower half interface. Take
advantage of new OS features for interrupt parameter passing
- (2017-03-xx).
+ (2017-03-27).
* MRF24J40: Take advantage of new OS features for interrupt parameter
passing (2017-03-27).
* lcd/: PCF8574 backpack logic needs to include poll.h
@@ -14781,7 +14781,7 @@
* STM32F0: Add basic support for STM32F07x family (2017-04-17).
* STM32F0: Move enabling of GPIO peripherals form UART setup to
clockconfig. This is not a UART function. It is needed by all
- peripherals (2017-04-xx).
+ peripherals (2017-04-17).
* STM32F0: Add logic to enable other USARTs. No UART4/5. Rather
USART4/5 (2017-04-17).
* STM32F7: Warn if no DMA2 configured when using ADC with DMA. Also
@@ -14960,7 +14960,7 @@
* Nucleo-F072RB: Add support for the I2C driver used by I2C tools
(2017-04-20).
* drivers/i2c: Fix compile issus if CONFIG_DISABLE_PSEUDOFS_OPERATIONS
- is enabled (2017-04-xx).
+ is enabled (2017-04-30).
* STM32F0 I2C: Update driver to use the standard interrupt parameter
passing logic (2017-04-30).
* STM32F0 I2C: Pin definitions should specify open drain (and probably
@@ -15601,7 +15601,7 @@
a rejected association response frame. From Anthony Merlino
(2017-06-15).
* Rename configs/mrf24j40-radio to mrf24j40-mac (2017-06-15).
- * clicker2-stm32: Add a configuratino that will, eventually, be used
+ * clicker2-stm32: Add a configuration that will, eventually, be used
for 6loWPAN testing (2017-06-15).
* Fix a typo. And typo in Kconfig file is reflect in all defconfig
files (2017-06-15).
@@ -16728,4 +16728,1434 @@
was not freeing resources when a wait was completed. From Boris
Astardzhiev (2017-09-04).
-7.23 2017-xx-xx Gregory Nutt
+7.23 2017-12-04 Gregory Nutt
+
+ * STM32L4: ADC, Kconfig small changes:
+ - STM32L4 ADC: port analog watchdog ioctls from the Motorola MDK
+ - STM32L4: Kconfig: add some L486 and L496 chips, remove duplicates
+ From Juha Niskanen (2017-09-06).
+ * 6LoWPAN: Correct an error in uncompressing multicast address
+ (2017-09-08).
+ * sem_open() should return SEM_FAILED on any failures. This is change
+ in the POSIX specification since the original sem_open() was written
+ so many years ago (2017-09-08).
+ * STM32: Add logic for enabling wakeup pins. From Oleg Evseev
+ (2017-09-08).
+ * Update/fix last commit: On some STM32's, the CSR regiser is 18 vs. 16
+ bits wide. Need to use 32-bit register accesses (2017-09-08).
+ * 6LoWPAN: I believe, based on RFC review, that with the last multicast
+ change, the NuttX 6LoWPAN is now compliant with RFC 6282 (2017-09-08).
+ * arch/arm/Kconfig: Add more classic ARM11 architecture selections
+ (2017-09-09).
+ * 6LoWPAN/Radio: Rename radio property sp_pktlen to sp_framelen. Add
+ 6LoWPAN utility to get the max frame length (not yet hooked in)
+ (2017-09-10).
+ * 6LoWPAN: Remove the option to disable fragmentation support. Two
+ reasons: (1) First fragementation is always required because IPv6
+ requires an MTU of 1280 bytes. The is no application use case that can
+ work without fragmentation support. And (2) it greatly reduces the
+ complexity of the code (2017-09-10).
+ * net/sixlowpan: Remove CONFIG_NET_6LOWPAN_FRAMELEN. In this case where
+ multiple radios are supported, this may not be a constant. 6LoWPAN now
+ always queries the driver to get the maximum frame length (2017-09-10).
+ * drivers/smps.c: fix error messages. From Mateusz Szafoni (2017-09-10).
+ * configs/stm32f334-disco: beginning of lower half driver for high power
+ LED (powerled). From Mateusz Szafoni (2017-09-10).
+ * Misc STM32 fixes
+ - stm32f33xxx_hrtim.h: fix definition
+ - stm32_hrtim: fix pclk calculation
+ - stm32_hrtim.c: cosmetics
+ - add upper-half driver for high power LED driver (powerled)
+ From Mateusz Szafoni (2017-09-10).
+ * drivers/video/fb.c: Add framebuffer character device (2017-09-11).
+ * drivers/video/fb.c: Add support for LCD drivers that use a simulated
+ framebuffer and must receive explicit notification when there is an
+ update to a region in the framebuffer (2017-09-11).
+ * configs/lc823450-xgevk: Enable ADC and watchdog driver. From Masayuki
+ Ishikawa (2017-09-12).
+ * arch/arm/src/lc823450: Conform to the NuttX coding style, merge the
+ latest fix in lc823450_rtc.c, add ADC driver, add watchdog driver. From
+ Masayuki Ishikawa (2017-09-12).
+ * net/sock: recvfrom: Fix double leave_cancellation_point on error
+ path. From Jussi Kivilinna (2017-09-12).
+ * net/socket: Do not enter cancellation point in psock_send() as this
+ is already done in send(). From Jussi Kivilinna (2017-09-12).
+ * net/socket: send: verify that sockfd is valid, fixes assert when using
+ send on closed socket. From Jussi Kivilinna (2017-09-12).
+ * drivers/video/fb.c and include/nuttx/video.fb.h: Some improvements
+ and fixes from early testing sith the sim/fb cnofiguration (2017-09-12).
+ * sim/configs/fb: Add a configuration for non-graphical testing of the
+ frambuffer character driver using apps/example/fb (2017-09-12).
+ * Rename CONFIG_VIDEO_DEVICES to CONFIG_DRIVERS_VIDEO to conform better
+ to the evolving configuration naming standard (2017-09-12).
+ * Rename CONFIG_AUDIO_DEVICES to CONFIG_DRIVERS_AUDIO to conform better
+ to the evolving configuration naming standard (2017-09-12).
+ * stm32: stm32 alt I2C ensure proper error handling. Injecting data
+ errors would cause the driver to continually reenter the isr with BERR
+ an RxNE. This fix allows the error to be cleared and propagated to the
+ waiting task. From David Sidrane (2017-09-12).
+ * stm32x i2c fixes, stm32: Fix coding standard error, stm32f7 I2C: fixed
+ typo in comment. From David Sidrane (2017-09-13).
+ * STM32 Tickless: Fixes compilation error when timer info/debug messages
+ are enabled. From Rajan Gill (2017-09-13).
+ * net/: Fix some errors found by Coverity.
+ * STM32/STM32 F7: Fix some errors found by Coverity (2017-09-13).
+ * drivers/video/fb.c: File offset is in units of bytes, not pixels
+ (2017-09-14).
+ * drivers/lis3dsh.c: Added the argument parameter (FAR void *arg) to
+ the interrupt handler provided by the LIS3DSH driver to fit the
+ definition for ISRs in xcpt_t. Changed the check for working queue
+ availability in lis3dsh interrupt handler to use work_available() and
+ not crash in case of an overrun. From Florian Olbrich (2017-09-14).
+ * configs/stm32f4discover: Added initialization code and Kconfig entries
+ to set up the LIS3DSH accelerometer driver on STM32F4Discovery rev. C
+ boards and attach the associated interrupt callback. From Florian
+ Olbrich (2017-09-14).
+ * Added initialization code and Kconfig entries for LIS3DSH
+ accelerometer on STM32F4Discovery + associated changes to LIS3DSH
+ driver. From Florian Olbrich (2017-09-14).
+ * LPC31xx: Change naming of some global variables to match coding
+ standard (2017-09-14).
+ * wireless/ieee802154/: Moves MAC802154IOC from ieee802154_ioctl.h and
+ renames ieee802154_ioctl.h to ieee802154_device.h since it only contains
+ types relevant to the MAC char device now. From Anthony Merlino
+ (2017-09-15).
+ * wireless/ieee802154: Adds support for receiving MAC events via IOCTL
+ through socket interface. Other small fixes and cleanup. From Anthony
+ Merlino (2017-09-15).
+ * drivers/wireless: Adds XBee S2C (802.15.4 firmware) support. XBee
+ driver emulates mac802154 interface. From Anthony Merlino (2017-09-15).
+ * sched/waitpid.c: Eliminate a warning detected by GCC 6 (2017-09-15).
+ * drivers/xbee: Fixes a few warnings
+ - drivers/xbee: Fixes a few warnings
+ - configs/clicker2-stm32: Updates sections about i8sak usage in the
+ README
+ From Anthony Merlino (2017-09-15).
+ * STM32 Tickless: The attached patch removes the restriction to 16bit
+ counts when a 32bit timer is used for the new tickless on the stm32. As
+ it is now, the restriction is very limiting, especially if one wants
+ high granularity and large achievable intervals and has the hardware
+ (namely the 32bit timers) available. From Rajan Gill (2017-09-16).
+ * configs/open1788: Initialization now follows the pattern of other
+ boards. Add initialization of fb driver. Add a configuration for
+ testing the framebuffer driver (2017-09-16).
+ * drivers/video: fb driver now clears framebuffer initially. Eliminates
+ (or minimizes) initial garbage on the display (2017-09-16).
+ * SAMV71-XULT: Add support for fb_driver (2017-09-17).
+ * drivers/lcd: Add suppose for a generic front-end that will convert
+ any LCD driver into a framebuffer driver (2017-09-17).
+ * SAMv71-XULT: Add a configuration to test the LCD framebuffer driver.
+ Not quite yet working properly (2017-09-17).
+ * configs/stm3210e-eval: Rename stm32_appinit.c to stm32_bringup.c so
+ that the start up logic is compatible with other, new boards. Bring in
+ new stm32_appinit.c, add board_initialize(), add support for FB
+ character driver (2017-09-17).
+ * configs/stm3240g-eval: Rename stm32_appinit.c to stm32_bringup.c to
+ better match other architectures. Replace the old-style stm32_appinit.c
+ with tne new one from the STM32F4-Discovery. Add a configuration for
+ testing the FB character driver at drivers/video/fb.c using the LCD
+ frame driver front end at drivers/lcd/lcd_framebuffer.c. Appears to be
+ fully functional (2017-09-17).
+ * netinet/in.h: Add missing IN6_IS_ADDR_V4COMPAT macro (2017-09-18).
+ * configs/stm32f4discovery: Update README. Add summary of differences
+ with the newest STM32F407G-DISC1 part. Remove a lot of old discussion
+ that is really no longer helpful (2017-09-18).
+ * Networking: sockgetname() files need to include udp/udp.h and
+ tcp/tcp.h or otherwise NET_UDP_HAVE_STACK and NET_TCP_HAVE_STACK are
+ undefined and the logic is never compiled. Noted by Anthony Merlino
+ (2017-09-18).
+ * Add driver for APA102 LED controller. These LEDs are used on LED
+ Strips and are controlled over SPI (2017-09-18).
+ * configs/stm32f103-minimum: Add board support for APA102 driver. From
+ Alan Carvalho de Assis (2017-09-18).
+ * sched/env_dup.c: Fix an error in the duplication of the child tasks
+ environment in the special case where the parent's environment was
+ created, but then all of the variables were unset. In that case, there
+ is still an allocation in place but the size of the allocation is zero.
+ This case was not being handled correctly when a child task attempts to
+ create its environment and inherit the zero-size partent environment.
+ Noted by Anthony Merlino (2017-09-18).
+ * STM32L4 DFSDM: add peripheral, DAC, TIM: small changes
+ - STM32L4 DAC: do not configure output pin if it is not used
+ - STM32L4 TIM: fix compilation of timers with complementary outputs
+ when not PWM_MULTICHAN
+ - STM32L4 DFSDM: peripheral for digital filters for sigma-delta ADCs
+ Initial version. Timer trigger support is not completed and there is
+ some issue with DMA.
+ From Juha Niskanen (2017-09-19).
+ * stm3240g-eval: Remove some bad conditional compilation (2017-09-19).
+ * Networking: IPv4 getsockname(): Fix a typo that can cause a compile
+ error (2017-09-19).
+ * viewtool-stm32f107: Enable NSH arch-specific initialization. Rename
+ stm32_appinit.c to stm32_bringup.c for consistency with other boards.
+ Replace old stm32_appinit.c (now stm32_bringup.c) with 'standard'
+ stm32_appinit.c from the STM32F4-Discovery. Add CONFIG_BOARD_INITIALIZE
+ logic to stm32_boot.c. Add support to auto-mount the procfs file system
+ (2017-09-19).
+ * Networking: Add implementation of logic for SIOCGIFCONF and
+ SIOCGLIFCOF IOCTL commnds (2017-09-19).
+ * Networking: drivers/net/loopback.c: Eliminate a warning.
+ net/netdev/netdev_ifconfig.c: Was not returning all of the address info
+ (2017-09-19).
+ * STM32L4 ADC, DFSDM: add routing of ADC data to DFSDM filters. From
+ Juha Niskanen
+ - configs/nucleo-l496zg: add DFSDM initialization
+ - STM32L4 ADC: add option for routing ADC data to DFSDM, fix DFSDM
+ DMA (2017-09-20).
+ * SIOCGIFCONF and SIOCGLIFCONF IOCTL commands should only report on
+ network adatpors in the UP state (2017-09-20).
+ * In some cases, packets are still not sent behind the router. I found
+ that NuttX sends the ARP requests not to the router but to the target.
+ Mistake in file net/route/netdev_router.c. From Aleksandr Kazantsev
+ (2017-09-20).
+ * stm32: stm32f40xxx I2C ensure proper isr handling. Injecting data
+ errors that causes a STOP to be perceived by the driver, will
+ continually re-enter the isr with SB not set and BTF
+ and RxNE set. This changes allows the interrupts to be cleared and
+ propagates a I2C_SR1_TIMEOUT to the waiting task. From David Sidrane
+ (2017-09-21).
+ * include/nuttx/net/net.h: Add missing semicolon in prototype. Fixes
+ error in certain combinations of configuration options. From Pavel Pisa
+ (2017-09-21).
+ * drivers/pipes: pipe_common: Fix writing large buffers not triggering
+ POLLIN for reader poll. From Jussi Kivilinna (2017-09-21).
+ * drivers/usbdev: Add support for RX flow control to the CDC/ACM driver
+ (2017-09-22).
+ * STM32 Serial: Fix some incorrect conditional compilation (2017-09-23).
+ * drivers/usbdev: Add support for flow control TERMIOs in CDC/ACM
+ driver (2017-09-23).
+ * drivers/usbdev: CDC/ACM should reset all 'irregular' notifications to
+ zero after sending the SerialState packet (2017-09-23).
+ * drivers/usbdev: Fix some bad conditional logic (2017-09-23).
+ * Fixes several errors preventing icmpv6_radvertise.c from being
+ compiled. Fixes conversions to network byte order (namely vlifetime,
+ plifetime, mtu). IPv6 source address is set to link-local IP address
+ instead of the address in the netdev structure. This is in compliance to
+ RFC 4861. RA didn't work on Linux before this change. Finally, router
+ prefix and prefix length are derived from the IPv6 address and netmask
+ in the netdev structure. This seems to make more sense than using a
+ predefined, separate prefix from the config. From Sakari Kapanen
+ (2017-09-24).
+ * drivers/usbdev/usbdev: Add RNDIS-over-USB driver. From Sakari Kapanen
+ (2017-09-24).
+ * net/igmp/igmp_send.c: Fix incoming IGMP checksum calculation. From
+ Louis Mayencourt (2017-09-25).
+ * Fixes for problems found by Coverity in the nuttx repository:
+ - net/socket/recvfrom.c: Check fromlen integrity before using it.
+ - net/socket/net_sockets.c: Always check for valid psock before using.
+ - net/tcp/tcp_send_unbuffered.c: Avoid using psock beforing
+ checking its integrity.
+ - sched/timer/timer_create.c: Fix watchdog resource leak if cannot
+ allocate a new timer.
+ From Bruno Herrera (2017-09-25).
+ * drivers/usbdev/Kconfig: Add comments in regard to RNDIS selection
+ (2017-09-25).
+ * configs/nucleo-f410rb: Add support for the nucleo-F410RB board. From
+ Gwenhael Goavec-Merou (2017-09-25).
+ * STM32 L4: Add SDMMC driver. From Miha Vrhovnik (2017-09-26).
+ * Nucleo-L496ZG: Add support for SDMMC driver. From Miha Vrhovnik
+ (2017-09-26).
+ * drivers/usbdev/cdcacm.c: Avoid using priv before checking its
+ validity. From Juha Niskanen (2017-09-26).
+ * drivers/usbdev/cdcacm.c: Change design for queuing RX packets that
+ cannot be processed. Previous design had a logic problem that could
+ cause data loss (2017-09-26).
+ * drivers/usbdev/cdcacm.c: Add a failsafe time to assure that the RX
+ pending queue cannot stall indefinitely. I can imagine a corner case
+ where the serial driver's RX buffer is full and it stops accepting data
+ and where all of the read requests are queued and there is not event to
+ restart RX processing. I am not sure that that scenario can really
+ happen, but the failsafe timer gives me peace of mind (2017-09-26).
+ * Build break fix: define PWM_TIM2_CH1CFG for channel 1 PWM. From
+ Tomasz Wozniak (2017-09-26).
+ * Fixed directory unlocking in tmpfs_opendir. From Dmitriy Linikov
+ (2017-09-27).
+ * drivers/usbdev/cdcacm.c: Add some missing logic when flow control is
+ disabled. Also make sure that the flowcontrol and rxint can handle
+ being re-entered when cdcacm_release_rxpending() is called (2017-09-27).
+ * drivers/usbdev/cdcacm.c: Fix confusion between flow control being
+ enabled and being active. Different things (2017-09-27).
+ * drivers/usbdev/cdcacm.c: Change ordering of some operations to avoid
+ races; Add missing uppder watermark logic that is normally in
+ serial_io.c but must be duplicated in cdcacm.c (2017-09-27).
+ * net/route: Permit IPv4 and IPv6 routing tables to be of different
+ sizes (2017-09-27).
+ * ROMFS for STM32F4 Discovery board. From Tomasz Wozniak (2017-09-28).
+ * STM32 PWR: Adds stm32_pwr_getsbf and stm32_pwr_getwuf functions that
+ return the standby flag and the wakeup flag PWR power control/status
+ register. From Oleg Evseev (2017-09-28).
+ * net/arp/arp_out.c: Fix IGMP Ethernet address computation. From Louis
+ Mayencourt (2017-09-28).
+ * net/route: Adds support for read-only routing tables. Prior to this
+ change, routing tables were only support in RAM and had to be
+ initialized with explicit logic to add the necessary routes to the
+ routing table. With this change, routes may be defined in the
+ pre-initialized, read-only routing table provided by the board-specific
+ logic
+
+ This would be particularly useful, for example, in the case where
+ there is only a single network adaptor and you want all output packets
+ to go to the single adaptor in all cases. So for that behavior you
+ could add a read-only routing table to the board-specific long that
+ contains a single entry, the default route: 0.0.0.0/0 (2017-09-28).
+ * fs/vfs: file_seek() is an internal OS interface and should not errors
+ via the errno (2017-09-28).
+ * fs/vfs: file_read() is an internal OS interface and should not errors
+ via the errno (2017-09-28).
+ * fs/vfs: file_write() and file_pwrite() are internal OS interfaces and
+ should not report errors via the errno (2017-09-28).
+ * STM32L4 FLASH, DFSDM: option bytes, JEXTSEL bits, ADC1 output to DFSDM
+ chips change
+ - STM32L4 FLASH: add function for modifying device option bytes
+ - STM32L4 DFSDM: add JEXTSEL bits, ADC1 output to DFSDM chips change
+ ST's documentation hints that ADC output can be routed to DFSDM on
+ some STM32L4X3 chips, but I got confirmation from tech support that
+ this is just a documentation error so remove this from Kconfig
+ From Juha Niskanen (2017-09-29).
+ * This commit adds support for routing tables in files in a file
+ system. This might be useful for customized, per-unit routing tables.
+ There are two issues with it however:
+ 1. Reading from file system on a per packet basis could be slow. I
+ think it probably should have a small, in-memory cache of most
+ frequently used routes for good problem.
+ 2. Currently the delroute logic is disabled due to a problem with
+ the design. NuttX does not currently support truncate().
+ Therefore, it is not possible to delete entries from the routing
+ table file.
+ In this current implementation, that leaves the last entry intact at
+ the end of the file. An alternative design might include a tag on
+ each record to indicate if the record is valid or not. That would
+ work but would add complexity to the other routing table functions
+ (2017-09-29).
+ * net/route: Add support for an in-memory routing table cache in order
+ to improve performance when the routing table is retained in a file.
+ The cache holds the most recently used routing table entries and so can
+ eliminate some file access. Flush the in-memory cache when any entry is
+ deleted from the routing table. When a router matching an IP address is
+ found, add the routing table entry to the cache (2017-09-29).
+ * fs/vfs: null check for path on open and buf on write. Null path
+ check is depend on CONFIG_DEBUG_FEATURES and CONFIG_DEBUG_ASSERTIONS,
+ added null checking so it's always performed Added null checking on buf
+ for write(). From Xiao Qin (2017-09-29).
+ * net/route: File read/write logic should be able to handle short reads
+ and writes (2017-09-29).
+ * drivers/syslog: syslog internal functions should not set the errno
+ variable: ramlog_putc(), syslog_dev_putc(), syslog_dev_write(),
+ syslog_force() (2017-09-29).
+ * net/sockets: psock_sendto() is an internal OS interface an should not
+ set the errno variable (2017-09-29).
+ * net/sockets: psock_send() is an internal OS interface an should not
+ set the errno variable (2017-09-29).
+ * psock_send() no longer sets errno, so send() must now set it
+ (2017-09-30).
+ * net/: Versions of psock_send() and pock_sendto() should not set
+ errno. That is taken care of at a higher level in the send()/sendto()
+ implementation as appropriate (2017-09-30).
+ * net/: psock_accept() is an internal interface and should not set the
+ errno (2017-09-30).
+ * net/: psock_bind() is an internal interface and should not set the
+ errno (2017-09-30).
+ * net/: psock_connect() is an internal interface and should not set the
+ errno nor should it be a cancellation point (2017-09-30).
+ * net/: psock_listen() is an internal interface and should not set the
+ errno (2017-09-30).
+ * net/: psock_getsockopt() is an internal interface and should not set
+ the errno (2017-09-30).
+ * net/: psock_getsockopt() and psock_socket() are an internal interfaces
+ and should not set the errno (2017-09-30).
+ * net/: psock_accept() is not a cancellation point (2017-09-30).
+ * net/: psock_recvfrom() is an internal interface and should not set the
+ errno nor should it be a cancellation point (2017-09-30).
+ * net/ and fs/: net_vfcntl(), file_fcntl(), file_dup(), and file_dup2()
+ are all internal OS interfaces and should not modify the errno value
+ (2017-09-30).
+ * net_dupsd() and net_dupsd2() are internal OS functions and should not
+ set the errno variable (2017-09-30).
+ * psock_ioctl() and netdev_ioctl() are internal OS functions and should
+ not set the errno variable (2017-09-30).
+ * psock_close() and net_close() are internal OS functions and should not
+ set the errno variable (2017-09-30).
+ * SAMv7, STM32, STM32 L4: DAC and ADC drivers are not permitted to set
+ the errno (2017-09-30).
+ * SIM LPC31xx: Serial and console drivers are not permitted to set the
+ errno (2017-09-30).
+ * STM32, STM32 F7: LTDC and DMA2D drivers are not permitted to set the
+ errno (2017-09-30).
+ * drivers/serial: 16550 UART driver IOCTL method must not set errno; it
+ must return a negated errno value (2017-09-30).
+ * drivers/lcd: ILI9341 initialize method not permitted to set errno
+ (2017-09-30).
+ * drivers/sensors: LIS331DL driver not permitted to set errno
+ (2017-09-30).
+ * drivers/wireless: CC1101 driver not permitted to set errno
+ (2017-09-30).
+ * configs/z80sim and xtrs: Serial driver lower halfs ioctl methods
+ should return a negated errno value, not set the errno variable
+ (2017-10-30).
+ * compiler.h, limits.h, types.h: Update SDCC/z80 files to include
+ support for long long, inline, __FILE__, and __func__ (2017-10-01).
+ * z80 Make.defs: Fixes dependency generation with newest SDCC compiler
+ (2017-10-01).
+ * include/: Add stdnoreturn.h (2017-10-01).
+ * tools/configure.sh: Add special support so that you can start with a
+ windows native configuration and install on a different host (and vice
+ versa). (2017-10-01).
+ * stm32_hrtim: add support for capture, chopper, deadtime and dump
+ registers. From Mateusz Szafoni (2017-10-01).
+ * tools/configure.c: Duplicate new functionaity added to configure.sh
+ (2017-10-01).
+ * tools/configure.sh: Another fix for the script. The last change only
+ worked for Windows Cygwin; for Linux, it needed to remove some
+ additional things from the defconfig file (2017-10-01).
+ * configs/z80sim: convert other configurations to default to Linux
+ (2017-10-01).
+ * tools/: configure.sh and configure.c should redirect stdout to
+ /dev/null but should not suppress stderr output (2017-10-01).
+ * stdnoreturn.h: Add definitions for the C11 noreturn keyword. Also
+ Remove C++11 dependency. Applies to C too (2017-10-02).
+ * net/route: Add logic to mark a route as most-recently-used in the
+ route cache (2017-10-02).
+ * commit b2ea300b6fb7672cdb682a0957b5dd2cff63804d broke the STM32L4 port
+ for people not using the L496xx or L4A6xx. That was because
+ stm32l4_sdmmc.h is included from the stm32l4.h global header, and this
+ header fires an #error for other chips. I see that ALL stm32l4 have the
+ same SDMMC except the stm32l4x2, which has none. From Sebastien Lorquet
+ (2017-10-02).
+ * net/route: Fix an error in cache list management (2017-10-02).
+ * Add support for Micron MT25Q series MT25Q128. From Sebastien Lorquet
+ (2017-10-02).
+ * binfmt/: Don't schedule starthook if there are no constructors
+ (2017-10-02).
+ * binfmt/: exec_module(), load_module(), unload_module(), and
+ schedule_unload() are internal OS functions and must not alter the errno
+ variable (2017-10-02).
+ * stm32f103-minimum: Add ADC support on stm32f103-minimum board. From
+ Alan Carvalho de Assis (2017-10-02).
+ * syscall/: The non-standard interface exec() is now enshrined as a
+ official NuttX API. I really dislike doing this but I think that this
+ is probably the only want to load programs in the protected mode. It is
+ currently used by some example code under apps/ that generate their own
+ symbol tables for linking. Other file execution APIs relay on a symbol
+ table provided by the OS. In the protected mode, the OS cannot provide
+ any meaning symbol table for execution of code in the user-space blob so
+ that is they exec() is really needed in that build case. And, finally,
+ the interface is completely useless and will not be supported in the
+ KERNEL build mode where the contrary is true: An application process
+ cannot provide any meaning symbolic information for use in linking a
+ different process (2017-10-03).
+ * STM32L4 RTC, PM: small fixes to subseconds handling, ADC
+ power-management hooks
+ - STM32L4 ADC: add PM hooks from Motorola MDK
+ - STM32L4 RTC: add up_rtc_getdatetime_with_subseconds
+ - STM32 RTC: workaround for potential subseconds race condition. In
+ all recent STM32 chips reading either RTC_SSR or RTC_TR is supposed
+ to lock the values in the higher-order calendar shadow registers
+ until RTC_DR is read. However many old chips have in their errata
+ this silicon bug (at least F401xB/C, F42xx, F43xx, L15xxE, L15xVD
+ and likely others): "When reading the calendar registers with
+ BYPSHAD=0, the RTC_TR and RTC_DR registers may not be locked after
+ reading the RTC_SSR register. This happens if the read operation is
+ initiated one APB clock period before the shadow registers are
+ updated. This can result in a non-consistency of the three
+ registers. Similarly, RTC_DR register can be updated after reading
+ the RTC_TR register instead of being locked."
+ - STM32L4 RTC: correct RTC_SSR and RTC_TR read ordering. In all
+ recent STM32 chips reading either RTC_SSR or RTC_TR is supposed to
+ lock the values in the higher-order calendar shadow registers until
+ RTC_DR is read. Change the register read ordering to match this and
+ don't keep a workaround for a hypothetical race condition (not in
+ any L4 errata, lets for once assume ST's silicon works as it is
+ documented...)
+ - STM32L4 PM: remove useless #ifdefs and old non-L4 STM32 code
+ From Juha Niskanen (2017-10-03).
+ * sched/semaphore: Rename sem_reset() to nxsem_reset() so that it is
+ clear this is an internal OS function (2017-10-03).
+ * sched/semaphore: Rename sem_tickwait() to nxsem_tickwait() so that it
+ is clear this is an internal OS function (2017-10-03).
+ * libc/semaphore: Add nxsem_init() which is identical to sem_init()
+ except that it never modifies the errno variable. Changed all
+ references to sem_init in the OS to nxsem_init() (2017-10-03).
+ * sched/semaphore: Rename all internal private functions from sem_xyz
+ to nxsem_xyz. The sem_ prefix is (will be) reserved only for the
+ application semaphore interfaces (2017-10-03).
+ * libc/semaphore: Add nxsem_getvalue() which is identical to
+ sem_getvalue() except that it never modifies the errno variable.
+ Changed all references to sem_getvalue in the OS to nxsem_getvalue()
+ (2017-10-03).
+ * libc/semaphore and sched/semaphore: Add nxsem_getprotocol() and
+ nxsem_setprotocola which are identical to sem_getprotocol() and
+ set_setprotocol() except that they never modifies the errno variable.
+ Changed all references to sem_setprotocol in the OS to
+ nxsem_setprotocol(). sem_getprotocol() was not used in the OS
+ (2017-10-03).
+ * sched/semaphore: Add nxsem_destroy() which is identical to
+ sem_destroy() except that it never modifies the errno variable. Changed
+ all references to sem_destroy() in the OS to nxsem_destroy() (2017-10-03).
+ * sched/semaphore: Add nxsem_post() which is identical to sem_post()
+ except that it never modifies the errno variable. Changed all
+ references to sem_post in the OS to nxsem_post() (2017-10-03).
+ * sched/semaphore: Add the function nxsem_wait(). This is a new
+ internal OS interface. It is functionally equivalent to sem_wait()
+ except that (1) it is not a cancellation point, and (2) it does not set
+ the per-thread errno value on return. In all OS functions (not
+ libraries), change sem_wait() to nxsem_wait(). This will prevent the OS
+ from creating bogus cancellation points and from modifying the per-task
+ errno variable. This commit also backs out most of commit
+ b4747286b19d3b15193b2a5e8a0fe48fa0a8638c. That change was added because
+ sem_wait() would sometimes cause cancellation points inappropriately.
+ But with these recent changes, nxsem_wait() is used instead and it is
+ not a cancellation point (2017-10-04).
+ * sched/semaphore: sem_timedwait() is a cancellation point and, hence,
+ cannot be called from within the OS. Created nxsem_timedwait() that is
+ equivalent but does not modify the errno and does not cause
+ cancellation. All calls to sem_timedwait() change to calls to
+ nxsem_timedwait() in the OS (2017-10-05).
+ * sched/semaphore: sem_trywait() modifies the errno value and, hence,
+ should not be used within the OS. Use nxsem_trywait() instead
+ (2017-10-05).
+ * This change renames all internal, private NuttX signal-related
+ functions to use the prefix nxsig_ so that they cannot be confused with
+ application interfaces that begin, primarily, with sig_. This is
+ analogous to similar renaming that was done previously for semaphores
+ (2017-10-05).
+ * drivers/input/cypress_mbr3108: Add missing variable for nxsem_wait
+ return value. From Jussi Kivilinna (2017-10-06).
+ * fs/vfs and net/socket: fcntl() is not return success fail for
+ F_SETFL. Reported by Jussi Kivilinna (2017-10-06).
+ * This commit adds internal versions of the signal interfaces:
+ - sigtimedwait() -> nxsig_timedwait()
+ - sigwaitinfo() -> nxsig_waitinfo()
+ - nanosleep() -> nxsig_nanosleep()
+ Replace all usage of sigwaitinfo(), sigtimedwait(), and nanosleep()
+ with the OS internal counterparts nxsig_waitinfo(), nxsig_timedwait(),
+ and nxsig_nanosleep(). The internal OS versions differ from the
+ standard application interfaces in that they do not create
+ cancellation points and they do not modify the application's errno
+ variable (2017-10-06).
+ * Adds new OS internal functions nxsig_sleep() and nxsig_usleep. These
+ differ from the standard sleep() and usleep() in that (1) they don't
+ cause cancellation points, and (2) don't set the errno variable (if
+ applicable). All calls to sleep() and usleep() changed to calls to
+ nxsig_sleep() and nxsig_usleep() (2017-10-06).
+ * drivers/serial/tcdrain: tcdrain() was recently added to the NuttX C
+ library. But there is a problem. The specification of tcdrain()
+ requires that it be a cancellation point. In order to do this, tcdrain
+ was moved from the C library into the OS and the addition cancellation
+ point hooks were added. In non-FLAT builds, access via system calls is
+ also now supported (2017-10-06).
+ * net/Kconfig: Remove improper use of comma in syntax (2017-10-06).
+ * mm/: Heap semaphore logic needs to use nxsem_* interfaces when
+ available, but the standard semaphores only when implementing a
+ user-space heap. Not this does introduce and issue: the memory
+ management functions them become cancellation points because of the use
+ of sem_wait (2017-10-07).
+ * syscall/: Fix some backward conditional compilation (2017-10-07).
+ * sched/signal: Add nxsig_kill() which is functionally equivalent to
+ kill() except that it does not modify the errno variable. Replace all
+ usage kill() in the OS proper with nxsig_kill() (2017-10-07).
+ * graphics/vnc/server: Fix an error in the VNC server introduced with
+ recent big set of changes (2017-10-07).
+ * sched/signal: Add nxsig_queue() which is functionally equivalent to
+ sigqueue() except that it does not modify the errno variable. Replace
+ all calls to sigqueue() in the OS proper with calls to nxsig_queue() to
+ avoid accessing the errno variable (2017-10-07).
+ * sched/signal: Add internal OS interface nxsig_procmask(). This
+ internal interface is equivalent to the standard sigprocmask() used by
+ applications except that it does not modify the errno value. Also fixes
+ a problem in that the original sigprocmask() was not setting the errno.
+ Replace all calls to sigprocmask() in the OS proper with calls to
+ nxsig_procmask(). (2017-10-07).
+ * sama5d4-ek: Remove a really old defconfig example file that is so far
+ out of date that it can only be misleading (2017-10-07).
+ * Fix some build problems after recent separation of internal OS from
+ application interfaces. The build problem only occurs in the PROTECTED
+ and KERNEL builds where separate libraries are built for the
+ applications and for use within the OS. In these cases, the correct
+ interfaces must be used. This commit fixes a few of these, so I can get
+ through build testing, but there are many more that need fixin'
+ (2017-10-08).
+ * SDCC Fixes: Change some prototypes and some assumptions about the
+ size of unsigned int to get to a clean SDCC compile (2017-10-08).
+ * Fix some problems in the previous commits: Forgot to update sigset()
+ after change to prototype. Also there was a stray semicolon in the
+ change signal() (2017-10-08).
+ * libc/stdio: Build the lib_noflush() and lib_snoflush() stubs even if
+ CONFIG_FILE_DESCRIPTORS=0. They may still be needed (2017-10-08).
+ * configs/z80sim: Fix a naming problem. Also, don't try to build the
+ serial driver if CONFIG_NFILE_DESCRIPTOR=0 (2017-10-08).
+ * libc and libnx: When the libraries are built into two libraries, a
+ user space library and a OS space library (as in the PROTECTED and
+ KERNEL build). Then the user space library must not use the OS internal
+ interfaces; similarly, the OS must avoid using the userspace interfaces
+ so that it does not muck the errno value or create spurious cancellation
+ points (2017-10-08).
+ * Misc STM32 Fixes
+ - stm32_hrtim.c: fix burst mode prescaler update
+ - stm32f334-disco: add flash mode support for powerled driver +
+ cosmetics
+ From Mateusz Szafoni (2017-10-08).
+ * powerled.h: Add fault field to state structure. From Mateusz Szafoni
+ (2017-10-08).
+ * libc/termios: Adds tcflow() (2017-10-09).
+ * RNDIS: Use CONFIG_USBDEV_MAXPOWER instead of hardcoded value. Use
+ LPWORK for network operations by default. From Sakari Kapanen
+ (2017-10-09).
+ * sched/mqueue: Rename all OS internal functions declared in
+ sched/mqueue/mqueue.h to begin with nxmq_ vs. mq_. The mq_ prefix is
+ reserved for standard application interfaces. Rename all private static
+ functions for use the nxmq_ vs. mq_ naming (2017-10-09).
+ * task: Add new cancellation point interface,
+ check_cancellation_point() (2017-10-09).
+ * STM32, STM32L4 serial changes:
+ - stm32: serial: add interface to get uart_dev_t by USART number,
+ stm32_serial_get_uart
+ - stm32: serial: do not stop processing input in SW flow-control mode
+ - stm32l4: serial: do not stop processing input in SW flow-control
+ mode
+ - stm32l4: serial: suspend serial for Stop mode
+ From Juha Niskanen (2017-10-09).
+ * Misc STM32 Fixes
+ - stm32_powerled.c: cosmetics
+ - stm32_hrtim.c: cosmetics
+ - stm32/Kconfig: add HRTIM configuration and add DAC external
+ trigger configuration
+ - stm32f334-disco: Add powerled example configuration. From Mateusz
+ Szafoni (2017-10-09).
+ * drivers/power: Add powerled to Kconfig. From Mateusz Szafoni
+ (2017-10-09).
+ * BCM2708: Add enough infrastructrue (more stubs) to get a clean
+ compilation of the Pi Zero configuration (with many undefined things at
+ link time). This includes several register definition header files
+ (some from Alan Carvalho de Assis), basic interrupt handling logic,
+ boot-up files, GPIO support, build and configuration logic, basic board
+ support at configs/pizero (2017-10-09).
+ * sched/mqueue: Add internal function nxmq_send() and nxmq_timedsend()
+ that are equivalent to mq_send() and mq_timedsend() except that they do
+ not create cancellation points and do to not modify the errno variable.
+ Change all calls to mq_send() and mq_timedsend() in the OS to calls to
+ nxmq_send() and nxmq_timedsend(), making appropriate changes for
+ differences in return values (2017-10-10).
+ * sched/mqueue: Add nxmq_receive() and mxmq_timedreceive() which are
+ functionally equivalent to the standard mq_receive and mq_timedreceive()
+ except that (1) they do not create cancellation points, and (2) the do
+ not modify the application's errno variable. Change all calls to
+ mq_receive() and mq_timedreceive() in the OS to calls to nxmq_receive()
+ and nxmq_timedreceive(), making appropriate changes for differences in
+ return values (2017-10-10).
+ * Fix a few places where there was a semicolon following the 'if'
+ condition, making the following logic unconditional (2017-10-10).
+ * The INA219 is a combined voltage and current sensor that can measure
+ up to 26 volts and a current that depends on an external shunt
+ resistor. Connection happens via i2c/smbus and the chip features a
+ power supply rail that is independent from the measured voltage, so it
+ can measure low voltages.
+
+ This commit adds a driver for this chip. Right now it measures bus
+ voltage and current, and does not use the internal calibrated current
+ reading, nor the available power measurement. From Sebastien Lorquet
+ (2017-10-10).
+ * configs/clicker2-stm32: Adds SD card, automount, and syslog file
+ support and fixes a few minor issues
+ - Moves defines for xbee from clicker2-stm32.h to stm32_xbee.h
+ - Adds support for uSD click boards and automount support
+ - Fixes minor guard clause
+ - Bring-up automounter before MMCSD
+ - MRF24J40 interrupt should only fire on falling edge.
+ - Adds file syslog support for logging to file on SD card
+ From Anthony Merlino (2017-10-11).
+ * Z80: Makefile fix for use with current SDCC (2017-10-11).
+ * fs/vfs: Change the return value of internal function fs_getfilep().
+ It no longer sets the errno variable but, rather, returns errors in the
+ same manner as other internal OS functions (2017-10-11).
+ * Adds OS internal functions nx_send(), ns_recv(), and nx_recvfrom()
+ which are functionally equivalent to send(), recv(), and recvfrom()
+ except that they do not set the errno variable and do not cause
+ cancellation points (2017-10-11).
+ * Adds OS internal function nx_write() which is functionally equivalent
+ to write() except that it does not set the errno variable and do not
+ cause cancellation points (2017-10-11).
+ * sched/task: task_exithook.c fails to link if signals are disabled
+ because was unconditionally trying to send the SIGCHLD signal to the
+ parent in certain configurations. Noted by Jeongchan Kim (2017-10-11).
+ * arch/arm/src/samv7: Correct an error in RX DMA setup. From Manish
+ Kumar Sharma (2017-10-11).
+ * net/socket: psock_send/psock_sendto: remove assert check for null
+ psock and buf input pointers. Removes check as 'psock == NULL'
+ altogether because that checked for later in psock_send and
+ psock_sendto. Change null check for 'buf' so that it is handled same as
+ in recvfrom.c (return -EINVAL instead of assert). From Jussi Kivilinna
+ (2017-10-11).
+ * fs/vfs: Add new internal OS interface nx_read(). nx_read() is
+ functionally equivalent to read() except that it does not modify the
+ errno variable and it is not a cancellation point. Changed all
+ references to read() in the OS to nx_read() (2017-10-11).
+ * sched/signal: Add logic to wake up a thread that is waiting on a
+ signal if it is canceled (2017-10-12).
+ * nxsig_timedwait: Add logic to suppress the wait if there is a pending
+ cancellation (2017-10-12).
+ * stm32 SPI: Add missing include required when CONFIG_SPI_CALLBACK is
+ enabled. From Anthony Merlino (2017-10-12).
+ * STM32L4 RTC fixes:
+ - STM32L4 RTC: init mode was never exited because nested locking in
+ rtc_synchwait() disabled backup domain access
+ - STM32L4 RTC: Use backup register magic value instead of INITS
+ bit. The INITS (bit 4) of RTC_ISR register cannot be used to
+ reliably detect backup domain reset. This is because we can operate
+ our device without ever initializing the year field in the RTC
+ calendar if our application does not care about correct date being
+ set. Hardware also clears the bit when RTC date is set back to year
+ 2000.
+ - STM32L4 RTC: put back the SSR race condition workaround. ST has
+ confirmed that the issue has not been fixed, and that it applies to
+ STM32L4 too (was not in errata sheets due to documentation bug) See
+ discussion: https://community.st.com/thread/43710-issue-with-rtc-maximum-time-resolution
+ - STM32F4, STM32L4, STM32F7 RTC: add more CONFIG_RTC_NALARMS > 1 to
+ reduce code size
+ - STM32L4: rename stm32l4_rtcc.c to stm32l4_rtc.c to better match
+ STM32F7
+ - STM32, STM32L4, STM32F7 RTC: stray comment and typos in
+ chip/stm32_rtcc.h
+ - STM32L4 RTC: change maximum alarm time from 24h to one month
+ From Juha Niskanen (2017-10-13).
+ * TCP Networking: When CONFIG_NET_TCP_WRITE_BUFF=y there is a situation
+ where a NULL pointer may be dereferenced. In this configuration, the
+ TCP connection's 'semi-permanent' callback, s_sndcb was nullified in
+ tcp_close_disconnect. However, other logic in tcp_lost_connection()
+ attempt to use that callback reference after it was nullifed. Fixed in
+ tcp_lost_connectino() by adding a NULL pointer change before the
+ access. This was reported by Dmitriy Linikov in Bitbucket Issue 72
+ (2017-10-13).
+ * stm32f7 BBSRAM: stm32_bbsram: avoid assert in stm32_bbsram_savepanic.
+ If panic happens before stm32_bbsram is initialized,
+ stm32_bbsram_savepanic caused additional assert panic. Function has null
+ pointer check, so drop DEBUGASSERT. From Jussi Kivilinna (2017-10-13).
+ * FS FAT: Fix hard-fault when listing contents of FAT root. From Jussi
+ Kivilinna (2017-10-13).
+ * configs/stm32f4discovery: Add a USB MSC configuration. From Alan
+ Carvalho de Assis (2017-10-13).
+ * 6LoWPAN: Correct a bug in handling uncompressed frames (IPv6
+ dispatch) (2017-10-13).
+ * 6LoWPAN: Fix a whole in the logic of the previous commit. It turns
+ out that g_uncomp_hdrlen has other usages so it cannot be modified as I
+ was doing. Instead, I needed to add a separate localt variable,
+ protosize, to keep track of the two usages of g_uncomp_hdrlen
+ (2017-10-13).
+ * configs/: The nx and nxtext examples no longer supports single user
+ mode (2017-10-14).
+ * The lcdrw example has been removed because it violates the portable OS
+ interface (2017-10-14).
+ * All configurations that use NXIMAGE or NXHELLO must select
+ NX_MULTIUSER. All configuratinos that use examples/nxterm must enable
+ CONFIG_LIB_BOARDCTL (2017-10-14).
+ * configs/stm32f103-minimum: Add support for LM75 in the
+ stm32f103-minimum board. From Alan Carvalho de Assis (2017-10-14).
+ * configs/: All configurations that use NXLINES must select
+ NX_MULTIUSER. All configurations that use the NX server need to have
+ larger POSIX messages (2017-10-14).
+ * boardctl(): Remove the BOARDIOC_GRAPHICS_SETUP command (2017-10-15).
+ * Initial ADC support for the STM32F33XX
+ - stm32_adc.h: add JEXTSEL definitions and hrtim trigger configuration
+ - stm32_adc.c: move STM32F33 ADC logic to a separate file
+ From Mateusz Szafoni (2017-10-15).
+ * configs/sim: Update touchscreen driver initialization to use only
+ multiple-user NX server logic (2017-10-15).
+ * configs/sim: Convert the traveler configuration so that it uses the
+ framebuffer driver (2017-10-16).
+ * task_delete(): Do not permit user applications to delete kernel
+ threads (2017-10-16).
+ * kthread_create(): Rename kernel_thread() to kthread_create() for
+ better naming consistency with task_create() and kthread_delete()
+ (2017-10-16).
+ * All other STM32: SHIFTR_SUBFS_MASK was correct in STM32F0 only
+ - STM32L1: use correct EXTI line definitions (2017-10-17).
+ * STM32 RTC fixes:
+ - RTC: canceling an alarm marks it as inactive
+ - STM32L4, STM32F4, STM32F7 RTC: fix reading alarm value that is
+ more than 24h in future
+ - STM32F0 RTC: fix backup register count in stm32_rtcc.h
+ From Juha Niskanen (2017-10-17)
+ * BCM2708: Add system timer register definitions and a partial
+ implementation of the tickless mode timer (2017-10-17).
+ * BCM2708: Add support for AUX interrupts. Add some build configuration
+ and support logic for low-level serial output (2017-10-17).
+ * drivers/usbdev: Correct input flow control logic when watermarks are
+ not enabled. Problem noedt by and change based on suggestion by Juha
+ Niskanen (2017-10-18).
+ * BCM2708: Add hooks to support both Mini- and PL011 UARTs (2017-10-18).
+ * BCM2708: Fleshes out GPIO interrupt logic (2017-10-18).
+ * fs/vfs: Fix after recent changes. write() was return negative values
+ in errno. Noted by Jussi Kivilinna (2017-10-18).
+ * drivers/usbdev: Move test for NULL pointer before the pointer is
+ deferences. Noted by Juha Niskanen (2017-10-18).
+ * net/: Fix some build issues noted when both IPv4 and IPv6 are
+ enabled. From Anthony Merlino (2017-10-18).
+ * photon: Support SPI1 and SPI3. From Anthony Merlino (2017-10-18).
+ * BCM2708: Allow pass parameters with AUX interrupts; Add mini-UART
+ break capability. BCM2708: Add Mini-UART logic. Still missing UART
+ configuration logic (2017-10-18).
+ * Alexey T, Bitbuck Issue 73: Lower part of STM32 CAN driver
+ arch/arm/src/stm32/stm32_can.c uses all three hw tx mailboxes and clears
+ TXFP bit in the CAN_MCR register (it means transmission order is defined
+ by identifier and mailbox number).
+
+ This creates situation when order frames are put in upper part of CAN
+ driver (via can_write) and order frames are sent on bus can be
+ different (and I experience this in wild). Since CAN driver API
+ pretends to be "file like" I expect data to be read from fd the same
+ order it is written. So I consider described behaviour to be a bug.
+
+ I propose either to set TXFP bit in the CAN_MCR register (FIFO
+ transmit order) or to use only one mailbox (2017-10-19).
+ * The timer frequencies (BOARD_TIMx_FREQUENCY) are incorrectly defined
+ in configs/stm3240g-eval/include/board.h. Since the APB prescalers are
+ set to divide by 4 and 2 respectively, the frequencies should be
+ "2xAPBx" as said in the comment. The correct frequencies are already
+ defined but as STM32_APBx_TIMx_CLKIN. From Mattias Edlund (2017-10-19).
+ * drivers/ioexpander: The IRQ subsystem now supports passing a void *
+ parameter to IRQ handlers. Use that method to support multiple pc9555
+ devices, by passing a pointer to the device to the board defined irq
+ handler. Now the CONFIG_ for multiple PCA devices just allocates device
+ structures dynamically instead of statically when not enabled.
+
+ The same interrupt handler is entered with the device structure
+ parameter in all situations, multiple or single PCA. One should still
+ be careful if multiple PCA devices share the same IRQ. From Sebastien
+ Lorquet (2017-10-19).
+ * libc/match: Use of exp() vs expf() in logf() caused function to be
+ slow. From Alan Carvalho de Assis (2017-10-19).
+ * drivrs/mtd/filemtd.c: add block device MTD interface. Block MTD
+ interface allows using block device directly as MTD instead of having to
+ use file-system in between. NOTE that this provides the opposite
+ capability of FTL which will let you use an MTD interface directly as a
+ block device. From Jussi Kivilinna (2017-10-19).
+ * There was a reference counting problem in the TPC logic of
+ net_clone(). net_clone() which is the common logic underlying dup() and
+ dup2() for sockets. When net_clone() calls net_start_monitor() and
+ net_start_monitor() returns a failure (because the underlying TCP
+ connection) then net_clone() must back out the reference count on the
+ structure. Problem noted by Pascal Speck and this implementation of the
+ solution is based on his suggestion (2017-10-19).
+ * There was a possible recursion that could eventually overflow the
+ stack. The error occurred when closing the socket with inet_close()
+ while a socket callback was still queued. When the socket callback was
+ executed by devif_conn_event(), this resulted in a call to
+ psock_send_eventhandler() with TCP_CLOSE flag set which then called
+ tcp_lost_connection(). tcp_shutdown_monitor() then called
+ tcp_callback() again, which again called psock_send_eventhandler(), and
+ so on.... Noted by Pascal Speck. Solution is also similar to a
+ solution proposed by Pascal Speck (2017-10-19).
+ * nucleo-f334r8/adc: change serial console to USART2 (STLINK COM). From
+ Mateusz Szafoni (2017-10-19).
+ * stm32f33xxx_adc.c: fix some warnings and compilation error when extsel
+ not in use. From Mateusz Szafoni (2017-10-19).
+ * net/tcp: Same change to tcp_send_buffered.c probably also applies to
+ tcp_send_unbuffered.c (2017-10-19).
+ * net/tcp: Same change to tcp_send_buffered.c probably also applies to
+ tcp_sendfile.c (2017-10-19).
+ * tcp_lost_connection() is called from two places in tcp_sendfile.c
+ (2017-10-19).
+ * net/tcp: Same change to tcp_send_buffered.c probably also applies to
+ sixlowpan_tcpsend.c and inet_recvfrom.c (2017-10-19).
+ * drivers/sensor: Add driver for the APDS-9960 gesture sensor. From
+ Alan Carvalho de Assis (2017-10-20).
+ * include/nuttx/sensors/ioctl: deduplicate SNIOC_CFGR. From Jussi
+ Kivilinna (2017-10-20).
+ * drivers/sensors/hts221: power-on sensor for loading calibration data.
+ From Jussi Kivilinna (2017-10-20).
+ * arch/arm/src/stm32f7/i2c: fix I2C_M_NORESTART handling. From Jussi
+ Kivilinna (2017-10-20).
+ * drivers/sensors/apds9960.c: Use work_queue to read/process data when
+ receive an IRQ. From Alan Carvalho de Assis (2017-10-20).
+ * STM32L1, STM32L4 RTC: add periodic interrupts, update L1 RTC
+ implementation
+ - STM32L4 RTC: add support experimental CONFIG_RTC_PERIODIC
+ - STM32 RTC: separate STM32L1 RTC into a separate file
+ STM32L1 RTC is very close to F4 or L4 versions, with two alarms and
+ periodic wakeup support so backported L4 peripheral to L1.
+ - RTC: Add periodic alarms to upper and lower halves
+ From Juha Niskanen (2017-10-20).
+ * stm32_adc.c: clear pending interrupts. From Mateusz Szafoni
+ (2017-10-20).
+ * drivers/bch: The character driver to block device access now supports
+ an IOCTL to get the geomtry of the underlying block device (2017-10-20).
+ * fs/fat: Remove mkfatfs from the OS. This is a user-space application
+ and belongs in apps, not in the OS (2017-10-20).
+ * configs/nucleo-f334r8: add logic for zero latency high priority
+ interrupts example. From Mateusz Szafoni (2017-10-22).
+ * Misc STM32 chagnes
+ - STM32 HRTIM: Fix warnings related with RCC
+ - STM32F33xxx ADC: Add some publicly visable interfaces and some
+ code to support injected channels
+ - STM32F33xxx DMA: Add public interface to handle with DMA interrupts
+ From Mateusz Szafoni (2017-10-22).
+ * stm32f103-minimum: Add an ADPS-9960 example configuration. From Alan
+ Carvalho de Assis (2017-10-23).
+ * net/icmp: This change adds support for semi-standard IPPROTO_ICMP
+ AF_INET datagram sockets. This replaces the old ad hoc, nonstandard way
+ of implementing ping with a more standard, socket interface (2017-10-23).
+ * net/inet: Add check for protocol before handing out TCP and UDP
+ sockets (2017-10-23).
+ * arch/arm/common/up_checkstack: fix assert panic when both TLS and
+ interrupt stack are enable. From Jussi Kivilinna (2017-10-23).
+ * net/icmp: Correct some comments, typings, spacing problems from last
+ big ICMP socket change (2017-10-23).
+ * configs/: All defconfig filess that include
+ CONFIG_NET_ICMPv6_SOCKET=y need to select CONFIG_SYSTEM_PING6=y and
+ deselect CONFIG_DISABLE_POLL (2017-10-24).
+ * net/icmpv6: This commit adds support for semi-standard IPPROTO_ICMP6
+ sockets. This is a replacement for the non-standard ICMPv6 ping support
+ that violated the portable POSIX OS interface (2017-10-24).
+ * mm/mm-heap: memalign: fix heap corruption caused by using unaligned
+ chuck size. Unaligned nodes generated by memalign later cause heap
+ corruptions when nodes are shrink further (for example, 24 bytes -> 8
+ bytes, when alignment is 16 bytes). From Jussi Kivilinna (2017-10-24).
+ * lm3s8962: NX configuration needs CONFIG_NXSTART_EXTERNINIT=y
+ (2017-10-24).
+ * sched/: move POSIX thread specific data from pthread TCB to common
+ TCB structure. This change allows using
+ pthread_getspecific/pthread_setspecific from main thread. Patch also
+ enables using pthread data with config option CONFIG_DISABLE_PTHREAD=y.
+ From Jussi Kivilinna (2017-10-25).
+ * net/local: fix typo in config macro name. From Juha Niskanen
+ (2017-10-25).
+ * Olimex stm32-h407 serial support for the on-board UEXT connector
+ (fixed style & defconfig). Add USART6 for UEXT connector. Add
+ nsh_uext configuration and README update. From Jan PobÅ™Ãslo (2017-10-26).
+ * configs/nucleo-l496zg/nsh: enable I2C4 bus with i2ctool. From Jussi
+ Kivilinna (2017-10-26).
+ * arch/arm/stm32f7: i2c: restore bus frequency after I2C reset. Copy
+ frequency restoration fix from STM32L4 I2C driver to STM32F7 I2C
+ driver. From Jussi Kivilinna (2017-10-26).
+ * arch/stm32l4: port STM32F7 I2C driver to STM32L4. STM32L4 I2C driver
+ is in work-in-progress state (plentiful of TODOs and #warnings) and lags
+ many features found in more up-to-date STM32 I2C drivers. The peripheral
+ on STM32F7 and STM32L4 are identical except for L4's 'wakeup from stop
+ mode' flag and STM32F7's I2C driver is in more 'ready to use' state.
+
+ Commit ports the STM32F7 I2C driver to STM32L4. The I2C clock
+ configuration is kept the same as before (I2CCLK = PCLK1 80 Mhz)
+ instead of switching to STM32F7 arch default that is I2CCLK=HSI.
+ Further work would be to add configuration option for choosing I2C
+ clock source instead of current hard-coded default. From Jussi
+ Kivilinna (2017-10-26).
+ * drivers/sensors/lis2dh: fixes for self-test. From Jussi Kivilinna
+ (2017-10-26).
+ * include/nuttx/fs/: Move prototype of foreach_mountpoint out of
+ include/nuttx/fs/fs.h to fs/mount/mount.h (2017-10-26).
+ * fs/mount: Implements procfs /proc/fs/blocks and /proc/fs/usage files,
+ replacing the NSH df command. Also implements procfs /proc/fs/mount
+ file, replacing the NSH mount command when there are no arguments
+ (2017-10-26).
+ * Correct a problem that was causing an apparent directory to be
+ reported as a file instead of a directory by opendir. This happened
+ after adding these three new procfs entries: fs/block, fs/mount, and
+ fs/usage. Of course, there is no directory fs in this case, only three
+ files that have fs/ in their relative pathnames. The logic was
+ detecting that fs was the name of the enty to report, but it was then
+ declaring that fs was a file (because fs/block is of type file). This
+ was fixed by adding a check for matching lenghts. i.e., if strlen(fs)
+ != strlen(fs/block), then report fs as a directory instead of a file
+ (2017-10-26).
+ * fs/procfs: Missing some conditional logic for cases where mountpoint
+ procfd entries excluded (2017-10-27).
+ * drivers/can/mcp2515.c: Fix the MCP2515 Bit Rate Prescale
+ calculation. Fix BRP for SET_BITTIMING ioctl as well. From Alan
+ Carvalho de Assis (2017-10-27).
+ * sensors/lis2dh: Fix use of obsolete dbg macro. From Jussi Kivilinna
+ (2017-10-27).
+ * nucleo-f334r8: Add highpri example configuration. From Mateusz
+ Szafoni (2017-10-28).
+ * STM32 F33xx: Add ADC DMA support to STM32F33 configuration. From
+ Mateusz Szafoni (2017-10-28).
+ * drivers/net: Remove the old, unfinished Crystal LAN driver. I don't
+ even have the hardware that it goes with anymore (2017-10-28).
+ * configs/mx1ads: This commit removes board support for the mx1ads
+ board. That board support was never completed and I no longer even have
+ the hardware. The unfinished board support is still available in the
+ Obsoleted repository if anyone would ever like to resurrect it
+ (2017-10-28).
+ * STM32 ADC: Added support for ADC's IO_ENABLE_TEMPER_VOLT_CH ioctl on
+ STM32F10XX and STM32F20XX. From Dmitriy Linikov (2017-10-30).
+ * STM32 F2: Fixed build for STM32F20XX platforms when
+ CONFIG_STM32_DMACAPABLE is enabled. From Dmitriy Linikov (2017-10-30).
+ * fs/userfs: This completes coding of the UserFS client and of the
+ UserFS feature in general. This feature is being merged to main now
+ because I believe it is innocuous. It is, however, untesed. The next
+ step will be to develop a test case to verify the feature. Uses Unix
+ domain local sockets instead of message queues. Easier to transfer big
+ data in local sockets than message queues (2017-10-30).
+ * Fix DEBUGASSERT() issues with nxhello on lc823450-xgevk
+ - sched/task: Remove DEBUGASSERT in task_exitstatus() and
+ task_groupexit()
+ - graphics: Change DEBUGASSERT condition in nx_runinstance()
+ From Masayuki Ishikawa (2017-10-31).
+ * Fix GPIO operation of STMPE811 driver.
+ 1. STMPE811_GPIO_DIR was defined for register name and later was
+ redefined to be the pin direction mask for `stmpe811_gpioconfig`. I
+ decided to change register name to be STMPE811_GPIO_DIR_REG, and keep
+ pin direction mask STMPE811_GPIO_DIR, so that any external code that
+ already use this driver will be unchanged.
+ 2. The STMPE811 register GPIO_DIR uses bit value 1 for output and 0
+ for input, but `stmpe811_gpioconfig` set the opposite.
+ 3. The call to `stmpe811_gpiowrite` from inside of
+ `stmpe811_gpioconfig` leaded to deadlock.
+ From Dmitriy Linikov (2017-10-31).
+ * sim/userfs: Add a configuration for testing the UserFS using
+ apps/examples/userfs (2017-10-31).
+ * Fixes a memory leak that is caused because the client message queue is
+ not unlinked after the client disconnects from the NX server. From
+ Masayuki Ishikawa (2017-10-31).
+ * drivers/wireless/ieee80211: Fix typos and spelling errors as needed
+ for Photon build. From Anthony Merlino (2017-11-01).
+ * net/icmpv6: Add some header file necessary for correct build. From
+ Anthony Merlinoo (2017-11-01).
+ * libc/userfs: Correct return value from dispatchers. Should return
+ zero on success, not the number of bytes sent (2017-11-01).
+ * net/ipforward: Fixes typo that caused build error when IP forwarding
+ was enabled with CONFIG_NET_ICMPv6_NEIGHBOR enabled as well. From
+ Anthony Merlino (2017-11-01).
+ * ieee802154: Simplifies notify() and rxframe() calls to a single
+ notify() call. dataind's and all other "notifs" are now "primitives"
+ which aligns with standard terminology From Anthony Merlino (2017-11-01).
+ * fs/userfs: Correct check for response type (2017-11-01).
+ * net/local: This commit modifies the Unix domain local socket design.
+ Local sockets are built on top of pipes. The Local socket
+ implementation maintained file descriptors to interrupt with the pipes.
+ File descriptors have the bad property that they are valid only while
+ running on the thread within the task that created the local socket.
+
+ As a policy, all internal OS implementations must use "detached" files
+ which are valid in any context and do not depend on the validity of a
+ file descriptor at any point in time. This commit converts the usage
+ of file descriptors to detached files throughout the local socket
+ implementation (2017-11-02).
+ * fs/userfs: There are some deadlock issues that make the UserFS
+ un-usable at the current time. Added to the TODO list; also feature is
+ now marked EXPERIMENTAL (2017-11-02).
+ * drivers/serial/serial.c: Optimize wait time in tcdram() for buffer
+ emptying. According to the specification, the close function must wait
+ until all data has been written before it closes the file (except
+ O_NONBLOCK is set). The maximum waiting time for this is not specified.
+
+ To be able to edit the file list of the process, the close function
+ has to lock the file list semaphore. After that the close function of
+ the serial driver is called.
+
+ Waiting for the complete transmission of all data is done in the
+ serial driver. This causes the semaphore to remain locked until all
+ data has been sent. However, no other thread of the process can edit
+ the file list for that time (open, close, dup2, etc.). This is not
+ optimal in a multithreaded environment. Therefore, we have to keep
+ the waiting time within the driver as short as possible. From Frank
+ Benkert (2017-11-02).
+ * drivers/loop: Don't use file descriptors... Use the internal file
+ system interfaces so that the loop device can be shared across threads
+ (2017-11-02).
+ * drivers/mtd/filemtd.c: Don't use file descriptors... Use the internal
+ file system interfaces so that the loop device can be shared across
+ threads (2017-11-02).
+ * mac802154: Fixes a warning for unused variable and returns -1 from
+ macnet_notify() if event is not used. From Anthony Merlino (2017-11-03).
+ * drivers/lcd/max7219.c: Add support to MAX7219 LED Matrix as LCD
+ interface. From Alan Carvalho de Assis (2017-11-04).
+ * configs/stm32f103-minimum: Add board support for MAX7219 LED Matrix
+ controller. From Alan Carvalho de Assis (2017-11-04).
+ * stm32f334-disco, nucleo-f334r8: add missing ram_vectors configuration
+ in linker script. From Mateusz Szafoni (2017-11-04).
+ * Kconfigs: Add CONFIG_LCD_UPDATE that works like CONFIG_NX_UPDATE but
+ can be enabled without enabling the graphics subsystem (2017-11-04).
+ * SAMv71-XULT: Remove non-functional framebuffer configuration
+ (2017-11-05).
+ * stm32f103-minimum: Remove warning when selecting MMCSD support, Add
+ board_usbmsc_initialize to stm32f103-minimum. From Alan Carvalho de
+ Assis (2017-11-05).
+ * nucleo-f334r8/highpri: missing ADC trigger configuration. From
+ Mateusz Szafoni (2017-11-05).
+ * stm32f334-Disco: beginning of lower-half driver for SMPS (buck-boost
+ onboard converter). From Mateusz Szafoni
+ * Misc. STM32 Fixes:
+ - STM32 HRTIM: add helper macros
+ - STM32F33xxx ADC: injected channels support, fix some definitions,
+ add interface to disable interrupts
+ From Mateusz Szafoni (2017-11-05).
+ * fs/userfs: This commit converts the underlying IPC used by the
+ UserFS from Unix domain local sockets to UDP LocalHost loopback
+ sockets. The problem with the local sockets is that they do require
+ operations on the top level psuedo-file system inode tree. That tree
+ must be locked during certain traversals such as enumerate mountpoints
+ or enumerating directory entries.
+
+ This conversion is unfortunate in the sense that Unix local domain
+ sockets are relatively lightweight. LocalHost UDP sockets are much
+ heavier weight since they rely on the full UDP stack. If anyone is
+ up for a complete redesign, then using some shared memory and a POSIX
+ message queue would be lightweight again.
+
+ This commit also fixes several bugs that were not testable before the
+ inode tree deadlock. I cannot say that the logic is 100% stable but
+ it does not have basic functionality (2017-11-05).
+ * fs/userfs: Fix return value from dup method. In order to return a
+ pointer, the parameter must be a pointer to a pointer (2017-11-06).
+ * configs/stm32f429i-disco/ltdc: This configuration has been deleted
+ because it violated the portable POSIX OS interface. It used
+ apps/examples/ltdc and include ltdc.h and dma2d.h which were also
+ removed for the same reason (2017-11-06).
+ * arch/arm/include/stm32 and stm32f7: Remove ltdc.h and dma2d.h.
+ Those header files in that location permitted inclusion into
+ application space logic and, hence, facilitated and encouraged calling
+ into the OS and violating the portable POSIX OS interface. The
+ definitions in those header files were move the appropriate location in
+ the counterpart, architecture specific files at arch/arm/src/stm32 and
+ stm32f7 dma2d.h and ltdc.h (2017-11-06).
+ * lpc43xx Ethernet: Fix some backward logic setting full-duplex and
+ 100mbps when autoconfiguration is disabled. Noted by Anonymous in
+ Issue #76 (2017-11-06).
+ * sched/sched/sched_cpuselect.c: For SMP, In order to find the cpu
+ with the lowest priority thread, we have to remember the already found
+ lowest priority. Noted by Anonymous in Issue #75 (2017-11-06).
+ * Add IPL2 support for LC823450
+ - arch/arm/src/lc823450: Add IPL2 support
+ - configs/lc823450-xgevk: Add IPL2 support
+ From Masayuki Ishikawa (2017-11-07).
+ * drivers/audio: Add WM8774 support. From Masayuki Ishikawa
+ (2017-11-08).
+ * lc823450-xgevk audio support
+ - arch/arm/src/lc823450: Add IPL2 support
+ - configs/lc823450-xgevk: Add IPL2 support
+ - libc/audio: Fix compilation error in lib_buffer.c
+ - arch/arm/src/lc823450: Add I2S support
+ - configs/lc823450-xgevk: Add WM8774 support
+ From Masayuki Ishikawa (2017-11-08).
+ * drivers/usbdev/rndis.c: fix packet receiving logic. The logic didn't
+ take single-byte termination frames in account. From Sakari Kapanen
+ (2017-11-08).
+ * net/icmpv6/icmpv6_radvertise.c: Add option to manually specify router
+ prefix. From Sakari Kapanen (2017-11-08).
+ * net/icmpv6/icmpv6_radvertise.c: set the prefix length to
+ preconfigured value (2017-11-08).
+ * STM32 L4 RCC: restore backup-registers after backup-domain reset.
+ From Jussi Kivilinna (2017-11-08).
+ * STM32 L4: Build stm32l4_idle.c only if CONFIG_ARCH_IDLE_CUSTOM is
+ not enabled. From Jussi Kivilinna (2017-11-08).
+ * drivers/power/bq2429x.c: Add BATIO_OPRTN_SYSON for enabling BATFET
+ after SYSOFF. From Jussi Kivilinna (2017-11-08).
+ * lc823450 auto LED support
+ - arch/arm/src/lc823450: Add auto LED for CPU activity
+ - configs/lc823450-xgevk: Add auto LED support
+ From Masayuki Ishikawa (2017-11-09).
+ * tools/configure.sh: This commit adds a -m option for macOS. For
+ anyone not aware, Apple renamed OSX to macOS recently; thus the 'm'
+ instead of 'o'. This does not change the other uses of *_OSX to macOS.
+ From jeditekunum (2017-11-09).
+ * tools/configure.c: Update functionality to match last change to
+ tools/configure.sh (2017-11-10).
+ * STM32L4 serial PM interface improvements: Check rx/tx buffers for
+ pending data in pmprepare. Remove adhoc PM interfaces and move serial
+ suspend functionality behind CONFIG_PM. From Jussi Kivilinna
+ (2017-11-10).
+ * procfs: Fix uptime being clse to maximum 32-bit value in certain
+ config. From Juha Niskanen (2017-11-10).
+ * libc: Add support for readv() and write(). Also includes some
+ cosmetic changes to some unrelated files (2017-11-11).
+ * libc/signal: Add support for sigwait() (2017-11-11).
+ * sched/signal/sig_nanosleep.c and libc/time/lib_nanosleep.c:
+ Implement clock_nanosleep(). nanosleep() is now reduced to a libc
+ wrapper around clock_nanosleep() (2017-11-11).
+ * Changes from review of clock_nanosleep(): Misplaced right bracket,
+ but return value in one failure case (2017-11-11).
+ * include/netinet/tcp.h: Add trivial standard tcp.h header file
+ (2017-11-12).
+ * Trivial re-ordering of socket option bit numbers to match order
+ presented on OpenGroup.org (2017-11-12).
+ * arch/arm/src/stm32/stm32f33xx_adc.c: Eliminate warnings about
+ cj_channels and j_chanlist being set but not used (2017-11-12).
+ * configs/stm32l476-mdk: Add support for the on-board LEDs (2017-11-12).
+ * include/netinet/tcp.h: Add trivial standard tcp.h header file
+ (2017-11-12).
+ * configs/stm32l476-mdk: Repartition bring-up logic so that it is more
+ like other board directories. Add support for USERLED driver. Add
+ bring-up initialization logic for the USERLED driver (2017-11-12).
+ * drivers/usbdev/rndis.c: Fix some issues in rndis.c Introduce
+ rndis_transmit() and change rndis_rxdispatch() to avoid packet
+ corruption. Introduce max packet size for dual speed whichis mainly
+ used for high speed mode. Fix adjusting MTU warning on Linux host. Fix
+ data corruption if a packet size excceds MTU. NOTE: Max packet size is
+ not configured dynamically. This should be fixed in the future
+ version. Change HPWORK to ETHWORK. NOTE: In the commit 07b98ccbb5,
+ max packet size of bulkout was assumed to be 64. In this commit,
+ priv->epbulkout->maxpacket is used instead. From Masayuki Ishikawa
+ (2017-11-13).
+ * configs/stm32f4discovery: RNDIS support on STM32F4Discovery
+ - Add rndis configuration. NOTE: STM32F4Discovery + DM-STF4BB
+ - Add stm32_netinit.c to avoid a compilation error
+ - Add rndis initialization in stm32_bringup.c
+ NOTE: MAC address for the host side starts 0xaa. This assignment
+ scheme should be fixed later. From Masayuki Ishikawa (2017-11-13).
+ * configs/: apps/system/free has been deleted because it violates the
+ portable POSIX OS interface. Remove CONFIG_SYSTEM_FREE=y from all
+ defconfig files (2017-11-13).
+ * fs/procfs/fs_procfsprogrem: Add /proc/progmem. This is an
+ alternative way to get the information that was previoulsy available in
+ apps/system/free. apps/system/free was removed beause it made illegal
+ calls into the OS violating the portable interface. This new procfs
+ entry provides the same information with no such violation (2017-11-13).
+ * Nucleo-F746ZG: Use the serial console over /dev/ttyACM0 by default.
+ The Nucleo-F746ZG doesn't come with Arduio RS-232 shield, then it is
+ better to use the serial over the /dev/ttyACM0 that is created
+ automatically when the board is plugged in the computer. From Alan
+ Carvalho de Assis (2017-11-13).
+ * SAMA5/SAMv7: It is necessary to disable pre-emption and interrupts
+ around a loop that copies TX data into the hardware in order to avoid a
+ TX data underrun condition. From Anthony Merlino (2017-11-13).
+ * fs/profcs: Add file to show user space heap. This replaces the NSH
+ free command (2017-11-13).
+ * fs/procfs: Optimization of previous commits. /proc/umm and
+ proc/progmem are deleted. /proc/kmm is renamed /proc/meminfo and
+ contains the output that was in all three files previously (2017-11-13).
+ * configs/stm32f439i-disco: Add an fb configuration (2017-11-13).
+ * configs/stm32f429i-disco/fb: Fix a compile issue. Disable all NX
+ features in the fb configuration. NX is not needed (2017-11-13).
+ * configs/stm32f429i-disco/fb: Refactor initialization logic so that
+ it is a little more like other boards. Remove double initialization of
+ framebuffer or LCD drivers (whichever is enabled) (2017-11-13).
+ * configs/stm32f429i-disco: Add logic to auto-mount procfs. Enable
+ procfs in all configurations that use NSH (2017-11-13).
+ * configs/stm32f429-disco/fb: Enable support for the STMPE811
+ touchscreen controller and also for the apps/exmaples/touchscreen test
+ (2017-11-14).
+ * Remove CONFIG_GRAN_SINGLE. It adds no technical benefit (other than
+ some minor reduction in the number of interface arguments) but adds a
+ lot of code complexity. Better without it (2017-11-14).
+ * mm/mm_gran: Add a function to get information about the state of the
+ granuale allocator (2017-11-14).
+ * fs/procfs: Add logic to show the state of the page allocator in
+ /proc/meminfo (2017-11-14).
+ * mm/mm_gran: Fix some issues found during test of the new gran_info()
+ interface (2017-11-14).
+ * configs/stm32429i-disco/src: Fix a compile error when
+ CONFIG_BOARD_INITIALIZE is defined (2017-11-14).
+ * configs/lc823450-xgevk: Fix compilation errors on Cygwin. From
+ Masayuki Ishikawa (2017-11-15).
+ * mm/mm_gran: Combine some common logic into a function (also fixes a
+ subtle bug) (2017-11-15).
+ * Build system: Fix CONFIG_BUILD_KERNEL logic directories that have
+ ubin and kbin subdirectories. Conditional logic was fine for
+ CONFIG_BUILD_FLAT and CONFIG_BUILD_PROTECTED but generated useless
+ dependencies if CONFIG_BUILD_KERNEL (2017-11-15).
+ * arch/arm/src/lpc43: Add LPC43xx CAN driver. From Alexander Vasiljev
+ (2017-11-15).
+ * arch/arm/src/lpc43: UART_RX pins should be configured with input
+ buffers enabled. Otherwise it cannot be read. From Alexander Vasiljev
+ (2017-11-15).
+ * STM32F429i-Disco: Convert NxWM configuration to use LTDC framebuffer
+ driver instead of SPI serial. Also reduce number of layers from 4 to 1
+ in fb configuration. Only one layer is used (2017-11-15).
+ * configs/stm32f429i-disco/ide: Remove the uVision IDE setup that goes
+ along with the ltdc configuration that was removed on 2017-10-28
+ (2017-11-16).
+ * configs/stm3220g-eval/ide: Remove the uVision IDE setup. This has
+ not been used for years and it a maintenance problem for me (2017-11-16).
+ * arch/arm/src/xmc4: Fix XMC4xxx USIC UART sginal to be high level when
+ in idle. From Alan Carvalho de Assis (2017-11-16).
+ * arch/arm/src/xmc4: Kconfig was not selecting XMC4_USIC for USIC1.
+ From Alan Carvalho de Assis (2017-11-16).
+ * configs/xmc4500-relax: Add config for UART3 on RXD P0.0 and TXD P0.1
+ pins. From Alan Carvalho de Assis (2017-11-16).
+ * STM32 F72xx and F73xx: Add register definition header files and
+ clocking logic. From Bob Feretich (2017-11-17).
+ * STM32F7: Fix typos in two RCC register definition header files.
+ From Bob Feretich (2017-11-17).
+ * STM32F7: Completes architecture support for the STM32 F72x and F73x
+ families. Adds support for the Nucleo-144 boards with STM32F722. From
+ Bob Feretich (2017-11-18).
+ * configs/sim: Disable NX graphics support in the fb configuration.
+ * libnx: Changes to allow the font subsystem to be built without
+ enabling the entire graphics system (CONFIG_NX). Adds CONFIG_NXFONTS
+ and CONFIG_NXGLIB. NX and NXFONTS are still pretty heavily entangled.
+ Needed to duplicate some Kconfig setting for NXFONTs if it can be
+ configured and built independently of NX. Also includes some
+ build-related fixes (2017-11-18).
+ * configs/mcb1700: Add support for Keil MCB1700 board. From Alan
+ Carvalho de Assis (2017-11-18).
+ * configs/open1788/pdcurses: Add a configuration for testing pdcurses
+ (2017-11-19).
+ * C library: Fix sscanf character conversion (%c): do not add '\0' at
+ the end as for strings, cause, for example, parsing one character will
+ fill two bytes: character itself and zero one '\0' after it, so will
+ overflow one byte variable argument and corrupt memory for variables
+ allocated after it. From Oleg Evseev (2017-11-19).
+ * arch/arm/src/xmc4:xmc4_uart_configure() expects the channel# not
+ uartbase as an input parameter. From Alan Carvalho de Assis
+ (2017-11-20).
+ * configs/open1788: Add support for the discrete joystick driver.
+ Update the pdcurses configuration to use apps/examples/djoystick
+ (2017-11-20).
+ * net/icmpv6: icmpv6_input() needs to set d_len to 0 after consuming
+ echo reply, otherwise, garbage will get sent out. From Anthony Merlino
+ (2017-11-20).
+ * configs/open1788: Enable discrete joystick input. This is
+ sufficient to get through all menuing that does not require text input
+ (2017-11-20).
+ * net/sixlowpan: Fix an endian-ness problem in 6LoWPAN address
+ decompression. From Anthony Merlino (2017-11-20).
+ * net/sixlowpan: The logic that extracts interface identifier from the
+ IP address needs to be generalized to handle cases where the address is
+ not a link local address. From Anthony Merlino (2017-11-20).
+ * arch/arm/src/xmc4 UART: Enable RX/TX status and small fixes. From
+ Alan Carvalho de Assis (2017-11-21).
+ * Various fixes for errors ound while debugging OTG on L496
+ - STM32, STM32 L4, and STM32 M4: USB OTGFS DMA trace output fix
+ - STM32: Add dump buffer feature to stm32 F4 series
+ - STM32 and STM32 L4: Fix bad USB OTGFS register address
+ - STM32 L4: Fix typo in USB OTGFS register usage
+ - STM32 L4: Add check in USB OTGFS driver to assure that SYSCFG is
+ enabled
+ - Nucleo-L496ZG: Make HSE on Nucleo-L496ZG default to enable USB
+ From Miha Vrhovnik (2017-11-21).
+ * Two changes for STM32F7.
+ 1) The first enables building with CONFIG_ARCH_IDLE_CUSTOM enabled.
+ 2) The second allows changing voltage output scaling setting and
+ prevents enabling over-drive mode for low frequencies (STM32 F74xx,
+ 75xx, 76xx, 77xx)
+ From Jussi Kivilinna (2017-11-21).
+ * Replicate Jussi Kivilinna's change for the newly added STM32F2xx and
+ F3xx family members. This change allows selecting voltage output scale
+ mode and enable over-drive only when needed (2017-11-21).
+ * mm: Add a debug assertion to check for integer overflow in malloc
+ (2017-11-21).
+ * net/icmpv6: Fix an error in the poll logic. It was assume that the
+ input parmeter pvconn was valid. It was not. Instead, the poll logic
+ must work like the sendto() and recvfrom() logic: It must keep a copy
+ of the conn structure in the private data (2017-11-21).
+ * net/icmpv6: Remove the 'list' field from struct icmpv6_conn_s. It
+ is not used (2017-11-21).
+ * net/icmp: Ports the changes in ICMPv6 of commits
+ 4629cf9461e5ac6f5f01ef8c9bee3ec9a60ce081 and
+ 74a633ea94bc308cd2eca0ec6c2be798d5794e72 to ICMP. ICMP and ICMPv6
+ sockets are nearly identical, bug-for-bug (2017-11-21).
+ * net/sixlowpan: Add htohs() in arguments to debug statements that
+ print IP addresses so that they are all shown in friendlier host
+ order. From Anthony Merlino (2017-11-21).
+ * stm32f33xxx_rcc: Fix CAN clock enable. From Mateusz Szafoni
+ (2017-11-22).
+ * drivers/lcd_framebuffer.c: If BPP is less then 8, then we need to
+ byte-align the update region (2017-11-22).
+ * configs/stm32f103-minimum: Add framebuffer driver initialization for
+ stm32f103-minimum board. From Alan Carvalho de Assis (2017-11-22).
+ * mm: Fix a typo in a debug assertion (2017-11-22).
+ * net/icmp and icmpv6: Fix some errors in debug assertions introduced
+ with last changes in this area. Also updates a REAME.txt file
+ (2017-11-22).
+ * net/: Fix some issues with regard to UDP broadcast handling. This
+ is Bitbucket Issue #77. This commit tentatively closes the issues,
+ subject to verification (2017-11-22).
+ * sixlowpan: Support sending to a router that is on-link and may be
+ able to forward the packet for us if the destination is not reachable
+ directly. From Anthony Merlino (2017-11-22).
+ * Pass header-payload offset to application for use when the MAC layer
+ is in promiscuous mode
+ - mac802154_device: When in promiscuous mode, the char driver sends
+ the entire frame, including the MAC header. This change adds an
+ offset field indicating the header-payload boundary. It is set to 0
+ when not in promiscuous mode as the header is not passed to the
+ application
+ - mac802154: Adds support for getting promiscuous mode state
+ From Anthony Merlino (2017-11-22).
+ * USB RNDIS - Fixes minor build error while using USB RNDIS with USB
+ debugging information enabled. From Anthony Merlino (2017-11-22).
+ * clicker2-stm32: Adds support for USB RNDIS device. From Anthony
+ Merlino (2017-11-22).
+ * STM32 L4 USB OTGFS: Remove dumpbuffer feature added in the last
+ commit. I don't want in features that cannot be controlled be via
+ Kconfig files and I do not accept debug code in the upstream GIT. My
+ mistake for merging it in the first place (2017-11-22).
+ * include/nuttx/video/fb.h: Add definition for a Y2 color format. I
+ don't know if this standard but I do have 2-bit greyscale hardware so
+ the definition is needed (2017-11-22).
+ * sixlowpan: Fixes build error introduced by recent PR when routing
+ table is enabled. From Anthony Merlino (2017-11-22).
+ * sixlowpan: Fixes build error introduced by recent PR when routing
+ table is enabled. From Anthony Merlino (2017-11-22).
+ * net/netdev: Add support for the SIOCGIFBRDADDR ioctl() command
+ (2017-11-22).
+ * include/nuttx/audio: Remove CONFIG_SCHED_WORKQUEUE check in pcm.h.
+ From Masayuki Ishikawa (2017-11-23).
+ * sched/semaphore/spinlock.c: Disable local interrupts in spin_setbit()
+ and spin_clrbit() in order to avoid a deadlock condition. From
+ Masayuki Ishikawa (2017-11-23).
+ * configs/stm32f4disovery: Add support for JLX12864G display on STM32F4
+ Discovery board. From Alan Carvalho de Assis (2017-11-23).
+ * configs: All NX configuration... Because of recent changes to
+ libnx/nxfonts, Supported bit per pixel must be separated specified for
+ NXFONTs too and need to match the select BPP for NX (2017-11-24).
+ * fs/procfs: Correct ordering of procfs entries. For consistency, use
+ alphabetical ordering (2017-11-24).
+ * configs/xmc4500-relax: Setup max. freq. 120MHz and setup pull-up to
+ UART RXD pin. From Alan Carvalho de Assis (2017-11-24).
+ * arch/arm/src/xmc4: Do not run at 144MHz unless BOARD_FCPU_144MHZ is
+ selected in the board.h header file. From Alan Carvalho de Assis
+ (2017-11-24).
+ * configs/xtrs: Removed the XTRS configuration This was an unverified
+ port of NuttX to a TRS-80 simulator. It was removed because (1) it is,
+ as I said, unverified as well as unsupported, and (2) the TRS-80
+ simulation is a sub-optimal platform. That platform includes a 16-bit
+ ROM image and only a 48Kb RAM space (2017-11-24).
+ * arch/arm/src/xmc4: Remove hard-coded values in clock configuration.
+ USB will be fixed later. From Alan Carvalho de Assis (2017-11-25).
+ * drivers/lcd: Add support for external LCD initialization required by
+ some board logic. configs/zpa214xpa: Tried to get the LCD working
+ again unsuccessfully. Too much bit rot I suppose (2017-11-25).
+ * STM32F4 Discovery: Fix some errors due to missing inclusion of
+ stm32_gpio.h (2017-11-25).
+ * XMC4 Serial: The Alternative Receive Interrupt was not being
+ configured (2017-11-25).
+ * drivers/lcd: Make LCD driver configuration indepently selected from
+ NX graphics configuration. This makes things awkward and loses some
+ error checking but is a necessary step in order to make LCD drivers
+ usable when the NX graphics system is disabled (2017-11-25).
+ * STM3240G-EVAL: Mount procfs if enabled (2017-11-25).
+ * arm/src/xmc4: Include Alt. Interrupt Enable to RX_EVENTS and rename
+ serial GPIO configurations. From Alan Carvalho de Assis (2017-11-25).
+ * configs/: CONFIG_QENCODER was renamed to CONFIG_SENSORS_QENCODER:
+ update occurrences in several Kconfig files (2017-11-25).
+ * configs/stm3240g-eval: Add support for pdcurses and the pdcurses
+ demo programs in the 'fb' configuration (2017-11-26).
+ * arch/arm/src/stm32: Fix compile error when trace is enabled.
+ I2CEVENT_ERROR was used but never defined (2017-11-26).
+ * configs/lc823450-xgevk: Enable CONFIG_SMP for audio.Update README.txt
+ regarding SMP audio. From Masayuki Ishikawa (2017-11-27).
+ * lc823450 smp audio
+ - arch/arm/src/lc823450: Remove a workaround in up_cpu_paused().
+ Introduce g_gpio_lock to improve write performance in SMP mode.
+ NOTE: This is a tentative solution and should be replaced with more
+ generic one. Add a workaround in up_txready() to avoid data
+ corruption. From Masayuki Ishikawa (2017-11-27).
+ * arch/arm/src/lpc43xx: lpc43_adc.c was being selected by the build
+ system wehn DAC was selected (2017-11-27).
+ * configs/lc823450-xgevk: Add rndis configuration. From Masayuki
+ Ishikawa (2017-11-28).
+ * drivers/input/nunchuck.c: Add Nintendo Wii Nunchuck driver. From
+ Alan Carvalho de Assis (2017-11-28).
+ * configs/stm32f4discovery/include/board.h: Remove only I2C pin config,
+ we can use PB6 and PB9. From Alan Carvalho de Assis (2017-11-28).
+ * configs/stm32f4discovery/src: Add stm32f4discovery board support for
+ Nunchuck joystick. From Alan Carvalho de Assis (2017-11-28).
+ * net/devif: Do not add link layer header size to d_len inside
+ devif_forward(). From Anthony Merlino (2017-11-29).
+ * Framebuffer Driver: Small modification convention for multi-planar
+ displays (of which there are none) (2017-11-29).
+ * configs/stm32f103-minimum: Add Nunchuck board support for
+ stm32f103-minimum board. From Alan Carvalho de Assis (2017-11-29).
+ * drivers/mtd: Add a driver for Macronix MX35LFxGE4AB serial NAND
+ flash. From Ekaterina Kovylova (2017-11-29).
+ * net/pkt: Eliminate a compile error due to missing include and also a
+ warning (2017-11-29).
+ * sched/task/task_exithook.c: Clear atexit() function pointer before
+ calling it. On most archs, up_assert() calls exit() so without this
+ change, if atexit() function triggers an assertion we are in endless
+ loop. From Juha Niskanen (2017-11-30).
+ * arch/arm/src/xmc4/Kconfig: Define user friendly SPI, I2C, LIN, and
+ I2S aliases to follow other arch names. From Alan Carvalho de Assis
+ (2017-11-30).
+
+7.24 2018-xx-xx Gregory Nutt
diff --git a/Directories.mk b/Directories.mk
index 2e55b91a94007f210ad4b6ab58700092a32e3bb3..cabca719ab17967c37fff1796c0d5601f7c0407c 100644
--- a/Directories.mk
+++ b/Directories.mk
@@ -1,7 +1,8 @@
############################################################################
# Directories.mk
#
-# Copyright (C) 2007-2012, 2014, 2016 Gregory Nutt. All rights reserved.
+# Copyright (C) 2007-2012, 2014, 2016-2017 Gregory Nutt. All rights
+# reserved.
# Author: Gregory Nutt
#
# Redistribution and use in source and binary forms, with or without
@@ -121,6 +122,10 @@ endif
ifeq ($(CONFIG_NX),y)
NONFSDIRS += graphics libnx
CONTEXTDIRS += graphics libnx
+else ifeq ($(CONFIG_NXFONTS),y)
+NONFSDIRS += libnx
+CONTEXTDIRS += libnx
+OTHERDIRS += graphics
else
OTHERDIRS += graphics libnx
endif
@@ -131,7 +136,7 @@ else
OTHERDIRS += audio
endif
-ifeq ($(CONFIG_DRIVERS_WIRELESS),y)
+ifeq ($(CONFIG_WIRELESS),y)
NONFSDIRS += wireless
else
OTHERDIRS += wireless
diff --git a/Documentation/NuttShell.html b/Documentation/NuttShell.html
index a4056e6d66231fa1eb8ce6736e09e09aa6938d29..c23950484cd83895c4f1a664914846070a2625fd 100644
--- a/Documentation/NuttShell.html
+++ b/Documentation/NuttShell.html
@@ -8,7 +8,7 @@
NuttShell (NSH)
- Last Updated: October 24, 2017
+ Last Updated: January 10, 2018
|
@@ -443,61 +443,67 @@
|
- 2.60 Unmount a File System (umount)
+ 2.60 Set the Size of a File (truncate)
|
|
- 2.61 Print system information (uname)
+ 2.61 Unmount a File System (umount)
|
|
- 2.62 Unset an Environment Variable (unset)
+ 2.62 Print system information (uname)
|
|
- 2.63 URL Decode (urldecode)
+ 2.63 Unset an Environment Variable (unset)
|
|
- 2.64 URL Encode (urlencode)
+ 2.64 URL Decode (urldecode)
|
|
- 2.65 Add a New User (useradd)
+ 2.65 URL Encode (urlencode)
|
|
- 2.66 Delete a user (userdel)
+ 2.66 Add a New User (useradd)
|
|
- 2.67 Wait for Microseconds (usleep)
+ 2.67 Delete a user (userdel)
|
|
- 2.68 Get File Via HTTP (wget)
+ 2.68 Wait for Microseconds (usleep)
|
|
- 2.69 Hexadecimal Dump of Memory (xd)
+ 2.69 Get File Via HTTP (wget)
+ |
+
+
+
|
+
+ 2.70 Hexadecimal Dump of Memory (xd)
|
@@ -1593,13 +1599,16 @@ dirname <path>
Command Syntax:
-echo [<string|$name> [<string|$name>...]]
+echo [-n] [<string|$name> [<string|$name>...]]
Synopsis.
Copy the sequence of strings and expanded environment variables to
console output (or to a file if the output is re-directed).
+
+ The -n
option suppresses the trailing newline character.
+
@@ -2977,7 +2986,35 @@ nsh>
+
+Command Syntax:
+
+truncate -s <length> <file-path>
+
+
+ Synopsis.
+ Shrink or extend the size of the regular file at <file-path> to the
+ specified<length>.
+
+
+ A <file-path> argument that does not exist is created. The <length>
+ option is NOT optional.
+
+
+ If a <file-path> is larger than the specified size, the extra data is
+ lost. If a <file-path> is shorter, it is extended and the extended part
+ reads as zero bytes.
+
+
+
+
@@ -3007,7 +3044,7 @@ nsh>
@@ -3074,7 +3111,7 @@ uname [-a | -imnoprsv]
@@ -3100,7 +3137,7 @@ nsh>
@@ -3117,7 +3154,7 @@ urldecode [-f] <string or filepath>
@@ -3134,7 +3171,7 @@ urlencode [-f] <string or filepath>
@@ -3151,7 +3188,7 @@ useradd <username> <password>
@@ -3168,7 +3205,7 @@ userdel <username>
@@ -3185,7 +3222,7 @@ usleep <usec>
@@ -3212,7 +3249,7 @@ wget [-o <local-path>] <url>
@@ -3639,6 +3676,11 @@ nsh>
|
CONFIG_NSH_DISABLE_TIME |
+
+ truncate |
+ !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0 |
+ CONFIG_NSH_DISABLE_TRUNCATE |
+
umount |
!CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_FS_READABLE 3 |
@@ -5443,10 +5485,10 @@ xxd -i romfs_img >nsh_romfsimg.h
CONFIG_NSH_ARCHROMFS
CONFIG_NSH_ROMFSMOUNTPT
CONFIG_NSH_ROMFSSECTSIZE
+ CONFIG_NSH_STRERROR
|
|
@@ -556,6 +556,14 @@
+
+
|
+
+
+ UserFS - User application file system.
+
+ |
+
|
@@ -808,7 +816,7 @@
|
|
- Special INET protocol sockets: Raw ICMP and ICMPv6 protocol ping sockets (IPPROTO_ICMP ).
+ Special INET protocol sockets: Raw ICMP and ICMPv6 protocol ping sockets (IPPROTO_ICMP /IPPROTO_ICMP6 ).
|
@@ -1073,7 +1081,7 @@
|
- Device-dependent USB class drivers available for USB serial (CDC/ACM and a PL2303 emulation), for USB mass storage, and for a dynamically configurable, composite USB devices.
+ Device-dependent USB class drivers available for USB serial (CDC/ACM and a PL2303 emulation), for USB mass storage, for RNDIS networking, and for a dynamically configurable, composite USB devices.
|
@@ -1417,11 +1425,11 @@
Released Versions
In addition to the ever-changing GIT repository, there are frozen released versions of NuttX available.
- The current release is NuttX 7.22.
- NuttX 7.22 is the 122nd release of NuttX.
- It was released on September 6, 2017, and is available for download from the
+ The current release is NuttX 7.23.
+ NuttX 7.23 is the 123rd release of NuttX.
+ It was released on December 4, 2017, and is available for download from the
Bitbucket.org website.
- Note that the release consists of two tarballs: nuttx-7.22.tar.gz
and apps-7.22.tar.gz
.
+ Note that the release consists of two tarballs: nuttx-7.23.tar.gz
and apps-7.23.tar.gz
.
Both may be needed (see the top-level nuttx/README.txt
file for build information).
@@ -1430,7 +1438,7 @@
- nuttx.
- Release notes for NuttX 7.22 are available here.
+ Release notes for NuttX 7.23 are available here.
Release notes for all released versions on NuttX are available in the Bitbucket GIT.
The ChangeLog for all releases of NuttX is available in the ChangeLog file that can viewed in the Bitbucket GIT.
The ChangeLog for the current release is at the bottom of that file.
@@ -1438,7 +1446,7 @@
apps.
Atmel AVR
+ Broadcom
+
+
Expressif
- ESP32 (Dual Xtensa LX6)
@@ -1635,18 +1649,18 @@
-
NXP/Freescale (Continued)
+
+ - Freescale i.MX1 (ARM920-T)
+ - Freescale i.MX6 (ARM Cortex-A9)
+ - FreeScale KL25Z (ARM Cortex-M0+)
+ - FreeScale KL26Z (ARM Cortex-M0+)
+ - FreeScale Kinetis K20 (ARM Cortex-M4)
- FreeScale Kinetis K40 (ARM Cortex-M4)
- FreeScale Kinetis K60 (ARM Cortex-M4)
- FreeScale Kinetis K64 (ARM Cortex-M4)
@@ -1716,6 +1730,7 @@
- STMicro STM32 L475 (STM32 L4 family, ARM Cortex-M4)
- STMicro STM32 L476 (STM32 L4 family, ARM Cortex-M4)
- STMicro STM32 L496 (STM32 L4 family, ARM Cortex-M4)
+ - STMicro STM32 F72x/F73x (STM32 F7 family, ARM Cortex-M7)
- STMicro STM32 F745/F746 (STM32 F7 family, ARM Cortex-M7)
- STMicro STM32 F756 (STM32 F7 family, ARM Cortex-M7)
- STMicro STM32 F76xx/F77xx (STM32 F7 family, ARM Cortex-M7)
@@ -2065,6 +2080,26 @@
|
+
+ |
+
+ ARM1176JZ.
+ |
+
+
+
|
+
+
+ Broadcom BCM2708.
+ Very basic support for the Broadcom BCM2708 was released with NuttX-7.23.
+
+ Raspberry Pi Zero.
+ This support was provided for the Raspberry Pi Zero which is based on the BCM2835.
+ Basic logic is in place but the port is incomplete and completely untested as of the NuttX-7.23 released.
+ Refer to the NuttX board README file for further information.
+
+ |
+
|
@@ -3467,10 +3502,13 @@ nsh>
A version of the LPCXPresso LPC1768 board with special support for the U-Blox model evaluation board.
+
+ Support for the Keil MCB1700 was contributed by Alan Carvalho de Assis in NuttX-7.23.
+
- The Nucleus 2G board, the mbed board, and the LPCXpresso all feature the NXP LPC1768 MCU;
+ The Nucleus 2G board, the mbed board, the LPCXpresso, and the MCB1700 all feature the NXP LPC1768 MCU;
the Olimex LPC1766-STK board features an LPC1766.
All use a GNU arm-nuttx-elf or arm-eabi toolchain* under either Linux or Cygwin (with native Windows GNU tools or Cygwin-based GNU tools).
@@ -3589,6 +3627,12 @@ nsh>
See the NuttX board README file for further information about this port.
+
+ Keil MCB1700 (LPC1768)
+
+ This board configuration was contributed by Alan Carvalho de Assis in NuttX-7.23.
+
+
@@ -3645,6 +3689,7 @@ nsh>
This port is intended to test LC823450 features including SMP. Supported peripherals include UART, TIMER, RTC, GPIO, DMA, I2C, SPI, LCD, eMMC, and USB device.
+ ADC, Watchdog, IPC2, and I2S support was added by Masayuki Ishakawa in NuttX-7.23.
|
@@ -3661,8 +3706,7 @@ nsh>
Infineon XMC45xx.
- An initial but still incomplete port to the XMC4500 Relax board was released with NuttX-7.21 (although it is not really ready for prime time).
- Much is functional but there are still some issues with the output to the NSH serial console.
+ An initial but still incomplete port to the XMC4500 Relax board was released with NuttX-7.21 (although it is not really ready for prime time). Basic NSH functionality was a serial console was added by Alan Carvahlo de Assis in NuttX-7.23.
This initial porting effort uses the Infineon XMC4500 Relax v1 board as described on the manufacturer's website.
@@ -4559,6 +4603,10 @@ nsh>
NuttX-7.17
EMC support was extended to include support SDRAM by Vytautas Lukenska.
+
+ NuttX-7.23
+ A CAN driver was contributed by Alexander Vasiljev in NuttX-7.23.
+
|
@@ -5005,6 +5053,29 @@ Mem: 29232 5920 23312 23312
Also refer to the NuttX board README file for further information.
+
+
+
|
+
|
+
+
+
|
+
+
+ STMicro STM32 F72x/F73x.
+ Support for the F72x/F73x family was provided by Bob Feretich in NuttX-7.23.
+ A single board is supported in this family:
+
+
+
+ Nucleo F722ZE.
+ This is a member of the common board support for the common Nucleo-144 boards, this one featuring the STM32F722ZE.
+ This port was also provided by Bob Feretich in NuttX-7.23.
+ See the board README.txt file for further information.
+
+
+ |
+
|
|
@@ -5936,10 +6007,16 @@ BFD_ASSERT (*plt_offset != (bfd_vma) -1);
STATUS:
- Basically the same as for the Z80 instruction set simulator.
- This port was contributed by Jacques Pelletier.
- Refer to the NuttX board README file for further information.
+ Basically the same as for the Z80 instruction set simulator.
+ This port was contributed by Jacques Pelletier.
+ Refer to the NuttX board README file for further information.
+
+ NOTE:
+ This port was removed from the NuttX source tree on 2017-11-24.
+ It was removed because (1) it is unfinished, unverified, and unsupported, and (2) the TRS-80 simulation is a sub-optimal platform.i
+ That platform includes a 16-bit ROM image and only a 48Kb RAM space for NuttX.
+ The removed board support is still available in the Obsoleted
repository if anyone would ever like to resurrect it.
diff --git a/Documentation/NxWidgets.html b/Documentation/NxWidgets.html
index 2d88d2bf48652bf3203914405ab65e1976378ed4..69344dc918c1e4b31d3b21ac6674e2161637484a 100644
--- a/Documentation/NxWidgets.html
+++ b/Documentation/NxWidgets.html
@@ -8,11 +8,11 @@
NxWidgets
- Last Updated: March 27, 2012
+ Last Updated: November 7, 2017
|
-NXWidgets
+NxWidgets
In order to better support NuttX based platforms, a special graphical userinterface has been created called NXWidgets.
NXWidgets is written in C++ and integrates seamlessly with the NuttX NX graphics subsystem in order to provide graphic objects, or "widgets," in the NX Graphics Subsystem
@@ -61,10 +61,10 @@
-
- NxWidgets-1.15:
- Documentation,
- Release notes, and
- Downloads
+ NxWidgets-1.18:
+ Documentation,
+ Release notes, and
+ Downloads
diff --git a/Documentation/README.html b/Documentation/README.html
index ad6e4ac1ab74bcfcb2fad863ea95f3aa7974156d..bad25c87e1afddb02e2188b5da4fc9889137bd08 100644
--- a/Documentation/README.html
+++ b/Documentation/README.html
@@ -8,7 +8,7 @@
NuttX README Files
- Last Updated: October 7, 2017
+ Last Updated: January 8, 2018
|
@@ -103,6 +103,10 @@ nuttx/
| | `- README.txt
| |- fire-stm32v2/
| | `- README.txt
+ | |- flipnclick-pic32mz/
+ | | `- README.txt
+ | |- flipnclick-sam3x/
+ | | `- README.txt
| |- freedom-k64f/
| | `- README.txt
| |- freedom-k66f/
@@ -114,6 +118,8 @@ nuttx/
| |- hymini-stm32v/
| | |- RIDE/README.txt
| | `- README.txt
+ | |- indium-f7/
+ | | `- README.txt
| |- kwikstik-k40/
| | `- README.txt
| |- launchxl-tms57004/
@@ -138,10 +144,14 @@ nuttx/
| | `- README.txt
| |- lpcxpresso-lpc1768/
| | `- README.txt
+ | |- lpcxpresso-lpc54628/
+ | | `- README.txt
| |- maple/
| | `- README.txt
| |- mbed/
| | `- README.txt
+ | |- mcb1700/
+ | | `- README.txt
| |- mcu123-lpc214x/
| | `- README.txt
| |- micropendous3/
@@ -285,8 +295,8 @@ nuttx/
| |- stm32f411e-disco/
| | `- README.txt
| |- stm32f429i-disco/
+ | | |- fb/README.txt
| | |- ide/ltcd/uvision/README.txt
- | | |- ltdc/README.txt
| | `- README.txt
| |- stm32f746g-disco/
| | `- README.txt
@@ -326,12 +336,10 @@ nuttx/
| | `- README.txt
| |- xmc4500-relax/
| | `- README.txt
- | |- xtrs/
- | | `- README.txt
| |- z16f2800100zcog/
- | | |- ostest/README.txt
- | | |- pashello/README.txt
- | | `- README.txt
+ | | |- ostest/README.txt
+ | | |- pashello/README.txt
+ | | `- README.txt
| |- z80sim/
| | `- README.txt
| |- z8encore000zco/
@@ -379,6 +387,7 @@ nuttx/
| |- zoneinfo/README.txt
| `- README.txt
|- libnx/
+ | |- libnx/README.txt
| `- README.txt
|- libxx/
| `- README.txt
diff --git a/FlatLibs.mk b/FlatLibs.mk
index 0a05e84c4934c8fa7fd6501b71fb241667f77f29..ad29c24272ad0c6760ad764e011aa8920e8c6457 100644
--- a/FlatLibs.mk
+++ b/FlatLibs.mk
@@ -1,7 +1,8 @@
############################################################################
# FlatLibs.mk
#
-# Copyright (C) 2007-2012, 2014, 2016 Gregory Nutt. All rights reserved.
+# Copyright (C) 2007-2012, 2014, 2016-2017 Gregory Nutt. All rights
+# reserved.
# Author: Gregory Nutt
#
# Redistribution and use in source and binary forms, with or without
@@ -104,6 +105,8 @@ endif
ifeq ($(CONFIG_NX),y)
NUTTXLIBS += lib$(DELIM)libgraphics$(LIBEXT)
NUTTXLIBS += lib$(DELIM)libnx$(LIBEXT)
+else ifeq ($(CONFIG_NXFONTS),y)
+NUTTXLIBS += lib$(DELIM)libnx$(LIBEXT)
endif
# Add libraries for the Audio sub-system
diff --git a/Kconfig b/Kconfig
index d5f4209c5d0472da5c490995c6f5c491b1965047..584db78620cfdc513e80cbb3b08256be46bc1dbf 100644
--- a/Kconfig
+++ b/Kconfig
@@ -1662,6 +1662,7 @@ endmenu
menu "Graphics Support"
source graphics/Kconfig
+source libnx/Kconfig
endmenu
menu "Memory Management"
diff --git a/KernelLibs.mk b/KernelLibs.mk
index b1da6dbd0b9fd17feec4e93500621ef29dff09f7..b5ea4768aa29fd60e0bff81f3b49ab848aa83c27 100644
--- a/KernelLibs.mk
+++ b/KernelLibs.mk
@@ -99,6 +99,9 @@ ifeq ($(CONFIG_NX),y)
NUTTXLIBS += lib$(DELIM)libgraphics$(LIBEXT)
NUTTXLIBS += lib$(DELIM)libknx$(LIBEXT)
USERLIBS += lib$(DELIM)libunx$(LIBEXT)
+else ifeq ($(CONFIG_NXFONTS),y)
+NUTTXLIBS += lib$(DELIM)libknx$(LIBEXT)
+USERLIBS += lib$(DELIM)libunx$(LIBEXT)
endif
# Add libraries for the Audio sub-system
diff --git a/LibTargets.mk b/LibTargets.mk
old mode 100755
new mode 100644
diff --git a/Makefile.unix b/Makefile.unix
index fbbb258afb593951ca5ed211ded3dd8f29c71b7e..ffe8d7ed6308ed8d4516ae6e00668303d9126bf0 100644
--- a/Makefile.unix
+++ b/Makefile.unix
@@ -568,7 +568,6 @@ clean: subdir_clean
$(call DELFILE, _SAVED_APPS_config)
$(call DELFILE, nuttx-export*)
$(call DELFILE, nuttx_user*)
- $(call DELFILE, .gdbinit)
$(call DELFILE, .cproject)
$(call DELFILE, .project)
$(call CLEAN)
@@ -587,6 +586,7 @@ endif
$(call DELFILE, Make.defs)
$(call DELFILE, .config)
$(call DELFILE, .config.old)
+ $(call DELFILE, .gdbinit)
# Application housekeeping targets. The APPDIR variable refers to the user
# application directory. A sample apps/ directory is included with NuttX,
diff --git a/ProtectedLibs.mk b/ProtectedLibs.mk
index 5dd45a6fab8ffe1d5fdf62417f71987e5fc23e51..df3edddadb0449d682c9153590ff5b1a12cb3a4b 100644
--- a/ProtectedLibs.mk
+++ b/ProtectedLibs.mk
@@ -1,7 +1,8 @@
############################################################################
# ProtectedLibs.mk
#
-# Copyright (C) 2007-2012, 2014, 2016 Gregory Nutt. All rights reserved.
+# Copyright (C) 2007-2012, 2014, 2016-2017 Gregory Nutt. All rights
+# reserved.
# Author: Gregory Nutt
#
# Redistribution and use in source and binary forms, with or without
@@ -103,12 +104,11 @@ endif
ifeq ($(CONFIG_NX),y)
NUTTXLIBS += lib$(DELIM)libgraphics$(LIBEXT)
-ifeq ($(CONFIG_BUILD_PROTECTED),y)
NUTTXLIBS += lib$(DELIM)libknx$(LIBEXT)
USERLIBS += lib$(DELIM)libunx$(LIBEXT)
-else
-NUTTXLIBS += lib$(DELIM)libnx$(LIBEXT)
-endif
+else ifeq ($(CONFIG_NXFONTS),y)
+NUTTXLIBS += lib$(DELIM)libknx$(LIBEXT)
+USERLIBS += lib$(DELIM)libunx$(LIBEXT)
endif
# Add libraries for the Audio sub-system
diff --git a/README.txt b/README.txt
index 0ab435362f1111073d240c488bbcc49d1fbb3fb5..adfead108410b4af248e67e7279135c3dfcb0157 100644
--- a/README.txt
+++ b/README.txt
@@ -1647,6 +1647,10 @@ nuttx/
| | `- README.txt
| |- fire-stm32v2/
| | `- README.txt
+ | |- flipnclick-pic32mz/
+ | | `- README.txt
+ | |- flipnclick-sam3x/
+ | | `- README.txt
| |- freedom-k64f/
| | `- README.txt
| |- freedom-k66f/
@@ -1657,6 +1661,8 @@ nuttx/
| | `- README.txt
| |- hymini-stm32v/
| | `- README.txt
+ | |- indium-f7
+ | | `- README.txt
| |- kwikstik-k40/
| | `- README.txt
| |- launchxl-tms57004/
@@ -1681,10 +1687,14 @@ nuttx/
| | `- README.txt
| |- lpcxpresso-lpc1768/
| | `- README.txt
+ | |- lpcxpresso-lpc54628/
+ | | `- README.txt
| |- maple/
| | `- README.txt
| |- mbed/
| | `- README.txt
+ | |- mcb1700/
+ | | `- README.txt
| |- mcu123-lpc214x/
| | `- README.txt
| |- micropendous3/
@@ -1827,8 +1837,8 @@ nuttx/
| |- stm32f411e-disco/
| | `- README.txt
| |- stm32f429i-disco/
+ | | |- fb/README.txt
| | |- ide/ltcd/uvision/README.txt
- | | |- ltdc/README.txt
| | `- README.txt
| |- stm32f746g-disco/
| | `- README.txt
@@ -1868,8 +1878,6 @@ nuttx/
| | `- README.txt
| |- xmc5400-relax/
| | `- README.txt
- | |- xtrs/
- | | `- README.txt
| |- z16f2800100zcog/
| | |- ostest/README.txt
| | |- pashello/README.txt
@@ -1922,6 +1930,8 @@ nuttx/
| | `- README.txt
| `- README.txt
|- libnx/
+ | |- nxfongs
+ | | `- README.txt
| `- README.txt
|- libxx/
| `- README.txt
diff --git a/ReleaseNotes b/ReleaseNotes
index bf2a4cef9a7ed20e156e5cb763c2b90c80da73fa..d3302c654ece99e39973764ebd62d9a0a5c59cbd 100644
--- a/ReleaseNotes
+++ b/ReleaseNotes
@@ -15601,3 +15601,1107 @@ detailed bugfix information):
use forward slashes for kconfig-frontends. interpreters/ficl -
Reorder some targets that causes GNUwin32 make to behave badly. From
Jeff.
+
+NuttX-7.23 Release Notes
+------------------------
+
+The 123rd release of NuttX, Version 7.23, was made on December 4, 2017,
+and is available for download from the Bitbucket.org website. Note
+that release consists of two tarballs: nuttx-7.23.tar.gz and
+apps-7.23.tar.gz. These are available from:
+
+ https://bitbucket.org/nuttx/nuttx/downloads
+ https://bitbucket.org/nuttx/apps/downloads
+
+Both may be needed (see the top-level nuttx/README.txt file for build
+information).
+
+Additional new features and extended functionality:
+
+ * Core OS:
+
+ - sem_open() should return SEM_FAILED on any failures. This is change
+ in the POSIX specification since the original sem_open() was written
+ so many years ago.
+ - exec(): The non-standard interface exec() is now enshrined as a
+ official NuttX API. I really dislike doing this but I think that
+ this is probably the only want to load programs in the protected
+ mode. It is currently used by some example code under apps/ that
+ generate their own symbol tables for linking. Other file execution
+ APIs relay on a symbol table provided by the OS. In the protected
+ mode, the OS cannot provide any meaning symbol table for execution
+ of code in the user-space blob so that is they exec() is really
+ needed in that build case. And, finally, the interface is
+ completely useless and will not be supported in the KERNEL build
+ mode where the contrary is true: An application process cannot
+ provide any meaning symbolic information for use in linking a
+ different process.
+ - OS Internal Functions: Rename many OS internal functions so it is
+ clear that they are not part of the application interface. All
+ internal functions with the sem_* prefix became nxsem_*, sig* become
+ nxsig_*, mq_* become nxmq_*, etc.
+ - Cancellation Points: Add new cancellation point interface,
+ check_cancellation_point().
+ - Signals: Add logic to wake up a thread that is waiting on a signal
+ if it is canceled.
+ - sigtimedwait(): Add logic to suppress the wait if there is a
+ pending cancellation.
+ - clock_nanosleep(): Implement clock_nanosleep(). nanosleep() is now
+ reduced to a libc wrapper around clock_nanosleep().
+ - task_delete(): Do not permit user applications to delete kernel
+ threads.
+ - kthread_create(): Rename kernel_thread() to kthread_create() for
+ better naming consistency with task_create() and kthread_delete().
+ - boardctl(): Remove the BOARDIOC_GRAPHICS_SETUP command.
+ - TCB: Move POSIX thread specific data from pthread TCB to common TCB
+ structure. This change allows using pthread_getspecific and
+ pthread_setspecific from main thread. Patch also enables using
+ pthread data with config option CONFIG_DISABLE_PTHREAD=y. From Jussi
+ Kivilinna.
+ - mm: Remove the CONFIG_GRAN_SINGLE configuration option. It adds no
+ technical benefit (other than some minor reduction in the number of
+ interface arguments) but adds a lot of code complexity. Better
+ without it.
+ - mm: Add a function to get information about the state of the
+ granule allocator. This is the moral equivalent of mallinfo().
+
+ * File Systems/Block and MTD Drivers
+
+ - MT25Q Serial FLASH: Add support for Micron MT25Q series MT25Q128.
+ From Sebastien Lorquet.
+ - MX35LFxGE4AB: Add an MTD driver for Macronix MX35LFxGE4AB serial
+ NAND flash. From Ekaterina Kovylova.
+ - FileMTD: Add block device MTD interface. Block MTD interface
+ allows using block device directly as MTD instead of having to use
+ file-system in between. NOTE that this provides the opposite
+ capability of FTL which will let you use an MTD interface directly
+ as a block device. From Jussi Kivilinna.
+ - BCH: The character driver to block device access now supports an
+ IOCTL to get the geomtry of the underlying block device.
+ - mkfatfs: Remove mkfatfs from the OS. This is a user-space
+ application and belongs in apps, not in the OS.
+ - procfs: Implements procfs /proc/fs/blocks and /proc/fs/usage files,
+ replacing the NSH df command. Also implements procfs /proc/fs/mount
+ file, replacing the NSH mount command when there are no arguments.
+ - procfs: Add /proc/meminfo. This is an alternative way to get the
+ information that was previoulsy available in apps/system/free.
+ apps/system/free was removed beause it made illegal calls into the
+ OS violating the portable interface. This new procfs entry provides
+ the same information with no such violation. it also provides
+ information about the kernel heap (formerly /proc/kmm), about the
+ use of program memory(formerly /proc/progmem). And also information
+ for the page table usage in the KERNEL build.
+ - UserFS: Adds the UserFS client and of the UserFS feature in
+ general. Initially used Unix domain local sockets instead of
+ message queues. Easier to transfer big data in local sockets than
+ message queues. However, that lead to certain inescapable deadlock
+ conditions So the IPC was converted to UDP LocalHost loopback
+ sockets. The problem with the local sockets is that they do require
+ operations on the top level psuedo-file system inode tree. That
+ tree must be locked during certain traversals such as enumerate
+ mountpoints or enumerating directory entries. This conversion is
+ unfortunate in the sense that Unix local domain sockets are
+ relatively lightweight. LocalHost UDP sockets are much heavier
+ weight since they rely on the full UDP stack.
+
+ * Graphics/Display Drivers:
+
+ - Framebufer character driver: Add framebuffer character device driver.
+ - LCD Framebuffer: Add support for a generic front-end that will
+ convert any LCD driver into a framebuffer driver.
+ - Framebufer character driver: Include support for LCD drivers that
+ use a simulated framebuffer and must receive explicit notification
+ when there is an update to a region in the framebuffer.
+ - LCD: Make LCD driver configuration indepently selected from NX
+ graphics configuration. This makes things awkward and loses some
+ error checking but is a necessary step in order to make LCD drivers
+ usable when the NX graphics system is disabled.
+
+ * Networking/Network Drivers:
+
+ - Networking: Add implementation of logic for SIOCGIFCONF and
+ SIOCGLIFCOF IOCTL commnds.
+ - Network IOCTLs: Add support for the SIOCGIFBRDADDR ioctl() command.
+ - Routing Tables: Permit IPv4 and IPv6 routing tables to be of
+ different sizes.
+ - Routing Tables: Adds support for read-only routing tables. Prior
+ to this change, routing tables were only support in RAM and had to
+ be initialized with explicit logic to add the necessary routes to
+ the routing table. With this change, routes may be defined in the
+ pre-initialized, read-only routing table provided by the
+ board-specific logic.
+ This would be particularly useful, for example, in the case where
+ there is only a single network adaptor and you want all output
+ packets to go to the single adaptor in all cases. So for that
+ behavior you could add a read-only routing table to the
+ board-specific long that contains a single entry, the default route:
+ 0.0.0.0/0.
+ - Routing Tables. Added support for routing tables in files in a file
+ system. This might be useful for customized, per-unit routing
+ tables. There are two issues with it however:
+ 1. Reading from file system on a per packet basis could be slow. I
+ think it probably should have a small, in-memory cache of most
+ frequently used routes for good problem.
+ 2. Currently the delroute logic is disabled due to a problem with
+ the design. NuttX does not currently support truncate().
+ Therefore, it is not possible to delete entries from the routing
+ table file. In this current implementation, that leaves the last
+ entry intact at the end of the file. An alternative design
+ might include a tag on each record to indicate if the record is
+ valid or not. That would work but would add complexity to the
+ other routing table functions.
+ - Routing Tables: Add support for an in-memory routing table cache in
+ order to improve performance when the routing table is retained in a
+ file. The cache holds the most recently used routing table entries
+ and so can eliminate some file access. Flush the in-memory cache
+ when any entry is deleted from the routing table. When a router
+ matching an IP address is found, add the routing table entry to the
+ cache.
+ - Routing Tables: Add logic to mark a route as most-recently-used in
+ the route cache.
+ - ICMP: This change adds support for semi-standard IPPROTO_ICMP
+ AF_INET datagram sockets. This replaces the old ad hoc, nonstandard
+ way of implementing ping with a more standard, socket interface.
+ - ICMPV6: This commit adds support for semi-standard IPPROTO_ICMP6
+ sockets. This is a replacement for the non-standard ICMPv6 ping
+ support that violated the portable POSIX OS interface.
+ - ICMPv6: Add option to manually specify router prefix in router
+ advertisement message. From Sakari Kapanen.
+ - Local Sockets: This commit modifies the Unix domain local socket
+ design. Local sockets are built on top of pipes. The Local socket
+ implementation maintained file descriptors to interrupt with the
+ pipes. File descriptors have the bad property that they are valid
+ only while running on the thread within the task that created the
+ local socket.
+ As a policy, all internal OS implementations must use "detached"
+ files which are valid in any context and do not depend on the
+ validity of a file descriptor at any point in time. This commit
+ converts the usage of file descriptors to detached files throughout
+ the local socket implementation.
+
+ * Wireless Networking/Wireless Drivers:
+
+ - IEEE-802154: Adds support for receiving MAC events via IOCTL through
+ socket interface. From Anthony Merlino.
+ - IEEE-802154: Simplifies notify() and rxframe() calls to a single
+ notify() call. dataind's and all other "notifs" are now "primitives"
+ which aligns with standard terminology From Anthony Merlino.
+ - MAC802154: Add support for getting promiscuous mode state From
+ Anthony Merlino.
+ - MAC802154 Character Driver: When in promiscuous mode, the char
+ driver sends the entire frame, including the MAC header. This
+ change adds an offset field indicating the header-payload boundary.
+ It is set to 0 when not in promiscuous mode as the header is not
+ passed to the application
+ - 6LoWPAN: Remove CONFIG_NET_6LOWPAN_FRAMELEN. In this case where
+ multiple radios are supported, this may not be a constant. 6LoWPAN
+ now always queries the driver to get the maximum frame length.
+ - 6LoWPAN: Support sending to a router that is on-link and may be
+ able to forward the packet for us if the destination is not
+ reachable directly. From Anthony Merlino.
+ - XBee: Adds XBee S2C (802.15.4 firmware) support. XBee driver
+ emulates mac802154 interface. From Anthony Merlino.
+
+ * Other Common Device Drivers:
+
+ - PowerLED: Add upper-half driver for high power LED driver (powerled)
+ From Mateusz Szafoni.
+ - RTC Driver: Add periodic alarms to upper and lower halves. From
+ Juha Niskanen.
+ - Pipes: Fix writing large buffers not triggering POLLIN for reader
+ poll. From Jussi Kivilinna.
+ - USB CDC/ACM Device: Add support for RX flow control to the CDC/ACM
+ driver.
+ - USB CDC/ACM Device: Add support for flow control TERMIOs in CDC/ACM
+ driver.
+ - USB RNDIS Device: Add RNDIS-over-USB driver. From Sakari Kapanen
+ with added Hi-Speed support from Masayuki Ishikawa.
+ - Loop Driver: Don't use file descriptors... Use the internal file
+ system interfaces so that the loop device can be shared across
+ threads.
+ - APA102 LED controller: Add driver for APA102 LED controller. These
+ LEDs are used on LED Strips and are controlled over SPI.
+ - INA219. Add INA219 Driver. The INA219 is a combined voltage and
+ current sensor that can measure up to 26 volts and a current that
+ depends on an external shunt resistor. Connection happens via
+ i2c/smbus and the chip features a power supply rail that is
+ independent from the measured voltage, so it can measure low
+ voltages. Right now it measures bus voltage and current, and does
+ not use the internal calibrated current reading, nor the available
+ power measurement. From Sebastien Lorquet.
+ - PCA9555: The IRQ subsystem now supports passing a void * parameter
+ to IRQ handlers. Use that method to support multiple PCA9555
+ devices, by passing a pointer to the device to the board defined irq
+ handler. Now the CONFIG_ for multiple PCA devices just allocates
+ device structures dynamically instead of statically when not enabled.
+ The same interrupt handler is entered with the device structure
+ parameter in all situations, multiple or single PCA. One should
+ still be careful if multiple PCA devices share the same IRQ. From
+ Sebastien Lorquet.
+ - APDS-9960: Add driver for the APDS-9960 gesture sensor. From Alan
+ Carvalho de Assis.
+ - MAX7219: Add support to MAX7219 LED Matrix as LCD interface. From
+ Alan Carvalho de Assis.
+ - WM8774: Add WM8774 audio DAC support. From Masayuki Ishikawa.
+ - Nunchuck: Add Nintendo Wii Nunchuck driver. From Alan Carvalho de
+ Assis.
+
+ * Simulation
+
+ - Simulation: Add a configuration for non-graphical testing of the
+ frambuffer character driver using apps/example/fb.
+ - Simulation: Add a configuration for testing the UserFS using
+ apps/examples/userfs.
+
+ * Broadcom BCM2708:
+
+ - BCM2708: Add enough infrastructrue (more stubs) to get a clean
+ compilation of the Pi Zero configuration (with many undefined things
+ at link time). This includes several register definition header
+ files (some from Alan Carvalho de Assis), basic interrupt handling
+ logic, boot-up files, GPIO support, tickless timer, build and
+ configuration logic
+
+ * Broadcom BCM2708 Boards:
+
+ - Raspberry Pi Zero. Basic board support at configs/pizero. Untested
+ in this release and still some remaining issues.
+
+ * Infineon XMC4xxx Boards:
+
+ - XMC4500-Relax: Add config for UART3 on RXD P0.0 and TXD P0.1 pins.
+ From Alan Carvalho de Assis.
+
+ * NXP Freescale LPC17xx Boards:
+
+ - Open1788: Add initialization of Framebuffer driver. Add
+ configuration for testing the framebuffer driver.
+
+ * NXP Freescale LPC43xx Drivers:
+
+ - LPC43xx: Add LPC43xx CAN driver. From Alexander Vasiljev.
+
+ * NXP Freescale LPC43xx Boards:
+
+ - MCB1700: Add support for Keil MCB1700 board. From Alan Carvalho de
+ Assis.
+ - Open1788: Add support for the discrete joystick driver.
+ - Open1788: Add a configuration for testing pdcurses with discrete
+ joystick.
+
+ * On Semiconductor LC823450
+
+ - LC823450: Add ADC driver and watchdog drivers. From Masayuki
+ Ishikawa.
+ - LC823450: Add IPL2 support. From Masayuki Ishikawa.
+ - LC823450: Add I2S support. From Masayuki Ishikawa.
+ - LC823450: Add auto LED for CPU activity. From Masayuki Ishikawa.
+
+ * On Semiconductor LC823450 Boards
+
+ - LC823450-XGEVK: Enable ADC and watchdog driver. From Masayuki
+ Ishikawa.
+ - LC823450-XGEVK: Add IPL2 support. From Masayuki Ishikawa.
+ - LC823450-XGEVK: Add WM8774 support. From Masayuki Ishikawa.
+ - LC823450-XGEVK: Add auto LED support. From Masayuki Ishikawa.
+ - LC823450-XGEVK: Enable CONFIG_SMP for audio. From Masayuki Ishikawa.
+ - LC823450-XGEVK: Add rndis configuration. From Masayuki Ishikawa.
+
+ * STMicro STM32:
+
+ - ARM Kconfig: Add support for classic ARM11 architecture selections.
+ - STM32 Tickless: Removes the restriction to 16-bit counts when a
+ 32-bit timer is used for tickless operation on the stm32. As it
+ was, the restriction is very limiting, especially if one wants high
+ granularity and large achievable intervals and has the hardware
+ (namely the 32bit timers) available. From Rajan Gill.
+ - STM32 L4 Kconfig: Add some L486 and L496 chips. From Juha Niskanen
+ - STM32 F7: Adds architecture support for the STM32 F72x and F73x
+ families. From Bob Feretich.
+ - STM32 F7: Allow changing voltage output scaling setting and
+ prevents enabling over-drive mode for low frequencies (STM32 F74xx,
+ 75xx, 76xx, 77xx). From Jussi Kivilinna. Changes replicated for
+ the 72xx and 73xx families.
+
+ * STMicro STM32 Drivers:
+
+ - STM32 ADC: Added support for ADC's IO_ENABLE_TEMPER_VOLT_CH ioctl
+ on STM32F10XX and STM32F20XX. From Dmitriy Linikov.
+ - STM32 Wakeup: Add logic for enabling wakeup pins. From Oleg Evseev.
+ - STM32 PWR: Adds stm32_pwr_getsbf and stm32_pwr_getwuf functions
+ that return the standby flag and the wakeup flag PWR power
+ control/status register. From Oleg Evseev.
+ - STM32 HRTIM: Sdd support for capture, chopper, deadtime and dump
+ registers. From Mateusz Szafoni.
+ - STM32 RTC: Canceling an alarm marks it as inactive. From Juha
+ Niskanen
+ - STM32 Serial: Add interface to get uart_dev_t by USART number,
+ stm32_serial_get_uart(). From Juha Niskanen.
+ - STM32 F33xx ADC: Initial ADC support for the STM32F33XX. From
+ Mateusz Szafoni.
+ - STM32 F33xx ADC: Add ADC DMA support to STM32F33 configuration. From
+ Mateusz Szafoni.
+ - STM32 L4 ADC: Port analog watchdog ioctl commands from the Motorola
+ MDK. From Juha Niskanen
+ - STM32 L4 ADC: Add option for routing ADC data to DFSDM, fix DFSDM
+ DMA. From Juha Niskanen
+ - STM32 L4 ADC: Add PM hooks from Motorola MDK
+ - STM32 L4 FLASH: Add function for modifying device option bytes,
+ From Juha Niskanen.
+ - STM32 L4 DFSDM: Add peripheral support for digital filters for
+ sigma-delta ADCs. Initial version. Timer trigger support is not
+ completed and there is some issue with DMA. From Juha Niskanen.
+ - STM32 L4 I2C: Port then STM32 F7 I2C driver to STM32 L4. STM32L4 I2C
+ driver is in work-in-progress state (plentiful of TODOs and
+ #warnings) and lags many features found in more up-to-date STM32 I2C
+ drivers. The peripheral on STM32F7 and STM32L4 are identical except
+ for L4's 'wakeup from stop mode' flag and STM32F7's I2C driver is in
+ more 'ready to use' state. The I2C clock configuration is kept the
+ same as before (I2CCLK = PCLK1 80 Mhz) instead of switching to
+ STM32F7 arch default that is I2CCLK=HSI. Further work would be to
+ add configuration option for choosing I2C clock source instead of
+ current hard-coded default. From Jussi Kivilinna.
+ - STM32 L4 RTC: Add up_rtc_getdatetime_with_subseconds
+ - STM32 L4 RTC: Change maximum alarm time from 24h to one month. From
+ Juha Niskanen.
+ - STM32 L4 RTC: Add support for periodic interrupts with
+ (experimental) CONFIG_RTC_PERIODIC. From Juha Niskanen.
+ - STM32 L4 SDMMC: Add support for an SDMMC driver. From Miha Vrhovnik.
+ - STM32 L4 Serial: Suspend serial for Stop mode. From Juha Niskanen.
+ - STM32 L4 Serial/PM: STM32L4 serial PM interface improvements:
+ Check rx/tx buffers for pending data in pmprepare. Remove adhoc PM
+ interfaces and move serial suspend functionality behind CONFIG_PM.
+ From Jussi Kivilinna.
+
+ * STMicro STM32 Boards:
+
+ - STM32F103-Minimum: Add board support for APA102 driver. From Alan
+ Carvalho de Assis.
+ - STM32F103-Minimum: Add ADC support on stm32f103-minimum board.
+ From Alan Carvalho de Assis.
+ - STM32F103-Minimum: Add support for LM75 in the stm32f103-minimum
+ board. From Alan Carvalho de Assis.
+ - STM32F103-Minimum: Add an ADPS-9960 example configuration. From
+ Alan Carvalho de Assis.
+ - STM32F103-Minimum: Add board support for MAX7219 LED Matrix
+ controller. From Alan Carvalho de Assis.
+ - STM32F103-Minimum: Add USB MSC device initialzation to
+ stm32f103-minimum. From Alan Carvalho de Assis.
+ - STM32F103-Minimum: Add framebuffer driver initialization for
+ stm32f103-minimum board. From Alan Carvalho de Assis.
+ - STM32F103-Minimum: Add Nunchuck board support for
+ stm32f103-minimum board. From Alan Carvalho de Assis.
+ - STM32F4 Discovery: Add support for JLX12864G display on STM32F4
+ Discovery board. From Alan Carvalho de Assis.
+ - Viewtool-STM32F107: Add support to auto-mount the procfs file system.
+ - Photon: Support SPI1 and SPI3. From Anthony Merlino.
+ - STM32F334-DISCO: Add lower half driver for high power LED
+ (powerled). From Mateusz Szafoni.
+ - STM32F334-DISCO: Add flash mode support for powerled driver. From
+ Mateusz Szafoni.
+ - STM32F334-DISCO: Add powerled example configuration. From Mateusz
+ Szafoni.
+ - STM32F334-DISCO: Add lower-half driver for SMPS (buck-boost onboard
+ converter). From Mateusz Szafoni
+ - Nucleo-F334R8: Add logic for zero latency high priority interrupts
+ example. From Mateusz Szafoni.
+ - Nucleo-F334R8: Add highpri example configuration. From Mateusz
+ Szafoni.
+ - STM32 F4 Discovery: Added support for the LIS3DSH accelerometer on
+ the STM32F4 Discovery rev. C boards. From Florian Olbrich.
+ - STM32 F4 Discovery: ROMFS for STM32F4 Discovery board. From Tomasz
+ Wozniak.
+ - STM32 F4 Discovery: Add a USB MSC configuration. From Alan Carvalho
+ de Assis.
+ - STM32 F4 Discovery: RNDIS support on STM32F4Discovery + DM-STF4BB.
+ NOTE: MAC address for the host side starts 0xaa. This assignment
+ scheme should be fixed later. From Masayuki Ishikawa.
+ - STM32 F4 Discovery: Add STM32F4 Discovery board support for
+ Nunchuck joystick. From Alan Carvalho de Assis.
+ - STM3240G-EVAL: Add a configuration for testing the Framebuffer
+ character driver using the LCD framebuffer front.
+ - STM3240G-EVAL: Mount procfs if enabled.
+ - STM3240G-EVAL: Add support for pdcurses and the pdcurses demo
+ programs in the 'fb' configuration.
+ - Clicker2-STM32: Adds SD card, automount, and syslog file
+ support and fixes a few minor issues. From Anthony Merlino.
+ - Clicker2-STM32: Adds support for USB RNDIS device. From Anthony
+ Merlino.
+ - Olimex STM32-H407: Add serial support on the on-board UEXT
+ connector. Add USART6 for UEXT connector. Add nsh_uext
+ configuration and README update. From Jan Pobríslo.
+ - Nucleo-F410RB: Add support for the nucleo-F410RB board. From
+ Gwenhael Goavec-Merou.
+ - STM32F429i-DISCO: Add framebuffer driver initialization. Add a
+ framebuffer (fb) configuration.
+ - STM32F429i-DISCO: Add logic to auto-mount procfs. Enable procfs in
+ all configurations that use NSH.
+ - STM32F429i-DISCO: Enable support for the STMPE811 touchscreen
+ controller. Enable touchscreen and also the touchscreen testa at
+ apps/examples/touchscreen in the fb configuration.
+ - STM32F429i-DISCO: Convert NxWM configuration to use LTDC
+ framebuffer driver instead of SPI serial. Also reduce number of
+ layers from 4 to 1 in fb configuration. Only one layer is used.
+ - STM32L476-MDK: Add support for the on-board LEDs.
+ - Nucleo-L496ZG: Add DFSDM initialization. From Juha Niskanen
+ - Nucleo-L496ZG: Add support for SDMMC driver. From Miha Vrhovnik.
+ - Nucleo-L496ZG: Enable I2C4 bus with i2ctool in NSH configuration.
+ From Jussi Kivilinna.
+ - Nucleo-L496ZG: Make HSE on Nucleo-L496ZG default to enable USB.
+ From Miha Vrhovnik.
+ - Nucleo-F746ZG: Use the serial console over /dev/ttyACM0 by default.
+ The Nucleo-F746ZG doesn't come with Arduio RS-232 shield, then it is
+ better to use the serial over the /dev/ttyACM0 that is created
+ automatically when the board is plugged in the computer. From Alan
+ Carvalho de Assis.
+ - Nucleo-144: Adds support for the Nucleo-144 boards with
+ STM32F722ZE. From Bob Feretich.
+
+ * ZiLOG Z80
+
+ - z80/include: compiler.h, limits.h, types.h: Update SDCC/z80 files
+ to include support for long long, inline, __FILE__, and __func__.
+
+ * C Library/Header Files:
+
+ - include/: Add stdnoreturn.h. Holds definitions for the C11
+ noreturn keyword. Applies to C too.
+ - include/netinet/tcp.h: Add trivial standard tcp.h header file.
+ - libc: Add support for readv() and writev().
+ - libc: Adds tcflow().
+ - libc: Add support for sigwait().
+ - libnx: Changes to allow the font subsystem to be built without
+ enabling the entire graphics system (CONFIG_NX). Adds
+ CONFIG_NXFONTS and CONFIG_NXGLIB. Needed to duplicate some Kconfig
+ setting for NXFONTs if it can be configured and built independently
+ of NX.
+
+ * Tools:
+
+ - tools/configure.sh: Add special support so that you can start with a
+ windows native configuration and install on a different host (and
+ vice versa).
+ - tools/configure.c: Duplicate new functionaity added to configure.sh.
+ - tools/configure.sh: This commit adds a -m option for macOS. For
+ anyone not aware, Apple renamed OSX to macOS recently; thus the 'm'
+ instead of 'o'. This does not change the other uses of *_OSX to
+ macOS. From jeditekunum.
+ - tools/configure.c: Update functionality to match last change to
+ tools/configure.sh.
+
+ * NSH: apps/nshlib:
+
+ - apps/nshlib: mount command no long uses the non-standard OS
+ interface foreach_mountpoint(). Now simply cats /proc/fs/mount
+ when there are no arguments to the mount command.
+ - apps/nshlib: df command no long uses the non-standard OS interface
+ foreach_mountpoint(). Now simply cats /proc/fs/blocks or
+ /proc/fs/usage.
+ - apps/nshlib: The free commands no longer used mallinfo() to get
+ the state of the use heap. Two reasons: That is not useful
+ information in the kernel build. And (2) there are other memory
+ resources of interest in other configurations such as the Kernel
+ heap in PROTECTED and KERNEL builds, and the prog mem uses when
+ FLASH is used to hold modifiable data. The free command has been
+ extended to just dump the content of procfs entries and to include
+ all of these other memory resources of the procfs entries are
+ available.
+
+ * Examples/Tests: apps/examples:
+
+ - apps/examples/fb: Add a simple test for the framebuffer character
+ driver..
+ - apps/examples/ostest: sem_open() now returns SEM_FAILED in the
+ event of a failure.
+ - examples/ostest: Extend cancellation test to make sure that
+ cancelable threads waiting on a message queue or on a signal can be
+ canceled.
+ - Added a simple reader example for the LIS3DSH acceleration sensor
+ on STM32F4Discovery. From Florian Olbrich.
+ - apps/examples/apa102: Add a Rainbow example for APA102 LED Strip.
+ From Alan Carvalho de Assis.
+ - apps/examples/flowc: Add a simple test of serial hardware flow
+ control.
+ - Add powerled driver example. From Mateusz Szafoni.
+ - apps/examples/ina219: A simple infinite loop that polls the INA219
+ sensor and displays the measurements. From Sebastien Lorquet.
+ - apps/examples/alarm: Add options for reading alarm value and
+ canceling it. From Juha Niskanen.
+ - Add -n samples to lm75 app and replace Centigrade with Celsius.
+ From Alan Carvalho de Assis.
+ - apps/examples/adps9960: Add ADPS-9960 example. From Alan Carvalho
+ de Assis.
+ - apps/examples/obd2: Add OBD2 example application. From Alan
+ Carvalho de Assis.
+ - apps/examples/userfs: Add a test case for verifying UserFS.
+ - apps/examples/smps: add SMPS driver example. From Mateusz Szafoni.
+ - apps/examples/pdcurses: Bring in pdcurses demos and make them
+ conform to the NuttX coding style.
+ - apps/examples/pdcurses: Add a very simple example that just shows
+ the entire character set (7-bit only). It adapts to the size of
+ the framebuffer and, hence, can be used with very tiny displays.
+ In fact it looks really dumb on big displays.
+ - apps/examples/nunchuck: Add Nunchuck example application. From
+ Alan Carvalho de Assis.
+
+ * File System Utilies: apps/fsutils:
+
+ - apps/fsutils/mkfatfs: Move mkfatfs from the OS to here.
+
+ * Network Utilities: apps/netutils:
+
+ - apps/netutils/netlib: Add netlib_ipv6adaptor() and
+ netlib_ipv4adaptor().
+ - apps/netutils/netlib: Add helpers for reading the routing table:
+ netlib_read_ipv4route() and netlib_read_ipv6route().
+ - apps/netutils/netlib: Add new utilities netlib_ipv[4|6]router()
+ that can be used to determine the IP address of a router that would
+ be used some some destination IP address that is not locally
+ accessible.
+ - apps/netutils/ftpc: Adds support for IPv6 and fixes various
+ transfer issues. From Anthony Merlino.
+
+ * CANUtilities: apps/canutils:
+
+ - apps/canutils/libobd2: Add libobd2 for NuttX. From Alan Carvalho
+ de Assis.
+
+ * Graphics: apps/graphics:
+
+ - graphics/traveler: Convert to use the framebuffer driver.
+ - apps/graphics/pdcurs34: This commit brings the public domain
+ pdcurses library into NuttX. NuttX graphics support based on the
+ framebuffer character drivers has been integrated. Input is
+ currently limited to a discrete joystick driver.
+
+ * Wireless Utilities: apps/wireless:
+
+ - apps/wireless/ieee802154/i8sak: Adds socket interface support. You
+ can now use both socket or char driver to control the MAC layer.
+ From Anthony Merlino.
+ - apps/wireless/ieee802154/i8sak: Adds sniffer port option and a few
+ other get/set parameters. From Anthony Merlino.
+ - apps/wireless/ieee802154/i8sak: Changes 'notif' to 'primitive'
+ corresponding to the changes in the Kernel. From Anthony Merlino.
+ - apps/wireless/ieee802154/i8sak: Channel setting is now saved
+ locally, so when performing a startpan or assoc, the channel
+ previously set is still used, even though the MAC layer gets reset.
+ From Anthony Merlino.
+ - apps/wireless/ieee802154/i8sak: Adds ability to get/set rxonidle
+ setting for MAC layer. From Anthony Merlino.
+ - apps/wireless/ieee802154/i8shark: Adds i8shark, a sniffer "adapter"
+ that captures all 802.15.4 traffic, packages it into a Wireshark ZEP
+ packet, and sends it to a host running Wireshark From Anthony
+ Merlino.
+
+ * System Utilities (apps/system)
+
+ - apps/system/ping and ping6: This commit removes the ping and ping6
+ commands from NSH and replaces then with the apps/system/ping and
+ apps/system/ping6 built-in commands. The NSH ping[6] commands had
+ to be removed because they violated the portable POSIX OS interface.
+ The apps/system/png and ping6 command uses the sem-standard
+ IPPROTO_ICMP and IPPROTO_ICMP6 socket interfaces.
+
+ * Platform-Specific Support (apps/platform)
+
+Bugfixes. Only the most critical bugfixes are listed here (see the
+ChangeLog for the complete list of bugfixes and for additional, more
+detailed bugfix information):
+
+ * Core OS:
+
+ - Task Environment Creation: Fix an error in the duplication of the
+ child tasks environment in the special case where the parent's
+ environment was created, but then all of the variables were unset.
+ In that case, there is still an allocation in place but the size of
+ the allocation is zero. This case was not being handled correctly
+ when a child task attempts to create its environment and inherit the
+ zero-size partent environment. Noted by Anthony Merlino.
+ - timer_create(): Fix watchdog resource leak if cannot allocate a new
+ timer. From Bruno Herrera.
+ - OS Internal Functions: Internal OS functions should not return error
+ information via the user errno variable: This includes functions
+ like file_seek(), file_read(), file_write(), etc. The complete list
+ is too long to duplicate here (please refer to the ChangeLog for
+ details).
+ - OS Internal Functions: Not only should internal OS functions not
+ modify the errno variable, they should never introduce cancellation
+ points: psock_connect(), psock_listen(), psock_getsockopt(), etc.
+ The list is too long to duplicate here (please refer to the
+ ChangeLog for details).
+ - OS Internal Functions: Create OS internal versions of many
+ applications functions that were used by the OS. The new versions
+ differ from the application interfaces in that (1) they do not
+ return error information via the errno variable, and (2) they never
+ create cancellation points. This includes new internal interfaces
+ like nxsem_init() that is like sem_init(), etc. There are too many
+ to list here (see the ChangeLog for details).
+ - Task Exit: task_exithook.c fails to link if signals are disabled
+ because was unconditionally trying to send the SIGCHLD signal to the
+ parent in certain configurations. Noted by Jeongchan Kim.
+ - memalign(): Fix heap corruption caused by using unaligned chunk
+ size. Unaligned nodes generated by memalign later cause heap
+ corruptions when nodes are shrink further (for example, 24 bytes ->
+ 8 bytes, when alignment is 16 bytes). From Jussi Kivilinna.
+ - SMP: In sched/sched/sched_cpuselect.c, in order to find the cpu
+ with the lowest priority thread, we have to remember the already
+ found lowest priority. Noted by Anonymous in Issue #75.
+ - spinlocks: Disable local interrupts in spin_setbit() and
+ spin_clrbit() in order to avoid a deadlock condition. From Masayuki
+ Ishikawa.
+ - atexit()/on_exit(): Clear atexit()/on_exit() function pointer
+ before calling it. On most archs, up_assert() calls exit() so
+ without this change, if atexit() function triggers an assertion we
+ are in endless loop. From Juha Niskanen.
+
+ * File System/Block and MTD Drivers:
+
+ - tmpfs: Fixed directory unlocking in tmpfs_opendir. From Dmitriy
+ Linikov.
+ - fcntl(): fcntl() did not return success fail for F_SETFL. Reported
+ by Jussi Kivilinna.
+ - tcdrain(): tcdrain() was recently added to the NuttX C library.
+ But there is a problem. The specification of tcdrain() requires
+ that it be a cancellation point. In order to do this, tcdrain was
+ moved from the C library into the OS and the addition cancellation
+ point hooks were added. In non-FLAT builds, access via system calls
+ is also now supported.
+ - FS FAT: Fix hard-fault when listing contents of FAT root. From
+ Jussi Kivilinna.
+ - procfs: Correct a problem that was causing an apparent directory to
+ be reported as a file instead of a directory by opendir. This
+ happened after adding these three new procfs entries: fs/block,
+ fs/mount, and fs/usage. Of course, there is no directory fs in this
+ case, only three files that have fs/ in their relative pathnames.
+ The logic was detecting that fs was the name of the enty to report,
+ but it was then declaring that fs was a file (because fs/block is of
+ type file). This was fixed by adding a check for matching lenghts.
+ i.e., if strlen(fs) != strlen(fs/block), then report fs as a
+ directory instead of a file.
+ - procfs: Fix uptime being clse to maximum 32-bit value in certain
+ config. From Juha Niskanen.
+
+ * Binary Loader:
+
+ - binfmt/: Don't schedule starthook if there are no constructors.
+
+ * Graphics/Display Drivers:
+
+ - LCD: ILI9341 initialize method not permitted to set errno.
+
+ * Networking/Network Drivers:
+
+ - Networking: net/netdev/netdev_ifconfig.c: Was not returning all of
+ the address info.
+ - Networking: In some cases, packets are still not sent behind the
+ router. I found that NuttX sends the ARP requests not to the router
+ but to the target. Mistake in file net/route/netdev_router.c. From
+ Aleksandr Kazantsev.
+ - SIOCGIFCONF and SIOCGLIFCONF IOCTL commands should only report on
+ network adatpors in the UP state.
+ - recvfrom(): Fix double leave_cancellation_point on error path.
+ From Jussi Kivilinna.
+ - send(): Verify that sock descriptor is valid. Fixes assertion when
+ using send on closed socket. From Jussi Kivilinna.
+ - sendto(): Remove assert check for null psock and buf input
+ pointers. Removes check as 'psock == NULL' altogether because that
+ checked for later in psock_send and psock_sendto. Change null check
+ for 'buf' so that it is handled same as in recvfrom.c (return
+ -EINVAL instead of assert). From Jussi Kivilinna.
+ - sockgetname() files need to include udp/udp.h and tcp/tcp.h or
+ otherwise NET_UDP_HAVE_STACK and NET_TCP_HAVE_STACK are undefined
+ and the logic is never compiled. Noted by Anthony Merlino.
+ - dup()/dup2(): There was a reference counting problem in the TPC
+ logic of net_clone(). net_clone() which is the common logic
+ underlying dup() and dup2() for sockets. When net_clone() calls
+ net_start_monitor() and net_start_monitor() returns a failure
+ (because the underlying TCP connection) then net_clone() must back
+ out the reference count on the structure. Problem noted by Pascal
+ Speck and this implementation of the solution is based on his
+ suggestion.
+ - close(): There was a possible recursion that could eventually
+ overflow the stack. The error occurred when closing the socket with
+ inet_close() while a socket callback was still queued. When the
+ socket callback was executed by devif_conn_event(), this resulted in
+ a call to psock_send_eventhandler() with TCP_CLOSE flag set which
+ then called tcp_lost_connection(). tcp_shutdown_monitor() then
+ called tcp_callback() again, which again called
+ psock_send_eventhandler(), and so on.... Noted by Pascal Speck.
+ Solution is also similar to a solution proposed by Pascal Speck.
+ - inet: Add check for protocol before handing out TCP and UDP sockets.
+ - IP Forwarding: Fixes typo that caused build error when IP
+ forwarding was enabled with CONFIG_NET_ICMPv6_NEIGHBOR enabled as
+ well. From Anthony Merlino.
+ - IP Forwarding: Do not add link layer header size to d_len inside
+ devif_forward(). From Anthony Merlino.
+ - TCP Networking: When CONFIG_NET_TCP_WRITE_BUFF=y there is a
+ situation where a NULL pointer may be dereferenced. In this
+ configuration, the TCP connection's 'semi-permanent' callback,
+ s_sndcb was nullified in tcp_close_disconnect. However, other logic
+ in tcp_lost_connection() attempt to use that callback reference
+ after it was nullifed. Fixed in tcp_lost_connectino() by adding a
+ NULL pointer change before the access. This was reported by Dmitriy
+ Linikov in Bitbucket Issue 72.
+ - UDP Broadcat: Fix some issues with regard to UDP broadcast
+ handling. This is Bitbucket Issue #77.
+ - ICMP: Fix an error in the poll logic. It was assumed that the
+ input parmeter pvconn was valid. It was not. Instead, the poll
+ logic must work like the sendto() and recvfrom() logic: It must
+ keep a copy of the conn structure in the private data.
+ - ICMPv6: Fixes several errors preventing icmpv6_radvertise.c from
+ being compiled. Fixes conversions to network byte order (namely
+ vlifetime, plifetime, mtu). IPv6 source address is set to
+ link-local IP address instead of the address in the netdev
+ structure. This is in compliance to RFC 4861. RA didn't work on
+ Linux before this change. Finally, router prefix and prefix length
+ are derived from the IPv6 address and netmask in the netdev
+ structure. This seems to make more sense than using a predefined,
+ separate prefix from the config. From Sakari Kapanen.
+ - ICMPV6: icmpv6_input() needs to set d_len to 0 after consuming echo
+ reply, otherwise, garbage will get sent out. From Anthony Merlino.
+ - ICMPV6: Fix an error in the poll logic. It was assumed that the
+ input parmeter pvconn was valid. It was not. Instead, the poll
+ logic must work like the sendto() and recvfrom() logic: It must
+ keep a copy of the conn structure in the private data.
+ - IGMPv2 Send: Fix incoming IGMP checksum calculation. From Louis
+ Mayencourt.
+ - ARP: Fix IGMP Ethernet address computation. From Louis Mayencourt.
+
+ * Wireless/Wireless Drivers:
+
+ - CC1101: CC1101 driver not permitted to set errno.
+ - 6LoWPAN: Correct an error in uncompressing multicast address.
+ - 6LoWPAN: Correct a bug in handling uncompressed frames (IPv6
+ dispatch). Adds a separate local variable, protosize, to keep track
+ of the size of thep protocol header.
+ - 6LoWPAN: Fix an endian-ness problem in 6LoWPAN address
+ decompression. From Anthony Merlino.
+ - 6LoWPAN: The logic that extracts interface identifier from the IP
+ address needs to be generalized to handle cases where the address is
+ not a link local address. From Anthony Merlino.
+
+ * Common Drivers:
+
+ - Serial: 16550 UART driver IOCTL method must not set errno; it must
+ return a negated errno value.
+ - LIS3DSH: Added the argument parameter (FAR void *arg) to the
+ interrupt handler provided by the LIS3DSH driver to fit the
+ definition for ISRs in xcpt_t. Changed the check for working queue
+ availability in lis3dsh interrupt handler to use work_available()
+ and not crash in case of an overrun. From Florian Olbrich.
+ - LIS2DH: Fixes for self-test. From Jussi Kivilinna.
+ - LIS2DH: Fix use of obsolete dbg macro. From Jussi Kivilinna.
+ - LIS331DL: LIS331DL driver not permitted to set errno.
+ - HTS221: Power-on sensor for loading calibration data. From Jussi
+ Kivilinna.
+ - MCP2515: Fix the MCP2515 Bit Rate Prescale calculation. Fix BRP
+ for SET_BITTIMING ioctl as well. From Alan Carvalho de Assis.
+ - STMPE811: Fix GPIO operation of STMPE811 driver.
+ 1. STMPE811_GPIO_DIR was defined for register name and later was
+ redefined to be the pin direction mask for `stmpe811_gpioconfig`.
+ I decided to change register name to be STMPE811_GPIO_DIR_REG, and
+ keep pin direction mask STMPE811_GPIO_DIR, so that any external
+ code that already use this driver will be unchanged.
+ 2. The STMPE811 register GPIO_DIR uses bit value 1 for output and 0
+ for input, but `stmpe811_gpioconfig` set the opposite.
+ 3. The call to `stmpe811_gpiowrite` from inside of
+ `stmpe811_gpioconfig` leaded to deadlock.
+ From Dmitriy Linikov.
+ - BQ2429X: Add BATIO_OPRTN_SYSON for enabling BATFET after SYSOFF.
+ From Jussi Kivilinna.
+
+ * Simulation:
+
+ - Simulation: Serial and console drivers are not permitted to set
+ the errno.
+
+ * ARMv7-M:
+
+ - ARM Stack Check: Fix assert panic when both TLS and interrupt stack
+ are enable. From Jussi Kivilinna.
+
+ * Expressif ESP32:
+
+ * Infineon XMC4xxx Drivers:
+
+ - XMC4 USIC: Kconfig was not selecting XMC4_USIC for USIC1. From Alan
+ Carvalho de Assis.
+ - XMC4 UART: Fix XMC4xxx USIC UART sginal to be high level when in idle.
+ From Alan Carvalho de Assis.
+ - XMC4 UART:xmc4_uart_configure() expects the channel# not uartbase as
+ an input parameter. From Alan Carvalho de Assis.
+ - XMC4 UART: Enable RX/TX status. From Alan Carvalho de Assis.
+ - XMC4 UART: The Alternative Receive Interrupt was not being
+ configured.
+
+ * Infineon XMC4xxx Boards:
+
+ - XMC4500-Relax: Setup max. freq. 120MHz and setup pull-up to UART
+ RXD pin. From Alan Carvalho de Assis.
+
+ * Microchip/Atmel SAMv7 Drivers:
+
+ - SAMv7: DAC and ADC drivers are not permitted to set the errno.
+ - SAMv7: Correct an error in RX DMA setup. From Manish Kumar Sharma.
+ - SAMv7 USB: It is necessary to disable pre-emption and interrupts
+ around a loop that copies TX data into the hardware in order to
+ avoid a TX data underrun condition. From Anthony Merlino.
+
+ * NXP/Freescale LPC31xx Drivers:
+
+ - LPC31xx: Serial and console drivers are not permitted to set
+ the errno.
+
+ * NXP/Freescale LPC43xx:
+
+ - lpc43xx: lpc43_adc.c was being selected by the build system wehn
+ DAC was selected.
+
+ * NXP/Freescale LPC43xx Drivers:
+
+ - LPC43xx Ethernet: Fix some backward logic setting full-duplex and
+ 100mbps when autoconfiguration is disabled. Noted by Anonymous in
+ Issue #76.
+ - lpc43xx: UART_RX pins should be configured with input buffers
+ enabled. Otherwise it cannot be read. From Alexander Vasiljev.
+
+ * STMicro STM32:
+
+ - STM32 F2: Fixed build for STM32F20XX platforms when
+ CONFIG_STM32_DMACAPABLE is enabled. From Dmitriy Linikov.
+ - STM32 F4: Remove ltdc.h and dma2d.h. Those header files in that
+ location permitted inclusion into application space logic and,
+ hence, facilitated and encouraged calling into the OS and violating
+ the portable POSIX OS interface. The definitions in those header
+ files were move the appropriate location in the counterpart,
+ architecture specific files at arch/arm/src/stm32/dma2d.h and ltdc.h.
+ - STM32 L4: Build stm32l4_idle.c only if CONFIG_ARCH_IDLE_CUSTOM is
+ not enabled. From Jussi Kivilinna.
+ - STM32 F7: Remove ltdc.h and dma2d.h. Those header files in that
+ location permitted inclusion into application space logic and,
+ hence, facilitated and encouraged calling into the OS and violating
+ the portable POSIX OS interface. The definitions in those header
+ files were move the appropriate location in the counterpart,
+ architecture specific files at arch/arm/src/stm32f7/dma2d.h and
+ ltdc.h.
+
+ * STMicro STM32 Drivers:
+
+ - STM32: DAC and ADC drivers are not permitted to set the errno.
+ - STM32 ADC: Clear pending interrupts. From Mateusz Szafoni.
+ - STM32 CAN: Lower part of STM32 CAN driver
+ arch/arm/src/stm32/stm32_can.c uses all three hw tx mailboxes and
+ clears TXFP bit in the CAN_MCR register (it means transmission order
+ is defined by identifier and mailbox number).
+ This creates situation when order frames are put in upper part of
+ CAN driver (via can_write) and order frames are sent on bus can be
+ different (and I experience this in wild). Since CAN driver API
+ pretends to be "file like" I expect data to be read from fd the same
+ order it is written. So I consider described behaviour to be a bug.
+ Fixed by settin the TXFP bit in the CAN_MCR register (FIFO
+ transmit order). From comments by Alexey T, in Bitbucket Issue 73.
+ - STM32 HRTIM: Fix pclk calculation. From Mateusz Szafoni.
+ - STM32 HRTIM: Fix burst mode prescaler update. From Mateusz Szafoni.
+ - STM32 (alt) I2C: Ensure proper error handling. Injecting data
+ errors would cause the driver to continually reenter the isr with
+ BERR an RxNE. This fix allows the error to be cleared and
+ propagated to the waiting task. From David Sidrane.
+ - STM32: LTDC and DMA2D drivers are not permitted to set the errno.
+ - STM32 RTC: Workaround for potential subseconds race condition. In
+ all recent STM32 chips reading either RTC_SSR or RTC_TR is supposed
+ to lock the values in the higher-order calendar shadow registers
+ until RTC_DR is read. However many old chips have in their errata
+ this silicon bug (at least F401xB/C, F42xx, F43xx, L15xxE, L15xVD
+ and likely others): "When reading the calendar registers with
+ BYPSHAD=0, the RTC_TR and RTC_DR registers may not be locked after
+ reading the RTC_SSR register. This happens if the read operation is
+ initiated one APB clock period before the shadow registers are
+ updated. This can result in a non-consistency of the three
+ registers. Similarly, RTC_DR register can be updated after reading
+ the RTC_TR register instead of being locked."
+ - STM32 Serial: Do not stop processing input in SW flow-control
+ mode. From Juha Niskanen.
+ - STM32F33xxx ADC: Add some publicly visable interfaces and some
+ code to support injected channels. From Mateusz Szafoni.
+ - STM32F33xxx DMA: Add public interface to handle with DMA
+ interrupts. From Mateusz Szafoni.
+ - STM32F33xxx RCC: Fix CAN clock enable. From Mateusz Szafoni.
+ - stm32 F4 I2C: Ensure proper interrupt handling. Injecting data
+ errors that causes a STOP to be perceived by the driver, will
+ continually re-enter the isr with SB not set and BTF and RxNE set.
+ This changes allows the interrupts to be cleared and propagates a
+ I2C_SR1_TIMEOUT to the waiting task. From David Sidrane.
+ - STM32 L4 Serial: Do not stop processing input in SW flow-control
+ mode. From Juha Niskanen.
+ - STM32 F7: LTDC and DMA2D drivers are not permitted to set the errno.
+ - STM32 L4: DAC and ADC drivers are not permitted to set the errno.
+ - STM32 L4 DAC: Do not configure output pin if it is not used. From
+ Juha Niskanen.
+ - STM32 L4 RTC, PM: Small fixes to subseconds handling, ADC
+ power-management hooks
+ - STM32 F4 RTC: Fix reading alarm value that is more than 24h in
+ future. From Juha Niskanen
+ - STM32 L4 RTC: Fix reading alarm value that is more than 24h in
+ future. From Juha Niskanen
+ - STM32 L4 TIM: Fix compilation of timers with complementary outputs
+ when not PWM_MULTICHAN. From Juha Niskanen.
+ - STM32 L4 RCC: Restore backup-registers after backup-domain reset.
+ From Jussi Kivilinna.
+ - STM32 L4 RTC: Correct RTC_SSR and RTC_TR read ordering. In all
+ recent STM32 chips reading either RTC_SSR or RTC_TR is supposed to
+ lock the values in the higher-order calendar shadow registers until
+ RTC_DR is read. Change the register read ordering to match this and
+ don't keep a workaround for a hypothetical race condition (not in
+ any L4 errata, lets for once assume ST's silicon works as it is
+ documented...)
+ - STM32 L4 RTC: Init mode was never exited because nested locking in
+ rtc_synchwait() disabled backup domain access. From Juha Niskanen.
+ - STM32 L4 RTC: Use backup register magic value instead of INITS
+ bit. The INITS (bit 4) of RTC_ISR register cannot be used to
+ reliably detect backup domain reset. This is because we can operate
+ our device without ever initializing the year field in the RTC
+ calendar if our application does not care about correct date being
+ set. Hardware also clears the bit when RTC date is set back to year
+ 2000. From Juha Niskanen.
+ - STM32 L4 RTC: Put back the SSR race condition workaround. ST has
+ confirmed that the issue has not been fixed, and that it applies to
+ STM32 L4 too (was not in errata sheets due to documentation bug) See
+ discussion: https://community.st.com/thread/43710-issue-with-rtc-maximum-time-resolution .
+ From Juha Niskanen.
+ - STM32 F7 BBSRAM: Avoid assert in stm32_bbsram_savepanic. If panic
+ happens before stm32_bbsram is initialized, stm32_bbsram_savepanic
+ caused additional assert panic. Function has null pointer check, so
+ drop DEBUGASSERT. From Jussi Kivilinna.
+ - STM32 F7 I2C: fix I2C_M_NORESTART handling. From Jussi Kivilinna.
+ - STM32 F7 I2C: Restore bus frequency after I2C reset. Copy
+ frequency restoration fix from STM32L4 I2C driver to STM32F7 I2C
+ driver. From Jussi Kivilinna.
+ - STM32 F7 RTC: Fix reading alarm value that is more than 24h in
+ future. From Juha Niskanen
+
+ * STMicro STM32 Boards:
+
+ - STM32F334-DISCO: Add missing ram_vectors configuration in linker
+ script. From Mateusz Szafoni.
+ - Nucleo-F334R8: Add missing ram_vectors configuration in linker
+ script. From Mateusz Szafoni.
+ - Nucleo-F334R8: Add Missing ADC trigger configuration tot he highpri
+ configuration. From Mateusz Szafoni.
+ - STM3240G-EVAL: The timer frequencies (BOARD_TIMx_FREQUENCY) are
+ incorrectly defined in board.h. Since the APB prescalers are set to
+ divide by 4 and 2 respectively, the frequencies should be "2xAPBx"
+ as said in the comment. The correct frequencies are already defined
+ but as STM32_APBx_TIMx_CLKIN. From Mattias Edlund.
+ - STM32F429i-DISCO: The ltdc configuration has been deleted because
+ it violated the portable POSIX OS interface. It used
+ apps/examples/ltdc and include ltdc.h and dma2d.h which were also
+ removed for the same reason.
+
+ * ZiLOG Z80
+
+ - configs/z80sim and xtrs: Serial driver lower halfs ioctl methods
+ should return a negated errno value, not set the errno variable.
+ - z80 Make.defs: Fixes dependency generation with newest SDCC
+ compiler.
+ - configs/z80sim: Fix a naming problem. Also, don't try to build the
+ serial driver if CONFIG_NFILE_DESCRIPTOR=0.
+ - Z80: Makefile fix for use with current SDCC.
+
+ * Build System
+
+ - configs/: All defconfig filess that include
+ CONFIG_NET_ICMPv6_SOCKET=y need to select CONFIG_SYSTEM_PING6=y and
+ deselect CONFIG_DISABLE_POLL.
+ - configs/: All NX configuration... Because of recent changes to
+ libnx/nxfonts, Supported bit per pixel must be separated specified
+ for NXFONTs too and need to match the select BPP for NX.
+ - Build system: Fix CONFIG_BUILD_KERNEL logic directories that have
+ ubin and kbin subdirectories. Conditional logic was fine for
+ CONFIG_BUILD_FLAT and CONFIG_BUILD_PROTECTED but generated useless
+ dependencies if CONFIG_BUILD_KERNEL.
+
+ * C Library/Header Files:
+
+ - libc/stdio: Build the lib_noflush() and lib_snoflush() stubs even
+ if CONFIG_FILE_DESCRIPTORS=0. They may still be needed.
+ - libc and libnx: When the libraries are built into two libraries, a
+ user space library and a OS space library (as in the PROTECTED and
+ KERNEL build). Then the user space library must not use the OS
+ internal interfaces; similarly, the OS must avoid using the
+ userspace interfaces so that it does not muck the errno value or
+ create spurious cancellation points.
+ - libc/match: Use of exp() vs expf() in logf() caused function to be
+ slow. From Alan Carvalho de Assis.
+ - libnx: Fixes a memory leak that is caused because the client message
+ queue is not unlinked after the client disconnects from the NX
+ server. From Masayuki Ishikawa.
+ - sscanf(): Fix sscanf() character conversion (%c): do not add '\0' at
+ the end as for strings, cause, for example, parsing one character
+ will fill two bytes: character itself and zero one '\0' after it, so
+ will overflow one byte variable argument and corrupt memory for
+ variables allocated after it. From Oleg Evseev.
+
+ * Tools
+
+ - tools/: configure.sh and configure.c should redirect stdout to
+ /dev/null but should not suppress stderr output.
+
+ * NSH: apps/nshlib:
+
+ - apps/nshlib/: Avoid truncating the strcmp result in the parser
+ into a unsigned char variable. nshlib/nsh_netcmds.c: Check for
+ valid hostip before using it. From Bruno Herrera.
+ - apps/nshlib/: Fix resouce leak in 'dd' commenad when 'if=' or
+ 'of=' params are repeated in the command line. For example:
+ dd if=/dev/null if=/dev/zero of=/dev/null or
+ dd if=/dev/zero of=/dev/zero of=/dev/null. From Bruno Herrera.
+ - apps/nshlib: This commit eliminates the ping and ping6 commands
+ from NSH and replaces them with 'built-in' commands at
+ apps/system/ping and ping6. The original NSH version of ping[6]
+ commands violated the portable POSIX interface and, hence, had to
+ be removed. The new system/ping and ping6 built-in commands uses
+ the new IPPROTO_ICMP AF_INET and IPPROTO_ICMP6 AF_INET6 datagram
+ sockets to implement ping.
+ - apps/nshlib: Fix parsing of empty strings when CONFIG_NSH_CMDPARMS
+ is not defined. Problem noted by Juha Niskanen.
+
+ * Examples/Tests: apps/examples:
+
+ - All configurations that use NXIMAGE or NXHELLO must select
+ NX_MULTIUSER. All configuratinos that use examples/nxterm must
+ enable CONFIG_LIB_BOARDCTL.
+ - All configurations that use NXLINES must select NX_MULTIUSER. All
+ configurations that use the NX server need to have larger POSIX
+ messages.
+ - apps/examples/adc: Fix g_adcstate.count initialization. From
+ Masayuki Ishikawa.
+ - apps/examples/elf: Remove low-level interfaces and replace with
+ call to exec().
+ - apps/examples/nxflat: Remove low-level interfaces and replace with
+ call to exec().
+ - examples/ostest: Works around a bug in printf() when cancellation
+ points are enabled. printf() is a cancellation point because it
+ calls write(). This is correct according to OpenGroup.org.
+ However, printf holds the stdio library semaphore when it is
+ canceled and this leaves the semaphore in a bad state. No fix for
+ the printf bug yet.
+ - apps/examples/nx: The NX example no longer supports single user
+ mode.
+ - apps/examples/nxtext: The nxtext example no longer supports single
+ user mode.
+ - apps/examples/nxhello now supports only multiuser mode.
+ - apps/examples/nximage now supports only multiuser mode.
+ - examples/nxlines: Now supports only multiuser mode.
+
+ * Network Utilies: apps/netutils:
+
+ - apps/netutils/ftpc: Fix some crazy comparisons to determine is a
+ file is an absolute path. Noted by Anthony Merlino.
+
+ * System Unitilities (apps/system)
+
+ - apps/system/i2ctool: Fixed i2ctool write operation in `no restart`
+ mode (flag `-n`). It seems that I2C driver has changed a bit since
+ i2ctool was written, so now i2ctool sends repeated start even if
+ `no restart` flag (-n) was passed to it. From Dmitriy Linikov.
\ No newline at end of file
diff --git a/TODO b/TODO
index 25fffb9b872f9243e843ad22c1c7c771dcf58780..3d92fd7ee2cc84745d03d4b523cd06576d4728fd 100644
--- a/TODO
+++ b/TODO
@@ -1,4 +1,4 @@
-NuttX TODO List (Last updated October 25, 2017)
+NuttX TODO List (Last updated January 3, 2018)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This file summarizes known NuttX bugs, limitations, inconsistencies with
@@ -14,18 +14,18 @@ nuttx/:
(1) Memory Management (mm/)
(0) Power Management (drivers/pm)
(3) Signals (sched/signal, arch/)
- (3) pthreads (sched/pthread)
+ (2) pthreads (sched/pthread)
(0) Message Queues (sched/mqueue)
(8) Kernel/Protected Build
(3) C++ Support
(6) Binary loaders (binfmt/)
- (16) Network (net/, drivers/net)
+ (17) Network (net/, drivers/net)
(4) USB (drivers/usbdev, drivers/usbhost)
(0) Other drivers (drivers/)
(12) Libraries (libc/, libm/)
(10) File system/Generic drivers (fs/, drivers/)
- (9) Graphics Subsystem (graphics/)
- (3) Build system / Toolchains
+ (10) Graphics Subsystem (graphics/)
+ (1) Build system / Toolchains
(3) Linux/Cywgin simulation (arch/sim)
(4) ARM (arch/arm/)
@@ -300,12 +300,13 @@ o Task/Scheduler (sched/)
./risc-v/src/common/up_internal.h:EXTERN uint32_t g_idle_topstack;
./x86/src/common/up_internal.h:extern uint32_t g_idle_topstack;
- That omits there architectures: sh1, sim, xtensa, z16, z80,
+ That omits these architectures: sh1, sim, xtensa, z16, z80,
ez80, and z8. All would have to support this common
globlal variable.
Also, the stack itself may be 8-, 16-, or 32-bits wide,
- depending upon the architecture.
+ depending upon the architecture and do have differing
+ alignment requirements.
2. Another problem is colorizing that stack to use with
stack usage monitoring logic. There is logic in some
@@ -551,49 +552,10 @@ o pthreads (sched/pthreads)
solution. So I discarded a few hours of programming. Not a
big loss from the experience I gained."
- Title: ISSUES WITH CANCELLATION POINTS
- Description: According to POSIX cancellation points must occur when a
- thread is executing the following functions. There are some
- exceptions as noted:
-
- accept() mq_timedsend() NA putpmsg() sigtimedwait()
- 04 aio_suspend() NA msgrcv() pwrite() NA sigwait()
- NA clock_nanosleep() NA msgsnd() read() sigwaitinfo()
- close() NA msync() NA readv() 01 sleep()
- connect() nanosleep() recv() 02 system()
- -- creat() open() recvfrom() tcdrain()
- fcntl() pause() NA recvmsg() 01 usleep()
- NA fdatasync() poll() select() -- wait()
- fsync() pread() sem_timedwait() waitid()
- NA getmsg() NA pselect() sem_wait() waitpid()
- NA getpmsg() pthread_cond_timedwait() send() write()
- NA lockf() pthread_cond_wait() NA sendmsg() NA writev()
- mq_receive() pthread_join() sendto()
- mq_send() pthread_testcancel() 03 sigpause()
- mq_timedreceive() NA putmsg() sigsuspend()
-
- NA Not supported
- -- Doesn't need instrumentation. Handled by lower level calls.
- nn See note nn
-
- NOTE 01: sleep() and usleep() are user-space functions in the C library and cannot
- serve as cancellation points. They are, however, simple wrappers around nanosleep
- which is a true cancellation point.
- NOTE 02: system() is actually implemented in apps/ as part of NSH. It cannot be
- a cancellation point.
- NOTE 03: sigpause() is a user-space function in the C library and cannot serve as
- cancellation points. It is, however, a simple wrapper around sigsuspend()
- which is a true cancellation point.
- NOTE 04: aio_suspend() is a user-space function in the C library and cannot serve as
- cancellation points. It does call around sigtimedwait() which is a true cancellation
- point.
- Status: Not really open. This is just the way it is.
- Priority: Nothing additional is planned.
-
Title: INAPPROPRIATE USE OF sched_lock() BY pthreads
Description: In implementation of standard pthread functions, the non-
standard, NuttX function sched_lock() is used. This is very
- strong sense it disables pre-emption for all threads in all
+ strong since it disables pre-emption for all threads in all
task groups. I believe it is only really necessary in most
cases to lock threads in the task group with a new non-
standard interface, say pthread_lock().
@@ -608,7 +570,7 @@ o pthreads (sched/pthreads)
This is an easy change: pthread_lock() and pthread_unlock()
would simply operate on a semaphore retained in the task
group structure. I am, however, hesitant to make this change:
- I the flat build model, there is nothing that prevents people
+ In the FLAT build model, there is nothing that prevents people
from accessing the inter-thread controls from threads in
differnt task groups. Making this change, while correct,
might introduce subtle bugs in code by people who are not
@@ -651,11 +613,9 @@ o Kernel/Protected Build
These functions still call directly into operating system
functions:
- - cdcacm_classobject - Called from apps/system/composite.
- usbmsc_configure - Called from apps/system/usbmsc and
apps/system/composite
- - usbmsc_bindlun - Called from apps/system/usbmsc and
- apps/system/composite
+ - usbmsc_bindlun - Called from apps/system/usbmsc
- usbmsc_exportluns - Called from apps/system/usbmsc.
Status: Open
@@ -1341,12 +1301,24 @@ o Network (net/, drivers/net)
connect() most likely has this same issue.
A work-around might be to raise the priority of the thread
- that calls accept().
+ that calls accept(). accept() might also need to check the
+ tcpstateflags in the connection structure before returning
+ in order to assure that the socket truly is connected.
Status: Open
Priority: Medium. I have never heard of this problem being reported
before, so I suspect it might not be so prevalent as one
might expect.
+ Title: LOCAL DATAGRAM RECVFROM RETURNS WRONG SENDER ADDRESS
+ Description: The recvfrom logic for local datagram sockets returns the
+ incorrect sender "from" address. Instead, it returns the
+ receiver's "to" address. This means that returning a reply
+ to the "from" address receiver sending a packet to itself.
+ Status: Open
+ Priority: Medium High. This makes using local datagram sockets in
+ anything but a well-known point-to-point configuration
+ impossible.
+
o USB (drivers/usbdev, drivers/usbhost)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -1787,14 +1759,10 @@ o File system / Generic drivers (fs/, drivers/)
intended for deeply embedded environments where there are
not multiple users with varying levels of trust.
- truncate - The standard way of setting a fixed file size.
- Often used with random access, data base files. There is no
- simple way of doing that now (other than just writing data
- to the file).
-
link, unlink, softlink, readlink - For symbolic links. Only
the ROMFS file system currently supports hard and soft links,
- so this is not too important.
+ so this is not too important. The top-level, psuedo-file
+ system supports soft links.
File locking
@@ -1807,6 +1775,8 @@ o File system / Generic drivers (fs/, drivers/)
True inodes - Standard Unix inodes. Currently only supported
by ROMFs.
+ File times, for example as set by utimes().
+
The primary obstacle to all these is that each would require
changes to all existing file systems. That number is pretty
large. The number of file system implementations that would
@@ -2042,6 +2012,27 @@ o Graphics Subsystem (graphics/)
Status: Open
Priority: Low for many, but I imagine higher in countries that use wide fonts
+ Title: LOW-RES FRAMEBUFFER RENDERERING
+ Description: There are obvious issues in the low-res, < 8 BPP, implemenation of
+ the framebuffer rendereing logic of graphics/nxglib/fb. I see two
+ obvious problems in reviewing nxglib_copyrectangle():
+
+ 1. The masking logic might work 1 BPP, but is insufficient for other
+ resolutions like 2-BPP and 4-BPP.
+ 2. The use of lnlen will not handle multiple bits per pixel. It
+ would need to be converted to a byte count.
+
+ The function PDC_copy_glyph() in the file apps/graphics/pdcurs34/nuttx/pdcdisp.c
+ derives from nxglib_copyrectangle() and all of those issues have been
+ resolved in that file.
+
+ Other frambuffer rendering functions probably have similary issues.
+ Status: Open
+ Priority: Low. It is not surprising that there would be bugs in this logic:
+ I have never encountered a hardware framebuffer with sub-byte pixel
+ depth. If such a beast ever shows up, then this priority would be
+ higher.
+
o Build system
^^^^^^^^^^^^
@@ -2058,109 +2049,6 @@ o Build system
Status: Open
Priority: Low.
- Title: CONTROL-C CAN BREAK DEPENDENCIES
- Description: If you control C out of a make, then there are things that can go
- wrong. For one, you can break the dependencies in this scenario:
-
- - The build in a given directory begins with all of the compilations.
- On terminal, this the long phase with CC: on each line. As each
- .o file is created, it is timestamped with the current time.
-
- - The dependencies on each .o are such that the C file will be re-
- compile if the .o file is OLDER that the corresponding .a archive
- file.
-
- - The compilation phase is followed by a single, relatively short
- AR: phase that adds each of the file to the .a archive file. As
- each file is added to archive, the timestamp of the of archive is
- updated to the current time. After the first .o file has been
- added, then archive file will have a newer timestamp than any of
- the newly compiled .o file.
-
- - If the user aborts with control-C during this AR: phase, then we
- are left with: (1) not all of the files have bee added to the
- archive, and (2) the archive file has a newer timestamp than any
- of the .o file.
-
- So when the make is restarted after a control, the dependencies will
- see that the .a archive file has the newer time stamp and those .o
- file will never be added to the archive until the directory is cleaned
- or some other dependency changes.
-
- NOTE: This may not really be an issue because the the timestamp on
- libapps.a is not really used but rather the timestamp on an empty
- file:
-
- .built: $(OBJS)
- $(call ARCHIVE, $(BIN), $(OBJS))
- $(Q) touch $@
-
- UPDATE: But there is another way that Control-C can break dependencies:
- If you control-c out of the make during the apps/ part of the build,
- the archive at apps/libapps.a is deleted (but all of the .built files
- remain in place). You can see this in the make outout, for example:
-
- CC: ieee802154_getsaddr.c
- make[2]: *** [Makefile:104: ieee802154_getsaddr.o] Interrupt
- make: *** Deleting file '../apps/libapps.a'
-
- When you rebuild the system, the first file archived will recreate
- libapps.a and set the timestamp to the current time. Then, none of
- the other object files will be added to the archive because they are
- all older.. or, more correctly, none of the other object files will
- be addred because .built files remained and say that there is no
- need to update the libapps.a file.
-
- The typical symptom of such an issue is a link time error like:
-
- LD: nuttx libsched.a(os_bringup.o): In function `os_bringup':
- os_bringup.c:(.text+0x34): undefined reference to `nsh_main'
-
- This is becuase the libapps.a file was deleted and an new empty
- libapps.a file was created (which the object containing nsh_main()).
- The object containing nsh_main() will not be added because the
- .built file exists and says that there is not need to add the
- nsh_main() object to libapps.a.
-
- The work-around for now is:
-
- $ make apps_distclean
-
- One solution to this might be to making the special target
- .PRECIOUS depend on apps/libapps.a. Then if make receives a
- signal, it will not delete apps/libapps.a. This would have to
- be done in all Makefiles.
-
- Status Open
- Priority: Medium-High. It is a rare event that control-C happens at just the
- point in time. However, when it does occur the resulting code may
- have binary incompatiblies in the code taken from the out-of-sync
- archives and cost a lot of debug time before you realize the issue.
-
- The first stated problem is not really an issue: There is already
- the spurious .built file that should handle the described case:
- If you control-C out of the build then the timestamp on the .built
- file will not be updated and the archiving should be okay on the
- next build.
-
- A work-around for the second stated problem is to do 'make clean'
- if you ever decide to control-C out of a make and see that the
- libapps.a file was deleted.
-
- UPDATE: This is a potential fix for the second problem in place
- in in all Makefiles under apps/. This fix adds
-
- .PRECIOUS: $(BIN)
-
- to all Makefiles. It has not yet been confirmed that this fix
- eliminates the dependency issue or not.
-
- Title: DEPENDENCIES OBJECT SUB-DIRECTORIES
- Descripton: Dependencies do not work in directories that keep binaries in
- a sub-directory like bin, ubin, kbin.
- Status: Open
- Priority: Medium-Low. Definitely a build issue once in awhile.
-
o Other drivers (drivers/)
^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/arch/Kconfig b/arch/Kconfig
index a621f6f163519263e39d5eb097520abcb5ef47b4..1efa5d52c2a4bd2ebeb961dcd9466204f56665e4 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -194,6 +194,10 @@ config ARCH_HAVE_POWEROFF
bool
default n
+config ARCH_HAVE_PROGMEM
+ bool
+ default n
+
config ARCH_HAVE_RESET
bool
default n
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index f87e9148d69799c8539f71d3e8a59288e9e24813..63ca64635c4beb812ee091ff5b1490fdc14886c2 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -171,6 +171,17 @@ config ARCH_CHIP_LPC43XX
---help---
NPX LPC43XX architectures (ARM Cortex-M4).
+config ARCH_CHIP_LPC54XX
+ bool "NXP LPC54XX"
+ select ARCH_CORTEXM4
+ select ARCH_HAVE_CMNVECTOR
+ select ARMV7M_CMNVECTOR
+ select ARCH_HAVE_MPU
+ select ARM_HAVE_MPU_UNIFIED
+ select ARCH_HAVE_FPU
+ ---help---
+ NPX LPC54XX architectures (ARM Cortex-M4).
+
config ARCH_CHIP_MOXART
bool "MoxART"
select ARCH_ARM7TDMI
@@ -244,9 +255,10 @@ config ARCH_CHIP_STM32
select ARCH_HAVE_MPU
select ARCH_HAVE_I2CRESET
select ARCH_HAVE_HEAPCHECK
+ select ARCH_HAVE_PROGMEM
+ select ARCH_HAVE_SPI_BITORDER
select ARCH_HAVE_TICKLESS
select ARCH_HAVE_TIMEKEEPING
- select ARCH_HAVE_SPI_BITORDER
select ARM_HAVE_MPU_UNIFIED
select ARMV7M_HAVE_STACKCHECK
---help---
@@ -275,13 +287,14 @@ config ARCH_CHIP_STM32F7
config ARCH_CHIP_STM32L4
bool "STMicro STM32 L4"
- select ARCH_HAVE_CMNVECTOR
select ARCH_CORTEXM4
- select ARCH_HAVE_MPU
+ select ARCH_HAVE_CMNVECTOR
select ARCH_HAVE_I2CRESET
select ARCH_HAVE_HEAPCHECK
- select ARCH_HAVE_TICKLESS
+ select ARCH_HAVE_MPU
+ select ARCH_HAVE_PROGMEM
select ARCH_HAVE_SPI_BITORDER
+ select ARCH_HAVE_TICKLESS
select ARM_HAVE_MPU_UNIFIED
select ARMV7M_CMNVECTOR
select ARMV7M_HAVE_STACKCHECK
@@ -520,6 +533,7 @@ config ARCH_CHIP
default "lpc2378" if ARCH_CHIP_LPC2378
default "lpc31xx" if ARCH_CHIP_LPC31XX
default "lpc43xx" if ARCH_CHIP_LPC43XX
+ default "lpc54xx" if ARCH_CHIP_LPC54XX
default "moxart" if ARCH_CHIP_MOXART
default "nuc1xx" if ARCH_CHIP_NUC1XX
default "sama5" if ARCH_CHIP_SAMA5
@@ -761,6 +775,9 @@ endif
if ARCH_CHIP_LPC43XX
source arch/arm/src/lpc43xx/Kconfig
endif
+if ARCH_CHIP_LPC54XX
+source arch/arm/src/lpc54xx/Kconfig
+endif
if ARCH_CHIP_MOXART
source arch/arm/src/moxart/Kconfig
endif
diff --git a/arch/arm/include/lpc54xx/chip.h b/arch/arm/include/lpc54xx/chip.h
new file mode 100644
index 0000000000000000000000000000000000000000..962dc0300f990fdb74c64aec2a839d7939d0cb65
--- /dev/null
+++ b/arch/arm/include/lpc54xx/chip.h
@@ -0,0 +1,134 @@
+/************************************************************************************
+ * arch/arm/include/lpc54xx/chip.h
+ *
+ * Copyright (C) 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.
+ *
+ ************************************************************************************/
+
+#ifndef __ARCH_ARM_INCLUDE_LPC54XX_CHIP_H
+#define __ARCH_ARM_INCLUDE_LPC54XX_CHIP_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include
+
+/************************************************************************************
+ * Pre-processor Definitions
+ ***********************************************************************************
+/* LPC546xx Family Options.
+ *
+ * Family CPU Flash SRAM FS HS Ether- CAN CAN LCD Package
+ * MHz (Kb) (Kb) USB USB net 2.0 FD
+ * LPC54628 220 512 200 X X X X X X BGA180
+ * LPC54618 180 <=512 <=200 X X X X X X BGA180, LQFP208
+ * LPC54616 180 <=512 <=200 X X X X X BGA100, BGA180, LQFP100, LQFP208
+ * LPC54608 180 512 200 X X X X X BGA180, LQFP208
+ * LPC54607 180 <=512 <=200 X X X BGA180, LQFP208
+ * LPC54606 180 <=512 <=200 X X X X BGA100, BGA180, LQFP100, LQFP208
+ * LPC54605 180 <=512 <=200 X X BGA180
+ */
+
+/* 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 Cortex-M4 core supports 8 programmable interrupt priority levels.
+ */
+
+#define NVIC_SYSH_PRIORITY_MIN 0xe0 /* All bits[7:5] 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 0x20 /* Steps between priorities */
+
+/* If CONFIG_ARMV7M_USEBASEPRI is selected, then interrupts will be disabled
+ * by setting the BASEPRI register to NVIC_SYSH_DISABLE_PRIORITY so that most
+ * interrupts will not have execution priority. SVCall must have execution
+ * priority in all cases.
+ *
+ * In the normal cases, interrupts are not nest-able and all interrupts run
+ * at an execution priority between NVIC_SYSH_PRIORITY_MIN and
+ * NVIC_SYSH_PRIORITY_MAX (with NVIC_SYSH_PRIORITY_MAX reserved for SVCall).
+ *
+ * If, in addition, CONFIG_ARCH_HIPRI_INTERRUPT is defined, then special
+ * high priority interrupts are supported. These are not "nested" in the
+ * normal sense of the word. These high priority interrupts can interrupt
+ * normal processing but execute outside of OS (although they can "get back
+ * into the game" via a PendSV interrupt).
+ *
+ * In the normal course of things, interrupts must occasionally be disabled
+ * using the up_irq_save() inline function to prevent contention in use of
+ * resources that may be shared between interrupt level and non-interrupt
+ * level logic. Now the question arises, if CONFIG_ARCH_HIPRI_INTERRUPT,
+ * do we disable all interrupts (except SVCall), or do we only disable the
+ * "normal" interrupts. Since the high priority interrupts cannot interact
+ * with the OS, you may want to permit the high priority interrupts even if
+ * interrupts are disabled. The setting CONFIG_ARCH_INT_DISABLEALL can be
+ * used to select either behavior:
+ *
+ * ----------------------------+--------------+----------------------------
+ * CONFIG_ARCH_HIPRI_INTERRUPT | NO | YES
+ * ----------------------------+--------------+--------------+-------------
+ * CONFIG_ARCH_INT_DISABLEALL | N/A | YES | NO
+ * ----------------------------+--------------+--------------+-------------
+ * | | | SVCall
+ * | SVCall | SVCall | HIGH
+ * Disable here and below --------> MAXNORMAL ---> HIGH --------> MAXNORMAL
+ * | | MAXNORMAL |
+ * ----------------------------+--------------+--------------+-------------
+ */
+
+#if defined(CONFIG_ARCH_HIPRI_INTERRUPT) && defined(CONFIG_ARCH_INT_DISABLEALL)
+# define NVIC_SYSH_MAXNORMAL_PRIORITY (NVIC_SYSH_PRIORITY_MAX + 2*NVIC_SYSH_PRIORITY_STEP)
+# define NVIC_SYSH_HIGH_PRIORITY (NVIC_SYSH_PRIORITY_MAX + NVIC_SYSH_PRIORITY_STEP)
+# define NVIC_SYSH_DISABLE_PRIORITY NVIC_SYSH_HIGH_PRIORITY
+# define NVIC_SYSH_SVCALL_PRIORITY NVIC_SYSH_PRIORITY_MAX
+#else
+# define NVIC_SYSH_MAXNORMAL_PRIORITY (NVIC_SYSH_PRIORITY_MAX + NVIC_SYSH_PRIORITY_STEP)
+# define NVIC_SYSH_HIGH_PRIORITY NVIC_SYSH_PRIORITY_MAX
+# define NVIC_SYSH_DISABLE_PRIORITY NVIC_SYSH_MAXNORMAL_PRIORITY
+# define NVIC_SYSH_SVCALL_PRIORITY NVIC_SYSH_PRIORITY_MAX
+#endif
+
+/************************************************************************************
+ * Public Types
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Data
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+#endif /* __ARCH_ARM_INCLUDE_LPC43XX_CHIP_H */
diff --git a/arch/arm/include/lpc54xx/irq.h b/arch/arm/include/lpc54xx/irq.h
new file mode 100644
index 0000000000000000000000000000000000000000..2be395af162aecc3a8f03e671abe5385456312a0
--- /dev/null
+++ b/arch/arm/include/lpc54xx/irq.h
@@ -0,0 +1,112 @@
+/********************************************************************************************
+ * arch/arm/include/lpc54xxx/irq.h
+ *
+ * Copyright (C) 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.
+ *
+ ********************************************************************************************/
+
+/* This file should never be included directed but, rather,
+ * only indirectly through nuttx/irq.h
+ */
+
+#ifndef __ARCH_ARM_INCLUDE_LPC54XX_IRQ_H
+#define __ARCH_ARM_INCLUDE_LPC54XX_IRQ_H
+
+/********************************************************************************************
+ * Included Files
+ ********************************************************************************************/
+
+#ifndef __ASSEMBLY__
+# include
+#endif
+
+/********************************************************************************************
+ * 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.
+ */
+
+/* Processor Exceptions (vectors 0-15) */
+
+#define LPC54_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 LPC54_IRQ_NMI (2) /* Vector 2: Non-Maskable Interrupt (NMI) */
+#define LPC54_IRQ_HARDFAULT (3) /* Vector 3: Hard fault */
+#define LPC54_IRQ_MEMFAULT (4) /* Vector 4: Memory management (MPU) */
+#define LPC54_IRQ_BUSFAULT (5) /* Vector 5: Bus fault */
+#define LPC54_IRQ_USAGEFAULT (6) /* Vector 6: Usage fault */
+#define LPC54_IRQ_SIGNVALUE (7) /* Vector 7: Sign value */
+#define LPC54_IRQ_SVCALL (11) /* Vector 11: SVC call */
+#define LPC54_IRQ_DBGMONITOR (12) /* Vector 12: Debug Monitor */
+ /* Vector 13: Reserved */
+#define LPC54_IRQ_PENDSV (14) /* Vector 14: Pendable system service request */
+#define LPC54_IRQ_SYSTICK (15) /* Vector 15: System tick */
+#define LPC54_IRQ_EXTINT (16) /* Vector 16: Vector number of the first external interrupt */
+
+/* Cortex-M4 External interrupts (vectors >= 16) */
+
+#if defined(CONFIG_ARCH_FAMILY_LPC546XX)
+# include
+#else
+# error "Unsupported LPC54 MCU"
+#endif
+
+/********************************************************************************************
+ * Public Types
+ ********************************************************************************************/
+
+#ifndef __ASSEMBLY__
+typedef void (*vic_vector_t)(uint32_t *regs);
+
+/********************************************************************************************
+ * Public Function Prototypes
+ ********************************************************************************************/
+
+#ifdef __cplusplus
+#define EXTERN extern "C"
+extern "C"
+{
+#else
+#define EXTERN extern
+#endif
+
+#undef EXTERN
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+#endif /* __ARCH_ARM_INCLUDE_LPC54XX_IRQ_H */
+
diff --git a/arch/arm/include/lpc54xx/lpc546x_irq.h b/arch/arm/include/lpc54xx/lpc546x_irq.h
new file mode 100644
index 0000000000000000000000000000000000000000..964b56f0027fba18116eb087e0b09af8703def5b
--- /dev/null
+++ b/arch/arm/include/lpc54xx/lpc546x_irq.h
@@ -0,0 +1,115 @@
+/****************************************************************************************************
+ * arch/arm/include/lpc54xxx/lpc546x_irq.h
+ *
+ * Copyright (C) 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.
+ *
+ ****************************************************************************************************/
+
+#ifndef __ARCH_ARM_INCLUDE_LPC54XX_LPC543X_IRQ_H
+#define __ARCH_ARM_INCLUDE_LPC54XX_LPC543X_IRQ_H
+
+/****************************************************************************************************
+ * Included Files
+ ****************************************************************************************************/
+
+/****************************************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************************************/
+
+/* Cortex-M4 External interrupts (vectors >= 16) */
+
+#define LPC54_IRQ_WDT (LPC54_IRQ_EXTINT+0) /* VOD Windowed watchdog timer, Brownout detect */
+#define LPC54_IRQ_DMA (LPC54_IRQ_EXTINT+1) /* DMA controller */
+#define LPC54_IRQ_GINT0 (LPC54_IRQ_EXTINT+2) /* GPIO group 0 */
+#define LPC54_IRQ_GINT1 (LPC54_IRQ_EXTINT+3) /* GPIO group 1 */
+#define LPC54_IRQ_PININT0 (LPC54_IRQ_EXTINT+4) /* Pin interrupt 0 or pattern match engine slice 0 */
+#define LPC54_IRQ_PININT1 (LPC54_IRQ_EXTINT+5) /* Pin interrupt 1 or pattern match engine slice 1 */
+#define LPC54_IRQ_PININT2 (LPC54_IRQ_EXTINT+6) /* Pin interrupt 2 or pattern match engine slice 2 */
+#define LPC54_IRQ_PININT3 (LPC54_IRQ_EXTINT+7) /* Pin interrupt 3 or pattern match engine slice 3 */
+#define LPC54_IRQ_UTICK (LPC54_IRQ_EXTINT+8) /* Micro-tick Timer */
+#define LPC54_IRQ_MRT (LPC54_IRQ_EXTINT+9) /* Multi-rate timer */
+#define LPC54_IRQ_CTIMER0 (LPC54_IRQ_EXTINT+10) /* Standard counter/timer CTIMER0 */
+#define LPC54_IRQ_CTIMER1 (LPC54_IRQ_EXTINT+11) /* Standard counter/timer CTIMER1 */
+#define LPC54_IRQ_SCTIMER (LPC54_IRQ_EXTINT+12) /* SCTimer/PWM0 */
+#define LPC54_IRQ_PWM0 (LPC54_IRQ_EXTINT+12) /* SCTimer/PWM0 */
+#define LPC54_IRQ_CTIMER3 (LPC54_IRQ_EXTINT+13) /* CTIMER3 Standard counter/timer CTIMER3 */
+#define LPC54_IRQ_FLEXCOMM0 (LPC54_IRQ_EXTINT+14) /* Flexcomm Interface 0 (USART, SPI, I2C) */
+#define LPC54_IRQ_FLEXCOMM1 (LPC54_IRQ_EXTINT+15) /* Flexcomm Interface 1 (USART, SPI, I2C) */
+#define LPC54_IRQ_FLEXCOMM2 (LPC54_IRQ_EXTINT+16) /* Flexcomm Interface 2 (USART, SPI, I2C) */
+#define LPC54_IRQ_FLEXCOMM3 (LPC54_IRQ_EXTINT+17) /* Flexcomm Interface 3 (USART, SPI, I2C) */
+#define LPC54_IRQ_FLEXCOMM4 (LPC54_IRQ_EXTINT+18) /* Flexcomm Interface 4 (USART, SPI, I2C) */
+#define LPC54_IRQ_FLEXCOMM5 (LPC54_IRQ_EXTINT+19) /* Flexcomm Interface 5 (USART, SPI, I2C) */
+#define LPC54_IRQ_FLEXCOMM6 (LPC54_IRQ_EXTINT+20) /* Flexcomm Interface 6 (USART, SPI, I2C, I2S) */
+#define LPC54_IRQ_FLEXCOMM7 (LPC54_IRQ_EXTINT+21) /* Flexcomm Interface 7 (USART, SPI, I2C, I2S) */
+#define LPC54_IRQ_ADC0SEQA (LPC54_IRQ_EXTINT+22) /* ADC0 sequence A completion */
+#define LPC54_IRQ_ADC0SEQB (LPC54_IRQ_EXTINT+23) /* ADC0 sequence B completion */
+#define LPC54_IRQ_ADC0THCMP (LPC54_IRQ_EXTINT+24) /* ADC0 threshold compare and error */
+#define LPC54_IRQ_DMIC (LPC54_IRQ_EXTINT+25) /* Digital microphone and audio subsystem */
+#define LPC54_IRQ_HWVAD (LPC54_IRQ_EXTINT+26) /* Hardware Voice Activity Detection */
+#define LPC54_IRQ_USB0NEEDCLK (LPC54_IRQ_EXTINT+27) /* USB0 Activity Interrupt */
+#define LPC54_IRQ_USB0 (LPC54_IRQ_EXTINT+28) /* USB0 host and device */
+#define LPC54_IRQ_RTC (LPC54_IRQ_EXTINT+29) /* RTC alarm and wake-up interrupts */
+ /* 30-31 Reserved */
+#define LPC54_IRQ_PININT4 (LPC54_IRQ_EXTINT+32) /* Pin interrupt 4 or pattern match engine slice 4 */
+#define LPC54_IRQ_PININT5 (LPC54_IRQ_EXTINT+33) /* Pin interrupt 5 or pattern match engine slice 5 */
+#define LPC54_IRQ_PININT6 (LPC54_IRQ_EXTINT+34) /* Pin interrupt 6 or pattern match engine slice 6 */
+#define LPC54_IRQ_PININT7 (LPC54_IRQ_EXTINT+35) /* Pin interrupt 7 or pattern match engine slice 7 */
+#define LPC54_IRQ_CTIMER2 (LPC54_IRQ_EXTINT+36) /* Standard counter/timer CTIMER2 */
+#define LPC54_IRQ_CTIMER4 (LPC54_IRQ_EXTINT+37) /* Standard counter/timer CTIMER4 */
+#define LPC54_IRQ_RIT (LPC54_IRQ_EXTINT+38) /* Repetitive Interrupt Timer */
+#define LPC54_IRQ_SPIFI (LPC54_IRQ_EXTINT+39) /* SPI flash interface */
+#define LPC54_IRQ_FLEXCOMM8 (LPC54_IRQ_EXTINT+40) /* Flexcomm Interface 8 (USART, SPI, I2C) */
+#define LPC54_IRQ_FLEXCOMM9 (LPC54_IRQ_EXTINT+41) /* Flexcomm Interface 9 (USART, SPI, I2C) */
+#define LPC54_IRQ_SDMMC (LPC54_IRQ_EXTINT+42) /* SD/MMC interrupt */
+#define LPC54_IRQ_CAN0IRQ0 (LPC54_IRQ_EXTINT+43) /* CAN0 interrupt 0 */
+#define LPC54_IRQ_CAN0IRQ1 (LPC54_IRQ_EXTINT+44) /* CAN0 interrupt 1 */
+#define LPC54_IRQ_CAN1IRQ0 (LPC54_IRQ_EXTINT+45) /* CAN1 interrupt 0 */
+#define LPC54_IRQ_CAN1IRQ1 (LPC54_IRQ_EXTINT+46) /* CAN1 interrupt 1 */
+#define LPC54_IRQ_USB1 (LPC54_IRQ_EXTINT+47) /* USB1 interrupt */
+#define LPC54_IRQ_USB1NEEDCLK (LPC54_IRQ_EXTINT+48) /* USB1 activity */
+#define LPC54_IRQ_ETHERNET (LPC54_IRQ_EXTINT+49) /* Ethernet */
+#define LPC54_IRQ_ETHERNETPMT (LPC54_IRQ_EXTINT+50) /* Ethernet power management interrupt */
+#define LPC54_IRQ_ETHERNETMACLP (LPC54_IRQ_EXTINT+51) /* Ethernet MAC interrupt */
+#define LPC54_IRQ_EEPROM (LPC54_IRQ_EXTINT+52) /* EEPROM interrupt */
+#define LPC54_IRQ_LCD (LPC54_IRQ_EXTINT+53) /* LCD interrupt */
+#define LPC54_IRQ_SHA (LPC54_IRQ_EXTINT+54) /* SHA interrupt */
+#define LPC54_IRQ_SMARTCARD0 (LPC54_IRQ_EXTINT+55) /* Smart card 0 interrupt */
+#define LPC54_IRQ_SMARTCARD1 (LPC54_IRQ_EXTINT+56) /* Smart card 1 interrupt */
+
+#define LPC54_IRQ_NEXTINT (57)
+#define LPC54_IRQ_NIRQS (LPC54_IRQ_EXTINT+LPC54_IRQ_NEXTINT)
+
+/* Total number of IRQ numbers */
+
+#define NR_VECTORS LPC54_IRQ_NIRQS
+#define NR_IRQS LPC54_IRQ_NIRQS
+
+#endif /* __ARCH_ARM_INCLUDE_LPC54XX_LPC543X_IRQ_H */
diff --git a/arch/arm/include/stm32/chip.h b/arch/arm/include/stm32/chip.h
index d8de19a4419235dc3bb19b295bb36aa58d68338f..0c197549c99a592ddf523a5b767c017939dc7784 100644
--- a/arch/arm/include/stm32/chip.h
+++ b/arch/arm/include/stm32/chip.h
@@ -1689,21 +1689,21 @@
* (3) 16-bit general timers count-up timers with DMA: TIM15-17 */
# define STM32_NGTIMNDMA 0 /* All timers have DMA */
# define STM32_NBTIM 2 /* (2) Basic timers: TIM6 and TIM7 */
-# define STM32_NDMA 1 /* (2) DMA1 (7 channels) */
-# define STM32_NSPI 1 /* (3) SPI1 */
-# define STM32_NI2S 0 /* (0) I2S1 */
+# define STM32_NDMA 1 /* (1) DMA1 (7 channels) */
+# define STM32_NSPI 1 /* (1) SPI1 */
+# define STM32_NI2S 0 /* (0) No I2S1 */
# define STM32_NUSART 2 /* (2) USART1-2 */
-# define STM32_NI2C 1 /* (2) I2C1 */
+# define STM32_NI2C 1 /* (1) I2C1 */
# define STM32_NCAN 1 /* (1) CAN1 */
# define STM32_NSDIO 0 /* (0) No SDIO */
# define STM32_NLCD 0 /* (0) No LCD */
# define STM32_NUSBOTG 0 /* (0) No USB */
# define STM32_NGPIO 25 /* GPIOA-F */
-# define STM32_NADC 2 /* (3) 12-bit ADC1-2 */
-# define STM32_NDAC 3 /* (2) 12-bit DAC1 CH1/CH2 and DAC2 CH1 */
+# define STM32_NADC 2 /* (2) 12-bit ADC1-2 */
+# define STM32_NDAC 3 /* (3) 12-bit DAC1 CH1/CH2 and DAC2 CH1 */
# define STM32_NCMP 2 /* (2) Ultra-fast analog comparators: COMP2 and COMP4 */
# define STM32_NPGA 1 /* (1) Operational amplifiers: OPAMP */
-# define STM32_NCAPSENSE 14 /* (14) No capacitive sensing channels */
+# define STM32_NCAPSENSE 14 /* (14) Capacitive sensing channels */
# define STM32_NCRC 1 /* (1) CRC calculation unit */
# define STM32_NETHERNET 0 /* (0) No Ethernet MAC */
# define STM32_NRNG 0 /* (0) No random number generator (RNG) */
@@ -1733,21 +1733,21 @@
* (3) 16-bit general timers count-up timers with DMA: TIM15-17 */
# define STM32_NGTIMNDMA 0 /* All timers have DMA */
# define STM32_NBTIM 2 /* (2) Basic timers: TIM6 and TIM7 */
-# define STM32_NDMA 1 /* (2) DMA1 (7 channels) */
-# define STM32_NSPI 1 /* (3) SPI1 */
-# define STM32_NI2S 0 /* (0) I2S1 */
-# define STM32_NUSART 3 /* (2) USART1-3 */
-# define STM32_NI2C 1 /* (2) I2C1 */
+# define STM32_NDMA 1 /* (1) DMA1 (7 channels) */
+# define STM32_NSPI 1 /* (1) SPI1 */
+# define STM32_NI2S 0 /* (0) No I2S1 */
+# define STM32_NUSART 3 /* (3) USART1-3 */
+# define STM32_NI2C 1 /* (1) I2C1 */
# define STM32_NCAN 1 /* (1) CAN1 */
# define STM32_NSDIO 0 /* (0) No SDIO */
# define STM32_NLCD 0 /* (0) No LCD */
# define STM32_NUSBOTG 0 /* (0) No USB */
# define STM32_NGPIO 37 /* GPIOA-F */
-# define STM32_NADC 3 /* (3) 12-bit ADC1-3 */
-# define STM32_NDAC 3 /* (2) 12-bit DAC1 CH1/CH2 and DAC2 CH1 */
+# define STM32_NADC 2 /* (2) 12-bit ADC1-2 */
+# define STM32_NDAC 3 /* (3) 12-bit DAC1 CH1/CH2 and DAC2 CH1 */
# define STM32_NCMP 3 /* (3) Ultra-fast analog comparators: COMP2, COMP4 and COMP6 */
# define STM32_NPGA 1 /* (1) Operational amplifiers: OPAMP */
-# define STM32_NCAPSENSE 17 /* (17) No capacitive sensing channels */
+# define STM32_NCAPSENSE 17 /* (17) Capacitive sensing channels */
# define STM32_NCRC 1 /* (1) CRC calculation unit */
# define STM32_NETHERNET 0 /* (0) No Ethernet MAC */
# define STM32_NRNG 0 /* (0) No random number generator (RNG) */
@@ -1777,21 +1777,21 @@
* (3) 16-bit general timers count-up timers with DMA: TIM15-17 */
# define STM32_NGTIMNDMA 0 /* All timers have DMA */
# define STM32_NBTIM 2 /* (2) Basic timers: TIM6 and TIM7 */
-# define STM32_NDMA 1 /* (2) DMA1 (7 channels) */
-# define STM32_NSPI 1 /* (3) SPI1 */
-# define STM32_NI2S 0 /* (0) I2S1 */
-# define STM32_NUSART 3 /* (2) USART1-3 */
-# define STM32_NI2C 1 /* (2) I2C1 */
+# define STM32_NDMA 1 /* (1) DMA1 (7 channels) */
+# define STM32_NSPI 1 /* (1) SPI1 */
+# define STM32_NI2S 0 /* (0) No I2S1 */
+# define STM32_NUSART 3 /* (3) USART1-3 */
+# define STM32_NI2C 1 /* (1) I2C1 */
# define STM32_NCAN 1 /* (1) CAN1 */
# define STM32_NSDIO 0 /* (0) No SDIO */
# define STM32_NLCD 0 /* (0) No LCD */
# define STM32_NUSBOTG 0 /* (0) No USB */
# define STM32_NGPIO 51 /* GPIOA-F */
-# define STM32_NADC 3 /* (3) 12-bit ADC1-3 */
-# define STM32_NDAC 3 /* (2) 12-bit DAC1 CH1/CH2 and DAC2 CH1 */
+# define STM32_NADC 2 /* (2) 12-bit ADC1-2 */
+# define STM32_NDAC 3 /* (3) 12-bit DAC1 CH1/CH2 and DAC2 CH1 */
# define STM32_NCMP 3 /* (3) Ultra-fast analog comparators: COMP2, COMP4 and COMP6 */
# define STM32_NPGA 1 /* (1) Operational amplifiers: OPAMP */
-# define STM32_NCAPSENSE 18 /* (18) No capacitive sensing channels */
+# define STM32_NCAPSENSE 18 /* (18) Capacitive sensing channels */
# define STM32_NCRC 1 /* (1) CRC calculation unit */
# define STM32_NETHERNET 0 /* (0) No Ethernet MAC */
# define STM32_NRNG 0 /* (0) No random number generator (RNG) */
diff --git a/arch/arm/include/stm32/dma2d.h b/arch/arm/include/stm32/dma2d.h
deleted file mode 100644
index be807de31dca8b917cad700529c7d6da46568c57..0000000000000000000000000000000000000000
--- a/arch/arm/include/stm32/dma2d.h
+++ /dev/null
@@ -1,415 +0,0 @@
-/****************************************************************************
- * arch/arm/include/stm32/dma2d.h
- *
- * Copyright (C) 2015 Marco Krahl. All rights reserved.
- * Author: Marco Krahl
- *
- * 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_STM32_DMA2D_H
-#define __ARCH_ARM_INCLUDE_STM32_DMA2D_H
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include
-#include
-#include
-
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-
-/****************************************************************************
- * Public Types
- ****************************************************************************/
-
-struct ltdc_area_s; /* see arch/chip/ltdc.h */
-
-/* Blend mode definitions */
-
-enum dma2d_blend_e
-{
- DMA2D_BLEND_NONE = 0, /* Disable all blend operation */
- DMA2D_BLEND_ALPHA = 0x1, /* Enable alpha blending */
- DMA2D_BLEND_PIXELALPHA = 0x2, /* Enable alpha blending from pixel color */
-};
-
-/* The layer is controlled through the following structure */
-
-struct dma2d_layer_s
-{
- /* Name: getvideoinfo
- *
- * Description:
- * Get video information about the layer
- *
- * Parameter:
- * layer - Reference to the layer control structure
- * vinfo - Reference to the video info structure
- *
- * Return:
- * On success - OK
- * On error - -EINVAL
- */
-
- int (*getvideoinfo)(FAR struct dma2d_layer_s *layer,
- FAR struct fb_videoinfo_s *vinfo);
-
- /* Name: getplaneinfo
- *
- * Description:
- * Get plane information about the layer
- *
- * Parameter:
- * layer - Reference to the layer control structure
- * planeno - Number of the plane
- * pinfo - Reference to the plane info structure
- *
- * Return:
- * On success - OK
- * On error - -EINVAL
- */
-
- int (*getplaneinfo)(FAR struct dma2d_layer_s *layer, int planeno,
- FAR struct fb_planeinfo_s *pinfo);
-
- /* Name: getlid
- *
- * Description:
- * Get a specific layer identifier.
- *
- * Parameter:
- * layer - Reference to the layer structure
- * lid - Reference to store the layer id
- *
- * Return:
- * On success - OK
- * On error - -EINVAL
- */
-
- int (*getlid)(FAR struct dma2d_layer_s *layer, int *lid);
-
-#ifdef CONFIG_STM32_DMA2D_L8
- /* Name: setclut
- *
- * Description:
- * Configure layer clut (color lookup table).
- * Non clut is defined during initializing.
- *
- * Parameter:
- * layer - Reference to the layer structure
- * cmap - color lookup table with up the 256 entries
- *
- * Return:
- * On success - OK
- * On error - -EINVAL
- */
-
- int (*setclut)(FAR struct dma2d_layer_s *layer,
- const FAR struct fb_cmap_s *cmap);
-
- /* Name: getclut
- *
- * Description:
- * Get configured layer clut (color lookup table).
- *
- * Parameter:
- * layer - Reference to the layer structure
- * cmap - Reference to valid color lookup table accept up the 256 color
- * entries
- *
- * Return:
- * On success - OK
- * On error - -EINVAL
- */
-
- int (*getclut)(FAR struct dma2d_layer_s *layer, FAR struct fb_cmap_s *cmap);
-#endif
-
- /* Name: setalpha
- *
- * Description:
- * Configure layer alpha value factor into blend operation.
- * During the layer blend operation the source alpha value is multiplied
- * with this alpha value. If the source color format doesn't support alpha
- * channel (e.g. non ARGB8888) this alpha value will be used as constant
- * alpha value for blend operation.
- * Default value during initializing: 0xff
- *
- * Parameter:
- * layer - Reference to the layer structure
- * alpha - Alpha value
- *
- * Return:
- * On success - OK
- * On error - -EINVAL
- */
-
- int (*setalpha)(FAR struct dma2d_layer_s *layer, uint8_t alpha);
-
- /* Name: getalpha
- *
- * Description:
- * Get configured layer alpha value factor for blend operation.
- *
- * Parameter:
- * layer - Reference to the layer structure
- * alpha - Reference to store the alpha value
- *
- * Return:
- * On success - OK
- * On error - -EINVAL
- */
-
- int (*getalpha)(FAR struct dma2d_layer_s *layer, uint8_t *alpha);
-
- /* Name: setblendmode
- *
- * Description:
- * Configure blend mode of the layer.
- * Default mode during initializing: DMA2D_BLEND_NONE
- * Blendmode is active after next update.
- *
- * Parameter:
- * layer - Reference to the layer structure
- * mode - Blend mode (see DMA2D_BLEND_*)
- *
- * Return:
- * On success - OK
- * On error - -EINVAL
- *
- * Procedure information:
- * DMA2D_BLEND_NONE:
- * Informs the driver to disable all blend operation for the given layer.
- * That means the layer is opaque.
- *
- * DMA2D_BLEND_ALPHA:
- * Informs the driver to enable alpha blending for the given layer.
- *
- * DMA2D_BLEND_PIXELALPHA:
- * Informs the driver to use the pixel alpha value of the layer instead
- * the constant alpha value. This is only useful for ARGB8888
- * color format.
- */
-
- int (*setblendmode)(FAR struct dma2d_layer_s *layer, uint32_t mode);
-
- /* Name: getblendmode
- *
- * Description:
- * Get configured blend mode of the layer.
- *
- * Parameter:
- * layer - Reference to the layer structure
- * mode - Reference to store the blend mode
- *
- * Return:
- * On success - OK
- * On error - -EINVAL
- */
-
- int (*getblendmode)(FAR struct dma2d_layer_s *layer, uint32_t *mode);
-
- /* Name: blit
- *
- * Description:
- * Copy selected area from a source layer to selected position of the
- * destination layer.
- *
- * Parameter:
- * dest - Reference to the destination layer
- * destxpos - Selected x target position of the destination layer
- * destypos - Selected y target position of the destination layer
- * src - Reference to the source layer
- * srcarea - Reference to the selected area of the source layer
- *
- * Return:
- * OK - On success
- * -EINVAL - If one of the parameter invalid or if the size of the
- * selected source area outside the visible area of the
- * destination layer. (The visible area usually represents the
- * display size)
- * -ECANCELED - Operation cancelled, something goes wrong.
- */
-
- int (*blit)(FAR struct dma2d_layer_s *dest,
- fb_coord_t destxpos, fb_coord_t destypos,
- FAR const struct dma2d_layer_s *src,
- FAR const struct ltdc_area_s *srcarea);
-
- /* Name: blend
- *
- * Description:
- * Blends the selected area from a background layer with selected position
- * of the foreground layer. Copies the result to the selected position of
- * the destination layer. Note! The content of the foreground and background
- * layer keeps unchanged as long destination layer is unequal to the
- * foreground and background layer.
- *
- * Parameter:
- * dest - Reference to the destination layer
- * fore - Reference to the foreground layer
- * forexpos - Selected x target position of the foreground layer
- * foreypos - Selected y target position of the foreground layer
- * back - Reference to the background layer
- * backarea - Reference to the selected area of the background layer
- *
- * Return:
- * OK - On success
- * -EINVAL - If one of the parameter invalid or if the size of the
- * selected source area outside the visible area of the
- * destination layer. (The visible area usually represents the
- * display size)
- * -ECANCELED - Operation cancelled, something goes wrong.
- */
-
- int (*blend)(FAR struct dma2d_layer_s *dest,
- fb_coord_t destxpos, fb_coord_t destypos,
- FAR const struct dma2d_layer_s *fore,
- fb_coord_t forexpos, fb_coord_t foreypos,
- FAR const struct dma2d_layer_s *back,
- FAR const struct ltdc_area_s *backarea);
-
- /* Name: fillarea
- *
- * Description:
- * Fill the selected area of the whole layer with a specific color.
- *
- * Parameter:
- * layer - Reference to the layer structure
- * area - Reference to the valid area structure select the area
- * color - Color to fill the selected area. Color must be formatted
- * according to the layer pixel format.
- *
- * Return:
- * OK - On success
- * -EINVAL - If one of the parameter invalid or if the size of the
- * selected area outside the visible area of the layer.
- * -ECANCELED - Operation cancelled, something goes wrong.
- */
-
- int (*fillarea)(FAR struct dma2d_layer_s *layer,
- FAR const struct ltdc_area_s *area,
- uint32_t color);
-};
-
-/****************************************************************************
- * Public Data
- ****************************************************************************/
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: up_dma2dgetlayer
- *
- * Description:
- * Get a dma2d layer structure by the layer identifier
- *
- * Parameter:
- * lid - Layer identifier
- *
- * Return:
- * Reference to the dma2d layer control structure on success or Null if no
- * related exist.
- *
- ****************************************************************************/
-
-FAR struct dma2d_layer_s *up_dma2dgetlayer(int lid);
-
-/****************************************************************************
- * Name: up_dma2dcreatelayer
- *
- * Description:
- * Create a new dma2d layer object to interact with the dma2d controller
- *
- * Parameter:
- * width - Layer width
- * height - Layer height
- * fmt - Pixel format of the layer
- *
- * Return:
- * On success - A valid dma2d layer reference
- * On error - NULL and errno is set to
- * -EINVAL if one of the parameter is invalid
- * -ENOMEM if no memory available or exceeds
- * CONFIG_STM32_DMA2D_NLAYERS
- *
- ****************************************************************************/
-
-FAR struct dma2d_layer_s *up_dma2dcreatelayer(fb_coord_t width,
- fb_coord_t height,
- uint8_t fmt);
-
-/****************************************************************************
- * Name: up_dma2dremovelayer
- *
- * Description:
- * Remove and deallocate the dma2d layer
- *
- * Parameter:
- * layer - Reference to the layer to remove
- *
- * Return:
- * On success - OK
- * On error - -EINVAL
- *
- ****************************************************************************/
-
-int up_dma2dremovelayer(FAR struct dma2d_layer_s *layer);
-
-/****************************************************************************
- * Name: up_dma2dinitialize
- *
- * Description:
- * Initialize the dma2d controller
- *
- * Return:
- * OK - On success
- * An error if initializing failed.
- *
- ****************************************************************************/
-
-int up_dma2dinitialize(void);
-
-/****************************************************************************
- * Name: up_dma2duninitialize
- *
- * Description:
- * Uninitialize the dma2d controller
- *
- ****************************************************************************/
-
-void up_dma2duninitialize(void);
-
-#endif /* __ARCH_ARM_INCLUDE_STM32_DMA2D_H */
diff --git a/arch/arm/include/stm32/ltdc.h b/arch/arm/include/stm32/ltdc.h
deleted file mode 100644
index c561c680cd6262e5c8c24ea0841c5fc3e2037072..0000000000000000000000000000000000000000
--- a/arch/arm/include/stm32/ltdc.h
+++ /dev/null
@@ -1,592 +0,0 @@
-/****************************************************************************
- * arch/arm/include/stm32/ltdc.h
- *
- * Copyright (C) 2014-2015 Marco Krahl. All rights reserved.
- * Author: Marco Krahl
- *
- * 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_STM32_LTDC_H
-#define __ARCH_ARM_INCLUDE_STM32_LTDC_H
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include
-#include
-#include
-
-#ifdef CONFIG_STM32_LTDC
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-
-/****************************************************************************
- * Public Types
- ****************************************************************************/
-
-struct dma2d_layer_s; /* see arch/chip/dma2d.h */
-
-/* Blend mode definitions */
-
-enum ltdc_blend_e
-{
- LTDC_BLEND_NONE = 0, /* Disable all blend operation */
- LTDC_BLEND_ALPHA = 0x1, /* Enable alpha blending */
- LTDC_BLEND_PIXELALPHA = 0x2, /* Enable alpha blending from pixel color */
- LTDC_BLEND_COLORKEY = 0x4, /* Enable colorkey */
- LTDC_BLEND_ALPHAINV = 0x8, /* Inverse alpha blending of source */
- LTDC_BLEND_PIXELALPHAINV = 0x10 /* Invers pixel alpha blending of source */
-};
-
-/* layer control definitions */
-
-enum ltdc_layer_e
-{
- LTDC_LAYER_OWN = 0, /* The given layer */
- LTDC_LAYER_TOP = 0x1, /* The initialized top layer */
- LTDC_LAYER_BOTTOM = 0x2, /* the initialized bottom layer */
- LTDC_LAYER_ACTIVE = 0x4, /* The current visible flip layer */
- LTDC_LAYER_INACTIVE = 0x8 /* The current invisible flip layer */
-#ifdef CONFIG_STM32_DMA2D
- ,LTDC_LAYER_DMA2D = 0x10 /* The dma2d interface layer id */
-#endif
-};
-
-/* Update operation flag */
-
-enum ltdc_update_e
-{
- LTDC_UPDATE_NONE = 0, /* Update given layer only */
- LTDC_UPDATE_SIM = 0x1, /* Update both layer simultaneous */
- LTDC_UPDATE_FLIP = 0x2, /* Perform flip operation */
- LTDC_UPDATE_ACTIVATE = 0x4 /* Set the given layer to the active layer */
-};
-
-/* sync mode definitions */
-
-enum ltdc_sync_e
-{
- LTDC_SYNC_NONE = 0, /* Immediately */
- LTDC_SYNC_VBLANK = 0x100, /* Upon vertical sync */
- LTDC_SYNC_WAIT = 0x200 /* Waits upon vertical sync */
-};
-
-/* Definition of the visible layer position and size */
-
-struct ltdc_area_s
-{
- fb_coord_t xpos; /* X position in pixel */
- fb_coord_t ypos; /* Y position in pixel */
- fb_coord_t xres; /* X resolution in pixel */
- fb_coord_t yres; /* Y resolution in pixel */
-};
-
-/* The layer is controlled through the following structure */
-
-struct ltdc_layer_s
-{
-
- /*
- * Name: getvideoinfo
- *
- * Description:
- * Get video information about the layer
- *
- * Parameter:
- * layer - Reference to the layer control structure
- * vinfo - Reference to the video info structure
- *
- * Return:
- * On success - OK
- * On error - -EINVAL
- *
- */
- int (*getvideoinfo)(FAR struct ltdc_layer_s *layer,
- FAR struct fb_videoinfo_s *vinfo);
-
- /*
- * Name: getplaneinfo
- *
- * Description:
- * Get plane information about the layer
- *
- * Parameter:
- * layer - Reference to the layer control structure
- * planeno - Number of the plane
- * pinfo - Reference to the plane info structure
- *
- * Return:
- * On success - OK
- * On error - -EINVAL
- *
- */
- int (*getplaneinfo)(FAR struct ltdc_layer_s *layer, int planeno,
- FAR struct fb_planeinfo_s *pinfo);
-
- /*
- * Name: getlid
- *
- * Description:
- * Get a specific layer identifier.
- *
- * Parameter:
- * layer - Reference to the layer structure
- * lid - Reference to store the layer id
- * flag - Operation flag describe the layer identifier
- * e.g. get the current active or inactive layer.
- * See LTDC_LAYER_* for possible values
- *
- * Return:
- * On success - OK
- * On error - -EINVAL
- *
- */
- int (*getlid)(FAR struct ltdc_layer_s *layer, int *lid, uint32_t flag);
-
-#ifdef CONFIG_FB_CMAP
- /*
- * Name: setclut
- *
- * Description:
- * Configure layer clut (color lookup table).
- * Non clut is defined during initializing.
- * Clut is active during next vertical blank period. Do not need an update.
- *
- * Parameter:
- * layer - Reference to the layer structure
- * cmap - color lookup table with up the 256 entries
- * enable - Enable or disable clut support (if false cmap is ignored and can
- * be NULL)
- *
- * Return:
- * On success - OK
- * On error - -EINVAL
- *
- */
- int (*setclut)(FAR struct ltdc_layer_s *layer,
- const FAR struct fb_cmap_s *cmap);
-
- /*
- * Name: getclut
- *
- * Description:
- * Get configured layer clut (color lookup table).
- *
- * Parameter:
- * layer - Reference to the layer structure
- * cmap - Reference to valid color lookup table accept up the 256 color
- * entries
- *
- * Return:
- * On success - OK
- * On error - -EINVAL
- *
- */
- int (*getclut)(FAR struct ltdc_layer_s *layer, FAR struct fb_cmap_s *cmap);
-#endif
-
- /*
- * Name: setcolor
- *
- * Description:
- * Configure layer color for the non active layer area.
- * Default value during initializing: 0x00000000
- * Color is active after next update.
- *
- * Parameter:
- * layer - Reference to the layer structure
- * argb - ARGB8888 color value
- *
- * Return:
- * On success - OK
- * On error - -EINVAL
- *
- */
- int (*setcolor)(FAR struct ltdc_layer_s *layer, uint32_t argb);
-
- /*
- * Name: getcolor
- *
- * Description:
- * Get configured layer color for the non active layer area.
- *
- * Parameter:
- * layer - Reference to the layer structure
- * argb - Reference to store the ARGB8888 color value
- *
- * Return:
- * On success - OK
- * On error - -EINVAL
- *
- */
- int (*getcolor)(FAR struct ltdc_layer_s *layer, uint32_t *argb);
-
- /*
- * Name: setcolorkey
- *
- * Description:
- * Configure the layer color key (chromakey) for transparence.
- * Default value during initializing: 0x00000000
- * Colorkey is active after next update.
- *
- * Parameter:
- * layer - Reference to the layer structure
- * rgb - RGB888 color key
- *
- * Return:
- * On success - OK
- * On error - -EINVAL
- *
- */
- int (*setcolorkey)(FAR struct ltdc_layer_s *layer, uint32_t rgb);
-
- /*
- * Name: getcolorkey
- *
- * Description:
- * Get the configured layer color key (chromakey) for transparence.
- *
- * Parameter:
- * layer - Reference to the layer structure
- * rgb - Reference to store the RGB888 color key
- *
- * Return:
- * On success - OK
- * On error - -EINVAL
- *
- */
- int (*getcolorkey)(FAR struct ltdc_layer_s *layer, uint32_t *rgb);
-
- /*
- * Name: setalpha
- *
- * Description:
- * Configure layer alpha value factor into blend operation.
- * During the layer blend operation the source alpha value is multiplied
- * with this alpha value. If the source color format doesn't support alpha
- * channel (e.g. non ARGB8888) this alpha value will be used as constant
- * alpha value for blend operation.
- * Default value during initializing: 0xff
- * Alpha is active after next update.
- *
- * Parameter:
- * layer - Reference to the layer structure
- * alpha - Alpha value
- *
- * Return:
- * On success - OK
- * On error - -EINVAL
- *
- */
- int (*setalpha)(FAR struct ltdc_layer_s *layer, uint8_t alpha);
-
- /*
- * Name: getalpha
- *
- * Description:
- * Get configured layer alpha value factor for blend operation.
- *
- * Parameter:
- * layer - Reference to the layer structure
- * alpha - Reference to store the alpha value
- *
- * Return:
- * On success - OK
- * On error - -EINVAL
- *
- */
- int (*getalpha)(FAR struct ltdc_layer_s *layer, uint8_t *alpha);
-
- /*
- * Name: setblendmode
- *
- * Description:
- * Configure blend mode of the layer.
- * Default mode during initializing: LTDC_BLEND_NONE
- * Blendmode is active after next update.
- *
- * Parameter:
- * layer - Reference to the layer structure
- * mode - Blend mode (see LTDC_BLEND_*)
- *
- * Return:
- * On success - OK
- * On error - -EINVAL
- *
- * Procedure information:
- * LTDC_BLEND_NONE:
- * Informs the driver to disable all blend operation for the given layer.
- * That means the layer is opaque. Note this has no effect on the
- * colorkey settings.
- *
- * LTDC_BLEND_ALPHA:
- * Informs the driver to enable alpha blending for the given layer.
- *
- * LTDC_BLEND_COLORKEY:
- * Informs the driver to enable colorkeying for the given layer.
- *
- * LTDC_BLEND_SRCPIXELALPHA:
- * Informs the driver to use the pixel alpha value of the layer instead
- * the constant alpha value. This is only useful for ARGB8888
- * color format.
- *
- * LTDC_BLEND_DESTPIXELALPHA:
- * Informs the driver to use the pixel alpha value of the subjacent layer
- * instead the constant alpha value. This is only useful for ARGB8888
- * color format.
- *
- */
- int (*setblendmode)(FAR struct ltdc_layer_s *layer, uint32_t mode);
-
- /*
- * Name: getblendmode
- *
- * Description:
- * Get configured blend mode of the layer.
- *
- * Parameter:
- * layer - Reference to the layer structure
- * mode - Reference to store the blend mode
- *
- * Return:
- * On success - OK
- * On error - -EINVAL
- *
- */
- int (*getblendmode)(FAR struct ltdc_layer_s *layer, uint32_t *mode);
-
- /*
- * Name: setarea
- *
- * Description:
- * Configure visible layer area and the reference position of the first
- * pixel of the whole layer which is the first visible top left pixel in
- * the active area.
- * Default value during initializing:
- * xpos = 0
- * ypos = 0
- * xres = display x resolution
- * yres = display y resolution
- *
- * Area is active after next update.
- *
- * Parameter:
- * layer - Reference to the layer control structure
- * area - Reference to the valid area structure for the new active area
- * srcxpos - x position of the visible pixel of the whole layer
- * srcypos - y position of the visible pixel of the whole layer
- *
- * Return:
- * On success - OK
- * On error - -EINVAL
- *
- * Procedure Information:
- * If the srcxpos and srcypos unequal the xpos and ypos of the coord
- * structure this acts like moving the visible area to another position on
- * the screen during the next update operation.
- *
- */
- int (*setarea)(FAR struct ltdc_layer_s *layer,
- FAR const struct ltdc_area_s *area,
- fb_coord_t srcxpos,
- fb_coord_t srcypos);
-
- /*
- * Name: getarea
- *
- * Description:
- * Get configured visible layer area.
- *
- * Parameter:
- * layer - Reference to the layer control structure
- * area - Reference to the area structure to store the active area
- * srcxpos - Reference to store the referenced x position of the whole layer
- * srcypos - Reference to store the reterenced y position of the whole layer
- *
- * Return:
- * On success - OK
- * On error - -EINVAL
- *
- */
- int (*getarea)(FAR struct ltdc_layer_s *layer,
- FAR struct ltdc_area_s *area,
- fb_coord_t *srcxpos,
- fb_coord_t *srcypos);
-
- /*
- * Name: update
- *
- * Description:
- * Update current layer settings and make changes visible.
- *
- * Parameter:
- * layer - Reference to the layer structure
- * mode - operation mode (see LTDC_UPDATE_*)
- *
- * Return:
- * OK - On success
- * -EINVAL - If one of the parameter invalid
- * -ECANCELED - Operation cancelled, something goes wrong
- *
- * Procedure information:
- * LTDC_UPDATE_SIM:
- * Informs the driver to update both ltdc layers simultaneously. Otherwise
- * update the given layer only.
- *
- * LTDC_UPDATE_FLIP:
- * Informs the driver to perform a flip operation.
- * This only effects the ltdc layer 1 and 2 and can be useful for double
- * buffering. Each flip operation changed the active layer ot the inactive
- * and vice versa. In the context of the ltdc that means, the inactive layer
- * is complete disabled. So the subjacent layer is the background layer
- * (background color). To reactivate both layer and their settings perform
- * an update without LTDC_UPDATE_FLIP flag.
- *
- * LTDC_UPDATE_ACTIVATE:
- * Informs the driver that the given layer should be the active layer when
- * the operation is complete.
- *
- * LTDC_SYNC_VBLANK:
- * Informs the driver to update the layer upon vertical blank. Otherwise
- * immediately.
- *
- */
- int (*update)(FAR struct ltdc_layer_s *layer, uint32_t mode);
-
-#ifdef CONFIG_STM32_DMA2D
- /*
- * Name: blit
- *
- * Description:
- * Copy selected area from a source layer to selected position of the
- * destination layer.
- *
- * Parameter:
- * dest - Reference to the destination layer
- * destxpos - Selected x position of the destination layer
- * destypos - Selected y position of the destination layer
- * src - Reference to the source layer
- * srcarea - Reference to the selected area of the source layer
- *
- * Return:
- * OK - On success
- * -EINVAL - If one of the parameter invalid or if the size of the selected
- * source area outside the visible area of the destination layer.
- * (The visible area usually represents the display size)
- *
- */
- int (*blit)(FAR struct ltdc_layer_s *dest,
- fb_coord_t destxpos, fb_coord_t destypos,
- FAR const struct dma2d_layer_s *src,
- FAR const struct ltdc_area_s *srcarea);
- /*
- *
- * Name: blend
- *
- * Description:
- * Blends the selected area from a foreground layer with selected position
- * of the background layer. Copy the result to the destination layer. Note!
- * The content of the foreground and background layer is not changed.
- *
- * Parameter:
- * dest - Reference to the destination layer
- * destxpos - Selected x position of the destination layer
- * destypos - Selected y position of the destination layer
- * fore - Reference to the foreground layer
- * forexpos - Selected x position of the foreground layer
- * foreypos - Selected y position of the foreground layer
- * back - Reference to the background layer
- * backarea - Reference to the selected area of the background layer
- *
- * Return:
- * OK - On success
- * -EINVAL - If one of the parameter invalid or if the size of the selected
- * source area outside the visible area of the destination layer.
- * (The visible area usually represents the display size)
- *
- */
- int (*blend)(FAR struct ltdc_layer_s *dest,
- fb_coord_t destxpos, fb_coord_t destypos,
- FAR const struct dma2d_layer_s *fore,
- fb_coord_t forexpos, fb_coord_t foreypos,
- FAR const struct dma2d_layer_s *back,
- FAR const struct ltdc_area_s *backarea);
-
- /*
- * Name: fillarea
- *
- * Description:
- * Fill the selected area of the whole layer with a specific color.
- *
- * Parameter:
- * layer - Reference to the layer structure
- * area - Reference to the valid area structure select the area
- * color - Color to fill the selected area. Color must be formatted
- * according to the layer pixel format.
- *
- * Return:
- * OK - On success
- * -EINVAL - If one of the parameter invalid or if the size of the selected
- * area outside the visible area of the layer.
- *
- */
- int (*fillarea)(FAR struct ltdc_layer_s *layer,
- FAR const struct ltdc_area_s *area,
- uint32_t color);
-#endif
-};
-
-/****************************************************************************
- * Public Data
- ****************************************************************************/
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: up_ltdcgetlayer
- *
- * Description:
- * Get the ltdc layer structure to perform hardware layer operation
- *
- * Parameter:
- * lid - Layer identifier
- *
- * Return:
- * Reference to the layer control structure on success or Null if parameter
- * invalid.
- *
- ****************************************************************************/
-FAR struct ltdc_layer_s *up_ltdcgetlayer(int lid);
-#endif /* CONFIG_STM32_LTDC */
-#endif /* __ARCH_ARM_INCLUDE_STM32_LTDC_H */
diff --git a/arch/arm/include/stm32f7/chip.h b/arch/arm/include/stm32f7/chip.h
index 7246cb2a2d5d8e59ea4dde1e7e67f4768b41462d..5735683959451f8cad4e6afde803bdaca20ee8f3 100644
--- a/arch/arm/include/stm32f7/chip.h
+++ b/arch/arm/include/stm32f7/chip.h
@@ -1,9 +1,10 @@
/************************************************************************************
* arch/arm/include/stm32f7/chip.h
*
- * Copyright (C) 2015-2016 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2015-2017 Gregory Nutt. All rights reserved.
* Authors: Gregory Nutt
* David Sidrane
+ * Bob Feretich
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -46,13 +47,23 @@
/************************************************************************************
* Pre-processor Definitions
************************************************************************************/
-/* STM32F745xx, STM32F746xx, STM32F756xx, STM32F765xx, STM32F767xx, STM32F768xx,
+/* STM32F722xx, STM32F723xx,
+ * STM32F745xx, STM32F746xx, STM32F756xx, STM32F765xx, STM32F767xx, STM32F768xx,
* STM32F769xx, STM32F777xx and STM32F779xx Differences between family members:
*
* ----------- ---------------- ----- ---- ----- ---- ---- ---- ---- ---- ----- ----- ---- ------------ ------
* SPI ADC LCD
* PART PACKAGE GPIOs I2S CHAN TFT MIPI JPEG CAN ETH DFSDM CRYPTO FPU RAM L1
* ----------- ---------------- ----- ---- ----- ---- ---- ---- ---- ---- ----- ----- ---- ------------ ------
+ * STM32F722Rx LQFP64 50 3/3 16 No No No 1 No No No SFPU (176+16+64) 8+8
+ * STM32F722Vx LQFP100 82 4/3 16 No No No 1 No No No SFPU (176+16+64) 8+8
+ * STM32F722Zx LQFP144 114 5/3 24 No No No 1 No No No SFPU (176+16+64) 8+8
+ * STM32F722Ix UFBGA176/LQFP176 140 5/3 24 No No No 1 No No No SFPU (176+16+64) 8+8
+ *
+ * STM32F723Vx WLCSP100 79 4/3 16 No No No 1 No No No SFPU (176+16+64) 8+8
+ * STM32F723Zx UFBGA144/LQFP144 112 5/3 24 No No No 1 No No No SFPU (176+16+64) 8+8
+ * STM32F723Ix UFBGA176/LQFP176 138 5/3 24 No No No 1 No No No SFPU (176+16+64) 8+8
+ *
* STM32F745Vx LQFP100 82 4/3 16 No No No 2 Yes No No SFPU (240+16+64) 4+4
* STM32F745Zx WLCSP143/LQFP144 114 6/3 24 No No No 2 Yes No No SFPU (240+16+64) 4+4
* STM32F745Ix UFBGA176/LQFP176 140 6/3 24 No No No 2 Yes No No SFPU (240+16+64) 4+4
@@ -108,6 +119,8 @@
* STM32F779Ax WLCSP180 129 6/3 24 Yes Yes Yes 3 No Yes Yes DFPU (368+16+128) 16+16
* ----------- ---------------- ----- ---- ----- ---- ---- ---- ---- ---- ----- ----- ---- ------------ ------
*
+ * Parts STM32F72xxC & STM32F73xxC have 256Kb of FLASH
+ * Parts STM32F72xxE & STM32F73xxE have 512Kb of FLASH
* Parts STM32F74xxE have 512Kb of FLASH
* Parts STM32F74xxG have 1024Kb of FLASH
* Parts STM32F74xxI have 2048Kb of FLASH
@@ -116,7 +129,23 @@
* with CONFIG_STM32F7_FLASH_OVERRIDE_x
*
*/
-#if defined(CONFIG_ARCH_CHIP_STM32F745VG) || \
+#if defined(CONFIG_ARCH_CHIP_STM32F722RC) || \
+ defined(CONFIG_ARCH_CHIP_STM32F722RE) || \
+ defined(CONFIG_ARCH_CHIP_STM32F722VC) || \
+ defined(CONFIG_ARCH_CHIP_STM32F722VE) || \
+ defined(CONFIG_ARCH_CHIP_STM32F722ZC) || \
+ defined(CONFIG_ARCH_CHIP_STM32F722ZE) || \
+ defined(CONFIG_ARCH_CHIP_STM32F722IC) || \
+ defined(CONFIG_ARCH_CHIP_STM32F722IE) || \
+ defined(CONFIG_ARCH_CHIP_STM32F723RC) || \
+ defined(CONFIG_ARCH_CHIP_STM32F723RE) || \
+ defined(CONFIG_ARCH_CHIP_STM32F723VC) || \
+ defined(CONFIG_ARCH_CHIP_STM32F723VE) || \
+ defined(CONFIG_ARCH_CHIP_STM32F723ZC) || \
+ defined(CONFIG_ARCH_CHIP_STM32F723ZE) || \
+ defined(CONFIG_ARCH_CHIP_STM32F723IC) || \
+ defined(CONFIG_ARCH_CHIP_STM32F723IE) || \
+ defined(CONFIG_ARCH_CHIP_STM32F745VG) || \
defined(CONFIG_ARCH_CHIP_STM32F745VE) || \
defined(CONFIG_ARCH_CHIP_STM32F745IG) || \
defined(CONFIG_ARCH_CHIP_STM32F745IE) || \
@@ -179,7 +208,20 @@
/* Size SRAM */
-#if defined(CONFIG_STM32F7_STM32F74XX) || defined(CONFIG_STM32F7_STM32F75XX)
+#if defined(CONFIG_STM32F7_STM32F72XX) || defined(CONFIG_STM32F7_STM32F73XX)
+# define STM32F7_SRAM1_SIZE (176*1024) /* 176Kb SRAM1 on AHB bus Matrix */
+# define STM32F7_SRAM2_SIZE (16*1024) /* 16Kb SRAM2 on AHB bus Matrix */
+# if defined(CONFIG_ARMV7M_HAVE_DTCM)
+# define STM32F7_DTCM_SRAM_SIZE (64*1024) /* 64Kb DTCM SRAM on TCM interface */
+# else
+# define STM32F7_DTCM_SRAM_SIZE (0) /* No DTCM SRAM on TCM interface */
+# endif
+# if defined(CONFIG_ARMV7M_HAVE_ITCM)
+# define STM32F7_ITCM_SRAM_SIZE (16*1024) /* 16Kb ITCM SRAM on TCM interface */
+# else
+# define STM32F7_ITCM_SRAM_SIZE (0) /* No ITCM SRAM on TCM interface */
+# endif
+#elif defined(CONFIG_STM32F7_STM32F74XX) || defined(CONFIG_STM32F7_STM32F75XX)
# define STM32F7_SRAM1_SIZE (240*1024) /* 240Kb SRAM1 on AHB bus Matrix */
# define STM32F7_SRAM2_SIZE (16*1024) /* 16Kb SRAM2 on AHB bus Matrix */
# if defined(CONFIG_ARMV7M_HAVE_DTCM)
@@ -209,6 +251,18 @@
# error STM32 F7 chip Family not identified
#endif
+/* Common to all Advanced (vs Foundation) Family members */
+
+#if defined(CONFIG_STM32F7_STM32F72XX) || defined(CONFIG_STM32F7_STM32F73XX)
+# define STM32F7_NSPDIFRX 0 /* Not supported */
+# define STM32F7_NGPIO 9 /* 9 GPIO ports, GPIOA-I */
+# define STM32F7_NI2C 3 /* I2C1-3 */
+#else
+# define STM32F7_NSPDIFRX 4 /* 4 SPDIFRX inputs */
+# define STM32F7_NGPIO 11 /* 11 GPIO ports, GPIOA-K */
+# define STM32F7_NI2C 4 /* I2C1-4 */
+#endif
+
/* Common to all Family members */
# define STM32F7_NATIM 2 /* Two advanced timers TIM1 and 8 */
@@ -219,14 +273,11 @@
# define STM32F7_NUART 4 /* UART 4-5 and 7-8 */
# define STM32F7_NUSART 4 /* USART1-3 and 6 */
# define STM32F7_NI2S 3 /* I2S1-2 (multiplexed with SPI1-3) */
-# define STM32F7_NI2C 4 /* I2C1-4 */
# define STM32F7_NUSBOTGFS 1 /* USB OTG FS */
# define STM32F7_NUSBOTGHS 1 /* USB OTG HS */
# define STM32F7_NSAI 2 /* SAI1-2 */
-# define STM32F7_NSPDIFRX 4 /* 4 SPDIFRX inputs */
# define STM32F7_NDMA 2 /* DMA1-2 */
-# define STM32F7_NGPIO 11 /* 11 GPIO ports, GPIOA-K */
-# define STM32F7_NADC 3 /* 12-bit ADC1-3, 24 channels *except V series) */
+# define STM32F7_NADC 3 /* 12-bit ADC1-3, number of channels vary */
# define STM32F7_NDAC 2 /* 12-bit DAC1-2 */
# define STM32F7_NCAPSENSE 0 /* No capacitive sensing channels */
# define STM32F7_NCRC 1 /* CRC */
@@ -258,11 +309,17 @@
#else
# define STM32F7_NRNG 0 /* No Random number generator (RNG) */
#endif
+
#if defined(CONFIG_STM32F7_HAVE_SPI5) && defined(CONFIG_STM32F7_HAVE_SPI6)
-# define STM32F7_NSPI 6 /* SPI1-6 (Except V series) */
-#else
+# define STM32F7_NSPI 6 /* SPI1-6 (Advanced Family Except V series) */
+#elif defined(CONFIG_STM32F7_HAVE_SPI5)
+# define STM32F7_NSPI 5 /* SPI1-5 (Foundation Family Except V & R series) */
+#elif defined(CONFIG_STM32F7_HAVE_SPI4)
# define STM32F7_NSPI 4 /* SPI1-4 V series */
+#else
+# define STM32F7_NSPI 3 /* SPI1-3 R series */
#endif
+
#if defined(CONFIG_STM32F7_HAVE_SDMMC2)
# define STM32F7_NSDMMC 2 /* 2 SDMMC interfaces */
#else
@@ -270,8 +327,10 @@
#endif
#if defined(CONFIG_STM32F7_HAVE_CAN3)
# define STM32F7_NCAN 3 /* CAN1-3 */
-#else
+#elif defined(CONFIG_STM32F7_HAVE_CAN2)
# define STM32F7_NCAN 2 /* CAN1-2 */
+#else
+# define STM32F7_NCAN 1 /* CAN1 only */
#endif
#if defined(CONFIG_STM32F7_HAVE_DCMI)
# define STM32F7_NDCMI 1 /* Digital camera interface (DCMI) */
@@ -288,10 +347,10 @@
#else
# define STM32F7_NLCDTFT 0 /* No LCD-TFT */
#endif
-#if defined(CONFIG_STM32F7_HAVE_DMA2D)
-# define STM32F7_NDMA2D 0 /* No DChrom-ART Acceleratorâ„¢ (DMA2D) */
-#else
+#if defined(CONFIG_STM32F7_HAVE_DMA2D) /* bf20171107 Swapped defines they were reversed. */
# define STM32F7_NDMA2D 1 /* DChrom-ART Acceleratorâ„¢ (DMA2D) */
+#else
+# define STM32F7_NDMA2D 0 /* No DChrom-ART Acceleratorâ„¢ (DMA2D) */
#endif
#if defined(CONFIG_STM32F7_HAVE_JPEG)
#define STM32F7_NJPEG 1 /* One JPEG Converter */
diff --git a/arch/arm/include/stm32f7/dma2d.h b/arch/arm/include/stm32f7/dma2d.h
deleted file mode 100755
index 0ebffb05f500b42aa6b179caac82318a8e42a51e..0000000000000000000000000000000000000000
--- a/arch/arm/include/stm32f7/dma2d.h
+++ /dev/null
@@ -1,415 +0,0 @@
-/****************************************************************************
- * arch/arm/include/stm32/dma2d.h
- *
- * Copyright (C) 2015 Marco Krahl. All rights reserved.
- * Author: Marco Krahl
- *
- * 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_STM32F7_DMA2D_H
-#define __ARCH_ARM_INCLUDE_STM32F7_DMA2D_H
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include
-#include
-#include
-
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-
-/****************************************************************************
- * Public Types
- ****************************************************************************/
-
-struct ltdc_area_s; /* see arch/chip/ltdc.h */
-
-/* Blend mode definitions */
-
-enum dma2d_blend_e
-{
- DMA2D_BLEND_NONE = 0, /* Disable all blend operation */
- DMA2D_BLEND_ALPHA = 0x1, /* Enable alpha blending */
- DMA2D_BLEND_PIXELALPHA = 0x2, /* Enable alpha blending from pixel color */
-};
-
-/* The layer is controlled through the following structure */
-
-struct dma2d_layer_s
-{
- /* Name: getvideoinfo
- *
- * Description:
- * Get video information about the layer
- *
- * Parameter:
- * layer - Reference to the layer control structure
- * vinfo - Reference to the video info structure
- *
- * Return:
- * On success - OK
- * On error - -EINVAL
- */
-
- int (*getvideoinfo)(FAR struct dma2d_layer_s *layer,
- FAR struct fb_videoinfo_s *vinfo);
-
- /* Name: getplaneinfo
- *
- * Description:
- * Get plane information about the layer
- *
- * Parameter:
- * layer - Reference to the layer control structure
- * planeno - Number of the plane
- * pinfo - Reference to the plane info structure
- *
- * Return:
- * On success - OK
- * On error - -EINVAL
- */
-
- int (*getplaneinfo)(FAR struct dma2d_layer_s *layer, int planeno,
- FAR struct fb_planeinfo_s *pinfo);
-
- /* Name: getlid
- *
- * Description:
- * Get a specific layer identifier.
- *
- * Parameter:
- * layer - Reference to the layer structure
- * lid - Reference to store the layer id
- *
- * Return:
- * On success - OK
- * On error - -EINVAL
- */
-
- int (*getlid)(FAR struct dma2d_layer_s *layer, int *lid);
-
-#ifdef CONFIG_STM32F7_DMA2D_L8
- /* Name: setclut
- *
- * Description:
- * Configure layer clut (color lookup table).
- * Non clut is defined during initializing.
- *
- * Parameter:
- * layer - Reference to the layer structure
- * cmap - color lookup table with up the 256 entries
- *
- * Return:
- * On success - OK
- * On error - -EINVAL
- */
-
- int (*setclut)(FAR struct dma2d_layer_s *layer,
- const FAR struct fb_cmap_s *cmap);
-
- /* Name: getclut
- *
- * Description:
- * Get configured layer clut (color lookup table).
- *
- * Parameter:
- * layer - Reference to the layer structure
- * cmap - Reference to valid color lookup table accept up the 256 color
- * entries
- *
- * Return:
- * On success - OK
- * On error - -EINVAL
- */
-
- int (*getclut)(FAR struct dma2d_layer_s *layer, FAR struct fb_cmap_s *cmap);
-#endif
-
- /* Name: setalpha
- *
- * Description:
- * Configure layer alpha value factor into blend operation.
- * During the layer blend operation the source alpha value is multiplied
- * with this alpha value. If the source color format doesn't support alpha
- * channel (e.g. non ARGB8888) this alpha value will be used as constant
- * alpha value for blend operation.
- * Default value during initializing: 0xff
- *
- * Parameter:
- * layer - Reference to the layer structure
- * alpha - Alpha value
- *
- * Return:
- * On success - OK
- * On error - -EINVAL
- */
-
- int (*setalpha)(FAR struct dma2d_layer_s *layer, uint8_t alpha);
-
- /* Name: getalpha
- *
- * Description:
- * Get configured layer alpha value factor for blend operation.
- *
- * Parameter:
- * layer - Reference to the layer structure
- * alpha - Reference to store the alpha value
- *
- * Return:
- * On success - OK
- * On error - -EINVAL
- */
-
- int (*getalpha)(FAR struct dma2d_layer_s *layer, uint8_t *alpha);
-
- /* Name: setblendmode
- *
- * Description:
- * Configure blend mode of the layer.
- * Default mode during initializing: DMA2D_BLEND_NONE
- * Blendmode is active after next update.
- *
- * Parameter:
- * layer - Reference to the layer structure
- * mode - Blend mode (see DMA2D_BLEND_*)
- *
- * Return:
- * On success - OK
- * On error - -EINVAL
- *
- * Procedure information:
- * DMA2D_BLEND_NONE:
- * Informs the driver to disable all blend operation for the given layer.
- * That means the layer is opaque.
- *
- * DMA2D_BLEND_ALPHA:
- * Informs the driver to enable alpha blending for the given layer.
- *
- * DMA2D_BLEND_PIXELALPHA:
- * Informs the driver to use the pixel alpha value of the layer instead
- * the constant alpha value. This is only useful for ARGB8888
- * color format.
- */
-
- int (*setblendmode)(FAR struct dma2d_layer_s *layer, uint32_t mode);
-
- /* Name: getblendmode
- *
- * Description:
- * Get configured blend mode of the layer.
- *
- * Parameter:
- * layer - Reference to the layer structure
- * mode - Reference to store the blend mode
- *
- * Return:
- * On success - OK
- * On error - -EINVAL
- */
-
- int (*getblendmode)(FAR struct dma2d_layer_s *layer, uint32_t *mode);
-
- /* Name: blit
- *
- * Description:
- * Copy selected area from a source layer to selected position of the
- * destination layer.
- *
- * Parameter:
- * dest - Reference to the destination layer
- * destxpos - Selected x target position of the destination layer
- * destypos - Selected y target position of the destination layer
- * src - Reference to the source layer
- * srcarea - Reference to the selected area of the source layer
- *
- * Return:
- * OK - On success
- * -EINVAL - If one of the parameter invalid or if the size of the
- * selected source area outside the visible area of the
- * destination layer. (The visible area usually represents the
- * display size)
- * -ECANCELED - Operation cancelled, something goes wrong.
- */
-
- int (*blit)(FAR struct dma2d_layer_s *dest,
- fb_coord_t destxpos, fb_coord_t destypos,
- FAR const struct dma2d_layer_s *src,
- FAR const struct ltdc_area_s *srcarea);
-
- /* Name: blend
- *
- * Description:
- * Blends the selected area from a background layer with selected position
- * of the foreground layer. Copies the result to the selected position of
- * the destination layer. Note! The content of the foreground and background
- * layer keeps unchanged as long destination layer is unequal to the
- * foreground and background layer.
- *
- * Parameter:
- * dest - Reference to the destination layer
- * fore - Reference to the foreground layer
- * forexpos - Selected x target position of the foreground layer
- * foreypos - Selected y target position of the foreground layer
- * back - Reference to the background layer
- * backarea - Reference to the selected area of the background layer
- *
- * Return:
- * OK - On success
- * -EINVAL - If one of the parameter invalid or if the size of the
- * selected source area outside the visible area of the
- * destination layer. (The visible area usually represents the
- * display size)
- * -ECANCELED - Operation cancelled, something goes wrong.
- */
-
- int (*blend)(FAR struct dma2d_layer_s *dest,
- fb_coord_t destxpos, fb_coord_t destypos,
- FAR const struct dma2d_layer_s *fore,
- fb_coord_t forexpos, fb_coord_t foreypos,
- FAR const struct dma2d_layer_s *back,
- FAR const struct ltdc_area_s *backarea);
-
- /* Name: fillarea
- *
- * Description:
- * Fill the selected area of the whole layer with a specific color.
- *
- * Parameter:
- * layer - Reference to the layer structure
- * area - Reference to the valid area structure select the area
- * color - Color to fill the selected area. Color must be formatted
- * according to the layer pixel format.
- *
- * Return:
- * OK - On success
- * -EINVAL - If one of the parameter invalid or if the size of the
- * selected area outside the visible area of the layer.
- * -ECANCELED - Operation cancelled, something goes wrong.
- */
-
- int (*fillarea)(FAR struct dma2d_layer_s *layer,
- FAR const struct ltdc_area_s *area,
- uint32_t color);
-};
-
-/****************************************************************************
- * Public Data
- ****************************************************************************/
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: up_dma2dgetlayer
- *
- * Description:
- * Get a dma2d layer structure by the layer identifier
- *
- * Parameter:
- * lid - Layer identifier
- *
- * Return:
- * Reference to the dma2d layer control structure on success or Null if no
- * related exist.
- *
- ****************************************************************************/
-
-FAR struct dma2d_layer_s *up_dma2dgetlayer(int lid);
-
-/****************************************************************************
- * Name: up_dma2dcreatelayer
- *
- * Description:
- * Create a new dma2d layer object to interact with the dma2d controller
- *
- * Parameter:
- * width - Layer width
- * height - Layer height
- * fmt - Pixel format of the layer
- *
- * Return:
- * On success - A valid dma2d layer reference
- * On error - NULL and errno is set to
- * -EINVAL if one of the parameter is invalid
- * -ENOMEM if no memory available or exceeds
- * CONFIG_STM32F7_DMA2D_NLAYERS
- *
- ****************************************************************************/
-
-FAR struct dma2d_layer_s *up_dma2dcreatelayer(fb_coord_t width,
- fb_coord_t height,
- uint8_t fmt);
-
-/****************************************************************************
- * Name: up_dma2dremovelayer
- *
- * Description:
- * Remove and deallocate the dma2d layer
- *
- * Parameter:
- * layer - Reference to the layer to remove
- *
- * Return:
- * On success - OK
- * On error - -EINVAL
- *
- ****************************************************************************/
-
-int up_dma2dremovelayer(FAR struct dma2d_layer_s *layer);
-
-/****************************************************************************
- * Name: up_dma2dinitialize
- *
- * Description:
- * Initialize the dma2d controller
- *
- * Return:
- * OK - On success
- * An error if initializing failed.
- *
- ****************************************************************************/
-
-int up_dma2dinitialize(void);
-
-/****************************************************************************
- * Name: up_dma2duninitialize
- *
- * Description:
- * Uninitialize the dma2d controller
- *
- ****************************************************************************/
-
-void up_dma2duninitialize(void);
-
-#endif /* __ARCH_ARM_INCLUDE_STM32F7_DMA2D_H */
diff --git a/arch/arm/include/stm32f7/irq.h b/arch/arm/include/stm32f7/irq.h
index f09659190b74a2f4078b0c0df1f5f31cbcfe2389..19e2596f7d76b9aa5c4ae33a608342f066e3e6cd 100644
--- a/arch/arm/include/stm32f7/irq.h
+++ b/arch/arm/include/stm32f7/irq.h
@@ -1,8 +1,9 @@
/************************************************************************************
* arch/arm/include/stm32f7/irq.h
*
- * Copyright (C) 2015 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2015, 2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt
+ * Bob Feretich
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -76,7 +77,9 @@
#define STM32_IRQ_FIRST (16) /* Vector number of the first external interrupt */
-#if defined(CONFIG_STM32F7_STM32F74XX) || defined(CONFIG_STM32F7_STM32F75XX)
+#if defined(CONFIG_STM32F7_STM32F72XX) || defined(CONFIG_STM32F7_STM32F73XX)
+# include
+#elif defined(CONFIG_STM32F7_STM32F74XX) || defined(CONFIG_STM32F7_STM32F75XX)
# include
#elif defined(CONFIG_STM32F7_STM32F76XX) || defined(CONFIG_STM32F7_STM32F77XX)
# include
diff --git a/arch/arm/include/stm32f7/ltdc.h b/arch/arm/include/stm32f7/ltdc.h
deleted file mode 100755
index 0b1e509916b9a2b355a18e18d56f76845eab788a..0000000000000000000000000000000000000000
--- a/arch/arm/include/stm32f7/ltdc.h
+++ /dev/null
@@ -1,575 +0,0 @@
-/****************************************************************************
- * arch/arm/include/stm32/ltdc.h
- *
- * Copyright (C) 2014-2015 Marco Krahl. All rights reserved.
- * Author: Marco Krahl
- *
- * 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_STM32F7_LTDC_H
-#define __ARCH_ARM_INCLUDE_STM32F7_LTDC_H
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include
-#include
-#include
-
-#ifdef CONFIG_STM32F7_LTDC
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-
-/****************************************************************************
- * Public Types
- ****************************************************************************/
-
-struct dma2d_layer_s; /* see arch/chip/dma2d.h */
-
-/* Blend mode definitions */
-
-enum ltdc_blend_e
-{
- LTDC_BLEND_NONE = 0, /* Disable all blend operation */
- LTDC_BLEND_ALPHA = 0x1, /* Enable alpha blending */
- LTDC_BLEND_PIXELALPHA = 0x2, /* Enable alpha blending from pixel color */
- LTDC_BLEND_COLORKEY = 0x4, /* Enable colorkey */
- LTDC_BLEND_ALPHAINV = 0x8, /* Inverse alpha blending of source */
- LTDC_BLEND_PIXELALPHAINV = 0x10 /* Invers pixel alpha blending of source */
-};
-
-/* layer control definitions */
-
-enum ltdc_layer_e
-{
- LTDC_LAYER_OWN = 0, /* The given layer */
- LTDC_LAYER_TOP = 0x1, /* The initialized top layer */
- LTDC_LAYER_BOTTOM = 0x2, /* the initialized bottom layer */
- LTDC_LAYER_ACTIVE = 0x4, /* The current visible flip layer */
- LTDC_LAYER_INACTIVE = 0x8 /* The current invisible flip layer */
-#ifdef CONFIG_STM32F7_DMA2D
- ,LTDC_LAYER_DMA2D = 0x10 /* The dma2d interface layer id */
-#endif
-};
-
-/* Update operation flag */
-
-enum ltdc_update_e
-{
- LTDC_UPDATE_NONE = 0, /* Update given layer only */
- LTDC_UPDATE_SIM = 0x1, /* Update both layer simultaneous */
- LTDC_UPDATE_FLIP = 0x2, /* Perform flip operation */
- LTDC_UPDATE_ACTIVATE = 0x4 /* Set the given layer to the active layer */
-};
-
-/* sync mode definitions */
-
-enum ltdc_sync_e
-{
- LTDC_SYNC_NONE = 0, /* Immediately */
- LTDC_SYNC_VBLANK = 0x100, /* Upon vertical sync */
- LTDC_SYNC_WAIT = 0x200 /* Waits upon vertical sync */
-};
-
-/* Definition of the visible layer position and size */
-
-struct ltdc_area_s
-{
- fb_coord_t xpos; /* X position in pixel */
- fb_coord_t ypos; /* Y position in pixel */
- fb_coord_t xres; /* X resolution in pixel */
- fb_coord_t yres; /* Y resolution in pixel */
-};
-
-/* The layer is controlled through the following structure */
-
-struct ltdc_layer_s
-{
- /* Name: getvideoinfo
- *
- * Description:
- * Get video information about the layer
- *
- * Parameter:
- * layer - Reference to the layer control structure
- * vinfo - Reference to the video info structure
- *
- * Return:
- * On success - OK
- * On error - -EINVAL
- */
-
- int (*getvideoinfo)(FAR struct ltdc_layer_s *layer,
- FAR struct fb_videoinfo_s *vinfo);
-
- /* Name: getplaneinfo
- *
- * Description:
- * Get plane information about the layer
- *
- * Parameter:
- * layer - Reference to the layer control structure
- * planeno - Number of the plane
- * pinfo - Reference to the plane info structure
- *
- * Return:
- * On success - OK
- * On error - -EINVAL
- */
-
- int (*getplaneinfo)(FAR struct ltdc_layer_s *layer, int planeno,
- FAR struct fb_planeinfo_s *pinfo);
-
- /* Name: getlid
- *
- * Description:
- * Get a specific layer identifier.
- *
- * Parameter:
- * layer - Reference to the layer structure
- * lid - Reference to store the layer id
- * flag - Operation flag describe the layer identifier
- * e.g. get the current active or inactive layer.
- * See LTDC_LAYER_* for possible values
- *
- * Return:
- * On success - OK
- * On error - -EINVAL
- */
-
- int (*getlid)(FAR struct ltdc_layer_s *layer, int *lid, uint32_t flag);
-
-#ifdef CONFIG_FB_CMAP
- /* Name: setclut
- *
- * Description:
- * Configure layer clut (color lookup table).
- * Non clut is defined during initializing.
- * Clut is active during next vertical blank period. Do not need an update.
- *
- * Parameter:
- * layer - Reference to the layer structure
- * cmap - color lookup table with up the 256 entries
- * enable - Enable or disable clut support (if false cmap is ignored and can
- * be NULL)
- *
- * Return:
- * On success - OK
- * On error - -EINVAL
- */
-
- int (*setclut)(FAR struct ltdc_layer_s *layer,
- const FAR struct fb_cmap_s *cmap);
-
- /* Name: getclut
- *
- * Description:
- * Get configured layer clut (color lookup table).
- *
- * Parameter:
- * layer - Reference to the layer structure
- * cmap - Reference to valid color lookup table accept up the 256 color
- * entries
- *
- * Return:
- * On success - OK
- * On error - -EINVAL
- */
-
- int (*getclut)(FAR struct ltdc_layer_s *layer, FAR struct fb_cmap_s *cmap);
-#endif
-
- /* Name: setcolor
- *
- * Description:
- * Configure layer color for the non active layer area.
- * Default value during initializing: 0x00000000
- * Color is active after next update.
- *
- * Parameter:
- * layer - Reference to the layer structure
- * argb - ARGB8888 color value
- *
- * Return:
- * On success - OK
- * On error - -EINVAL
- */
-
- int (*setcolor)(FAR struct ltdc_layer_s *layer, uint32_t argb);
-
- /* Name: getcolor
- *
- * Description:
- * Get configured layer color for the non active layer area.
- *
- * Parameter:
- * layer - Reference to the layer structure
- * argb - Reference to store the ARGB8888 color value
- *
- * Return:
- * On success - OK
- * On error - -EINVAL
- */
-
- int (*getcolor)(FAR struct ltdc_layer_s *layer, uint32_t *argb);
-
- /* Name: setcolorkey
- *
- * Description:
- * Configure the layer color key (chromakey) for transparence.
- * Default value during initializing: 0x00000000
- * Colorkey is active after next update.
- *
- * Parameter:
- * layer - Reference to the layer structure
- * rgb - RGB888 color key
- *
- * Return:
- * On success - OK
- * On error - -EINVAL
- */
-
- int (*setcolorkey)(FAR struct ltdc_layer_s *layer, uint32_t rgb);
-
- /* Name: getcolorkey
- *
- * Description:
- * Get the configured layer color key (chromakey) for transparence.
- *
- * Parameter:
- * layer - Reference to the layer structure
- * rgb - Reference to store the RGB888 color key
- *
- * Return:
- * On success - OK
- * On error - -EINVAL
- */
-
- int (*getcolorkey)(FAR struct ltdc_layer_s *layer, uint32_t *rgb);
-
- /* Name: setalpha
- *
- * Description:
- * Configure layer alpha value factor into blend operation.
- * During the layer blend operation the source alpha value is multiplied
- * with this alpha value. If the source color format doesn't support alpha
- * channel (e.g. non ARGB8888) this alpha value will be used as constant
- * alpha value for blend operation.
- * Default value during initializing: 0xff
- * Alpha is active after next update.
- *
- * Parameter:
- * layer - Reference to the layer structure
- * alpha - Alpha value
- *
- * Return:
- * On success - OK
- * On error - -EINVAL
- */
-
- int (*setalpha)(FAR struct ltdc_layer_s *layer, uint8_t alpha);
-
- /* Name: getalpha
- *
- * Description:
- * Get configured layer alpha value factor for blend operation.
- *
- * Parameter:
- * layer - Reference to the layer structure
- * alpha - Reference to store the alpha value
- *
- * Return:
- * On success - OK
- * On error - -EINVAL
- */
-
- int (*getalpha)(FAR struct ltdc_layer_s *layer, uint8_t *alpha);
-
- /* Name: setblendmode
- *
- * Description:
- * Configure blend mode of the layer.
- * Default mode during initializing: LTDC_BLEND_NONE
- * Blendmode is active after next update.
- *
- * Parameter:
- * layer - Reference to the layer structure
- * mode - Blend mode (see LTDC_BLEND_*)
- *
- * Return:
- * On success - OK
- * On error - -EINVAL
- *
- * Procedure information:
- * LTDC_BLEND_NONE:
- * Informs the driver to disable all blend operation for the given layer.
- * That means the layer is opaque. Note this has no effect on the
- * colorkey settings.
- *
- * LTDC_BLEND_ALPHA:
- * Informs the driver to enable alpha blending for the given layer.
- *
- * LTDC_BLEND_COLORKEY:
- * Informs the driver to enable colorkeying for the given layer.
- *
- * LTDC_BLEND_SRCPIXELALPHA:
- * Informs the driver to use the pixel alpha value of the layer instead
- * the constant alpha value. This is only useful for ARGB8888
- * color format.
- *
- * LTDC_BLEND_DESTPIXELALPHA:
- * Informs the driver to use the pixel alpha value of the subjacent layer
- * instead the constant alpha value. This is only useful for ARGB8888
- * color format.
- */
-
- int (*setblendmode)(FAR struct ltdc_layer_s *layer, uint32_t mode);
-
- /* Name: getblendmode
- *
- * Description:
- * Get configured blend mode of the layer.
- *
- * Parameter:
- * layer - Reference to the layer structure
- * mode - Reference to store the blend mode
- *
- * Return:
- * On success - OK
- * On error - -EINVAL
- */
-
- int (*getblendmode)(FAR struct ltdc_layer_s *layer, uint32_t *mode);
-
- /* Name: setarea
- *
- * Description:
- * Configure visible layer area and the reference position of the first
- * pixel of the whole layer which is the first visible top left pixel in
- * the active area.
- * Default value during initializing:
- * xpos = 0
- * ypos = 0
- * xres = display x resolution
- * yres = display y resolution
- *
- * Area is active after next update.
- *
- * Parameter:
- * layer - Reference to the layer control structure
- * area - Reference to the valid area structure for the new active area
- * srcxpos - x position of the visible pixel of the whole layer
- * srcypos - y position of the visible pixel of the whole layer
- *
- * Return:
- * On success - OK
- * On error - -EINVAL
- *
- * Procedure Information:
- * If the srcxpos and srcypos unequal the xpos and ypos of the coord
- * structure this acts like moving the visible area to another position on
- * the screen during the next update operation.
- */
-
- int (*setarea)(FAR struct ltdc_layer_s *layer,
- FAR const struct ltdc_area_s *area,
- fb_coord_t srcxpos,
- fb_coord_t srcypos);
-
- /* Name: getarea
- *
- * Description:
- * Get configured visible layer area.
- *
- * Parameter:
- * layer - Reference to the layer control structure
- * area - Reference to the area structure to store the active area
- * srcxpos - Reference to store the referenced x position of the whole layer
- * srcypos - Reference to store the reterenced y position of the whole layer
- *
- * Return:
- * On success - OK
- * On error - -EINVAL
- */
-
- int (*getarea)(FAR struct ltdc_layer_s *layer,
- FAR struct ltdc_area_s *area,
- fb_coord_t *srcxpos,
- fb_coord_t *srcypos);
-
- /* Name: update
- *
- * Description:
- * Update current layer settings and make changes visible.
- *
- * Parameter:
- * layer - Reference to the layer structure
- * mode - operation mode (see LTDC_UPDATE_*)
- *
- * Return:
- * OK - On success
- * -EINVAL - If one of the parameter invalid
- * -ECANCELED - Operation cancelled, something goes wrong
- *
- * Procedure information:
- * LTDC_UPDATE_SIM:
- * Informs the driver to update both ltdc layers simultaneously. Otherwise
- * update the given layer only.
- *
- * LTDC_UPDATE_FLIP:
- * Informs the driver to perform a flip operation.
- * This only effects the ltdc layer 1 and 2 and can be useful for double
- * buffering. Each flip operation changed the active layer ot the inactive
- * and vice versa. In the context of the ltdc that means, the inactive layer
- * is complete disabled. So the subjacent layer is the background layer
- * (background color). To reactivate both layer and their settings perform
- * an update without LTDC_UPDATE_FLIP flag.
- *
- * LTDC_UPDATE_ACTIVATE:
- * Informs the driver that the given layer should be the active layer when
- * the operation is complete.
- *
- * LTDC_SYNC_VBLANK:
- * Informs the driver to update the layer upon vertical blank. Otherwise
- * immediately.
- */
-
- int (*update)(FAR struct ltdc_layer_s *layer, uint32_t mode);
-
-#ifdef CONFIG_STM32F7_DMA2D
- /* Name: blit
- *
- * Description:
- * Copy selected area from a source layer to selected position of the
- * destination layer.
- *
- * Parameter:
- * dest - Reference to the destination layer
- * destxpos - Selected x position of the destination layer
- * destypos - Selected y position of the destination layer
- * src - Reference to the source layer
- * srcarea - Reference to the selected area of the source layer
- *
- * Return:
- * OK - On success
- * -EINVAL - If one of the parameter invalid or if the size of the selected
- * source area outside the visible area of the destination layer.
- * (The visible area usually represents the display size)
- */
-
- int (*blit)(FAR struct ltdc_layer_s *dest,
- fb_coord_t destxpos, fb_coord_t destypos,
- FAR const struct dma2d_layer_s *src,
- FAR const struct ltdc_area_s *srcarea);
-
- /* Name: blend
- *
- * Description:
- * Blends the selected area from a foreground layer with selected position
- * of the background layer. Copy the result to the destination layer. Note!
- * The content of the foreground and background layer is not changed.
- *
- * Parameter:
- * dest - Reference to the destination layer
- * destxpos - Selected x position of the destination layer
- * destypos - Selected y position of the destination layer
- * fore - Reference to the foreground layer
- * forexpos - Selected x position of the foreground layer
- * foreypos - Selected y position of the foreground layer
- * back - Reference to the background layer
- * backarea - Reference to the selected area of the background layer
- *
- * Return:
- * OK - On success
- * -EINVAL - If one of the parameter invalid or if the size of the selected
- * source area outside the visible area of the destination layer.
- * (The visible area usually represents the display size)
- */
-
- int (*blend)(FAR struct ltdc_layer_s *dest,
- fb_coord_t destxpos, fb_coord_t destypos,
- FAR const struct dma2d_layer_s *fore,
- fb_coord_t forexpos, fb_coord_t foreypos,
- FAR const struct dma2d_layer_s *back,
- FAR const struct ltdc_area_s *backarea);
-
- /* Name: fillarea
- *
- * Description:
- * Fill the selected area of the whole layer with a specific color.
- *
- * Parameter:
- * layer - Reference to the layer structure
- * area - Reference to the valid area structure select the area
- * color - Color to fill the selected area. Color must be formatted
- * according to the layer pixel format.
- *
- * Return:
- * OK - On success
- * -EINVAL - If one of the parameter invalid or if the size of the selected
- * area outside the visible area of the layer.
- */
-
- int (*fillarea)(FAR struct ltdc_layer_s *layer,
- FAR const struct ltdc_area_s *area,
- uint32_t color);
-#endif
-};
-
-/****************************************************************************
- * Public Data
- ****************************************************************************/
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: up_ltdcgetlayer
- *
- * Description:
- * Get the ltdc layer structure to perform hardware layer operation
- *
- * Parameter:
- * lid - Layer identifier
- *
- * Return:
- * Reference to the layer control structure on success or Null if parameter
- * invalid.
- *
- ****************************************************************************/
-
-FAR struct ltdc_layer_s *up_ltdcgetlayer(int lid);
-
-#endif /* CONFIG_STM32F7_LTDC */
-#endif /* __ARCH_ARM_INCLUDE_STM32F7_LTDC_H */
-
diff --git a/arch/arm/include/stm32f7/stm32f72xx73xx_irq.h b/arch/arm/include/stm32f7/stm32f72xx73xx_irq.h
new file mode 100644
index 0000000000000000000000000000000000000000..f1ff50d49e8aab132920fd7fb7a3926eed34aa6d
--- /dev/null
+++ b/arch/arm/include/stm32f7/stm32f72xx73xx_irq.h
@@ -0,0 +1,198 @@
+/****************************************************************************************************
+ * arch/arm/include/stm32f7/stm32f72xx73xx_irq.h.h
+ *
+ * Copyright (C) 2017 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt
+ * Bob Feretich
+ *
+ * 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.
+ *
+ *Change Record:
+ * bf20171107 Created file. It's identical to stm32f74xx75xx_irq except for the
+ * exclusions noted by this tag, and the addition of the last IRQ
+ * for SDMMC2 (IRQ103).
+ ****************************************************************************************************/
+
+/* This file should never be included directed but, rather, only indirectly through arch/irq.h */
+
+#ifndef __ARCH_ARM_INCLUDE_STM32F7_STM32F72XX73XX_IRQ_H
+#define __ARCH_ARM_INCLUDE_STM32F7_STM32F72XX73XX_IRQ_H
+
+/****************************************************************************************************
+ * Included Files
+ ****************************************************************************************************/
+
+#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.
+ *
+ * Processor Exceptions (vectors 0-15). These common definitions can be found in the file
+ * nuttx/arch/arm/include/stm32f7/irq.h which includes this file
+ *
+ * External interrupts (vectors >= 16)
+ */
+
+#define STM32_IRQ_WWDG (STM32_IRQ_FIRST+0) /* 0: Window Watchdog interrupt */
+#define STM32_IRQ_PVD (STM32_IRQ_FIRST+1) /* 1: PVD through EXTI Line detection interrupt */
+#define STM32_IRQ_TAMPER (STM32_IRQ_FIRST+2) /* 2: Tamper and time stamp interrupts */
+#define STM32_IRQ_TIMESTAMP (STM32_IRQ_FIRST+2) /* 2: Tamper and time stamp interrupts */
+#define STM32_IRQ_RTC_WKUP (STM32_IRQ_FIRST+3) /* 3: RTC global interrupt */
+#define STM32_IRQ_FLASH (STM32_IRQ_FIRST+4) /* 4: Flash global interrupt */
+#define STM32_IRQ_RCC (STM32_IRQ_FIRST+5) /* 5: RCC global interrupt */
+#define STM32_IRQ_EXTI0 (STM32_IRQ_FIRST+6) /* 6: EXTI Line 0 interrupt */
+#define STM32_IRQ_EXTI1 (STM32_IRQ_FIRST+7) /* 7: EXTI Line 1 interrupt */
+#define STM32_IRQ_EXTI2 (STM32_IRQ_FIRST+8) /* 8: EXTI Line 2 interrupt */
+#define STM32_IRQ_EXTI3 (STM32_IRQ_FIRST+9) /* 9: EXTI Line 3 interrupt */
+#define STM32_IRQ_EXTI4 (STM32_IRQ_FIRST+10) /* 10: EXTI Line 4 interrupt */
+#define STM32_IRQ_DMA1S0 (STM32_IRQ_FIRST+11) /* 11: DMA1 Stream 0 global interrupt */
+#define STM32_IRQ_DMA1S1 (STM32_IRQ_FIRST+12) /* 12: DMA1 Stream 1 global interrupt */
+#define STM32_IRQ_DMA1S2 (STM32_IRQ_FIRST+13) /* 13: DMA1 Stream 2 global interrupt */
+#define STM32_IRQ_DMA1S3 (STM32_IRQ_FIRST+14) /* 14: DMA1 Stream 3 global interrupt */
+#define STM32_IRQ_DMA1S4 (STM32_IRQ_FIRST+15) /* 15: DMA1 Stream 4 global interrupt */
+#define STM32_IRQ_DMA1S5 (STM32_IRQ_FIRST+16) /* 16: DMA1 Stream 5 global interrupt */
+#define STM32_IRQ_DMA1S6 (STM32_IRQ_FIRST+17) /* 17: DMA1 Stream 6 global interrupt */
+#define STM32_IRQ_ADC (STM32_IRQ_FIRST+18) /* 18: ADC1, ADC2, and ADC3 global interrupt */
+#define STM32_IRQ_CAN1TX (STM32_IRQ_FIRST+19) /* 19: CAN1 TX interrupts */
+#define STM32_IRQ_CAN1RX0 (STM32_IRQ_FIRST+20) /* 20: CAN1 RX0 interrupts */
+#define STM32_IRQ_CAN1RX1 (STM32_IRQ_FIRST+21) /* 21: CAN1 RX1 interrupt */
+#define STM32_IRQ_CAN1SCE (STM32_IRQ_FIRST+22) /* 22: CAN1 SCE interrupt */
+#define STM32_IRQ_EXTI95 (STM32_IRQ_FIRST+23) /* 23: EXTI Line[9:5] interrupts */
+#define STM32_IRQ_TIM1BRK (STM32_IRQ_FIRST+24) /* 24: TIM1 Break interrupt */
+#define STM32_IRQ_TIM9 (STM32_IRQ_FIRST+24) /* 24: TIM9 global interrupt */
+#define STM32_IRQ_TIM1UP (STM32_IRQ_FIRST+25) /* 25: TIM1 Update interrupt */
+#define STM32_IRQ_TIM10 (STM32_IRQ_FIRST+25) /* 25: TIM10 global interrupt */
+#define STM32_IRQ_TIM1TRGCOM (STM32_IRQ_FIRST+26) /* 26: TIM1 Trigger and Commutation interrupts */
+#define STM32_IRQ_TIM11 (STM32_IRQ_FIRST+26) /* 26: TIM11 global interrupt */
+#define STM32_IRQ_TIM1CC (STM32_IRQ_FIRST+27) /* 27: TIM1 Capture Compare interrupt */
+#define STM32_IRQ_TIM2 (STM32_IRQ_FIRST+28) /* 28: TIM2 global interrupt */
+#define STM32_IRQ_TIM3 (STM32_IRQ_FIRST+29) /* 29: TIM3 global interrupt */
+#define STM32_IRQ_TIM4 (STM32_IRQ_FIRST+30) /* 30: TIM4 global interrupt */
+#define STM32_IRQ_I2C1EV (STM32_IRQ_FIRST+31) /* 31: I2C1 event interrupt */
+#define STM32_IRQ_I2C1ER (STM32_IRQ_FIRST+32) /* 32: I2C1 error interrupt */
+#define STM32_IRQ_I2C2EV (STM32_IRQ_FIRST+33) /* 33: I2C2 event interrupt */
+#define STM32_IRQ_I2C2ER (STM32_IRQ_FIRST+34) /* 34: I2C2 error interrupt */
+#define STM32_IRQ_SPI1 (STM32_IRQ_FIRST+35) /* 35: SPI1 global interrupt */
+#define STM32_IRQ_SPI2 (STM32_IRQ_FIRST+36) /* 36: SPI2 global interrupt */
+#define STM32_IRQ_USART1 (STM32_IRQ_FIRST+37) /* 37: USART1 global interrupt */
+#define STM32_IRQ_USART2 (STM32_IRQ_FIRST+38) /* 38: USART2 global interrupt */
+#define STM32_IRQ_USART3 (STM32_IRQ_FIRST+39) /* 39: USART3 global interrupt */
+#define STM32_IRQ_EXTI1510 (STM32_IRQ_FIRST+40) /* 40: EXTI Line[15:10] interrupts */
+#define STM32_IRQ_RTCALRM (STM32_IRQ_FIRST+41) /* 41: RTC alarm through EXTI line interrupt */
+#define STM32_IRQ_OTGFSWKUP (STM32_IRQ_FIRST+42) /* 42: USB On-The-Go FS Wakeup through EXTI */
+#define STM32_IRQ_TIM8BRK (STM32_IRQ_FIRST+43) /* 43: TIM8 Break interrupt */
+#define STM32_IRQ_TIM12 (STM32_IRQ_FIRST+43) /* 43: TIM12 global interrupt */
+#define STM32_IRQ_TIM8UP (STM32_IRQ_FIRST+44) /* 44: TIM8 Update interrupt */
+#define STM32_IRQ_TIM13 (STM32_IRQ_FIRST+44) /* 44: TIM13 global interrupt */
+#define STM32_IRQ_TIM8TRGCOM (STM32_IRQ_FIRST+45) /* 45: TIM8 Trigger and Commutation interrupts */
+#define STM32_IRQ_TIM14 (STM32_IRQ_FIRST+45) /* 45: TIM14 global interrupt */
+#define STM32_IRQ_TIM8CC (STM32_IRQ_FIRST+46) /* 46: TIM8 Capture Compare interrupt */
+#define STM32_IRQ_DMA1S7 (STM32_IRQ_FIRST+47) /* 47: DMA1 Stream 7 global interrupt */
+#define STM32_IRQ_FMC (STM32_IRQ_FIRST+48) /* 48: FMC global interrupt */
+#define STM32_IRQ_SDMMC1 (STM32_IRQ_FIRST+49) /* 49: SDMMC1 global interrupt */
+#define STM32_IRQ_TIM5 (STM32_IRQ_FIRST+50) /* 50: TIM5 global interrupt */
+#define STM32_IRQ_SPI3 (STM32_IRQ_FIRST+51) /* 51: SPI3 global interrupt */
+#define STM32_IRQ_UART4 (STM32_IRQ_FIRST+52) /* 52: UART4 global interrupt */
+#define STM32_IRQ_UART5 (STM32_IRQ_FIRST+53) /* 53: UART5 global interrupt */
+#define STM32_IRQ_TIM6 (STM32_IRQ_FIRST+54) /* 54: TIM6 global interrupt */
+#define STM32_IRQ_DAC (STM32_IRQ_FIRST+54) /* 54: DAC1 and DAC2 underrun error interrupts */
+#define STM32_IRQ_TIM7 (STM32_IRQ_FIRST+55) /* 55: TIM7 global interrupt */
+#define STM32_IRQ_DMA2S0 (STM32_IRQ_FIRST+56) /* 56: DMA2 Stream 0 global interrupt */
+#define STM32_IRQ_DMA2S1 (STM32_IRQ_FIRST+57) /* 57: DMA2 Stream 1 global interrupt */
+#define STM32_IRQ_DMA2S2 (STM32_IRQ_FIRST+58) /* 58: DMA2 Stream 2 global interrupt */
+#define STM32_IRQ_DMA2S3 (STM32_IRQ_FIRST+59) /* 59: DMA2 Stream 3 global interrupt */
+#define STM32_IRQ_DMA2S4 (STM32_IRQ_FIRST+60) /* 60: DMA2 Stream 4 global interrupt */
+
+#define STM32_IRQ_OTGFS (STM32_IRQ_FIRST+67) /* 67: USB On The Go FS global interrupt */
+#define STM32_IRQ_DMA2S5 (STM32_IRQ_FIRST+68) /* 68: DMA2 Stream 5 global interrupt */
+#define STM32_IRQ_DMA2S6 (STM32_IRQ_FIRST+69) /* 69: DMA2 Stream 6 global interrupt */
+#define STM32_IRQ_DMA2S7 (STM32_IRQ_FIRST+70) /* 70: DMA2 Stream 7 global interrupt */
+#define STM32_IRQ_USART6 (STM32_IRQ_FIRST+71) /* 71: USART6 global interrupt */
+#define STM32_IRQ_I2C3EV (STM32_IRQ_FIRST+72) /* 72: I2C3 event interrupt */
+#define STM32_IRQ_I2C3ER (STM32_IRQ_FIRST+73) /* 73: I2C3 error interrupt */
+#define STM32_IRQ_OTGHSEP1OUT (STM32_IRQ_FIRST+74) /* 74: USB On The Go HS End Point 1 Out global interrupt */
+#define STM32_IRQ_OTGHSEP1IN (STM32_IRQ_FIRST+75) /* 75: USB On The Go HS End Point 1 In global interrupt */
+#define STM32_IRQ_OTGHSWKUP (STM32_IRQ_FIRST+76) /* 76: USB On The Go HS Wakeup through EXTI interrupt */
+#define STM32_IRQ_OTGHS (STM32_IRQ_FIRST+77) /* 77: USB On The Go HS global interrupt */
+
+#define STM32_IRQ_CRYP (STM32_IRQ_FIRST+79) /* 79: CRYP crypto global interrupt */
+#define STM32_IRQ_RNG (STM32_IRQ_FIRST+80) /* 80: Hash and Rng global interrupt */
+#define STM32_IRQ_FPU (STM32_IRQ_FIRST+81) /* 81: FPU global interrupt */
+#define STM32_IRQ_UART7 (STM32_IRQ_FIRST+82) /* 82: UART7 global interrupt */
+#define STM32_IRQ_UART8 (STM32_IRQ_FIRST+83) /* 83: UART8 global interrupt */
+#define STM32_IRQ_SPI4 (STM32_IRQ_FIRST+84) /* 84: SPI4 global interrupt */
+#define STM32_IRQ_SPI5 (STM32_IRQ_FIRST+85) /* 85: SPI5 global interrupt */
+
+#define STM32_IRQ_SAI1 (STM32_IRQ_FIRST+87) /* 87: SAI1 global interrupt */
+
+#define STM32_IRQ_SAI2 (STM32_IRQ_FIRST+91) /* 91: SAI2 global interrupt */
+#define STM32_IRQ_QUADSPI (STM32_IRQ_FIRST+92) /* 92: QuadSPI global interrupt */
+#define STM32_IRQ_LPTIMER1 (STM32_IRQ_FIRST+93) /* 93: LP Timer1 global interrupt */
+
+#define STM32_IRQ_SDMMC2 (STM32_IRQ_FIRST+103) /* 103: SDMMC2 global interrupt */
+#define NR_INTERRUPTS 103
+
+#define NR_VECTORS (STM32_IRQ_FIRST+NR_INTERRUPTS)
+
+/* EXTI interrupts (Do not use IRQ numbers) */
+
+#define NR_IRQS NR_VECTORS
+
+/****************************************************************************************************
+ * Public Types
+ ****************************************************************************************************/
+
+/****************************************************************************************************
+ * Public Data
+ ****************************************************************************************************/
+
+#ifndef __ASSEMBLY__
+#ifdef __cplusplus
+#define EXTERN extern "C"
+extern "C"
+{
+#else
+#define EXTERN extern
+#endif
+
+/****************************************************************************************************
+ * Public Functions
+ ****************************************************************************************************/
+
+#undef EXTERN
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+#endif /* __ARCH_ARM_INCLUDE_STM32F7_STM32F72XX73XX_IRQ_H */
+
diff --git a/arch/arm/include/xmc4/xmc4500_irq.h b/arch/arm/include/xmc4/xmc4500_irq.h
index b35a1b3f8a2c0fa7ce9d9b95c8e6c9a1fd20af40..556af564224f099e361560407e83adc2cab1e077 100644
--- a/arch/arm/include/xmc4/xmc4500_irq.h
+++ b/arch/arm/include/xmc4/xmc4500_irq.h
@@ -171,12 +171,12 @@
#define XMC4_IRQ_USIC1_SR3 (XMC4_IRQ_FIRST+93) /* 93: USIC1 Channel, SR3 */
#define XMC4_IRQ_USIC1_SR4 (XMC4_IRQ_FIRST+94) /* 94: USIC1 Channel, SR4 */
#define XMC4_IRQ_USIC1_SR5 (XMC4_IRQ_FIRST+95) /* 95: USIC1 Channel, SR5 */
-#define XMC4_IRQ_USIC2_SR0 (XMC4_IRQ_FIRST+96) /* 96: USIC1 Channel, SR0 */
-#define XMC4_IRQ_USIC2_SR1 (XMC4_IRQ_FIRST+97) /* 97: USIC1 Channel, SR1 */
-#define XMC4_IRQ_USIC2_SR2 (XMC4_IRQ_FIRST+98) /* 98: USIC1 Channel, SR2 */
-#define XMC4_IRQ_USIC2_SR3 (XMC4_IRQ_FIRST+99) /* 99: USIC1 Channel, SR3 */
-#define XMC4_IRQ_USIC2_SR4 (XMC4_IRQ_FIRST+100) /* 100: USIC1 Channel, SR4 */
-#define XMC4_IRQ_USIC2_SR5 (XMC4_IRQ_FIRST+101) /* 101: USIC1 Channel, SR5 */
+#define XMC4_IRQ_USIC2_SR0 (XMC4_IRQ_FIRST+96) /* 96: USIC2 Channel, SR0 */
+#define XMC4_IRQ_USIC2_SR1 (XMC4_IRQ_FIRST+97) /* 97: USIC2 Channel, SR1 */
+#define XMC4_IRQ_USIC2_SR2 (XMC4_IRQ_FIRST+98) /* 98: USIC2 Channel, SR2 */
+#define XMC4_IRQ_USIC2_SR3 (XMC4_IRQ_FIRST+99) /* 99: USIC2 Channel, SR3 */
+#define XMC4_IRQ_USIC2_SR4 (XMC4_IRQ_FIRST+100) /* 100: USIC2 Channel, SR4 */
+#define XMC4_IRQ_USIC2_SR5 (XMC4_IRQ_FIRST+101) /* 101: USIC2 Channel, SR5 */
#define XMC4_IRQ_LEDTS0_SR0 (XMC4_IRQ_FIRST+102) /* 102: LEDTS0, SR0 */
#define XMC4_IRQ_RESVD103 (XMC4_IRQ_FIRST+103) /* 103: Reserved */
#define XMC4_IRQ_FCR_SR0 (XMC4_IRQ_FIRST+104) /* 102: FCE, SR0 */
diff --git a/arch/arm/src/a1x/a1x_boot.c b/arch/arm/src/a1x/a1x_boot.c
index b7ceee33f74412dcdfa95520c6b0ec03db999e15..1dc27fd636520bc0cc3214c363b84cd3b64907c9 100644
--- a/arch/arm/src/a1x/a1x_boot.c
+++ b/arch/arm/src/a1x/a1x_boot.c
@@ -1,7 +1,7 @@
/****************************************************************************
* arch/arm/src/a1x/a1x_boot.c
*
- * Copyright (C) 2013 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2013, 2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt
*
* Redistribution and use in source and binary forms, with or without
@@ -46,8 +46,6 @@
# include
#endif
-#include
-
#include "chip.h"
#include "arm.h"
#include "mmu.h"
@@ -56,6 +54,7 @@
#include "up_arch.h"
#include "a1x_lowputc.h"
+#include "a1x_boot.h"
/****************************************************************************
* Pre-processor Definitions
@@ -76,10 +75,6 @@
# error High vector remap cannot be performed if we are using a ROM page table
#endif
-/****************************************************************************
- * Private Types
- ****************************************************************************/
-
/****************************************************************************
* Public Data
****************************************************************************/
diff --git a/arch/arm/src/a1x/a1x_boot.h b/arch/arm/src/a1x/a1x_boot.h
new file mode 100644
index 0000000000000000000000000000000000000000..49b226eec970991eeae8c3190ad4843c2e2be356
--- /dev/null
+++ b/arch/arm/src/a1x/a1x_boot.h
@@ -0,0 +1,62 @@
+/************************************************************************************
+ * arch/arm/src/a1x/a1x_boot.h
+ *
+ * Copyright (C) 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.
+ *
+ ************************************************************************************/
+
+#ifndef __ARCH_ARM_SRC_A1X_A1X_BOOT_H
+#define __ARCH_ARM_SRC_A1X_A1X_BOOT_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include
+
+/************************************************************************************
+ * Public Function Prototypes
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: a1x_boardinitialize
+ *
+ * Description:
+ * All A1x architectures must provide the following entry point. This entry
+ * point is called early in the initialization -- after clocking and memory have
+ * been configured but before caches have been enabled and before any devices have
+ * been initialized.
+ *
+ ************************************************************************************/
+
+void a1x_boardinitialize(void);
+
+#endif /* __ARCH_ARM_SRC_A1X_A1X_BOOT_H */
diff --git a/arch/arm/src/arm/up_cache.S b/arch/arm/src/arm/up_cache.S
index e03099ce04fc38676b3557295c37bbefe7da81d3..564df7553423d9224ea8d085e867a4ef0c0d5e4c 100644
--- a/arch/arm/src/arm/up_cache.S
+++ b/arch/arm/src/arm/up_cache.S
@@ -154,12 +154,12 @@ cp15_invalidate_icache:
cp15_invalidate_dcache:
bic r0, r0, #CACHE_DLINESIZE - 1
- mcr p15, 0, r0, c7, c6, 1 /* Invalidate D entry */
+1: mcr p15, 0, r0, c7, c6, 1 /* Invalidate D entry */
add r0, r0, #CACHE_DLINESIZE
cmp r0, r1
blo 1b
mov pc, lr
- .size cp15_flush_idcache, .-cp15_flush_idcache
+ .size cp15_invalidate_dcache, .-cp15_invalidate_dcache
#if 0 /* Not used */
/* Invalidate Dcache */
diff --git a/arch/arm/src/common/up_modifyreg16.c b/arch/arm/src/common/up_modifyreg16.c
index 8871d7f60c0581a2ca8db6a14053df14ac1aa0b0..796732093e3982865634aa899ee5770ccbf37103 100644
--- a/arch/arm/src/common/up_modifyreg16.c
+++ b/arch/arm/src/common/up_modifyreg16.c
@@ -64,10 +64,10 @@ void modifyreg16(unsigned int addr, uint16_t clearbits, uint16_t setbits)
irqstate_t flags;
uint16_t regval;
- flags = enter_critical_section();
+ flags = spin_lock_irqsave();
regval = getreg16(addr);
regval &= ~clearbits;
regval |= setbits;
putreg16(regval, addr);
- leave_critical_section(flags);
+ spin_unlock_irqrestore(flags);
}
diff --git a/arch/arm/src/common/up_modifyreg32.c b/arch/arm/src/common/up_modifyreg32.c
index 0a1619592b5953dee261b1bdda91cd53f1ad3ec1..c49cdfa425a6a93b2021ccb8e944c5f1475ab4a1 100644
--- a/arch/arm/src/common/up_modifyreg32.c
+++ b/arch/arm/src/common/up_modifyreg32.c
@@ -64,10 +64,10 @@ void modifyreg32(unsigned int addr, uint32_t clearbits, uint32_t setbits)
irqstate_t flags;
uint32_t regval;
- flags = enter_critical_section();
+ flags = spin_lock_irqsave();
regval = getreg32(addr);
regval &= ~clearbits;
regval |= setbits;
putreg32(regval, addr);
- leave_critical_section(flags);
+ spin_unlock_irqrestore(flags);
}
diff --git a/arch/arm/src/common/up_modifyreg8.c b/arch/arm/src/common/up_modifyreg8.c
index abc4b60885c29a58f58f4df382f4469c821aed32..b67cbdc028cae0a3bdbaa734687650c30dcc1b64 100644
--- a/arch/arm/src/common/up_modifyreg8.c
+++ b/arch/arm/src/common/up_modifyreg8.c
@@ -64,10 +64,10 @@ void modifyreg8(unsigned int addr, uint8_t clearbits, uint8_t setbits)
irqstate_t flags;
uint8_t regval;
- flags = enter_critical_section();
+ flags = spin_lock_irqsave();
regval = getreg8(addr);
regval &= ~clearbits;
regval |= setbits;
putreg8(regval, addr);
- leave_critical_section(flags);
+ spin_unlock_irqrestore(flags);
}
diff --git a/arch/arm/src/efm32/Kconfig b/arch/arm/src/efm32/Kconfig
index 877cca10740d2309d6d0830c87e6d79f490e2eb9..8cfba344fcf1fea02729ce43fab3f70961a83fce 100644
--- a/arch/arm/src/efm32/Kconfig
+++ b/arch/arm/src/efm32/Kconfig
@@ -135,6 +135,7 @@ config EFM32_RMU
config EFM32_FLASHPROG
bool "Enable Erase/Write flash function (MSC) "
default n
+ select ARCH_HAVE_PROGMEM
select ARCH_HAVE_RAMFUNCS
config EFM32_RMU_DEBUG
diff --git a/arch/arm/src/kinetis/kinetis_start.c b/arch/arm/src/kinetis/kinetis_start.c
index 41df37aa4dc74d8de1f855719eb6ddc7b9159424..3c094ca3020c6edf55798b78edfaf17fa23829a6 100644
--- a/arch/arm/src/kinetis/kinetis_start.c
+++ b/arch/arm/src/kinetis/kinetis_start.c
@@ -44,7 +44,6 @@
#include
#include
-#include
#include "up_arch.h"
#include "up_internal.h"
@@ -58,6 +57,8 @@
# include "nvic.h"
#endif
+#include "kinetis_start.h"
+
/****************************************************************************
* Private Function prototypes
****************************************************************************/
diff --git a/arch/arm/src/kinetis/kinetis_start.h b/arch/arm/src/kinetis/kinetis_start.h
new file mode 100644
index 0000000000000000000000000000000000000000..850fbd4341411549415f26fc07ed93b1c05c4cad
--- /dev/null
+++ b/arch/arm/src/kinetis/kinetis_start.h
@@ -0,0 +1,62 @@
+/************************************************************************************
+ * arch/arm/src/kinetis/kinetis_start.h
+ *
+ * Copyright (C) 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.
+ *
+ ************************************************************************************/
+
+#ifndef __ARCH_ARM_SRC_KINETIS_KINETIS_START_H
+#define __ARCH_ARM_SRC_KINETIS_KINETIS_START_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include
+
+/************************************************************************************
+ * Public Function Prototypes
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: kinetis_boardinitialize
+ *
+ * Description:
+ * All Kinetis architectures must provide the following entry point. This entry
+ * point is called early in the initialization -- after clocking and memory have
+ * been configured but before caches have been enabled and before any devices have
+ * been initialized.
+ *
+ ************************************************************************************/
+
+void kinetis_boardinitialize(void);
+
+#endif /* __ARCH_ARM_SRC_KINETIS_KINETIS_START_H */
diff --git a/arch/arm/src/kl/kl_start.c b/arch/arm/src/kl/kl_start.c
index 6e9970517f57854eb7cc18986237dccbd6bd50b7..5244365a2aae86aa1a0bc047819a9a820c11f5bf 100644
--- a/arch/arm/src/kl/kl_start.c
+++ b/arch/arm/src/kl/kl_start.c
@@ -1,7 +1,7 @@
/****************************************************************************
* arch/arm/src/kl/kl_start.c
*
- * Copyright (C) 2013 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2013, 2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt
*
* Redistribution and use in source and binary forms, with or without
@@ -44,7 +44,6 @@
#include
#include
-#include
#include "up_arch.h"
#include "up_internal.h"
@@ -56,6 +55,7 @@
#include "kl_lowputc.h"
#include "kl_userspace.h"
#include "kl_clockconfig.h"
+#include "kl_start.h"
/****************************************************************************
* Pre-processor Definitions
diff --git a/arch/arm/src/kl/kl_start.h b/arch/arm/src/kl/kl_start.h
new file mode 100644
index 0000000000000000000000000000000000000000..fb26e5b3222f13b3de28b150923e057c0881618c
--- /dev/null
+++ b/arch/arm/src/kl/kl_start.h
@@ -0,0 +1,62 @@
+/************************************************************************************
+ * arch/arm/src/kl/kl_start.h
+ *
+ * Copyright (C) 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.
+ *
+ ************************************************************************************/
+
+#ifndef __ARCH_ARM_SRC_KL_KL_START_H
+#define __ARCH_ARM_SRC_KL_KL_START_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include
+
+/************************************************************************************
+ * Public Function Prototypes
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: kl_boardinitialize
+ *
+ * Description:
+ * All Kinetis L architectures must provide the following entry point. This entry
+ * point is called early in the initialization -- after clocking and memory have
+ * been configured but before caches have been enabled and before any devices have
+ * been initialized.
+ *
+ ************************************************************************************/
+
+void kl_boardinitialize(void);
+
+#endif /* __ARCH_ARM_SRC_KL_KL_START_H */
diff --git a/arch/arm/src/lc823450/Kconfig b/arch/arm/src/lc823450/Kconfig
index 7866de57f69dbb489746980c8d3590e251c3435b..f616cbdfca9dcbe81c8f265ea9f815638b6cb5fa 100644
--- a/arch/arm/src/lc823450/Kconfig
+++ b/arch/arm/src/lc823450/Kconfig
@@ -7,6 +7,10 @@ comment "LC823450 Configuration Options"
menu "LC823450 Peripheral Support"
+config LC823450_IPL2
+ bool "IPL2"
+ default n
+
config LC823450_UART0
bool "UART0"
select UART0_SERIALDRIVER
@@ -125,6 +129,14 @@ config MTD_CONFIG_DEVPATH
string "Device path for config"
default "/dev/mtdblock0p2"
+config MTD_RECOVERY_DEVPATH
+ string "Device path for recovery"
+ default "/dev/mtdblock0p3"
+
+config MTD_KERNEL_DEVPATH
+ string "Device path for kernel"
+ default "/dev/mtdblock0p4"
+
config MTD_ETC_DEVPATH
string "Device path for etc"
default "/dev/mtdblock0p5"
@@ -173,6 +185,11 @@ config LC823450_I2C1
default n
depends on I2C
+config LC823450_I2S0
+ bool "I2S0"
+ default n
+ depends on I2S
+
config LC823450_SPI_DMA
bool "DMA for SPI"
default n
@@ -213,7 +230,7 @@ config LC823450_USBDEV_CUSTOM_HSDSEL_10
endchoice
config LC823450_LSISTBY
- bool "LIS Standby"
+ bool "LSI Standby"
default n
config LC823450_MTM0_TICK
@@ -229,4 +246,8 @@ config HRT_TIMER
bool "High resolution timer"
default n
+config DVFS
+ bool "Dynamic Voltage and Frequencey Scaling"
+ default n
+
endmenu
diff --git a/arch/arm/src/lc823450/Make.defs b/arch/arm/src/lc823450/Make.defs
index dca20b04c0a1af817cc9bda20e6f554f47cb7745..58905083caa22af5e3fb295336180ec8b7124ee2 100644
--- a/arch/arm/src/lc823450/Make.defs
+++ b/arch/arm/src/lc823450/Make.defs
@@ -137,8 +137,8 @@ ifeq ($(CONFIG_ADC),y)
CHIP_CSRCS += lc823450_adc.c
endif
-ifeq ($(CONFIG_IPL2),y)
-ifeq ($(CONFIG_SPIFLASH_BOOT),y)
+ifeq ($(CONFIG_LC823450_IPL2),y)
+ifeq ($(CONFIG_LC823450_SPIFLASH_BOOT),y)
CHIP_CSRCS += lc823450_spif_ipl2.c
else
CHIP_CSRCS += lc823450_ipl2.c
@@ -146,7 +146,8 @@ endif
endif
ifeq ($(CONFIG_DVFS),y)
-CHIP_CSRCS += lc823450_dvfs.c
+CHIP_CSRCS += lc823450_dvfs2.c
+CHIP_CSRCS += lc823450_procfs_dvfs.c
endif
ifeq ($(CONFIG_PM),y)
@@ -181,3 +182,7 @@ ifeq ($(CONFIG_LC823450_MTD),y)
CHIP_CSRCS += lc823450_mtd.c
CHIP_CSRCS += lc823450_mmcl.c
endif
+
+ifeq ($(CONFIG_LC823450_I2S0),y)
+CHIP_CSRCS += lc823450_i2s.c
+endif
diff --git a/arch/arm/src/lc823450/lc823450_clockconfig.c b/arch/arm/src/lc823450/lc823450_clockconfig.c
index 916eac8627cd7b515b6cb0270f89a4e5daeb6a6b..e2c0d8b6b5f37f2369d8a111831b38bc7b1336d4 100644
--- a/arch/arm/src/lc823450/lc823450_clockconfig.c
+++ b/arch/arm/src/lc823450/lc823450_clockconfig.c
@@ -141,7 +141,7 @@ void lc823450_clockconfig()
val |= OSCCNT_SCKSEL_MAIN;
putreg32(val, OSCCNT);
-#ifdef CONFIG_IPL2
+#ifdef CONFIG_LC823450_IPL2
/* set the common PLL values */
/* XTAL / XT1OSC_CLK = 1MHz */
diff --git a/arch/arm/src/lc823450/lc823450_cpupause.c b/arch/arm/src/lc823450/lc823450_cpupause.c
index a8f663e6d886cc44aed8b35738908a90365d9ce0..10b4a0baf25dfd39feda25de376d5a2a87136862 100644
--- a/arch/arm/src/lc823450/lc823450_cpupause.c
+++ b/arch/arm/src/lc823450/lc823450_cpupause.c
@@ -185,9 +185,6 @@ int up_cpu_paused(int cpu)
up_restorestate(tcb->xcp.regs);
- /* FIXME */
- up_udelay(500);
-
spin_unlock(&g_cpu_wait[cpu]);
return OK;
diff --git a/arch/arm/src/lc823450/lc823450_dma.c b/arch/arm/src/lc823450/lc823450_dma.c
index 104c1d2ac6d3a19d7da2090671d49dc5e7f34893..b228f706d54f25f36316fef077f60119a90fd41d 100644
--- a/arch/arm/src/lc823450/lc823450_dma.c
+++ b/arch/arm/src/lc823450/lc823450_dma.c
@@ -150,9 +150,11 @@ static int dma_interrupt_core(void *context)
struct lc823450_phydmach_s *pdmach;
struct lc823450_dmach_s *dmach;
sq_entry_t *q_ent;
+ irqstate_t flags;
pdmach = (struct lc823450_phydmach_s *)context;
+ flags = spin_lock_irqsave();
q_ent = pdmach->req_q.tail;
DEBUGASSERT(q_ent);
dmach = (struct lc823450_dmach_s *)q_ent;
@@ -160,11 +162,17 @@ static int dma_interrupt_core(void *context)
if (dmach->nxfrs == 0)
{
/* finish one transfer */
+
sq_remlast(&pdmach->req_q);
+ spin_unlock_irqrestore(flags);
if (dmach->callback)
dmach->callback((DMA_HANDLE)dmach, dmach->arg, 0);
}
+ else
+ {
+ spin_unlock_irqrestore(flags);
+ }
up_disable_clk(LC823450_CLOCK_DMA);
phydmastart(pdmach);
@@ -218,14 +226,14 @@ static int phydmastart(struct lc823450_phydmach_s *pdmach)
struct lc823450_dmach_s *dmach;
sq_entry_t *q_ent;
- flags = enter_critical_section();
+ flags = spin_lock_irqsave();
q_ent = pdmach->req_q.tail;
if (!q_ent)
{
pdmach->inprogress = 0;
- leave_critical_section(flags);
+ spin_unlock_irqrestore(flags);
return 0;
}
@@ -288,7 +296,7 @@ static int phydmastart(struct lc823450_phydmach_s *pdmach)
modifyreg32(DMACCFG(dmach->chn), 0, DMACCFG_ITC | DMACCFG_E);
- leave_critical_section(flags);
+ spin_unlock_irqrestore(flags);
return 0;
}
@@ -614,7 +622,7 @@ int lc823450_dmastart(DMA_HANDLE handle, dma_callback_t callback, void *arg)
/* select physical channel */
- flags = enter_critical_section();
+ flags = spin_lock_irqsave();
sq_addfirst(&dmach->q_ent, &g_dma.phydmach[dmach->chn].req_q);
@@ -628,7 +636,7 @@ int lc823450_dmastart(DMA_HANDLE handle, dma_callback_t callback, void *arg)
phydmastart(&g_dma.phydmach[dmach->chn]);
}
- leave_critical_section(flags);
+ spin_unlock_irqrestore(flags);
return OK;
}
@@ -645,7 +653,7 @@ void lc823450_dmastop(DMA_HANDLE handle)
DEBUGASSERT(dmach);
- flags = enter_critical_section();
+ flags = spin_lock_irqsave();
modifyreg32(DMACCFG(dmach->chn), DMACCFG_ITC | DMACCFG_E, 0);
@@ -660,6 +668,6 @@ void lc823450_dmastop(DMA_HANDLE handle)
sq_rem(&dmach->q_ent, &pdmach->req_q);
}
- leave_critical_section(flags);
+ spin_unlock_irqrestore(flags);
return;
}
diff --git a/arch/arm/src/lc823450/lc823450_dvfs2.c b/arch/arm/src/lc823450/lc823450_dvfs2.c
new file mode 100644
index 0000000000000000000000000000000000000000..2bc8855f516fc2c8a13cb11171cce262dd9b133f
--- /dev/null
+++ b/arch/arm/src/lc823450/lc823450_dvfs2.c
@@ -0,0 +1,429 @@
+/****************************************************************************
+ * arch/arm/src/lc823450/lc823450_dvfs2.c
+ *
+ * Copyright (C) 2015-2017 Sony Corporation. All rights reserved.
+ * Author: Masayuki Ishikawa
+ * Author: Masatoshi Tateishi
+ *
+ * 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 "lc823450_clockconfig.h"
+#include "lc823450_syscontrol.h"
+#include "lc823450_intc.h"
+#include "lc823450_sdc.h"
+#include "lc823450_dvfs2.h"
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+#define FREQ_160 0
+#define FREQ_080 1
+#define FREQ_040 2
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+typedef struct freq_entry
+{
+ uint16_t freq;
+ uint16_t pll1;
+ uint16_t mdiv;
+ uint16_t hdiv;
+} t_freq_entry;
+
+static struct freq_entry _dvfs_act_tbl[3] =
+{
+ { 160, OSCCNT_MCSEL, OSCCNT_MAINDIV_1, 3}, /* PLL1 */
+ { 80, OSCCNT_MCSEL, OSCCNT_MAINDIV_2, 1}, /* PLL1 */
+ { 40, OSCCNT_MCSEL, OSCCNT_MAINDIV_4, 0}, /* PLL1 */
+};
+
+static struct freq_entry _dvfs_idl_tbl[3] =
+{
+ { 24, 0, OSCCNT_MAINDIV_1, 0}, /* XT1 */
+ { 12, 0, OSCCNT_MAINDIV_2, 0}, /* XT1 */
+ { 6, 0, OSCCNT_MAINDIV_4, 0}, /* XT1 */
+};
+
+static uint16_t _dvfs_cur_idx = 0; /* current speed index */
+static uint16_t _dvfs_cur_hdiv = 3;
+static uint16_t _dvfs_cur_mdiv = OSCCNT_MAINDIV_1;
+
+#if 0
+static uint16_t _dvfs_init_timeout = (5 * 100); /* in ticks */
+#endif
+
+#if defined(CONFIG_SMP) && (CONFIG_SMP_NCPUS == 2)
+static uint8_t _dvfs_cpu_is_active[CONFIG_SMP_NCPUS];
+#endif
+
+static void lc823450_dvfs_set_div(int idx, int tbl);
+
+/****************************************************************************
+ * Public Data
+ ****************************************************************************/
+
+int8_t g_dvfs_enabled = 0;
+uint16_t g_dvfs_cur_freq = 160;
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: lc823450_dvfs_update_lpm
+ ****************************************************************************/
+
+static void lc823450_dvfs_update_lpm(int freq)
+{
+ /* TODO */
+}
+
+#if defined(CONFIG_SMP) && (CONFIG_SMP_NCPUS == 2)
+static int _dvfs_another_cpu_state(int me)
+{
+ if (0 == me)
+ {
+ return _dvfs_cpu_is_active[1];
+ }
+ else
+ {
+ return _dvfs_cpu_is_active[0];
+ }
+}
+#endif
+
+/****************************************************************************
+ * Name: lc823450_dvfs_set_div
+ * Set dividers in the OSC block
+ * target tbl: 0=active, 1=idle
+ ****************************************************************************/
+
+static void lc823450_dvfs_set_div(int idx, int tbl)
+{
+ uint32_t target;
+ uint32_t t_hdiv;
+ uint32_t t_mdiv;
+
+ if (0 == tbl)
+ {
+ target = _dvfs_act_tbl[idx].freq;
+ t_hdiv = _dvfs_act_tbl[idx].hdiv;
+ t_mdiv = _dvfs_act_tbl[idx].mdiv;
+ }
+ else
+ {
+ target = _dvfs_idl_tbl[idx].freq;
+ t_hdiv = _dvfs_idl_tbl[idx].hdiv;
+ t_mdiv = _dvfs_idl_tbl[idx].mdiv;
+ }
+
+ if (100 < target)
+ {
+ /* Set ROM wait cycle (CPU=1wait) */
+
+ modifyreg32(MEMEN4, 0, MEMEN4_HWAIT);
+ }
+
+ /* adjust AHB */
+
+ if (t_hdiv > _dvfs_cur_hdiv)
+ {
+ uint32_t pclkdiv = t_hdiv;
+#ifdef CONFIG_LC823450_SDRAM
+ pclkdiv += (t_hdiv << 16);
+#endif
+ putreg32(pclkdiv, PERICLKDIV);
+ }
+
+ uint32_t regval = getreg32(OSCCNT);
+
+ /* NOTE: In LC823450, MCSEL is reflected first then MAINDIV */
+ /* To avoid spec violation, 2-step clock change is needed */
+
+ /* step 1 : change MAINDIV if needed */
+
+ if (t_mdiv > _dvfs_cur_mdiv)
+ {
+ regval &= ~OSCCNT_MAINDIV_MASK;
+ regval |= t_mdiv;
+
+ /* change the MAINDIV first */
+
+ putreg32(regval, OSCCNT);
+ }
+
+ /* step 2 : change MCSEL and MAINDIV */
+
+ regval = getreg32(OSCCNT);
+ regval &= ~(OSCCNT_MCSEL | OSCCNT_MAINDIV_MASK);
+
+ if (0 == tbl)
+ {
+ regval |= _dvfs_act_tbl[idx].pll1;
+ }
+ else
+ {
+ regval |= _dvfs_idl_tbl[idx].pll1;
+ }
+
+ regval |= t_mdiv;
+
+ /* set MCSEL and MAINDIV again */
+
+ putreg32(regval, OSCCNT);
+
+ /* update loops_per_msec for up_udelay(), up_mdelay() */
+
+ if (0 == tbl)
+ {
+ lc823450_dvfs_update_lpm(_dvfs_act_tbl[idx].freq);
+ }
+ else
+ {
+ lc823450_dvfs_update_lpm(_dvfs_idl_tbl[idx].freq);
+ }
+
+ /* adjust AHB */
+
+ if (t_hdiv < _dvfs_cur_hdiv)
+ {
+ uint32_t pclkdiv = t_hdiv;
+#ifdef CONFIG_LC823450_SDRAM
+ pclkdiv += (t_hdiv << 16);
+#endif
+ putreg32(pclkdiv, PERICLKDIV);
+ }
+
+ _dvfs_cur_idx = idx;
+ _dvfs_cur_hdiv = t_hdiv;
+ _dvfs_cur_mdiv = t_mdiv;
+ g_dvfs_cur_freq = target;
+
+ if (100 > target)
+ {
+ /* Clear ROM wait cycle (CPU=0wait) */
+
+ modifyreg32(MEMEN4, MEMEN4_HWAIT, 0);
+ }
+
+}
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: lc823450_get_apb
+ * Assumption: CPU=APB
+ ****************************************************************************/
+
+uint32_t lc823450_get_apb(void)
+{
+ return g_dvfs_cur_freq * 1000000;
+}
+
+/****************************************************************************
+ * Name: lc823450_dvfs_tick_callback
+ * This callback is called in the timer interupt
+ ****************************************************************************/
+
+void lc823450_dvfs_tick_callback(void)
+{
+#if 0
+ if (_dvfs_init_timeout)
+ {
+ _dvfs_init_timeout--;
+
+ if (0 == _dvfs_init_timeout)
+ {
+ g_dvfs_enabled = 1;
+ }
+ }
+#endif
+}
+
+/****************************************************************************
+ * Name: lc823450_dvfs_enter_idle
+ ****************************************************************************/
+
+void lc823450_dvfs_enter_idle(void)
+{
+ irqstate_t flags = spin_lock_irqsave();
+
+ if (0 == g_dvfs_enabled)
+ {
+ goto exit_with_error;
+ }
+
+#if defined(CONFIG_SMP) && (CONFIG_SMP_NCPUS == 2)
+ int me = up_cpu_index();
+
+ /* Update my state first : 0 (idle) */
+
+ _dvfs_cpu_is_active[me] = 0;
+
+ /* check if another core is still active */
+
+ if (_dvfs_another_cpu_state(me))
+ {
+ /* do not change to idle clock */
+
+ goto exit_with_error;
+ }
+
+#endif
+
+#ifdef CONFIG_DVFS_CHECK_SDC
+ if (lc823450_sdc_locked())
+ {
+ goto exit_with_error;
+ }
+#endif
+
+ /* NOTE: set idle freq : idx=same, change:tbl */
+
+ lc823450_dvfs_set_div(_dvfs_cur_idx, 1);
+
+exit_with_error:
+ spin_unlock_irqrestore(flags);
+}
+
+/****************************************************************************
+ * Name: lc823450_dvfs_exit_idle
+ * This API is called in up_ack_irq() (i.e. interrupt context)
+ ****************************************************************************/
+
+void lc823450_dvfs_exit_idle(int irq)
+{
+ irqstate_t flags = spin_lock_irqsave();
+
+ if (0 == g_dvfs_enabled)
+ {
+ goto exit_with_error;
+ }
+
+#if defined(CONFIG_SMP) && (CONFIG_SMP_NCPUS == 2)
+ int me = up_cpu_index();
+
+ /* Update my state first: 1 (active) */
+
+ _dvfs_cpu_is_active[me] = 1;
+
+ /* Check if another core is already active */
+
+ if (_dvfs_another_cpu_state(me))
+ {
+ /* do nothing */
+
+ goto exit_with_error;
+ }
+#endif
+
+ /* NOTE: set active freq : idx=same, change:tbl */
+
+ lc823450_dvfs_set_div(_dvfs_cur_idx, 0);
+
+exit_with_error:
+ spin_unlock_irqrestore(flags);
+}
+
+/****************************************************************************
+ * Name: lc823450_dvfs_boost
+ * boost the sytem clock to MAX (i.e. 160M)
+ * timeout in msec
+ ****************************************************************************/
+
+int lc823450_dvfs_boost(int timeout)
+{
+ /* TODO */
+ return 0;
+}
+
+/****************************************************************************
+ * Name: lc823450_dvfs_set_freq
+ * NOTE: should be called from dvfs command only
+ ****************************************************************************/
+
+int lc823450_dvfs_set_freq(int freq)
+{
+ int ret = 0;
+ int idx;
+ irqstate_t flags;
+
+ if (0 == g_dvfs_enabled)
+ {
+ return -1;
+ }
+
+ flags = spin_lock_irqsave();
+
+ switch (freq)
+ {
+ case 160:
+ idx = FREQ_160;
+ break;
+
+ case 80:
+ idx = FREQ_080;
+ break;
+
+ case 40:
+ idx = FREQ_040;
+ break;
+
+ default:
+ ret = -1;
+ break;
+ }
+
+ if (0 == ret)
+ {
+ lc823450_dvfs_set_div(idx, 0);
+ }
+
+ spin_unlock_irqrestore(flags);
+ return ret;
+}
diff --git a/arch/arm/src/lc823450/lc823450_dvfs2.h b/arch/arm/src/lc823450/lc823450_dvfs2.h
new file mode 100644
index 0000000000000000000000000000000000000000..a4423d65e065c5e191bc490969cc2d75c4a1e7dc
--- /dev/null
+++ b/arch/arm/src/lc823450/lc823450_dvfs2.h
@@ -0,0 +1,75 @@
+/****************************************************************************
+ * arch/arm/src/lc823450/lc823450_dvfs2.h
+ *
+ * Copyright (C) 2015-2017 Sony Corporation. All rights reserved.
+ * Author: Masayuki Ishikawa
+ *
+ * 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_LC823450_LC823450_DVFS2_H
+#define __ARCH_ARM_SRC_LC823450_LC823450_DVFS2_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include
+
+/****************************************************************************
+ * Public Data
+ ****************************************************************************/
+
+#ifndef __ASSEMBLY__
+#ifdef __cplusplus
+#define EXTERN extern "C"
+extern "C"
+{
+#else
+#define EXTERN extern
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+void lc823450_dvfs_set_min(uint8_t id, uint16_t mhz);
+void lc823450_dvfs_enter_idle(void);
+void lc823450_dvfs_exit_idle(int irq);
+int lc823450_dvfs_set_freq(int freq);
+void lc823450_dvfs_tick_callback(void);
+
+int dvfs_procfs_register(void);
+
+#if defined(__cplusplus)
+}
+#endif
+#undef EXTERN
+#endif /* __ASSEMBLY__ */
+#endif /* __ARCH_ARM_SRC_LC823450_LC823450_DVFS2_H */
diff --git a/arch/arm/src/lc823450/lc823450_gpio.c b/arch/arm/src/lc823450/lc823450_gpio.c
index a9c6d06b50c9940600e87c51e38f96b9d2fbf43c..bb8aab5d3cb25821bd29ef713f93ed80ce4c741a 100644
--- a/arch/arm/src/lc823450/lc823450_gpio.c
+++ b/arch/arm/src/lc823450/lc823450_gpio.c
@@ -239,12 +239,12 @@ int lc823450_gpio_mux(uint16_t gpiocfg)
if (port <= (GPIO_PORT5 >> GPIO_PORT_SHIFT))
{
- irqstate_t flags = enter_critical_section();
+ irqstate_t flags = spin_lock_irqsave();
val = getreg32(PMDCNT0 + (port * 4));
val &= ~(3 << (2 * pin));
val |= (mux << (2 *pin));
putreg32(val, PMDCNT0 + (port * 4));
- leave_critical_section(flags);
+ spin_unlock_irqrestore(flags);
}
else
{
@@ -287,7 +287,7 @@ int lc823450_gpio_config(uint16_t gpiocfg)
/* Handle the GPIO configuration by the basic mode of the pin */
- flags = enter_critical_section();
+ flags = spin_lock_irqsave();
/* pull up/down specified */
@@ -312,7 +312,7 @@ int lc823450_gpio_config(uint16_t gpiocfg)
break;
}
- leave_critical_section(flags);
+ spin_unlock_irqrestore(flags);
}
#ifdef CONFIG_IOEX
else if (port <= (GPIO_PORTEX >> GPIO_PORT_SHIFT))
@@ -400,24 +400,24 @@ void lc823450_gpio_write(uint16_t gpiocfg, bool value)
regaddr = lc823450_get_gpio_data(port);
- flags = enter_critical_section();
+ flags = spin_lock_irqsave();
/* Write the value (0 or 1). To the data register */
regval = getreg32(regaddr);
- if (value)
- {
- regval |= (1 << pin);
- }
- else
- {
- regval &= ~(1 << pin);
- }
+ if (value)
+ {
+ regval |= (1 << pin);
+ }
+ else
+ {
+ regval &= ~(1 << pin);
+ }
- putreg32(regval, regaddr);
+ putreg32(regval, regaddr);
- leave_critical_section(flags);
+ spin_unlock_irqrestore(flags);
}
#ifdef CONFIG_IOEX
else if (port <= (GPIO_PORTEX >> GPIO_PORT_SHIFT))
diff --git a/arch/arm/src/lc823450/lc823450_i2c.c b/arch/arm/src/lc823450/lc823450_i2c.c
index 4b9c26451e570e735d9b192c3657131e2a76ed36..5b49856ee4b27a068c9386ec27bda8946de1f183 100644
--- a/arch/arm/src/lc823450/lc823450_i2c.c
+++ b/arch/arm/src/lc823450/lc823450_i2c.c
@@ -765,12 +765,12 @@ static int lc823450_i2c_poll(FAR struct lc823450_i2c_priv_s *priv)
i2cinfo("re-START condition\n");
+#ifdef CONFIG_I2C_RESET
/* Reset I2C bus by softreset. There is not description of the reset,
* but in order to recover I2C bus busy, it must be done.
* Please refer to macaron's code.
*/
-#ifdef CONFIG_I2C_RESET
lc823450_i2c_reset((FAR struct i2c_master_s *)priv);
#endif
@@ -778,6 +778,7 @@ static int lc823450_i2c_poll(FAR struct lc823450_i2c_priv_s *priv)
/* We have to enable interrupt again, because all registers are reset by
* lc823450_i2c_reset().
*/
+
lc823450_i2c_enableirq(priv);
#endif
@@ -1053,7 +1054,7 @@ static int lc823450_i2c_transfer(FAR struct i2c_master_s *dev,
leave_critical_section(irqs);
}
-#ifndef CONFIG_IPL2
+#ifndef CONFIG_LC823450_IPL2
i2cerr("ERROR: I2C timed out (dev=%xh)\n", msgs->addr);
#endif
}
diff --git a/arch/arm/src/lc823450/lc823450_i2s.c b/arch/arm/src/lc823450/lc823450_i2s.c
new file mode 100644
index 0000000000000000000000000000000000000000..3eced5cb4f246d282cf4b122b2ac7adf91330c6e
--- /dev/null
+++ b/arch/arm/src/lc823450/lc823450_i2s.c
@@ -0,0 +1,472 @@
+/****************************************************************************
+ * arch/arm/src/lc823450/lc823450_i2s.c
+ *
+ * Copyright (C) 2017 Sony Corporation. All rights reserved.
+ * Author: Masayuki Ishikawa
+ *
+ * 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_arch.h"
+#include "lc823450_dma.h"
+#include "lc823450_i2s.h"
+#include "lc823450_syscontrol.h"
+#include "lc823450_clockconfig.h"
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+#define LC823450_AUDIO_REGBASE 0x40060000
+
+#define ABUF_REGBASE (LC823450_AUDIO_REGBASE + 0x0000)
+#define BEEP_REGBASE (LC823450_AUDIO_REGBASE + 0x1200)
+#define PCKGEN_REGBASE (LC823450_AUDIO_REGBASE + 0x1600)
+#define AUDCTL_REGBASE (LC823450_AUDIO_REGBASE + 0x4000)
+
+#define ABUFCLR (ABUF_REGBASE + 0x0000)
+
+#define ABUFACCEN (ABUF_REGBASE + 0x0004)
+#define ABUFACCEN_CDCFEN (1 << 5)
+
+#define ABUFIRQEN0 (ABUF_REGBASE + 0x0008)
+#define ABUFIRQEN0_BFULIRQEN (1 << 5)
+
+#define ABUFSTS1 (ABUF_REGBASE + 0x0034)
+
+#define BUF_F_BASE (ABUF_REGBASE + 0x00c0 + (0x4 * 5))
+#define BUF_F_SIZE (ABUF_REGBASE + 0x0100 + (0x4 * 5))
+#define BUF_F_ULVL (ABUF_REGBASE + 0x0140 + (0x4 * 5))
+#define BUF_F_DTCAP (ABUF_REGBASE + 0x01c0 + (0x4 * 5))
+#define BUF_F_ACCESS (ABUF_REGBASE + 0x0300 + (0x4 * 5))
+
+#define CLOCKEN (AUDCTL_REGBASE + 0x0000)
+#define CLOCKEN_FCE_PCKGEN (1 << 28)
+#define CLOCKEN_FCE_PCMPS0 (1 << 17)
+#define CLOCKEN_FCE_BEEP (1 << 16)
+#define CLOCKEN_FCE_VOLPS0 (1 << 13)
+
+#define AUDSEL (AUDCTL_REGBASE + 0x001c)
+#define AUDSEL_PCM0_MODE (1 << 17)
+#define AUDSEL_PCM0_MODEM (1 << 16)
+
+#define PSCTL (AUDCTL_REGBASE + 0x0110)
+
+#define PCMOUTEN (AUDCTL_REGBASE + 0x0500)
+#define PCMOUTEN_DOUT0EN (1 << 3)
+#define PCMOUTEN_LRCK0EN (1 << 2)
+#define PCMOUTEN_MCLK0EN (1 << 1)
+#define PCMOUTEN_BCK0EN (1 << 0)
+
+#define PCMCTL (AUDCTL_REGBASE + 0x0504)
+
+#define BEEP_CTL (BEEP_REGBASE + 0x0000)
+#define BEEP_BYPASS (BEEP_REGBASE + 0x0004)
+#define BEEP_COEFF (BEEP_REGBASE + 0x0008)
+#define BEEP_TIME (BEEP_REGBASE + 0x000c)
+
+/* Audio PLL */
+
+#define AUDIOPLL_REGBASE (LC823450_OSCSYS_REGBASE + 0x2000)
+#define AUDPLLCNT (AUDIOPLL_REGBASE + 0x00)
+#define AUDPLLMDIV (AUDIOPLL_REGBASE + 0x04)
+#define AUDPLLNDIV (AUDIOPLL_REGBASE + 0x08)
+
+/****************************************************************************
+ * Private Types
+ ****************************************************************************/
+
+/* The state of the one I2S peripheral */
+
+struct lc823450_i2s_s
+{
+ struct i2s_dev_s dev; /* Externally visible I2S interface */
+};
+
+/****************************************************************************
+ * Private Function Prototypes
+ ****************************************************************************/
+
+static uint32_t lc823450_i2s_txsamplerate(struct i2s_dev_s *dev, uint32_t rate);
+static uint32_t lc823450_i2s_txdatawidth(struct i2s_dev_s *dev, int bits);
+static int lc823450_i2s_send(struct i2s_dev_s *dev, struct ap_buffer_s *apb,
+ i2s_callback_t callback, void *arg,
+ uint32_t timeout);
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/* I2S device operations */
+
+static const struct i2s_ops_s g_i2sops =
+{
+ /* Transmitter methods */
+
+ .i2s_txsamplerate = lc823450_i2s_txsamplerate,
+ .i2s_txdatawidth = lc823450_i2s_txdatawidth,
+ .i2s_send = lc823450_i2s_send,
+};
+
+static DMA_HANDLE _htxdma;
+static sem_t _sem_txdma;
+static sem_t _sem_buf_under;
+
+/****************************************************************************
+ * Public Data
+ ****************************************************************************/
+
+extern unsigned int XT1OSC_CLK;
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: _setup_audio_pll
+ ****************************************************************************/
+
+static void _setup_audio_pll(uint32_t freq)
+{
+ ASSERT(24000000 == XT1OSC_CLK);
+
+ uint32_t m;
+ uint32_t n;
+
+ switch (freq)
+ {
+ case 44100:
+ m = 625;
+ n = 3528;
+ break;
+
+ case 48000:
+ m = 125;
+ n = 768;
+ break;
+
+ default:
+ ASSERT(false);
+ }
+
+ /* Set divider */
+
+ putreg32(n, AUDPLLNDIV);
+ putreg32(m, AUDPLLMDIV);
+
+ /* Audio PLL standby=off, Audio PLL unreset */
+
+ putreg32(0x0503, AUDPLLCNT);
+
+ /* TODO: Wait */
+
+ usleep(50 * 1000);
+
+ /* Switch to the PLL */
+
+ modifyreg32(AUDCLKCNT,
+ 0x0,
+ 0x03 /* AUDCLKSEL=Audio PLL */
+ );
+
+ /* TODO: Clock divider settings */
+
+ modifyreg32(AUDCLKCNT,
+ 0x0,
+ 0x0200 /* AUDDIV=2 */
+ );
+}
+
+/****************************************************************************
+ * Name: _i2s_txdma_callback
+ ****************************************************************************/
+
+static void _i2s_txdma_callback(DMA_HANDLE hdma, void *arg, int result)
+{
+ sem_t *waitsem = (sem_t *)arg;
+ nxsem_post(waitsem);
+}
+
+/****************************************************************************
+ * Name: _i2s_semtake
+ ****************************************************************************/
+
+static void _i2s_semtake(FAR sem_t *sem)
+{
+ int ret;
+
+ do
+ {
+ /* Take the semaphore (perhaps waiting) */
+
+ ret = nxsem_wait(sem);
+
+ /* 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);
+}
+
+/****************************************************************************
+ * Name: lc823450_i2s_txsamplerate
+ ****************************************************************************/
+
+static uint32_t lc823450_i2s_txsamplerate(struct i2s_dev_s *dev, uint32_t rate)
+{
+ /* TODO */
+ return 0;
+}
+
+/****************************************************************************
+ * Name: lc823450_i2s_txdatawidth
+ ****************************************************************************/
+
+static uint32_t lc823450_i2s_txdatawidth(struct i2s_dev_s *dev, int bits)
+{
+ /* TODO */
+ return 0;
+}
+
+/****************************************************************************
+ * Name: _i2s_isr
+ ****************************************************************************/
+
+static int _i2s_isr(int irq, FAR void *context, FAR void *arg)
+{
+ /* Disable Buffer F Under Level IRQ */
+
+ putreg32(0, ABUFIRQEN0);
+
+ /* post semaphore for the waiter */
+
+ nxsem_post(&_sem_buf_under);
+ return 0;
+}
+
+/****************************************************************************
+ * Name: lc823450_i2s_send
+ ****************************************************************************/
+
+static int lc823450_i2s_send(struct i2s_dev_s *dev, struct ap_buffer_s *apb,
+ i2s_callback_t callback, void *arg,
+ uint32_t timeout)
+{
+ /* Enable Buffer F Under Level IRQ */
+
+ putreg32(ABUFIRQEN0_BFULIRQEN, ABUFIRQEN0);
+
+ /* Wait for Audio Buffer */
+
+ _i2s_semtake(&_sem_buf_under);
+
+ volatile uint32_t *ptr = (uint32_t *)&apb->samp[apb->curbyte];
+ uint32_t n = apb->nbytes;
+
+ /* Setup and start DMA for I2S */
+
+ lc823450_dmasetup(_htxdma,
+ LC823450_DMA_SRCINC |
+ LC823450_DMA_SRCWIDTH_WORD |
+ LC823450_DMA_DSTWIDTH_WORD,
+ (uint32_t)ptr, (uint32_t)BUF_F_ACCESS, n / 4);
+
+ lc823450_dmastart(_htxdma,
+ _i2s_txdma_callback,
+ &_sem_txdma);
+
+ _i2s_semtake(&_sem_txdma);
+
+ /* Invoke the callback handler */
+
+ callback(dev, apb, arg, 0);
+ return OK;
+}
+
+/****************************************************************************
+ * Name: lc823450_i2s_beeptest
+ ****************************************************************************/
+
+#ifdef BEEP_TEST
+static void lc823450_i2s_beeptest(void)
+{
+ /* Set BEEP params */
+
+ putreg32(0x0, BEEP_BYPASS);
+ putreg32(0x123ca6, BEEP_COEFF); /* 1kHz@fs=44.1k */
+ putreg32(0xffff, BEEP_TIME);
+
+ /* Start */
+
+ putreg32(0x3, BEEP_CTL);
+}
+#endif
+
+/****************************************************************************
+ * Name: lc823450_i2s_configure
+ ****************************************************************************/
+
+static int lc823450_i2s_configure(void)
+{
+ _setup_audio_pll(44100);
+
+ /* Unreset Audio Buffer */
+
+ putreg32(MRSTCNTEXT3_AUDIOBUF_RSTB,
+ MRSTCNTEXT3);
+
+ /* Enable clock to Audio Buffer */
+
+ putreg32(MCLKCNTEXT3_AUDIOBUF_CLKEN,
+ MCLKCNTEXT3);
+
+ /* F Buffer = 32KB */
+
+ putreg32(4096 * 8, BUF_F_SIZE);
+
+ /* Buffer Under Level = 1KB */
+
+ putreg32(1024, BUF_F_ULVL);
+
+ /* Clear Audio Buffer */
+
+ putreg32(0xffff, ABUFCLR);
+
+ /* Access Enable */
+
+ putreg32(ABUFACCEN_CDCFEN, ABUFACCEN);
+
+ /* PCM0: BCK0/LRCK0=master, MCLK0=master */
+
+ putreg32(AUDSEL_PCM0_MODE |
+ AUDSEL_PCM0_MODEM,
+ AUDSEL);
+
+ /* LRCK0/BCK0: 1/1fs, BCK0:64fs, BCK1:64fs */
+
+ putreg32(0x00001010,
+ PCMCTL);
+
+ /* Enable DOUT0/LRCK0/MCL0/BCK0 */
+
+ putreg32(PCMOUTEN_DOUT0EN |
+ PCMOUTEN_LRCK0EN |
+ PCMOUTEN_MCLK0EN |
+ PCMOUTEN_BCK0EN,
+ PCMOUTEN);
+
+ /* Stereo, PCMDLY=1, LRCK active low,
+ * MSB first and left justified, 32bit
+ */
+
+ putreg32(0x64, PSCTL);
+
+ /* Enable PCMPS0 */
+
+ putreg32(CLOCKEN_FCE_PCKGEN |
+ CLOCKEN_FCE_BEEP |
+ CLOCKEN_FCE_PCMPS0 |
+ CLOCKEN_FCE_VOLPS0,
+ CLOCKEN);
+
+ return 0;
+}
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: lc823450_i2sdev_initialize
+ ****************************************************************************/
+
+FAR struct i2s_dev_s *lc823450_i2sdev_initialize(void)
+{
+ FAR struct lc823450_i2s_s *priv = NULL;
+
+ /* The support STM32 parts have only a single I2S port */
+
+ i2sinfo("port: %d\n", port);
+
+ /* Allocate a new state structure for this chip select. NOTE that there
+ * is no protection if the same chip select is used in two different
+ * chip select structures.
+ */
+
+ priv = (struct lc823450_i2s_s *)zalloc(sizeof(struct lc823450_i2s_s));
+ if (!priv)
+ {
+ i2serr("ERROR: Failed to allocate a chip select structure\n");
+ return NULL;
+ }
+
+ /* Initialize the common parts for the I2S device structure */
+
+ priv->dev.ops = &g_i2sops;
+
+ (void)lc823450_i2s_configure();
+
+#ifdef BEEP_TEST
+ lc823450_i2s_beeptest();
+#endif
+
+ _htxdma = lc823450_dmachannel(DMA_CHANNEL_VIRTUAL);
+ nxsem_init(&_sem_txdma, 0, 0);
+ nxsem_init(&_sem_buf_under, 0, 0);
+
+ irq_attach(LC823450_IRQ_AUDIOBUF0, _i2s_isr, NULL);
+
+ /* Enable IRQ for Audio Buffer */
+
+ up_enable_irq(LC823450_IRQ_AUDIOBUF0);
+
+ /* Success exit */
+
+ return &priv->dev;
+}
diff --git a/drivers/wireless/ieee802154/xbee/xbee_dataind.h b/arch/arm/src/lc823450/lc823450_i2s.h
similarity index 69%
rename from drivers/wireless/ieee802154/xbee/xbee_dataind.h
rename to arch/arm/src/lc823450/lc823450_i2s.h
index 074f646f760b9bd3b8f4528151c0c3a42c28057c..82e64be60dcf0f947afaa322e727ac8eb4ec092b 100644
--- a/drivers/wireless/ieee802154/xbee/xbee_dataind.h
+++ b/arch/arm/src/lc823450/lc823450_i2s.h
@@ -1,9 +1,8 @@
/****************************************************************************
- * drivers/wireless/ieee802154/xbee/xbee_dataind.h
+ * arch/arm/src/lc823450/lc823450_i2s.h
*
- * Copyright (C) 2017 Verge Inc. All rights reserved.
- *
- * Author: Anthony Merlino
+ * Copyright (C) 2017 Sony Corporation. All rights reserved.
+ * Author: Masayuki Ishikawa
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -34,44 +33,43 @@
*
****************************************************************************/
-#ifndef __DRIVERS_WIRELESS_IEEE802154_XBEE_DATAIND_H
-#define __DRIVERS_WIRELESS_IEEE802154_XBEE_DATAIND_H
+#ifndef __ARCH_ARM_SRC_LC823450_LC823450_I2S_H
+#define __ARCH_ARM_SRC_LC823450_LC823450_I2S_H
/****************************************************************************
* Included Files
****************************************************************************/
#include
+#include
-#include
-#include
+#include "chip.h"
-#include
+#ifndef __ASSEMBLY__
/****************************************************************************
- * Private Types
+ * Public Data
****************************************************************************/
-/* Extend the public ieee802154_data_ind_s to include a private forward link to
- * support a list to handle allocation
- */
-
-struct xbee_dataind_s
+#undef EXTERN
+#if defined(__cplusplus)
+#define EXTERN extern "C"
+extern "C"
{
- struct ieee802154_data_ind_s pub; /* Publically visible structure */
- FAR struct xbee_dataind_s *flink; /* Supports a singly linked list */
-};
+#else
+#define EXTERN extern
+#endif
/****************************************************************************
- * Function Prototypes
+ * Public Function Prototypes
****************************************************************************/
-struct xbee_priv_s; /* Forward Reference */
-
-void xbee_dataindpool_init(FAR struct xbee_priv_s *priv);
+FAR struct i2s_dev_s *lc823450_i2sdev_initialize(void);
-int xbee_dataind_alloc(FAR struct xbee_priv_s *priv,
- FAR struct ieee802154_data_ind_s **dataind,
- bool allow_interrupt);
+#undef EXTERN
+#if defined(__cplusplus)
+}
+#endif
-#endif /* __DRIVERS_WIRELESS_IEEE802154_XBEE_DATAIND_H */
\ No newline at end of file
+#endif /* __ASSEMBLY__ */
+#endif /* __ARCH_ARM_SRC_LC823450_LC823450_I2S_H */
diff --git a/arch/arm/src/lc823450/lc823450_idle.c b/arch/arm/src/lc823450/lc823450_idle.c
index b9caac0dfef51b1878b25ea7188d8982453a921a..f4ced8826d5339e40514720efb61329c96489e13 100644
--- a/arch/arm/src/lc823450/lc823450_idle.c
+++ b/arch/arm/src/lc823450/lc823450_idle.c
@@ -42,13 +42,15 @@
#include
#include
+#include
+#include
#include "nvic.h"
#include "up_internal.h"
#include "up_arch.h"
#ifdef CONFIG_DVFS
-# include "lc823450_dvfs.h"
+# include "lc823450_dvfs2.h"
#endif
/****************************************************************************
@@ -60,6 +62,8 @@ static int32_t g_in_sleep;
static uint64_t g_sleep_t0;
#endif /* CONFIG_LC823450_SLEEP_MODE */
+static uint32_t g_idle_counter[2];
+
/****************************************************************************
* Private Functions
****************************************************************************/
@@ -122,16 +126,21 @@ void up_idle(void)
regval &= ~NVIC_SYSCON_SLEEPDEEP;
putreg32(regval, NVIC_SYSCON);
+ leave_critical_section(flags);
+#endif /* CONFIG_LC823450_SLEEP_MODE */
+
#ifdef CONFIG_DVFS
lc823450_dvfs_enter_idle();
#endif
- leave_critical_section(flags);
-#endif /* CONFIG_LC823450_SLEEP_MODE */
+ board_autoled_off(LED_CPU0 + up_cpu_index());
/* Sleep until an interrupt occurs to save power */
asm("WFI");
+
+ g_idle_counter[up_cpu_index()]++;
+
#endif
}
diff --git a/arch/arm/src/lc823450/lc823450_ipl2.c b/arch/arm/src/lc823450/lc823450_ipl2.c
new file mode 100644
index 0000000000000000000000000000000000000000..beabbc4a5f580445a1dace86476c23a7722c1bb1
--- /dev/null
+++ b/arch/arm/src/lc823450/lc823450_ipl2.c
@@ -0,0 +1,758 @@
+/****************************************************************************
+ * arch/arm/src/lc823450/lc823450_ipl2.c
+ *
+ * Copyright (C) 2015-2017 Sony Corporation. All rights reserved.
+ * Author: Masatoshi Tateishi
+ * Author: Nobutaka Toyoshima
+ * Author: Yasuhiro Osaki
+ *
+ * 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
+
+#ifdef CONFIG_FS_EVFAT
+# include
+#endif
+
+#include
+#include
+#include
+
+#ifdef CONFIG_I2C
+# include
+#endif
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#ifdef CONFIG_LASTKMSG
+# include
+#endif /* CONFIG_LASTKMSG */
+
+#include
+
+#include
+
+#include "up_internal.h"
+#include "up_arch.h"
+
+#ifdef CONFIG_ADC
+# include "lc823450_adc.h"
+#endif
+
+#include "lc823450_syscontrol.h"
+#include "lc823450_mtd.h"
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+#define IPL2_DEVPATH "/dev/mtdblock0"
+#define IPL2_IMAGE "LC8234xx_17S_start_data.boot_bin"
+
+#define LASTMSG_LOGPATH "/log/lastkmsg"
+
+#define R2A20056BM_ADDR 0x1B
+#define R2A20056BM_SCL 375000
+
+#ifdef CONFIG_CHARGER
+# define FORCE_USBBOOT_CHARGER
+#endif
+
+#pragma GCC optimize ("O0")
+
+/****************************************************************************
+ * Private Types
+ ****************************************************************************/
+
+static struct
+{
+ uint32_t sig;
+ uint32_t chunknum;
+ struct
+ {
+ char fname[32];
+ char csum[32];
+ uint32_t size;
+ uint32_t enc;
+ uint32_t offset;
+ } chunk[10];
+} upg_image;
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+static char copybuf[512];
+static void *tmp;
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+#ifdef CONFIG_USBMSC
+static void sysreset(void);
+static int set_config(int num, char *buf);
+#endif
+
+/****************************************************************************
+ * Name: blk_read()
+ ****************************************************************************/
+
+static int blk_read(void *buf, int len, const char *path, int offset)
+{
+ void *handle;
+ int ret;
+
+ ret = bchlib_setup(path, true, &handle);
+
+ if (ret)
+ {
+ return ret;
+ }
+
+ ret = bchlib_read(handle, buf, offset, len);
+
+ bchlib_teardown(handle);
+
+ return ret;
+}
+
+/****************************************************************************
+ * Name: blk_write()
+ ****************************************************************************/
+
+#ifdef CONFIG_USBMSC
+static int blk_write(const void *buf, int len, const char *path, int offset)
+{
+ void *handle;
+ int ret;
+
+ ret = bchlib_setup(path, true, &handle);
+
+ if (ret)
+ {
+ return ret;
+ }
+
+ ret = bchlib_write(handle, buf, offset, len);
+
+ bchlib_teardown(handle);
+
+ return ret;
+}
+#endif
+
+/****************************************************************************
+ * Name: install_recovery()
+ ****************************************************************************/
+
+static int install_recovery(const char *srcpath)
+{
+ int rfd, i, len, rem;
+ int ret = 0;
+ void *handle = NULL;
+
+ if (bchlib_setup(CONFIG_MTD_RECOVERY_DEVPATH, false, &handle))
+ {
+ return -1;
+ }
+
+ rfd = open(srcpath, O_RDONLY, 0444);
+
+ if (read(rfd, &upg_image, sizeof(upg_image)) != sizeof(upg_image))
+ {
+ _info("read head");
+ ret = -EIO;
+ goto err;
+ }
+
+#ifdef IMG_SIGNATURE
+ if (upg_image.sig != IMG_SIGNATURE)
+ {
+ _info("image signature missmatch. IPL2=%u, UPG=%u\n",
+ IMG_SIGNATURE, upg_image.sig);
+ _info("go normal boot\n");
+
+ memset(copybuf, 0, sizeof(copybuf));
+ snprintf(copybuf, sizeof(copybuf), "normal");
+ set_config(1, copybuf);
+ sysreset();
+
+ /* NOT REACHED */
+
+ }
+#endif
+
+ for (i = 0; i < upg_image.chunknum; i++)
+ {
+ if (!strcmp(basename(upg_image.chunk[i].fname), "recovery"))
+ {
+ break;
+ }
+ }
+
+ if (i == upg_image.chunknum)
+ {
+ _info("recovery not found\n");
+ ret = -ENOENT;
+ goto err;
+ }
+
+ lseek(rfd, upg_image.chunk[i].offset +
+ ((void *)&upg_image.chunk[upg_image.chunknum] - (void *)&upg_image),
+ SEEK_SET);
+
+ rem = upg_image.chunk[i].size;
+
+ while (rem > 0)
+ {
+ len = read(rfd, copybuf, rem > 512 ? 512 : rem);
+
+ if (len < 0)
+ {
+ _info("read image");
+ ret = -EIO;
+ goto err;
+ }
+
+ bchlib_write(handle, copybuf, upg_image.chunk[i].size - rem, len);
+ rem -= len;
+ }
+
+err:
+ if (handle)
+ {
+ bchlib_teardown(handle);
+ }
+
+ close(rfd);
+ _info("DONE\n");
+ return ret;
+}
+
+/****************************************************************************
+ * Name: load_kernel()
+ ****************************************************************************/
+
+static void load_kernel(const char *name, const char *devname)
+{
+ int i;
+
+ tmp = (void *)0x02040000;
+
+ (void)blk_read(tmp, 512 * 1024, devname, 0);
+
+ /* disable all IRQ */
+ for (i = LC823450_IRQ_NMI + 1; i < NR_IRQS; i++)
+ {
+ up_disable_irq(i);
+ }
+
+ /* clear pending IRQ */
+ putreg32(0xffffffff, NVIC_IRQ0_31_CLRPEND);
+ putreg32(0xffffffff, NVIC_IRQ32_63_CLRPEND);
+ putreg32(0xffffffff, NVIC_IRQ64_95_CLRPEND);
+
+ _info("start %s\n", name);
+
+ __asm__ __volatile__
+ (
+ "ldr r0, =tmp\n"
+ "ldr r1, [r0, #0]\n" /* r1 = 0x02040000 */
+ "ldr sp, [r1, #0]\n" /* set sp */
+ "ldr pc, [r1, #4]" /* set pc, start nuttx */
+ );
+
+}
+
+/****************************************************************************
+ * Name: check_diskformat()
+ ****************************************************************************/
+
+#ifdef CONFIG_USBMSC
+static int check_diskformat(void)
+{
+ int ret;
+
+#ifdef CONFIG_FS_EVFAT
+ struct evfat_format_s fmt = EVFAT_FORMAT_INITIALIZER;
+
+ /* load MBR */
+
+ ret = blk_read(copybuf, sizeof(copybuf), "/dev/mtdblock0p2", 0);
+
+ if (ret < 0)
+ {
+ return 0;
+ }
+
+ /* If part2 has MBR signature, this eMMC was formated by PC.
+ * This means the set is just after writing IPL2.
+ */
+
+ if (copybuf[510] != 0x55 || copybuf[511] != 0xaa)
+ {
+ return 0;
+ }
+
+ ret = mkevfatfs(CONFIG_MTD_CP_DEVPATH, &fmt);
+#endif
+
+ _info("FORMAT content partition : %d\n", ret);
+
+ memset(copybuf, 0, sizeof(copybuf));
+ ret = blk_write(copybuf, 512, CONFIG_MTD_ETC_DEVPATH, 0);
+ _info("clear /etc : %d\n", ret);
+ ret = blk_write(copybuf, 512, CONFIG_MTD_SYSTEM_DEVPATH, 0);
+ _info("clear /system : %d\n", ret);
+ ret = blk_write(copybuf, 512, CONFIG_MTD_CACHE_DEVPATH, 0);
+ _info("clear /cache : %d\n", ret);
+
+ return 1;
+}
+#endif
+
+/****************************************************************************
+ * Name: check_forceusbboot()
+ ****************************************************************************/
+
+#ifdef CONFIG_ADC
+static int check_forceusbboot(void)
+{
+ uint32_t val;
+ uint32_t val1;
+
+ /* enable clock & unreset */
+
+ modifyreg32(MCLKCNTAPB, 0, MCLKCNTAPB_ADC_CLKEN);
+ modifyreg32(MRSTCNTAPB, 0, MRSTCNTAPB_ADC_RSTB);
+
+ usleep(10000);
+
+ /* start ADC0,1 */
+
+ putreg32(rADCCTL_fADCNVCK_DIV32 | rADCCTL_fADACT | rADCCTL_fADCHSCN |
+ 1 /* 0,1 ch */, rADCCTL);
+
+ putreg32(53, rADCSMPL);
+
+ /* wait for adc done */
+
+ while ((getreg32(rADCSTS) & rADCSTS_fADCMPL) == 0)
+ ;
+
+ val = getreg32(rADC0DT);
+ val1 = getreg32(rADC1DT);
+
+ _info("val = %d, val1 = %d\n", val, val1);
+
+ /* disable clock & reset */
+
+ modifyreg32(MCLKCNTAPB, MCLKCNTAPB_ADC_CLKEN, 0);
+ modifyreg32(MRSTCNTAPB, MRSTCNTAPB_ADC_RSTB, 0);
+
+ /* check KEY0_AD_D key pressed */
+
+ if (val >= (0x3A << 2) && val < (0x57 << 2))
+ {
+ return 1;
+ }
+
+ /* check KEY0_AD_B key pressed */
+
+ if (val >= (0x0B << 2) && val < (0x20 << 2))
+ {
+ return 1;
+ }
+
+ /* check KEY1_AD_B key pressed */
+
+ if (val1 >= (0x0B << 2) && val1 < (0x20 << 2))
+ {
+ return 1;
+ }
+
+ return 0;
+}
+#endif
+
+#ifdef CONFIG_USBMSC
+
+/****************************************************************************
+ * Name: sysreset()
+ ****************************************************************************/
+
+static void sysreset(void)
+{
+ /* workaround to flush eMMC cache */
+
+ usleep(100000);
+
+ up_systemreset();
+}
+
+/****************************************************************************
+ * Name: get_config()
+ ****************************************************************************/
+
+static int get_config(int num, char *buf)
+{
+ int ret;
+ ret = blk_read(buf, 512, CONFIG_MTD_CONFIG_DEVPATH, num * 512);
+ return ret;
+}
+
+/****************************************************************************
+ * Name: set_config()
+ ****************************************************************************/
+
+static int set_config(int num, char *buf)
+{
+ int ret;
+ ret = blk_write(buf, 512, CONFIG_MTD_CONFIG_DEVPATH, num * 512);
+ return ret;
+}
+
+#endif /* CONFIG_USBMSC */
+
+extern volatile int g_update_flag;
+
+/****************************************************************************
+ * Name: chg_disable()
+ ****************************************************************************/
+
+#ifdef CONFIG_CHARGER
+static void chg_disable(void)
+{
+ FAR struct i2c_dev_s *i2c;
+ int ret;
+ uint32_t freq;
+
+ const uint8_t addr = 0x01;
+ const uint8_t data = 0x83;
+
+ struct i2c_msg_s msg[2] =
+ {
+ {
+ .addr = R2A20056BM_ADDR,
+ .flags = 0,
+ .buffer = (uint8_t *)&addr,
+ .length = 1,
+ },
+ {
+ .addr = R2A20056BM_ADDR,
+ .flags = I2C_M_NORESTART,
+ .buffer = (uint8_t *)&data,
+ .length = 1,
+ }
+ };
+
+ /* I2C pinmux */
+
+ modifyreg32(PMDCNT0, 0x0003C000, 0x00014000);
+
+ /* I2C drv : 4mA */
+
+ modifyreg32(PTDRVCNT0, 0x0003C000, 0x0003C000);
+
+ /* Enable I2C controller */
+
+ modifyreg32(MCLKCNTAPB, 0, MCLKCNTAPB_I2C0_CLKEN);
+ modifyreg32(MRSTCNTAPB, 0, MRSTCNTAPB_I2C0_RSTB);
+
+ /* I2C SCL: push pull */
+
+ modifyreg32(I2CMODE, 0, I2CMODE0);
+
+ /* Disable charge */
+
+ i2c = up_i2cinitialize(1);
+
+ if (i2c)
+ {
+ /* Set slave address */
+
+ ret = I2C_SETADDRESS(i2c, R2A20056BM_ADDR, 7);
+
+ /* Set frequency */
+
+ freq = I2C_SETFREQUENCY(i2c, R2A20056BM_SCL);
+
+ /* Charge disable */
+
+ if (ret == OK && freq == R2A20056BM_SCL)
+ {
+ ret = I2C_TRANSFER(i2c, msg, sizeof(msg) / sizeof(msg[0]));
+
+ if (ret != OK)
+ {
+ _info("no vbus (%d)\n", ret);
+ }
+ else
+ {
+ usleep(20);
+ }
+ }
+
+ up_i2cuninitialize(i2c);
+ }
+ else
+ {
+ _info("Failed to i2c initialize\n");
+ }
+}
+#endif
+
+/****************************************************************************
+ * Name: msc_enable()
+ ****************************************************************************/
+
+#ifdef CONFIG_USBMSC
+static int msc_enable(int forced)
+{
+ int ret;
+ void *handle;
+
+ usbmsc_configure(1, &handle);
+ usbmsc_bindlun(handle, CONFIG_MTD_CP_DEVPATH, 0, 0, 0, false);
+ usbmsc_exportluns(handle);
+
+#ifdef FORCE_USBBOOT_CHARGER
+ if (!forced && !usbdev_is_usbcharger())
+ {
+ /* If not USBCharger, go normal boot */
+
+ usbmsc_uninitialize(handle);
+ return 0;
+ }
+
+ /* wait for SCSI command */
+
+ while (g_update_flag == 0)
+ {
+ /* If key released, go normal boot */
+
+ if (!forced && !check_forceusbboot())
+ {
+ usbmsc_uninitialize(handle);
+ return 0;
+ }
+ usleep(10000);
+ }
+
+#else
+ /* wait for SCSI command */
+
+ while (g_update_flag == 0)
+ {
+ usleep(10000);
+ }
+#endif
+
+ usbmsc_uninitialize(handle);
+
+ /* check recovery kernel update */
+
+ mount(CONFIG_MTD_CP_DEVPATH, "/mnt/sd0", "evfat", 0, NULL);
+ usleep(10000);
+
+ /* recovery kernel install from UPG.img */
+
+ ret = install_recovery("/mnt/sd0/UPG.IMG");
+
+ if (ret == 0)
+ {
+ _info("Install recovery\n");
+
+ /* clear old MBR */
+ memset(copybuf, 0, sizeof(copybuf));
+ set_config(0, copybuf);
+ }
+
+ /* set bootmode to recovery */
+
+ memset(copybuf, 0, sizeof(copybuf));
+ snprintf(copybuf, sizeof(copybuf), "recovery");
+ set_config(1, copybuf);
+
+ sysreset();
+
+ /* not reached */
+ return 0;
+}
+#endif
+
+#ifdef CONFIG_LASTKMSG
+
+/****************************************************************************
+ * Name: check_lastkmsg()
+ ****************************************************************************/
+
+void check_lastkmsg(void)
+{
+ int ret;
+ FILE *fp;
+
+ if (g_lastksg_buf.sig != LASTKMSG_SIG)
+ {
+ return;
+ }
+
+ ret = mount(CONFIG_MTD_LOG_DEVPATH, "/log", "vfat", 0, NULL);
+
+ if (ret)
+ {
+ _info("mount: ret = %d\n", ret);
+ return;
+ }
+
+ /* log rotate */
+
+ (void)unlink(LASTMSG_LOGPATH ".4");
+ (void)rename(LASTMSG_LOGPATH ".3", LASTMSG_LOGPATH ".4");
+ (void)rename(LASTMSG_LOGPATH ".2", LASTMSG_LOGPATH ".3");
+ (void)rename(LASTMSG_LOGPATH ".1", LASTMSG_LOGPATH ".2");
+ (void)rename(LASTMSG_LOGPATH ".0", LASTMSG_LOGPATH ".1");
+
+ fp = fopen(LASTMSG_LOGPATH ".0", "w");
+
+ if (fp)
+ {
+ lastkmsg_output(fp);
+ fflush(fp);
+ fclose(fp);
+ }
+
+ umount("/log");
+
+ /* XXX: workaround for logfile size = 0 */
+
+ usleep(100000);
+}
+#endif /* CONFIG_LASTKMSG */
+
+/****************************************************************************
+ * Name: ipl2_main()
+ ****************************************************************************/
+
+int ipl2_main(int argc, char *argv[])
+{
+ int ret;
+
+ UNUSED(ret); /* Not used in all configurations */
+
+ _info("start: %s\n", CONFIG_CURRENT_REVISION);
+ _info("imgsig: %u\n", IMG_SIGNATURE);
+
+#ifdef CONFIG_CHARGER
+ /* NOTE:
+ * chg_disable() must be done before CMIC_FWAKE L->H.
+ * Please refer to PDFW15IS-2494 for more information
+ */
+
+ chg_disable();
+#endif
+
+ lc823450_mtd_initialize(0);
+
+#ifdef CONFIG_ADC
+ ret = check_forceusbboot();
+#endif
+
+#ifdef CONFIG_USBMSC
+ if (ret)
+ {
+ msc_enable(0);
+ }
+
+ ret = check_diskformat();
+
+ if (ret)
+ {
+ msc_enable(1);
+ }
+
+ memset(copybuf, 0, sizeof(copybuf));
+ get_config(1, copybuf);
+
+ /* for "reboot usb" */
+
+ if (!strncmp("usb", copybuf, 3))
+ {
+ /* remove boot flag for next boot */
+
+ memset(copybuf, 0, sizeof(copybuf));
+ set_config(1, copybuf);
+ msc_enable(1);
+ }
+#endif
+
+#ifdef CONFIG_LASTKMSG
+ check_lastkmsg();
+#endif /* CONFIG_LASTKMSG */
+
+ if (!strncmp("recovery", copybuf, 8))
+ {
+ /* check recovery kernel update */
+
+ mount(CONFIG_MTD_CP_DEVPATH, "/mnt/sd0", "evfat", 0, NULL);
+ usleep(10000);
+
+ /* recovery kernel install from UPG.img */
+
+ install_recovery("/mnt/sd0/UPG.IMG");
+ load_kernel("recovery", CONFIG_MTD_RECOVERY_DEVPATH);
+
+ }
+ else
+ {
+ load_kernel("nuttx", CONFIG_MTD_KERNEL_DEVPATH);
+ }
+
+ /* not reached */
+
+ return -1;
+}
+
diff --git a/arch/arm/src/lc823450/lc823450_irq.c b/arch/arm/src/lc823450/lc823450_irq.c
index e36b26b8bddbf983797f0769c81edced9174eba0..9339f7cd632a291821f2668b6d3b1ab27d707cbc 100644
--- a/arch/arm/src/lc823450/lc823450_irq.c
+++ b/arch/arm/src/lc823450/lc823450_irq.c
@@ -47,6 +47,8 @@
#include
#include
#include
+#include
+#include
#include "nvic.h"
#include "ram_vectors.h"
@@ -56,7 +58,7 @@
#include "lc823450_intc.h"
#ifdef CONFIG_DVFS
-# include "lc823450_dvfs.h"
+# include "lc823450_dvfs2.h"
#endif
/****************************************************************************
@@ -630,6 +632,7 @@ void up_enable_irq(int irq)
uintptr_t regaddr;
uint32_t regval;
uint32_t bit;
+ irqstate_t flags;
#ifdef CONFIG_LC823450_VIRQ
if (irq >= LC823450_IRQ_VIRTUAL &&
@@ -655,6 +658,8 @@ void up_enable_irq(int irq)
* set the bit in the System Handler Control and State Register.
*/
+ flags = spin_lock_irqsave();
+
if (irq >= LC823450_IRQ_NIRQS)
{
/* Clear already asserted IRQ */
@@ -675,6 +680,8 @@ void up_enable_irq(int irq)
regval |= bit;
putreg32(regval, regaddr);
}
+
+ spin_unlock_irqrestore(flags);
}
/* lc823450_dumpnvic("enable", irq); */
@@ -690,10 +697,24 @@ void up_enable_irq(int irq)
void up_ack_irq(int irq)
{
+ if (irq < LC823450_IRQ_SYSTICK)
+ {
+ return;
+ }
+
#ifdef CONFIG_DVFS
lc823450_dvfs_exit_idle(irq);
#endif
+ board_autoled_on(LED_CPU0 + up_cpu_index());
+
+#ifdef CONFIG_SMP
+ if (irq > LC823450_IRQ_LPDSP0 && 1 == up_cpu_index())
+ {
+ irqwarn("*** warning irq(%d) handled on CPU1.");
+ }
+#endif
+
#ifdef CONFIG_LC823450_SLEEP_MODE
extern void up_update_idle_time(void);
up_update_idle_time();
@@ -789,7 +810,7 @@ int lc823450_irq_srctype(int irq, enum lc823450_srctype_e srctype)
port = (irq & 0x70) >> 4;
gpio = irq & 0xf;
- flags = enter_critical_section();
+ flags = spin_lock_irqsave();
regaddr = INTC_REG(EXTINTnCND_BASE, port);
regval = getreg32(regaddr);
@@ -799,7 +820,7 @@ int lc823450_irq_srctype(int irq, enum lc823450_srctype_e srctype)
putreg32(regval, regaddr);
- leave_critical_section(flags);
+ spin_unlock_irqrestore(flags);
return OK;
}
diff --git a/arch/arm/src/lc823450/lc823450_procfs_dvfs.c b/arch/arm/src/lc823450/lc823450_procfs_dvfs.c
new file mode 100644
index 0000000000000000000000000000000000000000..fa69b0a3ca3a0dd34c22cb2d162b4988b6a89a84
--- /dev/null
+++ b/arch/arm/src/lc823450/lc823450_procfs_dvfs.c
@@ -0,0 +1,354 @@
+/****************************************************************************
+ * arch/arm/src/lc823450/lc823450_procfs_dvfs.c
+ *
+ * Copyright (C) 2018 Sony Corporation. All rights reserved.
+ * Author: Masayuki Ishikawa
+ *
+ * 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
+#include
+#include
+#include
+#include
+
+#include
+
+#include "lc823450_dvfs2.h"
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+#define DVFS_LINELEN 64
+
+#ifndef MIN
+# define MIN(a,b) (a < b ? a : b)
+#endif
+
+/****************************************************************************
+ * Private Types
+ ****************************************************************************/
+
+struct dvfs_file_s
+{
+ struct procfs_file_s base; /* Base open file structure */
+ unsigned int linesize; /* Number of valid characters in line[] */
+ char line[DVFS_LINELEN]; /* Pre-allocated buffer for formatted lines */
+};
+
+/****************************************************************************
+ * Private Function Prototypes
+ ****************************************************************************/
+
+static int dvfs_open(FAR struct file *filep, FAR const char *relpath,
+ int oflags, mode_t mode);
+static int dvfs_close(FAR struct file *filep);
+static ssize_t dvfs_read(FAR struct file *filep, FAR char *buffer,
+ size_t buflen);
+static ssize_t dvfs_write(FAR struct file *filep, FAR const char *buffer,
+ size_t buflen);
+static int dvfs_dup(FAR const struct file *oldp,
+ FAR struct file *newp);
+static int dvfs_stat(FAR const char *relpath, FAR struct stat *buf);
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+static const struct procfs_operations dvfs_procfsoperations =
+{
+ dvfs_open, /* open */
+ dvfs_close, /* close */
+ dvfs_read, /* read */
+ dvfs_write, /* write */
+ dvfs_dup, /* dup */
+ NULL, /* opendir */
+ NULL, /* closedir */
+ NULL, /* readdir */
+ NULL, /* rewinddir */
+ dvfs_stat /* stat */
+};
+
+static const struct procfs_entry_s g_procfs_dvfs =
+{
+ "dvfs",
+ &dvfs_procfsoperations
+};
+
+/****************************************************************************
+ * Public Data
+ ****************************************************************************/
+
+extern int8_t g_dvfs_enabled;
+extern uint16_t g_dvfs_cur_freq;
+
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: dvfs_open
+ ****************************************************************************/
+
+static int dvfs_open(FAR struct file *filep, FAR const char *relpath,
+ int oflags, mode_t mode)
+{
+ FAR struct dvfs_file_s *priv;
+
+ finfo("Open '%s'\n", relpath);
+
+ /* "dvfs" is the only acceptable value for the relpath */
+
+ if (strcmp(relpath, "dvfs") != 0)
+ {
+ ferr("ERROR: relpath is '%s'\n", relpath);
+ return -ENOENT;
+ }
+
+ /* Allocate a container to hold the task and attribute selection */
+
+ priv = (FAR struct dvfs_file_s *)kmm_zalloc(sizeof(struct dvfs_file_s));
+ if (!priv)
+ {
+ ferr("ERROR: Failed to allocate file attributes\n");
+ return -ENOMEM;
+ }
+
+ /* Save the index as the open-specific state in filep->f_priv */
+
+ filep->f_priv = (FAR void *)priv;
+ return OK;
+}
+
+/****************************************************************************
+ * Name: dvfs_close
+ ****************************************************************************/
+
+static int dvfs_close(FAR struct file *filep)
+{
+ FAR struct dvfs_file_s *priv;
+
+ /* Recover our private data from the struct file instance */
+
+ priv = (FAR struct dvfs_file_s *)filep->f_priv;
+ DEBUGASSERT(priv);
+
+ /* Release the file attributes structure */
+
+ kmm_free(priv);
+ filep->f_priv = NULL;
+ return OK;
+}
+
+/****************************************************************************
+ * Name: dvfs_read
+ ****************************************************************************/
+
+static ssize_t dvfs_read(FAR struct file *filep, FAR char *buffer,
+ size_t buflen)
+{
+ FAR struct dvfs_file_s *priv;
+ size_t linesize;
+ size_t copysize;
+ size_t remaining;
+ size_t totalsize;
+ off_t offset = filep->f_pos;
+
+ finfo("buffer=%p buflen=%d\n", buffer, (int)buflen);
+
+ priv = (FAR struct dvfs_file_s *)filep->f_priv;
+ DEBUGASSERT(priv);
+
+ remaining = buflen;
+ totalsize = 0;
+
+ linesize = snprintf(priv->line,
+ DVFS_LINELEN,
+ "cur_freq %d \n", g_dvfs_cur_freq);
+ copysize = procfs_memcpy(priv->line, linesize, buffer, remaining, &offset);
+ totalsize += copysize;
+ buffer += copysize;
+ remaining -= copysize;
+
+ if (totalsize >= buflen)
+ {
+ return totalsize;
+ }
+
+ linesize = snprintf(priv->line,
+ DVFS_LINELEN,
+ "enable %d \n", g_dvfs_enabled);
+ copysize = procfs_memcpy(priv->line, linesize, buffer, remaining, &offset);
+ totalsize += copysize;
+
+ /* Update the file offset */
+
+ if (totalsize > 0)
+ {
+ filep->f_pos += totalsize;
+ }
+
+ return totalsize;
+}
+
+/****************************************************************************
+ * Name: procfs_write
+ ****************************************************************************/
+
+static ssize_t dvfs_write(FAR struct file *filep, FAR const char *buffer,
+ size_t buflen)
+{
+ char line[DVFS_LINELEN];
+ char cmd[16];
+ int n;
+ int freq;
+ int enable;
+
+ n = MIN(buflen, DVFS_LINELEN - 1);
+ strncpy(line, buffer, n);
+ line[n] = '\0';
+
+ n = MIN(strcspn(line, " "), sizeof(cmd) - 1);
+ strncpy(cmd, line, n);
+ cmd[n] = '\0';
+
+ if (0 == strcmp(cmd, "cur_freq"))
+ {
+ freq = atoi(line + (n + 1));
+ (void)lc823450_dvfs_set_freq(freq);
+ }
+ else if (0 == strcmp(cmd, "enable"))
+ {
+ enable = atoi(line + (n + 1));
+ g_dvfs_enabled = enable;
+ }
+ else
+ {
+ printf("%s not supported.\n", cmd);
+ }
+
+ return buflen;
+}
+
+/****************************************************************************
+ * Name: dvfs_dup
+ ****************************************************************************/
+
+static int dvfs_dup(FAR const struct file *oldp, FAR struct file *newp)
+{
+ FAR struct dvfs_file_s *oldpriv;
+ FAR struct dvfs_file_s *newpriv;
+
+ finfo("Dup %p->%p\n", oldp, newp);
+
+ /* Recover our private data from the old struct file instance */
+
+ oldpriv = (FAR struct dvfs_file_s *)oldp->f_priv;
+ DEBUGASSERT(oldpriv);
+
+ /* Allocate a new container to hold the task and attribute selection */
+
+ newpriv = (FAR struct dvfs_file_s *)kmm_zalloc(sizeof(struct dvfs_file_s));
+ if (!newpriv)
+ {
+ ferr("ERROR: Failed to allocate file attributes\n");
+ return -ENOMEM;
+ }
+
+ /* The copy the file attributes from the old attributes to the new */
+
+ memcpy(newpriv, oldpriv, sizeof(struct dvfs_file_s));
+
+ /* Save the new attributes in the new file structure */
+
+ newp->f_priv = (FAR void *)newpriv;
+ return OK;
+}
+
+/****************************************************************************
+ * Name: dvfs_stat
+ ****************************************************************************/
+
+static int dvfs_stat(const char *relpath, struct stat *buf)
+{
+ if (strcmp(relpath, "dvfs") != 0)
+ {
+ ferr("ERROR: relpath is '%s'\n", relpath);
+ return -ENOENT;
+ }
+
+ buf->st_mode =
+ S_IFREG |
+ S_IROTH | S_IWOTH |
+ S_IRGRP | S_IWGRP |
+ S_IRUSR | S_IWUSR;
+
+ buf->st_size = 0;
+ buf->st_blksize = 0;
+ buf->st_blocks = 0;
+
+ return OK;
+}
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: dvfs_procfs_register
+ ****************************************************************************/
+
+int dvfs_procfs_register(void)
+{
+ return procfs_register(&g_procfs_dvfs);
+}
diff --git a/arch/arm/src/lc823450/lc823450_pwm.h b/arch/arm/src/lc823450/lc823450_pwm.h
new file mode 100644
index 0000000000000000000000000000000000000000..1c364f86e255a38c15df1a2028e08ed749101589
--- /dev/null
+++ b/arch/arm/src/lc823450/lc823450_pwm.h
@@ -0,0 +1,115 @@
+/****************************************************************************
+ * arch/arm/src/lc823450/lc823450_pwm.h
+ *
+ * Copyright (C) 2014-2017 Sony Corporation. All rights reserved.
+ * Author: Nobutaka Toyoshima
+ * Author: Masayuki Ishikawa
+ *
+ * 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_LC823450_LC823450_PWM_H
+#define __ARCH_ARM_SRC_LC823450_LC823450_PWM_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include
+#include
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/* Register Addresses *******************************************************/
+
+#define LC823450_MTM0_REGBASE 0x40043000
+#define LC823450_MTM1_REGBASE 0x40044000
+
+#define LC823450_MTM_OPR 0x00
+#define LC823450_MTM_SYNC 0x04
+#define LC823450_MTM_PWM 0x08
+#define LC823450_MTM_FCTL 0x0c
+
+#define LC823450_MTM_0CTL 0x40
+#define LC823450_MTM_0IOCL 0x44
+#define LC823450_MTM_0STS 0x4C
+#define LC823450_MTM_0CNT 0x50
+#define LC823450_MTM_0A 0x54
+#define LC823450_MTM_0B 0x58
+#define LC823450_MTM_0SOL 0x5C
+#define LC823450_MTM_0BA 0x60
+#define LC823450_MTM_0BB 0x64
+#define LC823450_MTM_0PSCL 0x68
+#define LC823450_MTM_0TIER 0x6C
+#define LC823450_MTM_0TISR 0x70
+
+#define LC823450_MTM_1CTL 0x80
+#define LC823450_MTM_1IOCL 0x84
+#define LC823450_MTM_1STS 0x8C
+#define LC823450_MTM_1CNT 0x90
+#define LC823450_MTM_1A 0x94
+#define LC823450_MTM_1B 0x98
+#define LC823450_MTM_1SOL 0x9C
+#define LC823450_MTM_1BA 0xA0
+#define LC823450_MTM_1BB 0xA4
+#define LC823450_MTM_1PSCL 0xA8
+#define LC823450_MTM_1TIER 0xAC
+#define LC823450_MTM_1TISR 0xB0
+
+/* PWM Identifier ***********************************************************/
+
+#define LC823450_PWMTIMER0_CH0 0
+#define LC823450_PWMTIMER0_CH1 1
+#define LC823450_PWMTIMER1_CH0 2
+#define LC823450_PWMTIMER1_CH1 3
+
+#ifndef __ASSEMBLY__
+#ifdef __cplusplus
+#define EXTERN extern "C"
+extern "C"
+{
+#else
+#define EXTERN extern
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+EXTERN FAR struct pwm_lowerhalf_s *lc823450_pwminitialize(int timer);
+
+#undef EXTERN
+#if defined(__cplusplus)
+}
+#endif
+#endif /* __ASSEMBLY__ */
+
+#endif /* __ARCH_ARM_SRC_LC823450_LC823450_PWM_H */
diff --git a/arch/arm/src/lc823450/lc823450_serial.c b/arch/arm/src/lc823450/lc823450_serial.c
index eba588f38ba8a2c1ac9570be19b35814e9cce8fb..5ddeb324dfeffe618828137bbee40b611fdbf644 100644
--- a/arch/arm/src/lc823450/lc823450_serial.c
+++ b/arch/arm/src/lc823450/lc823450_serial.c
@@ -1007,7 +1007,11 @@ static bool up_txready(struct uart_dev_s *dev)
}
#endif /* CONFIG_DEV_CONSOLE_SWITCH */
+#ifndef CONFIG_SMP
return ((up_serialin(priv, UART_USR) & UART_USR_TXFULL) == 0);
+#else
+ return (UART_USFS_TXFF_LV(up_serialin(priv, UART_USFS)) <= 1);
+#endif
}
/****************************************************************************
diff --git a/arch/arm/src/lc823450/lc823450_start.c b/arch/arm/src/lc823450/lc823450_start.c
index a52bf2cf1fbb877c050a46d22d512de3cf2dbb1f..089f21eaee6da39d618d8aff12105103ccf768f8 100644
--- a/arch/arm/src/lc823450/lc823450_start.c
+++ b/arch/arm/src/lc823450/lc823450_start.c
@@ -251,17 +251,20 @@ void __start(void)
#else /* CONFIG_SPIFLASH_BOOT */
/* vector offset */
-#ifdef CONFIG_IPL2
+#ifdef CONFIG_LC823450_IPL2
putreg32(0x02000e00, 0xe000ed08);
putreg32(0x0, 0x40080008); /* XXX: remap disable */
-#else /* CONFIG_IPL2 */
+#else /* CONFIG_LC823450_IPL2 */
putreg32(0x02040000, 0xe000ed08);
-#endif /* CONFIG_IPL2 */
-#endif /* CONFIG_SPIFLASH_BOOT */
+#endif /* CONFIG_LC823450_IPL2 */
+#endif /* CONFIG_LC823450_SPIFLASH_BOOT */
- /* Mutex enable */
+ /* Enable Mutex */
+ /* NOTE: modyfyreg32() can not be used because it might use spin_lock */
- modifyreg32(MRSTCNTBASIC, 0, MRSTCNTBASIC_MUTEX_RSTB);
+ uint32_t val = getreg32(MRSTCNTBASIC);
+ val |= MRSTCNTBASIC_MUTEX_RSTB;
+ putreg32(val, MRSTCNTBASIC);
/* Configure the uart so that we can get debug output as soon as possible */
@@ -273,7 +276,7 @@ void __start(void)
/* IPL2 don't change mux */
-#ifdef CONFIG_IPL2
+#ifdef CONFIG_LC823450_IPL2
/* GPIO2F out High in IPL2 */
modifyreg32(MCLKCNTAPB, 0, MCLKCNTAPB_PORT2_CLKEN);
@@ -286,9 +289,9 @@ void __start(void)
modifyreg32(PMDCNT5, 0, 3 << 14);
#endif /* CONFIG_DEBUG */
-#else /* CONFIG_IPL2 */
+#else /* CONFIG_LC823450_IPL2 */
up_init_default_mux();
-#endif /* CONFIG_IPL2 */
+#endif /* CONFIG_LC823450_IPL2 */
showprogress('B');
@@ -326,9 +329,9 @@ void __start(void)
showprogress('F');
-#ifndef CONFIG_IPL2
+#ifndef CONFIG_LC823450_IPL2
sinfo("icx_boot_reason = 0x%x\n", icx_boot_reason);
-#endif /* CONFIG_IPL2 */
+#endif /* CONFIG_LC823450_IPL2 */
#ifdef CONFIG_POWERBUTTON_LDOWN
if (icx_boot_reason & ICX_BOOT_REASON_POWERBUTTON)
diff --git a/arch/arm/src/lc823450/lc823450_syscontrol.c b/arch/arm/src/lc823450/lc823450_syscontrol.c
index 35d18b2a2a6c38a3a70772fbddd49cfda0d56f64..82e6c2ee01885489de549b52033781fe0b4087d2 100644
--- a/arch/arm/src/lc823450/lc823450_syscontrol.c
+++ b/arch/arm/src/lc823450/lc823450_syscontrol.c
@@ -144,7 +144,7 @@ void mod_stby_regs(uint32_t enabits, uint32_t disbits)
void up_enable_clk(enum clock_e clk)
{
irqstate_t flags;
- flags = enter_critical_section();
+ flags = spin_lock_irqsave();
ASSERT(clk < LC823450_CLOCK_NUM);
@@ -154,7 +154,7 @@ void up_enable_clk(enum clock_e clk)
0, lc823450_clocks[clk].regmask);
}
- leave_critical_section(flags);
+ spin_unlock_irqrestore(flags);
}
/****************************************************************************
@@ -164,7 +164,7 @@ void up_enable_clk(enum clock_e clk)
void up_disable_clk(enum clock_e clk)
{
irqstate_t flags;
- flags = enter_critical_section();
+ flags = spin_lock_irqsave();
ASSERT(clk < LC823450_CLOCK_NUM);
@@ -181,7 +181,7 @@ void up_disable_clk(enum clock_e clk)
lc823450_clocks[clk].count = 0;
}
- leave_critical_section(flags);
+ spin_unlock_irqrestore(flags);
}
/****************************************************************************
diff --git a/arch/arm/src/lc823450/lc823450_syscontrol.h b/arch/arm/src/lc823450/lc823450_syscontrol.h
index 509f2c3b9f278c3eec59944e0b1d60f82ed5b53f..d31edf4eda6337e4c947224f89c3ae1ca979864d 100644
--- a/arch/arm/src/lc823450/lc823450_syscontrol.h
+++ b/arch/arm/src/lc823450/lc823450_syscontrol.h
@@ -108,6 +108,9 @@
#define MCLKCNTEXT1_PTM1C_CLKEN (1 << 29)
#define MCLKCNTEXT1_PTM2C_CLKEN (1 << 30)
+#define MCLKCNTEXT3 (LC823450_SYSCONTROL_REGBASE + 0x0108)
+#define MCLKCNTEXT3_AUDIOBUF_CLKEN (1 << 0)
+
#define MCLKCNTEXT4 (LC823450_SYSCONTROL_REGBASE + 0x010c)
#define MCLKCNTEXT4_SDRAMC_CLKEN0 (1 << 0)
#define MCLKCNTEXT4_SDRAMC_CLKEN1 (1 << 1)
@@ -156,6 +159,9 @@
#define MRSTCNTEXT1_SDIF2_RSTB (1 << 10)
#define MRSTCNTEXT1_MSIF_RSTB (1 << 11)
+#define MRSTCNTEXT3 (LC823450_SYSCONTROL_REGBASE + 0x011c)
+#define MRSTCNTEXT3_AUDIOBUF_RSTB (1 << 0)
+
#define MRSTCNTEXT4 (LC823450_SYSCONTROL_REGBASE + 0x0120)
#define MRSTCNTEXT4_SDRAMC_RSTB (1 << 0)
diff --git a/arch/arm/src/lc823450/lc823450_testset.c b/arch/arm/src/lc823450/lc823450_testset.c
index 2093b42f404e37852247d50b733cfb250ff88f5e..826150285ef80d289e1ab15d53679a028e8e7f0f 100644
--- a/arch/arm/src/lc823450/lc823450_testset.c
+++ b/arch/arm/src/lc823450/lc823450_testset.c
@@ -95,12 +95,15 @@ spinlock_t up_testset(volatile FAR spinlock_t *lock)
}
while (getreg32(MUTEX_REG_MUTEX0) != val);
+ SP_DMB();
+
ret = *lock;
if (ret == SP_UNLOCKED)
{
*lock = SP_LOCKED;
}
+ SP_DMB();
val = (up_cpu_index() << 16) | 0x0;
putreg32(val, MUTEX_REG_MUTEX0);
diff --git a/arch/arm/src/lc823450/lc823450_timerisr.c b/arch/arm/src/lc823450/lc823450_timerisr.c
index 1357219b262c5389c9c42bd1ca100680d928f406..1e89f795273220c8062050a3d3c17ec0b88b9cc1 100644
--- a/arch/arm/src/lc823450/lc823450_timerisr.c
+++ b/arch/arm/src/lc823450/lc823450_timerisr.c
@@ -62,6 +62,13 @@
#include "lc823450_clockconfig.h"
#include "lc823450_serial.h"
+#ifdef CONFIG_DVFS
+# include "lc823450_dvfs2.h"
+#endif
+
+#if !defined(CONFIG_LC823450_MTM0_TICK) && defined (CONFIG_DVFS)
+# error "Use CONFIG_LC823450_MTM0_TICK=y"
+#endif
/****************************************************************************
* Pre-processor Definitions
@@ -109,6 +116,11 @@
# define rMT30CNT (LC823450_MTM3_REGBASE + LC823450_MTM_0CNT)
#endif /* CONFIG_PROFILE */
+#ifndef container_of
+# define container_of(ptr, type, member) \
+ ((type *)((void *)(ptr) - offsetof(type, member)))
+#endif
+
/****************************************************************************
* Private Types
****************************************************************************/
@@ -175,7 +187,7 @@ static void hrt_queue_refresh(void)
struct hrt_s *tmp;
irqstate_t flags;
- flags = enter_critical_section();
+ flags = spin_lock_irqsave();
elapsed = (uint64_t)getreg32(rMT20CNT) * (1000 * 1000) * 10 / XT1OSC_CLK;
for (pent = hrt_timer_queue.head; pent; pent = dq_next(pent))
@@ -193,7 +205,9 @@ cont:
if (tmp->usec <= 0)
{
dq_rem(pent, &hrt_timer_queue);
+ spin_unlock_irqrestore(flags);
nxsem_post(&tmp->sem);
+ flags = spin_lock_irqsave();
goto cont;
}
else
@@ -202,12 +216,12 @@ cont:
}
}
- leave_critical_section(flags);
+ spin_unlock_irqrestore(flags);
}
#endif
/****************************************************************************
- * Name: hrt_queue_refresh
+ * Name: hrt_usleep_setup
****************************************************************************/
#ifdef CONFIG_HRT_TIMER
@@ -217,7 +231,7 @@ static void hrt_usleep_setup(void)
struct hrt_s *head;
irqstate_t flags;
- flags = enter_critical_section();
+ flags = spin_lock_irqsave();
head = container_of(hrt_timer_queue.head, struct hrt_s, ent);
if (head == NULL)
{
@@ -225,7 +239,7 @@ static void hrt_usleep_setup(void)
modifyreg32(MCLKCNTEXT1, MCLKCNTEXT1_MTM2C_CLKEN, 0x0);
modifyreg32(MCLKCNTEXT1, MCLKCNTEXT1_MTM2_CLKEN, 0x0);
- leave_critical_section(flags);
+ spin_unlock_irqrestore(flags);
return;
}
@@ -244,12 +258,10 @@ static void hrt_usleep_setup(void)
putreg32(0, rMT20CNT); /* counter */
putreg32(count, rMT20A); /* AEVT counter */
- up_enable_irq(LC823450_IRQ_MTIMER20);
-
/* Enable MTM2-Ch0 */
putreg32(1, rMT2OPR);
- leave_critical_section(flags);
+ spin_unlock_irqrestore(flags);
}
#endif
@@ -273,6 +285,10 @@ static int hrt_interrupt(int irq, FAR void *context, FAR void *arg)
return OK;
}
+/****************************************************************************
+ * Name: hrt_usleep_add
+ ****************************************************************************/
+
static void hrt_usleep_add(struct hrt_s *phrt)
{
dq_entry_t *pent;
@@ -284,7 +300,7 @@ static void hrt_usleep_add(struct hrt_s *phrt)
hrt_queue_refresh();
- flags = enter_critical_section();
+ flags = spin_lock_irqsave();
/* add phrt to hrt_timer_queue */
@@ -305,7 +321,7 @@ static void hrt_usleep_add(struct hrt_s *phrt)
dq_addlast(&phrt->ent, &hrt_timer_queue);
}
- leave_critical_section(flags);
+ spin_unlock_irqrestore(flags);
hrt_usleep_setup();
}
@@ -350,21 +366,20 @@ int up_timerisr(int irq, uint32_t *regs, FAR void *arg)
/* Process timer interrupt */
#ifdef CONFIG_DVFS
- extern void lc823450_dvfs_tick_callback(void);
- lc823450_dvfs_tick_callback();
+ lc823450_dvfs_tick_callback();
#endif
#ifdef CONFIG_LC823450_MTM0_TICK
- /* Clear the interrupt (BEVT) */
+ /* Clear the interrupt (BEVT) */
- putreg32(1 << 1, rMT00STS);
+ putreg32(1 << 1, rMT00STS);
#endif
- sched_process_timer();
+ sched_process_timer();
#ifdef CONFIG_LCA_SOUNDSKIP_CHECK
- extern void lca_check_soundskip(void);
- lca_check_soundskip();
+ extern void lca_check_soundskip(void);
+ lca_check_soundskip();
#endif
#ifdef CHECK_INTERVAL
@@ -375,7 +390,7 @@ int up_timerisr(int irq, uint32_t *regs, FAR void *arg)
hsuart_wdtimer();
#endif /* CONFIG_HSUART */
- return 0;
+ return 0;
}
/****************************************************************************
@@ -474,6 +489,8 @@ void arm_timer_initialize(void)
modifyreg32(MCLKCNTEXT1, MCLKCNTEXT1_MTM2_CLKEN, 0);
(void)irq_attach(LC823450_IRQ_MTIMER20, (xcpt_t)hrt_interrupt, NULL);
+ up_enable_irq(LC823450_IRQ_MTIMER20);
+
#endif /* CONFIG_HRT_TIMER */
#ifdef CONFIG_PROFILE
@@ -619,7 +636,7 @@ int up_hr_gettime(FAR struct timespec *tp)
irqstate_t flags;
uint64_t f;
- flags = enter_critical_section();
+ flags = spin_lock_irqsave();
/* Get the elapsed time */
@@ -630,7 +647,7 @@ int up_hr_gettime(FAR struct timespec *tp)
f = up_get_timer_fraction();
elapsed += f;
- leave_critical_section(flags);
+ spin_unlock_irqrestore(flags);
tmrinfo("elapsed = %lld \n", elapsed);
diff --git a/arch/arm/src/lc823450/lc823450_usbdev.c b/arch/arm/src/lc823450/lc823450_usbdev.c
index f8c0a09787c91ba72470597e5a4e9b7bb188e408..27e804fb9714b7a928d4f94d2b180001ae60a388 100644
--- a/arch/arm/src/lc823450/lc823450_usbdev.c
+++ b/arch/arm/src/lc823450/lc823450_usbdev.c
@@ -487,7 +487,7 @@ static int lc823450_epclearreq(struct usbdev_ep_s *ep)
struct lc823450_ep_s *privep = (struct lc823450_ep_s *)ep;
irqstate_t flags;
- flags = enter_critical_section();
+ flags = spin_lock_irqsave();
while (privep->req_q.tail)
{
struct usbdev_req_s *req;
@@ -504,7 +504,7 @@ static int lc823450_epclearreq(struct usbdev_ep_s *ep)
req->callback(ep, req);
}
- leave_critical_section(flags);
+ spin_unlock_irqrestore(flags);
return 0;
}
@@ -666,27 +666,27 @@ static int lc823450_epsubmit(struct usbdev_ep_s *ep, struct usbdev_req_s *req)
if (privep->epphy == 0)
{
- flags = enter_critical_section();
+ flags = spin_lock_irqsave();
req->xfrd = epbuf_write(privep->epphy, req->buf, req->len);
- leave_critical_section(flags);
+ spin_unlock_irqrestore(flags);
req->callback(ep, req);
}
else if (privep->in)
{
/* Send packet requst from function driver */
- flags = enter_critical_section();
+ flags = spin_lock_irqsave();
if ((getreg32(USB_EPCOUNT(privep->epphy * 2)) &
USB_EPCOUNT_PHYCNT_MASK) >> USB_EPCOUNT_PHYCNT_SHIFT ||
privep->req_q.tail)
{
sq_addfirst(&privreq->q_ent, &privep->req_q); /* non block */
- leave_critical_section(flags);
+ spin_unlock_irqrestore(flags);
}
else
{
- leave_critical_section(flags);
+ spin_unlock_irqrestore(flags);
req->xfrd = epbuf_write(privep->epphy, req->buf, req->len);
req->callback(ep, req);
}
@@ -695,9 +695,9 @@ static int lc823450_epsubmit(struct usbdev_ep_s *ep, struct usbdev_req_s *req)
{
/* receive packet buffer from function driver */
- flags = enter_critical_section();
+ flags = spin_lock_irqsave();
sq_addfirst(&privreq->q_ent, &privep->req_q); /* non block */
- leave_critical_section(flags);
+ spin_unlock_irqrestore(flags);
lc823450_epack(privep->epphy, 1);
}
@@ -716,10 +716,13 @@ static int lc823450_epcancel(struct usbdev_ep_s *ep, struct usbdev_req_s *req)
{
struct lc823450_req_s *privreq = (struct lc823450_req_s *)req;
struct lc823450_ep_s *privep = (struct lc823450_ep_s *)ep;
+ irqstate_t flags;
/* remove request from req_queue */
+ flags = spin_lock_irqsave();
sq_remafter(&privreq->q_ent, &privep->req_q);
+ spin_unlock_irqrestore(flags);
return 0;
}
@@ -738,7 +741,7 @@ static int lc823450_epstall(struct usbdev_ep_s *ep, bool resume)
/* STALL or RESUME the endpoint */
- flags = enter_critical_section();
+ flags = spin_lock_irqsave();
usbtrace(resume ? TRACE_EPRESUME : TRACE_EPSTALL, privep->epphy);
if (resume)
@@ -752,7 +755,7 @@ static int lc823450_epstall(struct usbdev_ep_s *ep, bool resume)
epcmd_write(privep->epphy, USB_EPCMD_STALL_SET | USB_EPCMD_TGL_SET);
}
- leave_critical_section(flags);
+ spin_unlock_irqrestore(flags);
return OK;
}
@@ -761,11 +764,11 @@ void up_epignore_clear_stall(struct usbdev_ep_s *ep, bool ignore)
{
struct lc823450_ep_s *privep = (struct lc823450_ep_s *)ep;
irqstate_t flags;
- flags = enter_critical_section();
+ flags = spin_lock_irqsave();
privep->ignore_clear_stall = ignore;
- leave_critical_section(flags);
+ spin_unlock_irqrestore(flags);
}
#endif /* CONFIG_USBMSC_IGNORE_CLEAR_STALL */
@@ -922,7 +925,7 @@ static void usb_suspend_work_func(void *arg)
}
#endif
- flags = enter_critical_section();
+ flags = spin_lock_irqsave();
if (getreg32(USB_DEVS) & USB_DEVS_SUSPEND)
{
uinfo("USB BUS SUSPEND\n");
@@ -936,7 +939,7 @@ static void usb_suspend_work_func(void *arg)
g_usbsuspend = 1;
wake_unlock(&priv->wlock);
}
- leave_critical_section(flags);
+ spin_unlock_irqrestore(flags);
}
#endif
@@ -1251,6 +1254,9 @@ static void subintr_epin(uint8_t epnum, struct lc823450_ep_s *privep)
{
/* Send packet done */
+ irqstate_t flags;
+ flags = spin_lock_irqsave();
+
if (privep->req_q.tail)
{
struct usbdev_req_s *req;
@@ -1259,6 +1265,9 @@ static void subintr_epin(uint8_t epnum, struct lc823450_ep_s *privep)
/* Dequeue from TXQ */
q_ent = sq_remlast(&privep->req_q);
+
+ spin_unlock_irqrestore(flags);
+
req = &container_of(q_ent, struct lc823450_req_s, q_ent)->req;
/* Write to TX FIFO */
@@ -1272,6 +1281,7 @@ static void subintr_epin(uint8_t epnum, struct lc823450_ep_s *privep)
}
else
{
+ spin_unlock_irqrestore(flags);
epcmd_write(epnum, USB_EPCMD_EMPTY_CLR);
}
}
@@ -1288,6 +1298,9 @@ static void subintr_epout(uint8_t epnum, struct lc823450_ep_s *privep)
{
/* Packet receive from host */
+ irqstate_t flags;
+ flags = spin_lock_irqsave();
+
if (privep->req_q.tail)
{
struct usbdev_req_s *req;
@@ -1296,6 +1309,7 @@ static void subintr_epout(uint8_t epnum, struct lc823450_ep_s *privep)
/* Dequeue from Reqbuf poll */
q_ent = sq_remlast(&privep->req_q);
+
req = &container_of(q_ent, struct lc823450_req_s, q_ent)->req;
if (privep->req_q.tail == NULL)
{
@@ -1304,6 +1318,8 @@ static void subintr_epout(uint8_t epnum, struct lc823450_ep_s *privep)
lc823450_epack(epnum, 0);
}
+ spin_unlock_irqrestore(flags);
+
/* PIO */
epcmd_write(epnum, USB_EPCMD_READY_CLR);
@@ -1315,6 +1331,7 @@ static void subintr_epout(uint8_t epnum, struct lc823450_ep_s *privep)
}
else
{
+ spin_unlock_irqrestore(flags);
uinfo("REQ Buffer Exhault\n");
epcmd_write(epnum, USB_EPCMD_READY_CLR);
}
@@ -1630,7 +1647,7 @@ int usbdev_unregister(struct usbdevclass_driver_s *driver)
* canceled while the class driver is still bound.
*/
- flags = enter_critical_section();
+ flags = spin_lock_irqsave();
#ifdef CONFIG_WAKELOCK
/* cancel USB suspend work */
@@ -1666,7 +1683,7 @@ int usbdev_unregister(struct usbdevclass_driver_s *driver)
pm_unregister(&pm_cb);
#endif /* CONFIG_PM */
- leave_critical_section(flags);
+ spin_unlock_irqrestore(flags);
#ifdef CONFIG_LC823450_LSISTBY
/* disable USB */
@@ -1915,7 +1932,7 @@ static void usbdev_pmnotify(struct pm_callback_s *cb, enum pm_state_e pmstate)
{
irqstate_t flags;
- flags = enter_critical_section();
+ flags = spin_lock_irqsave();
switch (pmstate)
{
@@ -1936,6 +1953,6 @@ static void usbdev_pmnotify(struct pm_callback_s *cb, enum pm_state_e pmstate)
default:
break;
}
- leave_critical_section(flags);
+ spin_unlock_irqrestore(flags);
}
#endif
diff --git a/arch/arm/src/lpc11xx/lpc11_start.c b/arch/arm/src/lpc11xx/lpc11_start.c
index 917cdeae275e6a5ef705a3e14e67293309b684c6..51dac5d00bf21e54159142dc6ebb371a25ea027f 100644
--- a/arch/arm/src/lpc11xx/lpc11_start.c
+++ b/arch/arm/src/lpc11xx/lpc11_start.c
@@ -1,7 +1,7 @@
/****************************************************************************
* arch/arm/src/lpc11xx/lpc11_start.c
*
- * Copyright (C) 2015 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2015, 2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt
*
* Redistribution and use in source and binary forms, with or without
@@ -44,7 +44,6 @@
#include
#include
-#include
#include "up_arch.h"
#include "up_internal.h"
@@ -57,6 +56,8 @@
# include "nvic.h"
#endif
+#include "lpc11_start.h"
+
/****************************************************************************
* Private Definitions
****************************************************************************/
diff --git a/arch/arm/src/lpc11xx/lpc11_start.h b/arch/arm/src/lpc11xx/lpc11_start.h
new file mode 100644
index 0000000000000000000000000000000000000000..ebace6f72c8546ede93d7ad3653d0ec15a624ded
--- /dev/null
+++ b/arch/arm/src/lpc11xx/lpc11_start.h
@@ -0,0 +1,62 @@
+/************************************************************************************
+ * arch/arm/src/lpc11xx/lpc11_start.h
+ *
+ * Copyright (C) 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.
+ *
+ ************************************************************************************/
+
+#ifndef __ARCH_ARM_SRC_LPC11XX_LPC11_START_H
+#define __ARCH_ARM_SRC_LPC11XX_LPC11_START_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include
+
+/************************************************************************************
+ * Public Function Prototypes
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: lpc11_boardinitialize
+ *
+ * Description:
+ * All LPC11xx architectures must provide the following entry point. This entry
+ * point is called early in the initialization -- after clocking and memory have
+ * been configured but before caches have been enabled and before any devices have
+ * been initialized.
+ *
+ ************************************************************************************/
+
+void lpc11_boardinitialize(void);
+
+#endif /* __ARCH_ARM_SRC_LPC11XX_LPC11_START_H */
diff --git a/arch/arm/src/lpc17xx/lpc17_gpdma.c b/arch/arm/src/lpc17xx/lpc17_gpdma.c
index 7825f2ce0d0765db2fa2628e2dfb4134dfe54106..a9ae9443190bbd6526aa9d4e225300722154c127 100644
--- a/arch/arm/src/lpc17xx/lpc17_gpdma.c
+++ b/arch/arm/src/lpc17xx/lpc17_gpdma.c
@@ -272,10 +272,11 @@ static int gpdma_interrupt(int irq, FAR void *context, FAR void *arg)
* Name: up_dmainitialize
*
* Description:
- * Initialize the GPDMA subsystem.
+ * Initialize the GPDMA subsystem. Called from up_initialize() early in the
+ * boot-up sequence. Prototyped in up_internal.h.
*
* Returned Value:
- * Zero on success; A negated errno value on failure.
+ * None
*
****************************************************************************/
diff --git a/arch/arm/src/lpc17xx/lpc17_gpdma.h b/arch/arm/src/lpc17xx/lpc17_gpdma.h
index a7c0d7009ccbdef0d522665bd9540cf6e3f25091..7953bda182aa255310edeb5e0bf5972553de6f4a 100644
--- a/arch/arm/src/lpc17xx/lpc17_gpdma.h
+++ b/arch/arm/src/lpc17xx/lpc17_gpdma.h
@@ -140,19 +140,6 @@ EXTERN volatile uint8_t g_dma_inprogress;
* Public Functions
****************************************************************************/
-/****************************************************************************
- * Name: up_dmainitialize
- *
- * Description:
- * Initialize the GPDMA subsystem (also prototyped in up_internal.h).
- *
- * Returned Value:
- * Zero on success; A negated errno value on failure.
- *
- ****************************************************************************/
-
-void weak_function up_dmainitialize(void);
-
/****************************************************************************
* Name: lpc17_dmaconfigure
*
diff --git a/arch/arm/src/lpc17xx/lpc17_lcd.c b/arch/arm/src/lpc17xx/lpc17_lcd.c
index dde2d50ae039f2d7292a1f3a2f64ad54f9ae00f8..90332fc12e9d072bde96e8e135d4deea28650b12 100644
--- a/arch/arm/src/lpc17xx/lpc17_lcd.c
+++ b/arch/arm/src/lpc17xx/lpc17_lcd.c
@@ -483,7 +483,10 @@ int up_fbinitialize(int display)
putreg32(regval, LPC17_SYSCON_MATRIXARB);
/* Configure pins */
- /* Video data */
+ /* Video data:
+ *
+ * REVISIT: The conditional logic is not correct here. See arch/arm/src/lpc54xx/lpc454_lcd.c
+ */
lcdinfo("Configuring pins\n");
diff --git a/arch/arm/src/lpc17xx/lpc17_start.c b/arch/arm/src/lpc17xx/lpc17_start.c
index 3a0ae1d70554331623ad0447b8a4df2949941ed5..88b4f8d69e9f7073a5acdfa390ebebefc9772a8c 100644
--- a/arch/arm/src/lpc17xx/lpc17_start.c
+++ b/arch/arm/src/lpc17xx/lpc17_start.c
@@ -45,7 +45,6 @@
#include
#include
-#include
#include "up_arch.h"
#include "up_internal.h"
@@ -58,17 +57,7 @@
# include "nvic.h"
#endif
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-
-/****************************************************************************
- * Private Data
- ****************************************************************************/
-
-/****************************************************************************
- * Public Data
- ****************************************************************************/
+#include "lpc17_start.h"
/****************************************************************************
* Private Functions
diff --git a/arch/arm/src/lpc17xx/lpc17_start.h b/arch/arm/src/lpc17xx/lpc17_start.h
new file mode 100644
index 0000000000000000000000000000000000000000..9b038be3738ceb7a257cc49ac26defb0728d4cec
--- /dev/null
+++ b/arch/arm/src/lpc17xx/lpc17_start.h
@@ -0,0 +1,62 @@
+/************************************************************************************
+ * arch/arm/src/lpc17xx/lpc17_start.h
+ *
+ * Copyright (C) 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.
+ *
+ ************************************************************************************/
+
+#ifndef __ARCH_ARM_SRC_LPC17XX_LPC17_START_H
+#define __ARCH_ARM_SRC_LPC17XX_LPC17_START_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include
+
+/************************************************************************************
+ * Public Function Prototypes
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: lpc17_boardinitialize
+ *
+ * Description:
+ * All LPC17xx architectures must provide the following entry point. This entry
+ * point is called early in the initialization -- after clocking and memory have
+ * been configured but before caches have been enabled and before any devices have
+ * been initialized.
+ *
+ ************************************************************************************/
+
+void lpc17_boardinitialize(void);
+
+#endif /* __ARCH_ARM_SRC_LPC17XX_LPC17_START_H */
diff --git a/arch/arm/src/lpc31xx/lpc31_boot.c b/arch/arm/src/lpc31xx/lpc31_boot.c
index 5c106ae34d8aa70271797fd0352379c74bea4377..8578cef04f9f10457fa400f7afe36c7b8dc418e8 100644
--- a/arch/arm/src/lpc31xx/lpc31_boot.c
+++ b/arch/arm/src/lpc31xx/lpc31_boot.c
@@ -40,25 +40,20 @@
#include
#include
-#include
-
#include "chip.h"
#include "arm.h"
#include "up_internal.h"
#include "up_arch.h"
-#include "lpc31_syscreg.h"
-#include "lpc31_cgudrvr.h"
-#include "lpc31.h"
-
#ifdef CONFIG_PAGING
# include
# include "pg_macros.h"
#endif
-/************************************************************************************
- * Private Types
- ************************************************************************************/
+#include "lpc31_syscreg.h"
+#include "lpc31_cgudrvr.h"
+#include "lpc31.h"
+#include "lpc31_boot.h"
/************************************************************************************
* Private Types
diff --git a/arch/arm/src/lpc31xx/lpc31_boot.h b/arch/arm/src/lpc31xx/lpc31_boot.h
new file mode 100644
index 0000000000000000000000000000000000000000..cfa096d9b094470dab8f36db602eeec09dab472c
--- /dev/null
+++ b/arch/arm/src/lpc31xx/lpc31_boot.h
@@ -0,0 +1,62 @@
+/************************************************************************************
+ * arch/arm/src/lpc31xx/lpc31_boot.h
+ *
+ * Copyright (C) 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.
+ *
+ ************************************************************************************/
+
+#ifndef __ARCH_ARM_SRC_LPC31XX_LPC31_BOOT_H
+#define __ARCH_ARM_SRC_LPC31XX_LPC31_BOOT_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include
+
+/************************************************************************************
+ * Public Function Prototypes
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: lpc31_boardinitialize
+ *
+ * Description:
+ * All LPC31xx architectures must provide the following entry point. This entry
+ * point is called early in the initialization -- after clocking and memory have
+ * been configured but before caches have been enabled and before any devices have
+ * been initialized.
+ *
+ ************************************************************************************/
+
+void lpc31_boardinitialize(void);
+
+#endif /* __ARCH_ARM_SRC_LPC31XX_LPC31_BOOT_H */
diff --git a/arch/arm/src/lpc43xx/Kconfig b/arch/arm/src/lpc43xx/Kconfig
index db16b30626ab41c2ac25027fe47e645344c36db0..59c927604b43975e88f97bd4ad0acdd8425ce854 100644
--- a/arch/arm/src/lpc43xx/Kconfig
+++ b/arch/arm/src/lpc43xx/Kconfig
@@ -142,7 +142,7 @@ config LPC43_BOOT_FLASHA
bool "Running in internal FLASHA"
config LPC43_BOOT_FLASHB
- bool "Running in internal FLASHA"
+ bool "Running in internal FLASHB"
config LPC43_BOOT_CS0FLASH
bool "Running in external FLASH CS0"
@@ -172,11 +172,11 @@ config LPC43_ATIMER
bool "Alarm timer"
default n
-config LPC43_CAN1
- bool "C_CAN1"
+config LPC43_CAN0
+ bool "C_CAN0"
default n
-config LPC43_CAN2
+config LPC43_CAN1
bool "C_CAN1"
default n
@@ -254,6 +254,8 @@ config LPC43_SCT
config LPC43_SDMMC
bool "SD/MMC"
default n
+ select ARCH_HAVE_SDIO
+ depends on EXPERIMENTAL
config LPC43_SPI
bool "SPI"
@@ -338,19 +340,6 @@ config LPC43_WWDT
endmenu # LPC43xx Peripheral Support
-menu "ADC driver options"
- depends on LPC43_ADC0 || LPC43_ADC1
-
-config ADC0_MASK
- hex "ADC0 mask"
- default 0x01
-
-config ADC0_FREQ
- int "ADC0 frequency"
- default 4500000
-
-endmenu # ADC driver options
-
config LPC43_GPIO_IRQ
bool "GPIO interrupt support"
default n
@@ -509,6 +498,32 @@ endif # LCP43_EXTSDRAM3
endmenu # External Memory Configuration
+menu "SD/MMC Configuration"
+ depends on LPC43_SDMMC
+
+config LPC43_SDMMC_PWRCTRL
+ bool "Power-enable pin"
+ default n
+ ---help---
+ Select if the board supports a power-enable pin that must be selected
+ to provide power to the SD card.
+
+config LPC43_SDMMC_DMA
+ bool "Support DMA data transfers"
+ default y
+ select SDIO_DMA
+ ---help---
+ Support DMA data transfers.
+
+config LPC43_SDMMC_REGDEBUG
+ bool "Register level debug"
+ default n
+ depends on DEBUG_MEMCARD_INFO
+ ---help---
+ Output detailed register-level SD/MMC debug information.
+
+endmenu # SD/MMC Configuration
+
menu "Ethernet MAC configuration"
depends on LPC43_ETHERNET
@@ -672,6 +687,19 @@ config LPC43_ETHERNET_REGDEBUG
endmenu # Ethernet MAC configuration
+menu "ADC driver options"
+ depends on LPC43_ADC0 || LPC43_ADC1
+
+config ADC0_MASK
+ hex "ADC0 mask"
+ default 0x01
+
+config ADC0_FREQ
+ int "ADC0 frequency"
+ default 4500000
+
+endmenu # ADC driver options
+
menu "RS-485 Configuration"
if LPC43_USART0
diff --git a/arch/arm/src/lpc43xx/Make.defs b/arch/arm/src/lpc43xx/Make.defs
index d68a19635b31dea6de0fe4bfdb26dddbf2ebfc30..d5bd89123723dec372537e7e7dadd7e137ee7731 100644
--- a/arch/arm/src/lpc43xx/Make.defs
+++ b/arch/arm/src/lpc43xx/Make.defs
@@ -1,7 +1,7 @@
############################################################################
# arch/arm/src/lpc43xx/Make.defs
#
-# Copyright (C) 2012-2015 Gregory Nutt. All rights reserved.
+# Copyright (C) 2012-2015, 2017 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt
#
# Redistribution and use in source and binary forms, with or without
@@ -112,6 +112,14 @@ ifeq ($(CONFIG_LPC43_GPIO_IRQ),y)
CHIP_CSRCS += lpc43_gpioint.c
endif
+ifeq ($(CONFIG_LPC43_WWDT),y)
+CHIP_CSRCS += lpc43_wwdt.c
+endif
+
+ifeq ($(CONFIG_LPC43_SDMMC),y)
+CHIP_CSRCS += lpc43_sdmmc.c
+endif
+
ifeq ($(CONFIG_LPC43_ETHERNET),y)
CHIP_CSRCS += lpc43_ethernet.c
endif
@@ -122,15 +130,11 @@ endif
ifeq ($(CONFIG_LPC43_SPI),y)
CHIP_CSRCS += lpc43_spi.c
-else
-ifeq ($(CONFIG_LPC43_SSP0),y)
+else ifeq ($(CONFIG_LPC43_SSP0),y)
CHIP_CSRCS += lpc43_spi.c
-else
-ifeq ($(CONFIG_LPC43_SSP1),y)
+else ifeq ($(CONFIG_LPC43_SSP1),y)
CHIP_CSRCS += lpc43_spi.c
endif
-endif
-endif
ifeq ($(CONFIG_LPC43_SPIFI),y)
CHIP_CSRCS += lpc43_spifi.c
@@ -138,11 +142,9 @@ endif
ifeq ($(CONFIG_LPC43_SSP0),y)
CHIP_CSRCS += lpc43_ssp.c
-else
-ifeq ($(CONFIG_LPC43_SSP1),y)
+else ifeq ($(CONFIG_LPC43_SSP1),y)
CHIP_CSRCS += lpc43_ssp.c
endif
-endif
ifeq ($(CONFIG_LPC43_TIMER),y)
CHIP_CSRCS += lpc43_timer.c
@@ -152,28 +154,30 @@ ifeq ($(CONFIG_LPC43_RIT),y)
CHIP_CSRCS += lpc43_rit.c
endif
+ifeq ($(CONFIG_LPC43_RTC),y)
+CHIP_CSRCS += lpc43_rtc.c
+endif
+
ifeq ($(CONFIG_LPC43_I2C0),y)
CHIP_CSRCS += lpc43_i2c.c
-else
-ifeq ($(CONFIG_LPC43_I2C1),y)
+else ifeq ($(CONFIG_LPC43_I2C1),y)
CHIP_CSRCS += lpc43_i2c.c
endif
+
+ifeq ($(CONFIG_LPC43_CAN0),y)
+CHIP_CSRCS += lpc43_can.c
+else ifeq ($(CONFIG_LPC43_CAN1),y)
+CHIP_CSRCS += lpc43_can.c
endif
ifeq ($(CONFIG_LPC43_ADC0),y)
CHIP_CSRCS += lpc43_adc.c
-else
-ifeq ($(CONFIG_LPC43_ADC1),y)
+else ifeq ($(CONFIG_LPC43_ADC1),y)
CHIP_CSRCS += lpc43_adc.c
endif
-endif
ifeq ($(CONFIG_LPC43_DAC),y)
-CHIP_CSRCS += lpc43_adc.c
-else
-ifeq ($(CONFIG_LPC43_DAC),y)
-CHIP_CSRCS += lpc43_adc.c
-endif
+CHIP_CSRCS += lpc43_dac.c
endif
ifeq ($(CONFIG_LPC43_USBOTG),y)
diff --git a/arch/arm/src/lpc43xx/chip/lpc4337jet100_pinconfig.h b/arch/arm/src/lpc43xx/chip/lpc4337jet100_pinconfig.h
index 38a951e5e6319b81222027ca3175e511fd1d3708..db66b779adfe9337b2e7e6c3b114dfee53d3136e 100644
--- a/arch/arm/src/lpc43xx/chip/lpc4337jet100_pinconfig.h
+++ b/arch/arm/src/lpc43xx/chip/lpc4337jet100_pinconfig.h
@@ -41,6 +41,7 @@
****************************************************************************************************/
#include
+#include "lpc43_pinconfig.h"
/****************************************************************************************************
* Pre-processor Definitions
@@ -89,14 +90,14 @@
#define PINCONF_ADCTRIG1_1 (PINCONF_FUNC2|PINCONF_PINSE|PINCONF_PIN_3)
#define PINCONF_ADCTRIG1_2 (PINCONF_FUNC3|PINCONF_PINS2|PINCONF_PIN_5)
-#define PINCONF_CAN0_RD_1 (PINCONF_FUNC1|PINCONF_PINSE|PINCONF_PIN_2)
-#define PINCONF_CAN0_RD_2 (PINCONF_FUNC2|PINCONF_PINS3|PINCONF_PIN_1)
+#define PINCONF_CAN0_RD_1 (PINCONF_FUNC1|PINCONF_INBUFFER|PINCONF_PINSE|PINCONF_PIN_2)
+#define PINCONF_CAN0_RD_2 (PINCONF_FUNC2|PINCONF_INBUFFER|PINCONF_PINS3|PINCONF_PIN_1)
#define PINCONF_CAN0_TD_1 (PINCONF_FUNC1|PINCONF_PINSE|PINCONF_PIN_3)
#define PINCONF_CAN0_TD_2 (PINCONF_FUNC2|PINCONF_PINS3|PINCONF_PIN_2)
-#define PINCONF_CAN1_RD_1 (PINCONF_FUNC5|PINCONF_PINS1|PINCONF_PIN_18)
-#define PINCONF_CAN1_RD_2 (PINCONF_FUNC5|PINCONF_PINSE|PINCONF_PIN_1)
-#define PINCONF_CAN1_RD_3 (PINCONF_FUNC6|PINCONF_PINS4|PINCONF_PIN_9)
+#define PINCONF_CAN1_RD_1 (PINCONF_FUNC5|PINCONF_INBUFFER|PINCONF_PINS1|PINCONF_PIN_18)
+#define PINCONF_CAN1_RD_2 (PINCONF_FUNC5|PINCONF_INBUFFER|PINCONF_PINSE|PINCONF_PIN_1)
+#define PINCONF_CAN1_RD_3 (PINCONF_FUNC6|PINCONF_INBUFFER|PINCONF_PINS4|PINCONF_PIN_9)
#define PINCONF_CAN1_TD_1 (PINCONF_FUNC5|PINCONF_PINS1|PINCONF_PIN_17)
#define PINCONF_CAN1_TD_2 (PINCONF_FUNC5|PINCONF_PINSE|PINCONF_PIN_0)
#define PINCONF_CAN1_TD_3 (PINCONF_FUNC6|PINCONF_PINS4|PINCONF_PIN_8)
@@ -862,12 +863,12 @@
#define PINCONF_U1_TXD_4 (PINCONF_FUNC4|PINCONF_PULLUP|PINCONF_INBUFFER|PINCONF_PINS3|PINCONF_PIN_4)
#define PINCONF_U1_TXD_5 (PINCONF_FUNC4|PINCONF_PULLUP|PINCONF_INBUFFER|PINCONF_PINS5|PINCONF_PIN_6)
-#define PINCONF_U2_DIR_1 (PINCONF_FUNC1|PINCONF_PINS1|PINCONF_PIN_18)
-#define PINCONF_U2_DIR_2 (PINCONF_FUNC7|PINCONF_PINS2|PINCONF_PIN_13)
-#define PINCONF_U2_RXD_1 (PINCONF_FUNC1|PINCONF_PINS1|PINCONF_PIN_16)
-#define PINCONF_U2_RXD_2 (PINCONF_FUNC2|PINCONF_PINS2|PINCONF_PIN_11)
-#define PINCONF_U2_RXD_3 (PINCONF_FUNC3|PINCONF_PINSA|PINCONF_PIN_2)
-#define PINCONF_U2_RXD_4 (PINCONF_FUNC6|PINCONF_PINS7|PINCONF_PIN_2)
+#define PINCONF_U2_DIR_1 (PINCONF_FUNC1|PINCONF_PULLUP|PINCONF_INBUFFER|PINCONF_PINS1|PINCONF_PIN_18)
+#define PINCONF_U2_DIR_2 (PINCONF_FUNC7|PINCONF_PULLUP|PINCONF_INBUFFER|PINCONF_PINS2|PINCONF_PIN_13)
+#define PINCONF_U2_RXD_1 (PINCONF_FUNC1|PINCONF_PULLUP|PINCONF_INBUFFER|PINCONF_PINS1|PINCONF_PIN_16)
+#define PINCONF_U2_RXD_2 (PINCONF_FUNC2|PINCONF_PULLUP|PINCONF_INBUFFER|PINCONF_PINS2|PINCONF_PIN_11)
+#define PINCONF_U2_RXD_3 (PINCONF_FUNC3|PINCONF_PULLUP|PINCONF_INBUFFER|PINCONF_PINSA|PINCONF_PIN_2)
+#define PINCONF_U2_RXD_4 (PINCONF_FUNC6|PINCONF_PULLUP|PINCONF_INBUFFER|PINCONF_PINS7|PINCONF_PIN_2)
#define PINCONF_U2_TXD_1 (PINCONF_FUNC1|PINCONF_PINS1|PINCONF_PIN_15)
#define PINCONF_U2_TXD_2 (PINCONF_FUNC2|PINCONF_PINS2|PINCONF_PIN_10)
#define PINCONF_U2_TXD_3 (PINCONF_FUNC3|PINCONF_PINSA|PINCONF_PIN_1)
@@ -875,16 +876,16 @@
#define PINCONF_U2_UCLK_1 (PINCONF_FUNC1|PINCONF_PINS1|PINCONF_PIN_17)
#define PINCONF_U2_UCLK_2 (PINCONF_FUNC7|PINCONF_PINS2|PINCONF_PIN_12)
-#define PINCONF_U3_BAUD_1 (PINCONF_FUNC1|PINCONF_PINSF|PINCONF_PIN_7)
-#define PINCONF_U3_BAUD_2 (PINCONF_FUNC2|PINCONF_PINS2|PINCONF_PIN_9)
-#define PINCONF_U3_BAUD_3 (PINCONF_FUNC6|PINCONF_PINS4|PINCONF_PIN_3)
-#define PINCONF_U3_DIR_1 (PINCONF_FUNC1|PINCONF_PINSF|PINCONF_PIN_6)
-#define PINCONF_U3_DIR_2 (PINCONF_FUNC2|PINCONF_PINS2|PINCONF_PIN_8)
-#define PINCONF_U3_DIR_3 (PINCONF_FUNC6|PINCONF_PINS4|PINCONF_PIN_4)
-#define PINCONF_U3_RXD_1 (PINCONF_FUNC1|PINCONF_PINSF|PINCONF_PIN_3)
-#define PINCONF_U3_RXD_2 (PINCONF_FUNC2|PINCONF_PINS2|PINCONF_PIN_4)
-#define PINCONF_U3_RXD_3 (PINCONF_FUNC6|PINCONF_PINS4|PINCONF_PIN_2)
-#define PINCONF_U3_RXD_4 (PINCONF_FUNC7|PINCONF_PINS9|PINCONF_PIN_4)
+#define PINCONF_U3_BAUD_1 (PINCONF_FUNC1|PINCONF_PULLUP|PINCONF_INBUFFER|PINCONF_PINSF|PINCONF_PIN_7)
+#define PINCONF_U3_BAUD_2 (PINCONF_FUNC2|PINCONF_PULLUP|PINCONF_INBUFFER|PINCONF_PINS2|PINCONF_PIN_9)
+#define PINCONF_U3_BAUD_3 (PINCONF_FUNC6|PINCONF_PULLUP|PINCONF_INBUFFER|PINCONF_PINS4|PINCONF_PIN_3)
+#define PINCONF_U3_DIR_1 (PINCONF_FUNC1|PINCONF_PULLUP|PINCONF_INBUFFER|PINCONF_PINSF|PINCONF_PIN_6)
+#define PINCONF_U3_DIR_2 (PINCONF_FUNC2|PINCONF_PULLUP|PINCONF_INBUFFER|PINCONF_PINS2|PINCONF_PIN_8)
+#define PINCONF_U3_DIR_3 (PINCONF_FUNC6|PINCONF_PULLUP|PINCONF_INBUFFER|PINCONF_PINS4|PINCONF_PIN_4)
+#define PINCONF_U3_RXD_1 (PINCONF_FUNC1|PINCONF_PULLUP|PINCONF_INBUFFER|PINCONF_PINSF|PINCONF_PIN_3)
+#define PINCONF_U3_RXD_2 (PINCONF_FUNC2|PINCONF_PULLUP|PINCONF_INBUFFER|PINCONF_PINS2|PINCONF_PIN_4)
+#define PINCONF_U3_RXD_3 (PINCONF_FUNC6|PINCONF_PULLUP|PINCONF_INBUFFER|PINCONF_PINS4|PINCONF_PIN_2)
+#define PINCONF_U3_RXD_4 (PINCONF_FUNC7|PINCONF_PULLUP|PINCONF_INBUFFER|PINCONF_PINS9|PINCONF_PIN_4)
#define PINCONF_U3_TXD_1 (PINCONF_FUNC1|PINCONF_PINSF|PINCONF_PIN_2)
#define PINCONF_U3_TXD_2 (PINCONF_FUNC2|PINCONF_PINS2|PINCONF_PIN_3)
#define PINCONF_U3_TXD_3 (PINCONF_FUNC6|PINCONF_PINS4|PINCONF_PIN_1)
diff --git a/arch/arm/src/lpc43xx/chip/lpc43_can.h b/arch/arm/src/lpc43xx/chip/lpc43_can.h
index cebeaccd8ce4e1f35003f285243d0514e19c37f8..c03ceab04bd617e58972f29b2bfe33abb7efc4a6 100644
--- a/arch/arm/src/lpc43xx/chip/lpc43_can.h
+++ b/arch/arm/src/lpc43xx/chip/lpc43_can.h
@@ -93,6 +93,50 @@
/* Register Addresses ***************************************************************/
+#define LPC43_CAN0_CNTL (LPC43_CAN0_BASE+LPC43_CAN_CNTL_OFFSET)
+#define LPC43_CAN0_STAT (LPC43_CAN0_BASE+LPC43_CAN_STAT_OFFSET)
+#define LPC43_CAN0_EC (LPC43_CAN0_BASE+LPC43_CAN_EC_OFFSET)
+#define LPC43_CAN0_BT (LPC43_CAN0_BASE+LPC43_CAN_BT_OFFSET)
+#define LPC43_CAN0_INT (LPC43_CAN0_BASE+LPC43_CAN_INT_OFFSET)
+#define LPC43_CAN0_TEST (LPC43_CAN0_BASE+LPC43_CAN_TEST_OFFSET)
+#define LPC43_CAN0_BRPE (LPC43_CAN0_BASE+LPC43_CAN_BRPE_OFFSET)
+
+#define LPC43_CAN0_IF1_CMDREQ (LPC43_CAN0_BASE+LPC43_CAN_IF1_CMDREQ_OFFSET)
+#define LPC43_CAN0_IF1_CMDMSKW (LPC43_CAN0_BASE+LPC43_CAN_IF1_CMDMSKW_OFFSET)
+#define LPC43_CAN0_IF1_CMDMSKR (LPC43_CAN0_BASE+LPC43_CAN_IF1_CMDMSKR_OFFSET)
+#define LPC43_CAN0_IF1_MSK1 (LPC43_CAN0_BASE+LPC43_CAN_IF1_MSK1_OFFSET)
+#define LPC43_CAN0_IF1_MSK2 (LPC43_CAN0_BASE+LPC43_CAN_IF1_MSK2_OFFSET)
+#define LPC43_CAN0_IF1_ARB1 (LPC43_CAN0_BASE+LPC43_CAN_IF1_ARB1_OFFSET)
+#define LPC43_CAN0_IF1_ARB2 (LPC43_CAN0_BASE+LPC43_CAN_IF1_ARB2_OFFSET)
+#define LPC43_CAN0_IF1_MCTRL (LPC43_CAN0_BASE+LPC43_CAN_IF1_MCTRL_OFFSET)
+#define LPC43_CAN0_IF1_DA1 (LPC43_CAN0_BASE+LPC43_CAN_IF1_DA1_OFFSET)
+#define LPC43_CAN0_IF1_DA2 (LPC43_CAN0_BASE+LPC43_CAN_IF1_DA2_OFFSET)
+#define LPC43_CAN0_IF1_DB1 (LPC43_CAN0_BASE+LPC43_CAN_IF1_DB1_OFFSET)
+#define LPC43_CAN0_IF1_DB2 (LPC43_CAN0_BASE+LPC43_CAN_IF1_DB2_OFFSET)
+
+#define LPC43_CAN0_IF2_CMDREQ (LPC43_CAN0_BASE+LPC43_CAN_IF2_CMDREQ_OFFSET)
+#define LPC43_CAN0_IF2_CMDMSKW (LPC43_CAN0_BASE+LPC43_CAN_IF2_CMDMSKW_OFFSET)
+#define LPC43_CAN0_IF2_CMDMSKR (LPC43_CAN0_BASE+LPC43_CAN_IF2_CMDMSKR_OFFSET)
+#define LPC43_CAN0_IF2_MSK1 (LPC43_CAN0_BASE+LPC43_CAN_IF2_MSK1_OFFSET)
+#define LPC43_CAN0_IF2_MSK2 (LPC43_CAN0_BASE+LPC43_CAN_IF2_MSK2_OFFSET)
+#define LPC43_CAN0_IF2_ARB1 (LPC43_CAN0_BASE+LPC43_CAN_IF2_ARB1_OFFSET)
+#define LPC43_CAN0_IF2_ARB2 (LPC43_CAN0_BASE+LPC43_CAN_IF2_ARB2_OFFSET)
+#define LPC43_CAN0_IF2_MCTRL (LPC43_CAN0_BASE+LPC43_CAN_IF2_MCTRL_OFFSET)
+#define LPC43_CAN0_IF2_DA1 (LPC43_CAN0_BASE+LPC43_CAN_IF2_DA1_OFFSET)
+#define LPC43_CAN0_IF2_DA2 (LPC43_CAN0_BASE+LPC43_CAN_IF2_DA2_OFFSET)
+#define LPC43_CAN0_IF2_DB1 (LPC43_CAN0_BASE+LPC43_CAN_IF2_DB1_OFFSET)
+#define LPC43_CAN0_IF2_DB2 (LPC43_CAN0_BASE+LPC43_CAN_IF2_DB2_OFFSET)
+
+#define LPC43_CAN0_TXREQ1 (LPC43_CAN0_BASE+LPC43_CAN_TXREQ1_OFFSET)
+#define LPC43_CAN0_TXREQ2 (LPC43_CAN0_BASE+LPC43_CAN_TXREQ2_OFFSET)
+#define LPC43_CAN0_ND1 (LPC43_CAN0_BASE+LPC43_CAN_ND1_OFFSET)
+#define LPC43_CAN0_ND2 (LPC43_CAN0_BASE+LPC43_CAN_ND2_OFFSET)
+#define LPC43_CAN0_IR1 (LPC43_CAN0_BASE+LPC43_CAN_IR1_OFFSET)
+#define LPC43_CAN0_IR2 (LPC43_CAN0_BASE+LPC43_CAN_IR2_OFFSET)
+#define LPC43_CAN0_MSGV1 (LPC43_CAN0_BASE+LPC43_CAN_MSGV1_OFFSET)
+#define LPC43_CAN0_MSGV2 (LPC43_CAN0_BASE+LPC43_CAN_MSGV2_OFFSET)
+#define LPC43_CAN0_CLKDIV (LPC43_CAN0_BASE+LPC43_CAN_CLKDIV_OFFSET)
+
#define LPC43_CAN1_CNTL (LPC43_CAN1_BASE+LPC43_CAN_CNTL_OFFSET)
#define LPC43_CAN1_STAT (LPC43_CAN1_BASE+LPC43_CAN_STAT_OFFSET)
#define LPC43_CAN1_EC (LPC43_CAN1_BASE+LPC43_CAN_EC_OFFSET)
@@ -137,50 +181,6 @@
#define LPC43_CAN1_MSGV2 (LPC43_CAN1_BASE+LPC43_CAN_MSGV2_OFFSET)
#define LPC43_CAN1_CLKDIV (LPC43_CAN1_BASE+LPC43_CAN_CLKDIV_OFFSET)
-#define LPC43_CAN2_CNTL (LPC43_CAN2_BASE+LPC43_CAN_CNTL_OFFSET)
-#define LPC43_CAN2_STAT (LPC43_CAN2_BASE+LPC43_CAN_STAT_OFFSET)
-#define LPC43_CAN2_EC (LPC43_CAN2_BASE+LPC43_CAN_EC_OFFSET)
-#define LPC43_CAN2_BT (LPC43_CAN2_BASE+LPC43_CAN_BT_OFFSET)
-#define LPC43_CAN2_INT (LPC43_CAN2_BASE+LPC43_CAN_INT_OFFSET)
-#define LPC43_CAN2_TEST (LPC43_CAN2_BASE+LPC43_CAN_TEST_OFFSET)
-#define LPC43_CAN2_BRPE (LPC43_CAN2_BASE+LPC43_CAN_BRPE_OFFSET)
-
-#define LPC43_CAN2_IF1_CMDREQ (LPC43_CAN2_BASE+LPC43_CAN_IF1_CMDREQ_OFFSET)
-#define LPC43_CAN2_IF1_CMDMSKW (LPC43_CAN2_BASE+LPC43_CAN_IF1_CMDMSKW_OFFSET)
-#define LPC43_CAN2_IF1_CMDMSKR (LPC43_CAN2_BASE+LPC43_CAN_IF1_CMDMSKR_OFFSET)
-#define LPC43_CAN2_IF1_MSK1 (LPC43_CAN2_BASE+LPC43_CAN_IF1_MSK1_OFFSET)
-#define LPC43_CAN2_IF1_MSK2 (LPC43_CAN2_BASE+LPC43_CAN_IF1_MSK2_OFFSET)
-#define LPC43_CAN2_IF1_ARB1 (LPC43_CAN2_BASE+LPC43_CAN_IF1_ARB1_OFFSET)
-#define LPC43_CAN2_IF1_ARB2 (LPC43_CAN2_BASE+LPC43_CAN_IF1_ARB2_OFFSET)
-#define LPC43_CAN2_IF1_MCTRL (LPC43_CAN2_BASE+LPC43_CAN_IF1_MCTRL_OFFSET)
-#define LPC43_CAN2_IF1_DA1 (LPC43_CAN2_BASE+LPC43_CAN_IF1_DA1_OFFSET)
-#define LPC43_CAN2_IF1_DA2 (LPC43_CAN2_BASE+LPC43_CAN_IF1_DA2_OFFSET)
-#define LPC43_CAN2_IF1_DB1 (LPC43_CAN2_BASE+LPC43_CAN_IF1_DB1_OFFSET)
-#define LPC43_CAN2_IF1_DB2 (LPC43_CAN2_BASE+LPC43_CAN_IF1_DB2_OFFSET)
-
-#define LPC43_CAN2_IF2_CMDREQ (LPC43_CAN2_BASE+LPC43_CAN_IF2_CMDREQ_OFFSET)
-#define LPC43_CAN2_IF2_CMDMSKW (LPC43_CAN2_BASE+LPC43_CAN_IF2_CMDMSKW_OFFSET)
-#define LPC43_CAN2_IF2_CMDMSKR (LPC43_CAN2_BASE+LPC43_CAN_IF2_CMDMSKR_OFFSET)
-#define LPC43_CAN2_IF2_MSK1 (LPC43_CAN2_BASE+LPC43_CAN_IF2_MSK1_OFFSET)
-#define LPC43_CAN2_IF2_MSK2 (LPC43_CAN2_BASE+LPC43_CAN_IF2_MSK2_OFFSET)
-#define LPC43_CAN2_IF2_ARB1 (LPC43_CAN2_BASE+LPC43_CAN_IF2_ARB1_OFFSET)
-#define LPC43_CAN2_IF2_ARB2 (LPC43_CAN2_BASE+LPC43_CAN_IF2_ARB2_OFFSET)
-#define LPC43_CAN2_IF2_MCTRL (LPC43_CAN2_BASE+LPC43_CAN_IF2_MCTRL_OFFSET)
-#define LPC43_CAN2_IF2_DA1 (LPC43_CAN2_BASE+LPC43_CAN_IF2_DA1_OFFSET)
-#define LPC43_CAN2_IF2_DA2 (LPC43_CAN2_BASE+LPC43_CAN_IF2_DA2_OFFSET)
-#define LPC43_CAN2_IF2_DB1 (LPC43_CAN2_BASE+LPC43_CAN_IF2_DB1_OFFSET)
-#define LPC43_CAN2_IF2_DB2 (LPC43_CAN2_BASE+LPC43_CAN_IF2_DB2_OFFSET)
-
-#define LPC43_CAN2_TXREQ1 (LPC43_CAN2_BASE+LPC43_CAN_TXREQ1_OFFSET)
-#define LPC43_CAN2_TXREQ2 (LPC43_CAN2_BASE+LPC43_CAN_TXREQ2_OFFSET)
-#define LPC43_CAN2_ND1 (LPC43_CAN2_BASE+LPC43_CAN_ND1_OFFSET)
-#define LPC43_CAN2_ND2 (LPC43_CAN2_BASE+LPC43_CAN_ND2_OFFSET)
-#define LPC43_CAN2_IR1 (LPC43_CAN2_BASE+LPC43_CAN_IR1_OFFSET)
-#define LPC43_CAN2_IR2 (LPC43_CAN2_BASE+LPC43_CAN_IR2_OFFSET)
-#define LPC43_CAN2_MSGV1 (LPC43_CAN2_BASE+LPC43_CAN_MSGV1_OFFSET)
-#define LPC43_CAN2_MSGV2 (LPC43_CAN2_BASE+LPC43_CAN_MSGV2_OFFSET)
-#define LPC43_CAN2_CLKDIV (LPC43_CAN2_BASE+LPC43_CAN_CLKDIV_OFFSET)
-
/* Register Bit Definitions *********************************************************/
/* CAN control register */
@@ -267,7 +267,7 @@
# define CAN_INT_MSG30 (30 << CAN_INT_SHIFT) /* Message 30 */
# define CAN_INT_MSG31 (31 << CAN_INT_SHIFT) /* Message 31 */
# define CAN_INT_MSG32 (32 << CAN_INT_SHIFT) /* Message 32 */
-# define CAN_INT_MSG32 (0x8000 << CAN_INT_SHIFT) /* Status interrupt */
+# define CAN_INT_STAT (0x8000 << CAN_INT_SHIFT) /* Status interrupt */
/* Bits 16-31: Reserved */
/* Test register */
/* Bits 0-1: Reserved */
diff --git a/arch/arm/src/lpc43xx/chip/lpc43_cgu.h b/arch/arm/src/lpc43xx/chip/lpc43_cgu.h
index bd9682c8fd444d076e52da49a6ba2d40202fd162..7f60f38836fa3db2108cc76e31b7e050ecde6174 100644
--- a/arch/arm/src/lpc43xx/chip/lpc43_cgu.h
+++ b/arch/arm/src/lpc43xx/chip/lpc43_cgu.h
@@ -643,6 +643,31 @@
# define BASE_VADC_CLKSEL_IDIVD (15 << BASE_VADC_CLK_CLKSEL_SHIFT) /* IDIVD */
# define BASE_VADC_CLKSEL_IDIVE (16 << BASE_VADC_CLK_CLKSEL_SHIFT) /* IDIVE */
/* Bits 29-31: Reserved */
+
+/* Output stage 13 control register (BASE_SDIO_CLK) */
+/* NOTE: Clocks 4-19 are identical */
+
+#define BASE_SDIO_CLK_PD (1 << 0) /* Bit 0: Output stage power down */
+ /* Bits 1-10: Reserved */
+#define BASE_SDIO_CLK_AUTOBLOCK (1 << 11) /* Bit 11: Block clock during frequency change */
+ /* Bits 12-23: Reserved */
+#define BASE_SDIO_CLK_CLKSEL_SHIFT (24) /* Bits 24-28: Clock source selection */
+#define BASE_SDIO_CLK_CLKSEL_MASK (31 << BASE_SDIO_CLK_CLKSEL_SHIFT)
+# define BASE_SDIO_CLKSEL_32KHZOSC (0 << BASE_SDIO_CLK_CLKSEL_SHIFT) /* 32 kHz oscillator */
+# define BASE_SDIO_CLKSEL_IRC (1 << BASE_SDIO_CLK_CLKSEL_SHIFT) /* IRC (default) */
+# define BASE_SDIO_CLKSEL_ENET_RXCLK (2 << BASE_SDIO_CLK_CLKSEL_SHIFT) /* ENET_RX_CLK */
+# define BASE_SDIO_CLKSEL_ENET_TXCLK (3 << BASE_SDIO_CLK_CLKSEL_SHIFT) /* ENET_TX_CLK */
+# define BASE_SDIO_CLKSEL_GPCLKIN (4 << BASE_SDIO_CLK_CLKSEL_SHIFT) /* GP_CLKIN */
+# define BASE_SDIO_CLKSEL_XTAL (6 << BASE_SDIO_CLK_CLKSEL_SHIFT) /* Crystal oscillator */
+# define BASE_SDIO_CLKSEL_PLL0AUDIO (8 << BASE_SDIO_CLK_CLKSEL_SHIFT) /* PLL0AUDIO */
+# define BASE_SDIO_CLKSEL_PLL1 (9 << BASE_SDIO_CLK_CLKSEL_SHIFT) /* PLL1 */
+# define BASE_SDIO_CLKSEL_IDIVA (12 << BASE_SDIO_CLK_CLKSEL_SHIFT) /* IDIVA */
+# define BASE_SDIO_CLKSEL_IDIVB (13 << BASE_SDIO_CLK_CLKSEL_SHIFT) /* IDIVB */
+# define BASE_SDIO_CLKSEL_IDIVC (14 << BASE_SDIO_CLK_CLKSEL_SHIFT) /* IDIVC */
+# define BASE_SDIO_CLKSEL_IDIVD (15 << BASE_SDIO_CLK_CLKSEL_SHIFT) /* IDIVD */
+# define BASE_SDIO_CLKSEL_IDIVE (16 << BASE_SDIO_CLK_CLKSEL_SHIFT) /* IDIVE */
+ /* Bits 29-31: Reserved */
+
/* Output stage 14 control register (BASE_SSP0_CLK) */
/* NOTE: Clocks 4-19 are identical */
diff --git a/arch/arm/src/lpc43xx/chip/lpc43_sdmmc.h b/arch/arm/src/lpc43xx/chip/lpc43_sdmmc.h
index 05a51178fb24852294c8290ea145ac081cef7b82..a61c254894cb2e8bd44f09358875519f0715d416 100644
--- a/arch/arm/src/lpc43xx/chip/lpc43_sdmmc.h
+++ b/arch/arm/src/lpc43xx/chip/lpc43_sdmmc.h
@@ -46,6 +46,11 @@
* Pre-processor Definitions
************************************************************************************************/
+#define LPC43_TXFIFO_DEPTH 32
+#define LPC43_TXFIFO_WIDTH 4
+#define LPC43_RXFIFO_DEPTH 32
+#define LPC43_RXFIFO_WIDTH 4
+
/* MCI register offsets (with respect to the MCI base) ******************************************/
#define LPC43_SDMMC_CTRL_OFFSET 0x0000 /* Control register */
@@ -114,7 +119,6 @@
#define LPC43_SDMMC_TBBCNT (LPC43_SDMMC_BASE+LPC43_SDMMC_TBBCNT_OFFSET)
#define LPC43_SDMMC_TBBCNT (LPC43_SDMMC_BASE+LPC43_SDMMC_TBBCNT_OFFSET)
#define LPC43_SDMMC_DEBNCE (LPC43_SDMMC_BASE+LPC43_SDMMC_DEBNCE_OFFSET)
-#define LPC43_SDMMC_DEBNCE (LPC43_SDMMC_BASE+LPC43_SDMMC_DEBNCE_OFFSET)
#define LPC43_SDMMC_RSTN (LPC43_SDMMC_BASE+LPC43_SDMMC_RSTN_OFFSET)
#define LPC43_SDMMC_BMOD (LPC43_SDMMC_BASE+LPC43_SDMMC_BMOD_OFFSET)
#define LPC43_SDMMC_PLDMND (LPC43_SDMMC_BASE+LPC43_SDMMC_PLDMND_OFFSET)
@@ -157,12 +161,16 @@
#define SDMMC_CLKDIV0_SHIFT (0) /* Bits 0-7: Clock divider 0 value */
#define SDMMC_CLKDIV0_MASK (255 << SDMMC_CLKDIV0_SHIFT)
+# define SDMMC_CLKDIV0(n) ((((n) + 1) >> 1) << SDMMC_CLKDIV0_SHIFT)
#define SDMMC_CLKDIV1_SHIFT (8) /* Bits 8-15: Clock divider 1 value */
#define SDMMC_CLKDIV1_MASK (255 << SDMMC_CLKDIV1_SHIFT)
+# define SDMMC_CLKDIV1(n) ((((n) + 1) >> 1) << SDMMC_CLKDIV1_SHIFT)
#define SDMMC_CLKDIV2_SHIFT (16) /* Bits 16-23: Clock divider 2 value */
#define SDMMC_CLKDIV2_MASK (255 << SDMMC_CLKDIV2_SHIFT)
+# define SDMMC_CLKDIV2(n) ((((n) + 1) >> 1) << SDMMC_CLKDIV2_SHIFT)
#define SDMMC_CLKDIV3_SHIFT (24) /* Bits 24-31: Clock divider 3 value */
#define SDMMC_CLKDIV3_MASK (255 << SDMMC_CLKDIV3_SHIFT)
+# define SDMMC_CLKDIV3(n) ((((n) + 1) >> 1) << SDMMC_CLKDIV3_SHIFT)
/* Clock source register CLKSRC */
@@ -175,7 +183,7 @@
/* Bits 2-31: Reserved */
/* Clock enable register CLKENA */
-#define SDMMC_CLKENA_EMABLE (1 << 0) /* Bit 0: Clock enable */
+#define SDMMC_CLKENA_ENABLE (1 << 0) /* Bit 0: Clock enable */
/* Bits 1-15: Reserved */
#define SDMMC_CLKENA_LOWPOWER (1 << 16) /* Bit 16: Low-power mode */
/* Bits 17-31: Reserved */
@@ -188,6 +196,7 @@
/* Card type register CTYPE */
+#define SDMMC_CTYPE_WIDTH1 (0) /* 1-bit mode */
#define SDMMC_CTYPE_WIDTH4 (1 << 0) /* Bit 0: 4-bit mode */
/* Bits 1-15: Reserved */
#define SDMMC_CTYPE_WIDTH8 (1 << 16) /* Bit 16: 8-bit mode */
@@ -218,7 +227,7 @@
#define SDMMC_INT_SBE (1 << 13) /* Bit 13: Start-bit error */
#define SDMMC_INT_ACD (1 << 14) /* Bit 14: Auto command done */
#define SDMMC_INT_EBE (1 << 15) /* Bit 15: End-bit error (read)/Write no CRC */
-#define SDMMC_INT_SDIO (1 << 16) /* Bit 16: Mask SDIO interrupt */
+#define SDMMC_INT_SDIO (1 << 16) /* Bit 16: SDIO interrupt */
/* Bits 17-31: Reserved */
#define SDMMC_INT_ALL (0x1ffff)
@@ -228,6 +237,11 @@
#define SDMMC_CMD_CMDINDEX_MASK (63 << SDMMC_CMD_CMDINDEX_SHIFT)
#define SDMMC_CMD_RESPONSE (1 << 6) /* Bit 6: Response expected from card */
#define SDMMC_CMD_LONGRESP (1 << 7) /* Bit 7: Long response expected from card */
+#define SDMMC_CMD_WAITRESP_SHIFT (6) /* Bits 6-7: Response expected */
+#define SDMMC_CMD_WAITRESP_MASK (3 << SDMMC_CMD_WAITRESP_SHIFT)
+# define SDMMC_CMD_NORESPONSE (0 << SDMMC_CMD_WAITRESP_SHIFT) /* x0: No response */
+# define SDMMC_CMD_SHORTRESPONSE (1 << SDMMC_CMD_WAITRESP_SHIFT) /* 01: Short response */
+# define SDMMC_CMD_LONGRESPONSE (3 << SDMMC_CMD_WAITRESP_SHIFT) /* 11: Long response */
#define SDMMC_CMD_RESPCRC (1 << 8) /* Bit 8: Check response CRC */
#define SDMMC_CMD_DATAXFREXPTD (1 << 9) /* Bit 9: Data transfer expected (read/write) */
#define SDMMC_CMD_WRITE (1 << 10) /* Bit 10: Write to card */
@@ -286,9 +300,11 @@
#define SDMMC_FIFOTH_TXWMARK_SHIFT (0) /* Bits 0-11: FIFO threshold level when transmitting */
#define SDMMC_FIFOTH_TXWMARK_MASK (0xfff << SDMMC_FIFOTH_TXWMARK_SHIFT)
+# define SDMMC_FIFOTH_TXWMARK(n) ((uint32_t)(n) << SDMMC_FIFOTH_TXWMARK_SHIFT)
/* Bits 12-15: Reserved */
#define SDMMC_FIFOTH_RXWMARK_SHIFT (16) /* Bits 16-27: FIFO threshold level when receiving */
#define SDMMC_FIFOTH_RXWMARK_MASK (0xfff << SDMMC_FIFOTH_RXWMARK_SHIFT)
+# define SDMMC_FIFOTH_RXWMARK(n) ((uint32_t)(n) << SDMMC_FIFOTH_RXWMARK_SHIFT)
#define SDMMC_FIFOTH_DMABURST_SHIFT (28) /* Bits 28-30: Burst size for multiple transaction */
#define SDMMC_FIFOTH_DMABURST_MASK (7 << SDMMC_FIFOTH_DMABURST_SHIFT)
# define SDMMC_FIFOTH_DMABURST_1XFR (0 << SDMMC_FIFOTH_DMABURST_SHIFT) /* 1 transfer */
@@ -324,6 +340,7 @@
#define SDMMC_BMOD_FB (1 << 1) /* Bit 1: Fixed Burst */
#define SDMMC_BMOD_DSL_SHIFT (2) /* Bits 2-6: Descriptor Skip Length */
#define SDMMC_BMOD_DSL_MASK (31 << SDMMC_BMOD_DSL_SHIFT)
+# define SDMMC_BMOD_DSL(n) ((uint32_t)(n) << SDMMC_BMOD_DSL_SHIFT)
#define SDMMC_BMOD_DE (1 << 7) /* Bit 7: SD/MMC DMA Enable */
#define SDMMC_BMOD_PBL_SHIFT (8) /* Bits 8-10: Programmable Burst Length */
#define SDMMC_BMOD_PBL_MASK (7 << SDMMC_BMOD_PBL_SHIFT)
@@ -365,7 +382,6 @@
/* Bits 17-31: Reserved */
/* Internal DMAC Interrupt Enable Register */
-#define SDMMC_IDINTEN_
#define SDMMC_IDINTEN_TI (1 << 0) /* Bit 0: Transmit Interrupt */
#define SDMMC_IDINTEN_RI (1 << 1) /* Bit 1: Receive Interrupt */
#define SDMMC_IDINTEN_FBE (1 << 2) /* Bit 2: Fatal Bus Error Interrupt */
@@ -376,6 +392,7 @@
#define SDMMC_IDINTEN_NIS (1 << 8) /* Bit 8: Normal Interrupt Summary */
#define SDMMC_IDINTEN_AIS (1 << 9) /* Bit 9: Abnormal Interrupt Summary */
/* Bits 10-31: Reserved */
+#define SDMMC_IDINTEN_ALL 0x00000333
/************************************************************************************************
* Public Types
diff --git a/arch/arm/src/lpc43xx/chip/lpc43_usb0.h b/arch/arm/src/lpc43xx/chip/lpc43_usb0.h
index caa4c86cc2faaa6618ac3b193dbb0101b39aaf22..15e009a2467a7bdc7ae5d0adf055e9f658e8166e 100644
--- a/arch/arm/src/lpc43xx/chip/lpc43_usb0.h
+++ b/arch/arm/src/lpc43xx/chip/lpc43_usb0.h
@@ -58,6 +58,7 @@
#define LPC43_USBDEV_DCCPARAMS_OFFSET 0x0124 /* Device controller capability parameters */
/* Device/host/OTG operational registers */
+
#define LPC43_USBOTG_HCOR_OFFSET 0x0140 /* Offset to EHCI Host Controller Operational Registers */
#define LPC43_USBOTG_USBCMD_OFFSET 0x0140 /* USB command (both) */
#define LPC43_USBOTG_USBSTS_OFFSET 0x0144 /* USB status (both) */
diff --git a/arch/arm/src/lpc43xx/lpc43_can.c b/arch/arm/src/lpc43xx/lpc43_can.c
new file mode 100644
index 0000000000000000000000000000000000000000..415a7b28efd163130bac8e6079c611b681dd0643
--- /dev/null
+++ b/arch/arm/src/lpc43xx/lpc43_can.c
@@ -0,0 +1,1279 @@
+/****************************************************************************
+ * arch/arm/src/lpc43xx/lpc43_can.c
+ *
+ * Copyright(C) 2017 Gregory Nutt. All rights reserved.
+ *
+ * Created on: 2 May 2017
+ * Author: katherine
+ *
+ * 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.
+ *
+ ****************************************************************************/
+
+#include
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include
+#include
+#include
+
+#include "up_internal.h"
+#include "up_arch.h"
+#include "cache.h"
+
+#include "chip.h"
+#include "lpc43_gpio.h"
+#include "chip/lpc43_can.h"
+#include "chip/lpc43_rgu.h"
+#include "lpc43_ccu.h"
+#include "lpc43_cgu.h"
+
+#if defined(CONFIG_LPC43_CAN0) || defined(CONFIG_LPC43_CAN1)
+
+#define CAN_MSG_OBJECTS_NUM 0x20
+#define CAN_RX_OBJ_NUM 0x10
+#define CAN_TX_OBJ_NUM 0x10
+
+#define CAN_RX_OBJ_FIRST 0x01
+#define CAN_RX_OBJ_LAST (CAN_RX_OBJ_FIRST + CAN_RX_OBJ_NUM - 0x01)
+
+#define CAN_TX_OBJ_FIRST (CAN_RX_OBJ_LAST + 0x01)
+#define CAN_TX_OBJ_LAST (CAN_TX_OBJ_FIRST + CAN_TX_OBJ_NUM - 0x01)
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/* Configuration ************************************************************/
+
+#ifdef CONFIG_LPC43_CAN0
+
+/* A CAN bit rate must be provided */
+
+# ifndef CONFIG_CAN0_BAUD
+# define CONFIG_CAN0_BAUD 1000000
+# endif
+#endif
+
+#ifdef CONFIG_LPC43_CAN1
+
+/* A CAN bit rate must be provided */
+
+# ifndef CONFIG_CAN1_BAUD
+# define CONFIG_CAN1_BAUD 1000000
+# endif
+#endif
+
+/* User-defined TSEG1 and TSEG2 settings may be used.
+ *
+ * CONFIG_CAN_TSEG1 = the number of CAN time quanta in segment 1
+ * CONFIG_CAN_TSEG2 = the number of CAN time quanta in segment 2
+ * CAN_BIT_QUANTA = The number of CAN time quanta in on bit time
+ */
+
+#ifndef CONFIG_CAN_TSEG1
+# define CONFIG_CAN_TSEG1 12
+#endif
+
+#ifndef CONFIG_CAN_TSEG2
+# define CONFIG_CAN_TSEG2 4
+#endif
+
+#define CAN_BIT_QUANTA (CONFIG_CAN_TSEG1 + CONFIG_CAN_TSEG2 + 1)
+
+/* Timing *******************************************************************/
+
+/* CAN clock source is defined in board.h */
+
+#define CAN_CLOCK_FREQUENCY(c) ((uint32_t)LPC43_CCLK / ((uint32_t)(c)))
+
+/* CAN module clock must be less then 50 MHz */
+
+#define CAN_CLKDIVVAL 0x05
+
+/****************************************************************************
+ * Private Types
+ ****************************************************************************/
+
+struct up_dev_s
+{
+ uint8_t port; /* CAN port number */
+ uint8_t clkdiv; /* CLKDIV register */
+ uint32_t baud; /* Configured baud */
+ uint32_t base; /* CAN register base address */
+ uint8_t irq; /* IRQ associated with this CAN */
+};
+
+/****************************************************************************
+ * Private Function Prototypes
+ ****************************************************************************/
+/* CAN Register access */
+
+#ifdef CONFIG_CAN_REGDEBUG
+static void can_printreg(uint32_t addr, uint32_t value);
+#endif
+
+static uint32_t can_getreg(struct up_dev_s *priv, int offset);
+static void can_putreg(struct up_dev_s *priv, int offset, uint32_t value);
+
+#ifdef CONFIG_CAN_REGDEBUG
+static uint32_t can_getcommon(uint32_t addr);
+static void can_putcommon(uint32_t addr, uint32_t value);
+#else
+# define can_getcommon(addr) getreg32(addr)
+# define can_putcommon(addr, value) putreg32(value, addr)
+#endif
+
+/* CAN methods */
+
+static void can_reset(FAR struct can_dev_s *dev);
+static int can_setup(FAR struct can_dev_s *dev);
+static void can_shutdown(FAR struct can_dev_s *dev);
+static void can_rxint(FAR struct can_dev_s *dev, bool enable);
+static void can_txint(FAR struct can_dev_s *dev, bool enable);
+static int can_ioctl(FAR struct can_dev_s *dev, int cmd, unsigned long arg);
+static int can_remoterequest(FAR struct can_dev_s *dev, uint16_t id);
+static int can_send(FAR struct can_dev_s *dev, FAR struct can_msg_s *msg);
+static bool candev_txready(FAR struct can_dev_s *dev);
+static bool candev_txempty(FAR struct can_dev_s *dev);
+
+/* CAN interrupts */
+
+#ifdef CONFIG_LPC43_CAN0
+static int can0_interrupt(int irq, void *context, FAR void *arg);
+#endif
+#ifdef CONFIG_LPC43_CAN1
+static int can1_interrupt(int irq, void *context, FAR void *arg);
+#endif
+static void can_interrupt(FAR struct can_dev_s *dev);
+
+/* Message Processing */
+
+static void can_savemsg(struct up_dev_s *priv, struct can_hdr_s *hdr,
+ uint32_t *data);
+static void can_readobj(struct up_dev_s *priv, uint32_t index);
+static void can_invalobj(struct up_dev_s *priv, uint32_t index);
+static void can_setuprxobj(struct up_dev_s *priv);
+
+/* Initialization */
+
+static int can_bittiming(struct up_dev_s *priv);
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+static const struct can_ops_s g_canops =
+{
+ .co_reset = can_reset,
+ .co_setup = can_setup,
+ .co_shutdown = can_shutdown,
+ .co_rxint = can_rxint,
+ .co_txint = can_txint,
+ .co_ioctl = can_ioctl,
+ .co_remoterequest = can_remoterequest,
+ .co_send = can_send,
+ .co_txready = candev_txready,
+ .co_txempty = candev_txempty,
+};
+
+#ifdef CONFIG_LPC43_CAN0
+static struct up_dev_s g_can0priv =
+{
+ .port = 0,
+ .clkdiv = CAN_CLKDIVVAL + 1,
+ .baud = CONFIG_CAN0_BAUD,
+ .base = LPC43_CAN0_BASE,
+ .irq = LPC43M4_IRQ_CAN0,
+};
+
+static struct can_dev_s g_can0dev =
+{
+ .cd_ops = &g_canops,
+ .cd_priv = &g_can0priv,
+};
+#endif
+
+#ifdef CONFIG_LPC43_CAN1
+static struct up_dev_s g_can1priv =
+{
+ .port = 1,
+ .clkdiv = CAN_CLKDIVVAL + 1,
+ .baud = CONFIG_CAN1_BAUD,
+ .base = LPC43_CAN1_BASE,
+ .irq = LPC43M4_IRQ_CAN1,
+};
+
+static struct can_dev_s g_can1dev =
+{
+ .cd_ops = &g_canops,
+ .cd_priv = &g_can1priv,
+};
+#endif
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: can_printreg
+ *
+ * Description:
+ * Print the value read from a register.
+ *
+ * Input Parameters:
+ * addr - The register address
+ * value - The register value
+ *
+ * Returned Value:
+ * None
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_CAN_REGDEBUG
+static void can_printreg(uint32_t addr, uint32_t value)
+{
+ static uint32_t prevaddr = 0;
+ static uint32_t preval = 0;
+ static uint32_t count = 0;
+
+ /* Is this the same value that we read from the same register last time?
+ * Are we polling the register? If so, suppress some of the output.
+ */
+
+ if (addr == prevaddr && value == preval)
+ {
+ if (count == 0xffffffff || ++count > 3)
+ {
+ if (count == 4)
+ {
+ caninfo("...\n");
+ }
+
+ return;
+ }
+ }
+
+ /* No this is a new address or value */
+
+ else
+ {
+ /* Did we print "..." for the previous value? */
+
+ if (count > 3)
+ {
+ /* Yes.. then show how many times the value repeated */
+
+ caninfo("[repeats %d more times]\n", count-3);
+ }
+
+ /* Save the new address, value, and count */
+
+ prevaddr = addr;
+ preval = value;
+ count = 1;
+ }
+
+ /* Show the register value read */
+
+ caninfo("%08x->%08x\n", addr, value);
+}
+#endif /* CONFIG_CAN_REGDEBUG */
+
+/****************************************************************************
+ * Name: can_getreg
+ *
+ * Description:
+ * Read the value of an CAN1/2 register.
+ *
+ * Input Parameters:
+ * priv - A reference to the CAN block status
+ * offset - The offset to the register to read
+ *
+ * Returned Value:
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_CAN_REGDEBUG
+static uint32_t can_getreg(struct up_dev_s *priv, int offset)
+{
+ uint32_t addr;
+ uint32_t value;
+
+ /* Read the value from the register */
+
+ addr = priv->base + offset;
+ value = getreg32(addr);
+ can_printreg(addr, value);
+ return value;
+}
+#else
+static uint32_t can_getreg(struct up_dev_s *priv, int offset)
+{
+ return getreg32(priv->base + offset);
+}
+#endif /* CONFIG_CAN_REGDEBUG */
+
+/****************************************************************************
+ * Name: can_putreg
+ *
+ * Description:
+ * Set the value of an CAN1/2 register.
+ *
+ * Input Parameters:
+ * priv - A reference to the CAN block status
+ * offset - The offset to the register to write
+ * value - The value to write to the register
+ *
+ * Returned Value:
+ * None
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_CAN_REGDEBUG
+static void can_putreg(struct up_dev_s *priv, int offset, uint32_t value)
+{
+ uint32_t addr = priv->base + offset;
+
+ /* Show the register value being written */
+
+ caninfo("%08x<-%08x\n", addr, value);
+
+ /* Write the value */
+
+ putreg32(value, addr);
+}
+#else
+static void can_putreg(struct up_dev_s *priv, int offset, uint32_t value)
+{
+ putreg32(value, priv->base + offset);
+}
+#endif /* CONFIG_CAN_REGDEBUG */
+
+/****************************************************************************
+ * Name: can_getcommon
+ *
+ * Description:
+ * Get the value of common register.
+ *
+ * Input Parameters:
+ * addr - The address of the register to read
+ *
+ * Returned Value:
+ * None
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_CAN_REGDEBUG
+static uint32_t can_getcommon(uint32_t addr)
+{
+ uint32_t value;
+
+ /* Read the value from the register */
+
+ value = getreg32(addr);
+ can_printreg(addr, value);
+ return value;
+}
+#endif /* CONFIG_CAN_REGDEBUG */
+
+/****************************************************************************
+ * Name: can_putcommon
+ *
+ * Description:
+ * Set the value of common register.
+ *
+ * Input Parameters:
+ * addr - The address of the register to write
+ * value - The value to write to the register
+ *
+ * Returned Value:
+ * None
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_CAN_REGDEBUG
+static void can_putcommon(uint32_t addr, uint32_t value)
+{
+ /* Show the register value being written */
+
+ caninfo("%08x<-%08x\n", addr, value);
+
+ /* Write the value */
+
+ putreg32(value, addr);
+}
+#endif /* CONFIG_CAN_REGDEBUG */
+
+/****************************************************************************
+ * Name: can_reset
+ *
+ * Description:
+ * Reset the CAN device. Called early to initialize the hardware. This
+ * function is called, before can_setup() and on error conditions.
+ *
+ * Input Parameters:
+ * dev - An instance of the "upper half" can driver state structure.
+ *
+ * Returned Value:
+ * None
+ *
+ ****************************************************************************/
+
+static void can_reset(FAR struct can_dev_s *dev)
+{
+ FAR struct up_dev_s *priv = (FAR struct up_dev_s *)dev->cd_priv;
+ uint32_t regval;
+
+ caninfo("CAN%d reset\n", priv->port);
+
+#ifdef CONFIG_LPC43_CAN0
+ if (priv->port == 0)
+ {
+ regval = ~(getreg32(LPC43_RGU_ACTIVE1));
+ regval |= RGU_CTRL1_CAN0_RST;
+ putreg32(regval, LPC43_RGU_CTRL1);
+ }
+#endif /* CONFIG_LPC43_CAN0 */
+
+#ifdef CONFIG_LPC43_CAN1
+ if (priv->port == 1)
+ {
+ regval = ~(getreg32(LPC43_RGU_ACTIVE1));
+ regval |= RGU_CTRL1_CAN1_RST;
+ putreg32(regval, LPC43_RGU_CTRL1);
+ }
+#endif /* CONFIG_LPC43_CAN1 */
+}
+
+/****************************************************************************
+ * Name: can_setup
+ *
+ * Description:
+ * Configure the CAN. This method is called the first time that the CAN
+ * device is opened. This will occur when the port is first opened.
+ * This setup includes configuring and attaching CAN interrupts.
+ * All CAN interrupts are disabled upon return.
+ *
+ * Input Parameters:
+ * dev - An instance of the "upper half" can driver state structure.
+ *
+ * Returned Value:
+ * Zero on success; a negated errno on failure
+ *
+ ****************************************************************************/
+
+static int can_setup(FAR struct can_dev_s *dev)
+{
+ FAR struct up_dev_s *priv = (FAR struct up_dev_s *) dev->cd_priv;
+ uint32_t regval;
+ uint8_t i;
+ int ret = ERROR;
+
+ caninfo("CAN%d setup\n", priv->port);
+
+ can_bittiming(priv);
+
+ /* Clock must be divided by the CAN clock divider CLKDIV to be less than
+ * 50 MHz.
+ */
+
+ can_putreg(priv, LPC43_CAN_CLKDIV_OFFSET, CAN_CLKDIVVAL);
+
+ /* Invalidate all message objects */
+
+ for (i = 1; i <= CAN_MSG_OBJECTS_NUM; ++i)
+ {
+ can_invalobj(priv, i);
+ }
+
+ /* Initialization finished, normal operation now. */
+
+ regval = can_getreg(priv, LPC43_CAN_CNTL_OFFSET);
+ regval &= ~CAN_CNTL_INIT;
+ can_putreg(priv, LPC43_CAN_CNTL_OFFSET, regval);
+
+ while (can_getreg(priv, LPC43_CAN_CNTL_OFFSET) & CAN_CNTL_INIT);
+
+#ifdef CONFIG_LPC43_CAN0
+ if (priv->irq == LPC43M4_IRQ_CAN0)
+ {
+ ret = irq_attach(priv->irq, can0_interrupt, 0);
+ }
+#endif
+
+#ifdef CONFIG_LPC43_CAN1
+ if (priv->irq == LPC43M4_IRQ_CAN1)
+ {
+ ret = irq_attach(priv->irq, can1_interrupt, 0);
+ }
+#endif
+
+ if (ret == OK)
+ {
+ up_enable_irq(priv->irq);
+
+ /* Enable CAN interrupts within CAN module */
+
+ regval = can_getreg(priv, LPC43_CAN_CNTL_OFFSET);
+ regval |= (CAN_CNTL_IE | CAN_CNTL_SIE | CAN_CNTL_EIE);
+ can_putreg(priv, LPC43_CAN_CNTL_OFFSET, regval);
+ }
+
+ return ret;
+}
+
+/****************************************************************************
+ * Name: can_shutdown
+ *
+ * Description:
+ * Disable the CAN. This method is called when the CAN device is closed.
+ * This method reverses the operation the setup method.
+ *
+ * Input Parameters:
+ * dev - An instance of the "upper half" can driver state structure.
+ *
+ * Returned Value:
+ * None
+ *
+ ****************************************************************************/
+
+static void can_shutdown(FAR struct can_dev_s *dev)
+{
+ FAR struct up_dev_s *priv = (FAR struct up_dev_s *) dev->cd_priv;
+ uint32_t regval;
+
+ caninfo("CAN%d\n", priv->port);
+
+ /* Stop operation mode */
+
+ regval = can_getreg(priv, LPC43_CAN_CNTL_OFFSET);
+ regval |= CAN_CNTL_INIT;
+ can_putreg(priv, LPC43_CAN_CNTL_OFFSET, regval);
+
+ /* Disable CAN interrupts */
+
+ regval = can_getreg(priv, LPC43_CAN_CNTL_OFFSET);
+ regval &= ~(CAN_CNTL_IE | CAN_CNTL_SIE | CAN_CNTL_EIE);
+ can_putreg(priv, LPC43_CAN_CNTL_OFFSET, regval);
+
+ up_disable_irq(priv->irq);
+
+ /* Then detach the CAN interrupt handler. */
+
+ irq_detach(priv->irq);
+}
+
+/****************************************************************************
+ * Name: can_rxint
+ *
+ * Description:
+ * Call to enable or disable RX interrupts.
+ * This function is called two times: from can_open and can_close. Therefore
+ * this function enables and disables not only RX interrupts but all message
+ * objects.
+ *
+ * Input Parameters:
+ * dev - An instance of the "upper half" can driver state structure.
+ *
+ * Returned Value:
+ * None
+ *
+ ****************************************************************************/
+
+static void can_rxint(FAR struct can_dev_s *dev, bool enable)
+{
+ FAR struct up_dev_s *priv = (FAR struct up_dev_s *) dev->cd_priv;
+
+ if (enable == true)
+ {
+ can_setuprxobj(priv);
+ }
+ else
+ {
+ uint8_t i = 0;
+ for (i = CAN_RX_OBJ_FIRST; i <= CAN_RX_OBJ_LAST; ++i)
+ {
+ can_invalobj(priv, i);
+ }
+ }
+}
+
+/****************************************************************************
+ * Name: can_txint
+ *
+ * Description:
+ * Call to enable or disable TX interrupts.
+ *
+ * Input Parameters:
+ * dev - An instance of the "upper half" can driver state structure.
+ *
+ * Returned Value:
+ * None
+ *
+ ****************************************************************************/
+
+static void can_txint(FAR struct can_dev_s *dev, bool enable)
+{
+ /* The TX interrupt is automatically enabled in can_send within a
+ * message object.
+ */
+}
+
+/****************************************************************************
+ * Name: can_ioctl
+ *
+ * Description:
+ * All ioctl calls will be routed through this method
+ *
+ * Input Parameters:
+ * dev - An instance of the "upper half" can driver state structure.
+ *
+ * Returned Value:
+ * Zero on success; a negated errno on failure
+ *
+ ****************************************************************************/
+
+static int can_ioctl(FAR struct can_dev_s *dev, int cmd, unsigned long arg)
+{
+ caninfo("Fix me:Not Implemented\n");
+ return 0;
+}
+
+/****************************************************************************
+ * Name: can_remoterequest
+ *
+ * Description:
+ * Send a remote request
+ *
+ * Input Parameters:
+ * dev - An instance of the "upper half" can driver state structure.
+ *
+ * Returned Value:
+ * Zero on success; a negated errno on failure
+ *
+ ****************************************************************************/
+
+static int can_remoterequest(FAR struct can_dev_s *dev, uint16_t id)
+{
+ caninfo("Fix me:Not Implemented\n");
+ return 0;
+}
+
+/****************************************************************************
+ * Name: can_send
+ *
+ * Description:
+ * Send one can message.
+ *
+ * One CAN-message consists of a maximum of 10 bytes. A message is
+ * composed of at least the first 2 bytes (when there are no data bytes).
+ *
+ * Byte 0: Bits 0-7: Bits 3-10 of the 11-bit CAN identifier
+ * Byte 1: Bits 5-7: Bits 0-2 of the 11-bit CAN identifier
+ * Bit 4: Remote Tranmission Request (RTR)
+ * Bits 0-3: Data Length Code (DLC)
+ * Bytes 2-10: CAN data
+ *
+ * Input Parameters:
+ * dev - An instance of the "upper half" can driver state structure.
+ *
+ * Returned Value:
+ * Zero on success; a negated errno on failure
+ *
+ ****************************************************************************/
+
+static int can_send(FAR struct can_dev_s *dev, FAR struct can_msg_s *msg)
+{
+ FAR struct up_dev_s *priv = (FAR struct up_dev_s *) dev->cd_priv;
+ uint32_t regval;
+ uint32_t clz;
+ uint32_t id;
+ uint32_t dlc;
+ uint8_t txobj;
+
+ if(msg == NULL)
+ {
+ return ERROR;
+ }
+
+ regval = (can_getreg(priv, LPC43_CAN_MSGV2_OFFSET) & 0xFFFF);
+ clz = arm_clz(regval);
+
+ if (clz == 0x10)
+ {
+ return ERROR;
+ }
+
+ txobj = CAN_TX_OBJ_LAST - clz + CAN_TX_OBJ_FIRST;
+ DEBUGASSERT((txobj >= CAN_TX_OBJ_FIRST) && (txobj <= CAN_TX_OBJ_LAST));
+
+ id = (uint32_t) msg->cm_hdr.ch_id;
+ dlc = (uint32_t) msg->cm_hdr.ch_dlc;
+
+ caninfo("CAN%d ID: %d DLC: %d\n",
+ priv->port, msg->cm_hdr.ch_id, msg->cm_hdr.ch_dlc);
+
+ can_putreg(priv, LPC43_CAN_IF1_MSK1_OFFSET, 0xFFFF);
+ can_putreg(priv, LPC43_CAN_IF1_MSK2_OFFSET, 0xFFFF);
+
+ regval = ((dlc & CAN_MCTRL_DLC_MASK) | CAN_MCTRL_EOB | CAN_MCTRL_TXRQST
+ | CAN_MCTRL_TXIE );
+ can_putreg(priv, LPC43_CAN_IF1_MCTRL_OFFSET, regval);
+
+ /* Write data to IF1 data registers */
+
+ regval = msg->cm_data[0] + (msg->cm_data[1] << 8);
+ can_putreg(priv, LPC43_CAN_IF1_DA1_OFFSET, regval);
+
+ regval = msg->cm_data[2] + (msg->cm_data[3] << 8);
+ can_putreg(priv, LPC43_CAN_IF1_DA2_OFFSET, regval);
+
+ regval = msg->cm_data[4] + (msg->cm_data[5] << 8);
+ can_putreg(priv, LPC43_CAN_IF1_DB1_OFFSET, regval);
+
+ regval = msg->cm_data[6] + (msg->cm_data[7] << 8);
+ can_putreg(priv, LPC43_CAN_IF1_DB2_OFFSET, regval);
+
+#ifdef CONFIG_CAN_EXTID
+ can_putreg(priv, LPC43_CAN_IF1_ARB1_OFFSET, id & 0x0000FFFF);
+ can_putreg(priv, LPC43_CAN_IF1_ARB2_OFFSET, CAN_MSK2_DIR | CAN_MSK2_XTD
+ | CAN_MSK2_MSGVAL | id >> 16);
+#else
+ can_putreg(priv, LPC43_CAN_IF1_ARB1_OFFSET, 0x0000);
+ can_putreg(priv, LPC43_CAN_IF1_ARB2_OFFSET, CAN_MSK2_DIR | CAN_MSK2_MSGVAL
+ | id << 2);
+#endif
+
+ regval = (CAN_CMDMSKW_WRRD | CAN_CMDMSKW_MASK | CAN_CMDMSKW_ARB
+ | CAN_CMDMSKW_CTRL | CAN_CMDMSKW_CLRINTPND | CAN_CMDMSKW_TXRQST
+ | CAN_CMDMSKW_DATAA | CAN_CMDMSKW_DATAB);
+ can_putreg(priv, LPC43_CAN_IF1_CMDMSKW_OFFSET, regval);
+
+ /* Write to Message RAM */
+
+ can_putreg(priv, LPC43_CAN_IF1_CMDREQ_OFFSET, txobj);
+
+#ifdef CONFIG_CAN_TXREADY
+ can_txdone(dev);
+#endif
+
+ return OK;
+}
+
+/****************************************************************************
+ * Name: candev_txready
+ *
+ * Description:
+ * Return true if the CAN hardware can accept another TX message.
+ *
+ * Input Parameters:
+ * dev - An instance of the "upper half" can driver state structure.
+ *
+ * Returned Value:
+ * True if the CAN hardware is ready to accept another TX message.
+ *
+ ****************************************************************************/
+
+static bool candev_txready(FAR struct can_dev_s *dev)
+{
+ FAR struct up_dev_s *priv = (FAR struct up_dev_s *) dev->cd_priv;
+
+ if (can_getreg(priv, LPC43_CAN_MSGV2_OFFSET) & 0x8000)
+ {
+ return false;
+ }
+
+ if (can_getreg(priv, LPC43_CAN_IF1_CMDREQ_OFFSET) & CAN_CMDREQ_BUSY)
+ {
+ return false;
+ }
+
+ return true;
+}
+
+/****************************************************************************
+ * Name: candev_txempty
+ *
+ * Description:
+ * Return true if all message have been sent. If for example, the CAN
+ * hardware implements FIFOs, then this would mean the transmit FIFO is
+ * empty. This method is called when the driver needs to make sure that
+ * all characters are "drained" from the TX hardware before calling
+ * co_shutdown().
+ *
+ * Input Parameters:
+ * dev - An instance of the "upper half" can driver state structure.
+ *
+ * Returned Value:
+ * True if there are no pending TX transfers in the CAN hardware.
+ *
+ ****************************************************************************/
+
+static bool candev_txempty(FAR struct can_dev_s *dev)
+{
+ FAR struct up_dev_s *priv = (FAR struct up_dev_s *) dev->cd_priv;
+ return (!((can_getreg(priv, LPC43_CAN_MSGV2_OFFSET)) & 0xFFFF));
+}
+
+/****************************************************************************
+ * Name: can0/1_interrupt
+ *
+ * Description:
+ * CAN interrupt handler for CAN0 and CAN1.
+ *
+ * Input Parameters:
+ * irq - The IRQ number of the interrupt.
+ * context - The register state save array at the time of the interrupt.
+ *
+ * Returned Value:
+ * Zero on success; a negated errno on failure
+ *
+ ****************************************************************************/
+
+
+#ifdef CONFIG_LPC43_CAN0
+static int can0_interrupt(int irq, void *context, FAR void *arg)
+{
+ can_interrupt(&g_can0dev);
+ return OK;
+}
+#endif
+
+#ifdef CONFIG_LPC43_CAN1
+static int can1_interrupt(int irq, void *context, FAR void *arg)
+{
+ can_interrupt(&g_can1dev);
+ return OK;
+}
+#endif
+
+/****************************************************************************
+ * Name: can_interrupt
+ *
+ * Description:
+ * CAN interrupt handler. There is a single interrupt for both CAN0 and
+ * CAN1.
+ *
+ ****************************************************************************/
+
+static void can_interrupt(FAR struct can_dev_s *dev)
+{
+ FAR struct up_dev_s *priv = (FAR struct up_dev_s *) dev->cd_priv;
+ uint32_t regval = 0;
+
+ uint32_t msgindex = 0;
+
+ /* Read CAN interrupt register */
+
+ uint32_t interrupt = can_getreg(priv, LPC43_CAN_INT_OFFSET);
+
+ /* Read CAN status register */
+
+ uint32_t stat = can_getreg(priv, LPC43_CAN_STAT_OFFSET);
+
+ if ( interrupt & CAN_INT_STAT )
+ {
+ /* Clear all warning/error states except RXOK/TXOK */
+
+ regval = can_getreg(priv, LPC43_CAN_STAT_OFFSET);
+ regval &= CAN_STAT_RXOK | CAN_STAT_TXOK;
+ can_putreg(priv, LPC43_CAN_STAT_OFFSET, regval);
+ }
+ else
+ {
+ msgindex = interrupt & 0x7FFF;
+
+ /* if no error detected */
+
+ if (((stat & CAN_STAT_LEC_MASK) == 0) ||
+ ((stat & CAN_STAT_LEC_MASK) == CAN_STAT_LEC_MASK))
+ {
+ if (msgindex <= CAN_RX_OBJ_LAST)
+ {
+ struct can_hdr_s hdr;
+ uint32_t data[2];
+
+ regval = can_getreg(priv, LPC43_CAN_STAT_OFFSET);
+ regval &= ~CAN_STAT_RXOK;
+ can_putreg(priv, LPC43_CAN_STAT_OFFSET, regval);
+
+ can_readobj(priv, msgindex);
+ can_savemsg(priv, &hdr, data);
+ can_invalobj(priv, msgindex);
+ can_receive(dev, &hdr, (uint8_t *)data);
+ }
+ else
+ {
+ regval = can_getreg(priv, LPC43_CAN_STAT_OFFSET);
+ regval &= ~CAN_STAT_TXOK;
+ can_putreg(priv, LPC43_CAN_STAT_OFFSET, regval);
+
+ can_invalobj(priv, msgindex);
+#ifdef CONFIG_CAN_TXREADY
+ can_txready(dev);
+#else
+ can_txdone(dev);
+#endif
+ }
+ }
+ else
+ {
+ can_invalobj(priv, msgindex);
+ }
+
+ can_putreg(priv, LPC43_CAN_STAT_OFFSET, 0);
+
+ if (msgindex == CAN_RX_OBJ_LAST)
+ {
+ can_setuprxobj(priv);
+ }
+ }
+}
+
+/****************************************************************************
+ * Name: can_savemsg
+ *
+ * Description:
+ * Save received message.
+ *
+ * Input Parameters:
+ * priv - A reference to the CAN block status
+ * hdr - A reference to the message header
+ * data - A reference to the data block
+ *
+ * Returned Value:
+ * None
+ *
+ ****************************************************************************/
+
+static void can_savemsg(struct up_dev_s *priv, struct can_hdr_s *hdr,
+ uint32_t *data)
+{
+#ifdef CONFIG_CAN_EXTID
+ hdr->ch_id = (can_getreg(priv, LPC43_CAN_IF2_ARB1_OFFSET) & 0xFFFF) |
+ (can_getreg(priv, LPC43_CAN_IF2_ARB2_OFFSET) & 0x0FFF) << 16;
+ hdr->ch_extid = 1;
+#else
+ hdr->ch_id = (can_getreg(priv, LPC43_CAN_IF2_ARB2_OFFSET) & 0x1FFF) >> 2;
+#endif
+ hdr->ch_dlc = can_getreg(priv, LPC43_CAN_IF2_MCTRL_OFFSET) & 0x000F;
+ hdr->ch_rtr = 0;
+
+ data[0] = can_getreg(priv, LPC43_CAN_IF2_DA2_OFFSET) << 16 |
+ can_getreg(priv, LPC43_CAN_IF2_DA1_OFFSET);
+ data[1] = can_getreg(priv, LPC43_CAN_IF2_DB2_OFFSET) << 16 |
+ can_getreg(priv, LPC43_CAN_IF2_DB1_OFFSET);
+}
+
+/****************************************************************************
+ * Name: can_readobj
+ *
+ * Description:
+ * Transfer Message Object into IF registers.
+ *
+ * Input Parameters:
+ * priv - A reference to the CAN block status
+ * index - Message Object number
+ *
+ * Returned Value:
+ * None
+ *
+ ****************************************************************************/
+
+static void can_readobj(struct up_dev_s *priv, uint32_t index)
+{
+ uint32_t regval;
+
+ while (can_getreg(priv, LPC43_CAN_IF2_CMDREQ_OFFSET) & CAN_CMDREQ_BUSY);
+
+ regval = (CAN_CMDMSKR_MASK | CAN_CMDMSKR_ARB | CAN_CMDMSKR_CTRL |
+ CAN_CMDMSKR_CLRINTPND | CAN_CMDMSKR_DATAA | CAN_CMDMSKR_DATAB);
+ can_putreg(priv, LPC43_CAN_IF2_CMDMSKR_OFFSET, regval);
+ can_putreg(priv, LPC43_CAN_IF2_CMDREQ_OFFSET, index);
+}
+
+/****************************************************************************
+ * Name: can_invalobj
+ *
+ * Description:
+ * Invalidate Message Object.
+ *
+ * Input Parameters:
+ * priv - A reference to the CAN block status
+ * index - Message Object number
+ *
+ * Returned Value:
+ * None
+ *
+ ****************************************************************************/
+
+static void can_invalobj(struct up_dev_s *priv, uint32_t index)
+{
+ while (can_getreg(priv, LPC43_CAN_IF2_CMDREQ_OFFSET) & CAN_CMDREQ_BUSY);
+
+ can_putreg(priv, LPC43_CAN_IF2_ARB1_OFFSET, 0x0000);
+ can_putreg(priv, LPC43_CAN_IF2_ARB2_OFFSET, 0x0000);
+
+ /* Disable reception and transmission interrupts, clear transmit request */
+
+ can_putreg(priv, LPC43_CAN_IF2_MCTRL_OFFSET, CAN_MCTRL_EOB);
+ can_putreg(priv, LPC43_CAN_IF2_CMDMSKW_OFFSET, CAN_CMDMSKW_WRRD
+ | CAN_CMDMSKW_CLRINTPND | CAN_CMDMSKW_CTRL | CAN_CMDMSKW_ARB);
+ can_putreg(priv, LPC43_CAN_IF2_CMDREQ_OFFSET, index);
+}
+
+/****************************************************************************
+ * Name: can_setuprxobj
+ *
+ * Description:
+ * Setup Message Object as buffer for received messages.
+ *
+ * Input Parameters:
+ * priv - A reference to the CAN block status
+ *
+ * Returned Value:
+ * None
+ *
+ ****************************************************************************/
+
+static void can_setuprxobj(struct up_dev_s *priv)
+{
+ uint32_t regval;
+ uint8_t i;
+
+ while (can_getreg(priv, LPC43_CAN_IF2_CMDREQ_OFFSET) & CAN_CMDREQ_BUSY);
+
+ can_putreg(priv, LPC43_CAN_IF2_MSK1_OFFSET, 0x0000);
+ regval = (CAN_MSK2_MXTD | CAN_MSK2_MDIR);
+ can_putreg(priv, LPC43_CAN_IF2_MSK2_OFFSET, regval);
+
+ regval = (CAN_MCTRL_DLC_MASK | CAN_MCTRL_EOB | CAN_MCTRL_RXIE |
+ CAN_MCTRL_UMASK);
+ can_putreg(priv, LPC43_CAN_IF2_MCTRL_OFFSET, regval);
+
+ can_putreg(priv, LPC43_CAN_IF2_ARB1_OFFSET, 0x0000);
+#ifdef CONFIG_CAN_EXTID
+ can_putreg(priv, LPC43_CAN_IF2_ARB2_OFFSET, CAN_MSK2_MSGVAL | CAN_MSK2_XTD);
+#else
+ can_putreg(priv, LPC43_CAN_IF2_ARB2_OFFSET, CAN_MSK2_MSGVAL);
+#endif
+
+ regval = (CAN_CMDMSKR_WRRD | CAN_CMDMSKR_MASK | CAN_CMDMSKR_ARB |
+ CAN_CMDMSKR_CTRL | CAN_CMDMSKR_CLRINTPND | CAN_CMDMSKR_DATAA |
+ CAN_CMDMSKR_DATAB);
+ can_putreg(priv, LPC43_CAN_IF2_CMDMSKR_OFFSET, regval);
+
+ for (i = CAN_RX_OBJ_FIRST; i <= CAN_RX_OBJ_LAST; ++i)
+ {
+ while (can_getreg(priv, LPC43_CAN_IF2_CMDREQ_OFFSET) & CAN_CMDREQ_BUSY);
+ can_putreg(priv, LPC43_CAN_IF2_CMDREQ_OFFSET, i);
+ }
+}
+
+/****************************************************************************
+ * Name: can_bittiming
+ *
+ * Description:
+ * Set the CAN bit timing register (BTR) based on the configured BAUD.
+ *
+ * The bit timing logic monitors the serial bus-line and performs sampling
+ * and adjustment of the sample point by synchronizing on the start-bit edge
+ * and resynchronizing on the following edges.
+ *
+ * Its operation may be explained simply by splitting nominal bit time into
+ * three segments as follows:
+ *
+ * 1. Synchronization segment (SYNC_SEG): a bit change is expected to occur
+ * within this time segment. It has a fixed length of one time quantum
+ * (1 x tCAN).
+ * 2. Bit segment 1 (BS1): defines the location of the sample point. It
+ * includes the PROP_SEG and PHASE_SEG1 of the CAN standard. Its duration
+ * is programmable between 1 and 16 time quanta but may be automatically
+ * lengthened to compensate for positive phase drifts due to differences
+ * in the frequency of the various nodes of the network.
+ * 3. Bit segment 2 (BS2): defines the location of the transmit point. It
+ * represents the PHASE_SEG2 of the CAN standard. Its duration is
+ * programmable between 1 and 8 time quanta but may also be automatically
+ * shortened to compensate for negative phase drifts.
+ *
+ * Pictorially:
+ *
+ * |<----------------- NOMINAL BIT TIME ----------------->|
+ * |<- SYNC_SEG ->|<------ BS1 ------>|<------ BS2 ------>|
+ * |<---- Tq ---->|<----- Tbs1 ------>|<----- Tbs2 ------>|
+ *
+ * Where
+ * Tbs1 is the duration of the BS1 segment
+ * Tbs2 is the duration of the BS2 segment
+ * Tq is the "Time Quantum"
+ *
+ * Relationships:
+ *
+ * baud = 1 / bit_time
+ * bit_time = Tq + Tbs1 + Tbs2
+ * Tbs1 = Tq * ts1
+ * Tbs2 = Tq * ts2
+ * Tq = brp * Tcan
+ *
+ * Where:
+ * Tcan is the period of the APB clock (PCLK = CCLK / CONFIG_CAN1_DIVISOR).
+ *
+ * Input Parameter:
+ * priv - A reference to the CAN block status
+ *
+ * Returned Value:
+ * Zero on success; a negated errno on failure
+ *
+ ****************************************************************************/
+
+static int can_bittiming(struct up_dev_s *priv)
+{
+ uint32_t ts1 = CONFIG_CAN_TSEG1;
+ uint32_t ts2 = CONFIG_CAN_TSEG2;
+ uint32_t sjw = 1;
+ uint32_t brp = CAN_CLOCK_FREQUENCY(priv->clkdiv) /
+ (priv->baud * CAN_BIT_QUANTA);
+
+ uint32_t regval;
+
+ canllvdbg("CAN%d PCLK: %d baud: %d\n",
+ priv->port, CAN_CLOCK_FREQUENCY(priv->clkdiv), priv->baud);
+ canllvdbg("TS1: %d TS2: %d BRP: %d SJW= %d\n", ts1, ts2, brp, sjw);
+
+ /* Start configuring bit timing */
+
+ regval = can_getreg(priv, LPC43_CAN_CNTL_OFFSET);
+ regval |= CAN_CNTL_CCE;
+ can_putreg(priv, LPC43_CAN_CNTL_OFFSET, regval);
+
+ regval = (((brp - 1) << CAN_BT_BRP_SHIFT)
+ | ((ts1 - 1) << CAN_BT_TSEG1_SHIFT)
+ | ((ts2 - 1) << CAN_BT_TSEG2_SHIFT)
+ | ((sjw - 1) << CAN_BT_SJW_SHIFT));
+
+ canllvdbg("Setting CANxBTR= 0x%08x\n", regval);
+
+ /* Set bit timing */
+
+ can_putreg(priv, LPC43_CAN_BT_OFFSET, regval);
+
+ /* Stop configuring bit timing */
+
+ regval = can_getreg(priv, LPC43_CAN_CNTL_OFFSET);
+ regval &= ~CAN_CNTL_CCE;
+ can_putreg(priv, LPC43_CAN_CNTL_OFFSET, regval);
+
+ return OK;
+}
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: lpc43_caninitialize
+ *
+ * Description:
+ * Initialize the selected can port
+ *
+ * Input Parameter:
+ * Port number (for hardware that has mutiple can interfaces)
+ *
+ * Returned Value:
+ * Valid can device structure reference on succcess; a NULL on failure
+ *
+ ****************************************************************************/
+
+FAR struct can_dev_s *lpc43_caninitialize(int port)
+{
+ FAR struct can_dev_s *candev;
+ irqstate_t flags;
+ uint32_t regval;
+
+ canllvdbg("CAN%d\n", port);
+
+ flags = enter_critical_section();
+
+#ifdef CONFIG_LPC43_CAN0
+ if (port == 0)
+ {
+ /* Enable clock */
+
+ regval = getreg32(LPC43_CCU1_APB3_CAN0_CFG);
+ regval |= CCU_CLK_CFG_RUN;
+ putreg32(regval, LPC43_CCU1_APB3_CAN0_CFG);
+
+ /* Configure CAN GPIO pins */
+
+ lpc43_pin_config(PINCONF_CAN0_RD);
+ lpc43_pin_config(PINCONF_CAN0_TD);
+
+ candev = &g_can0dev;
+ }
+ else
+#endif /* CONFIG_LPC43_CAN0 */
+
+#ifdef CONFIG_LPC43_CAN1
+ if (port == 1)
+ {
+ /* Enable clock */
+
+ regval = getreg32(LPC43_CCU1_APB1_CAN1_CFG);
+ regval |= CCU_CLK_CFG_RUN;
+ putreg32(regval, LPC43_CCU1_APB1_CAN1_CFG);
+
+ /* Configure CAN GPIO pins */
+
+ lpc43_pin_config(PINCONF_CAN1_RD);
+ lpc43_pin_config(PINCONF_CAN1_TD);
+
+ candev = &g_can1dev;
+ }
+ else
+#endif /* CONFIG_LPC43_CAN1 */
+ {
+ canerr("Unsupported port: %d\n", port);
+
+ leave_critical_section(flags);
+ return NULL;
+ }
+
+ leave_critical_section(flags);
+
+ return candev;
+}
+#endif
diff --git a/arch/arm/src/lpc43xx/lpc43_can.h b/arch/arm/src/lpc43xx/lpc43_can.h
new file mode 100644
index 0000000000000000000000000000000000000000..f321c9b72fa087ce403f8e48a75e92847a90b28d
--- /dev/null
+++ b/arch/arm/src/lpc43xx/lpc43_can.h
@@ -0,0 +1,85 @@
+/****************************************************************************
+ * arch/arm/src/lpc43xx/lpc43_can.h
+ *
+ * Copyright(C) 2017 Gregory Nutt. All rights reserved.
+ *
+ * Created on: 2 May 2017
+ * Author: katherine
+ *
+ * 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_LPC43XX_LPC43_CAN_H_
+#define __ARCH_ARM_SRC_LPC43XX_LPC43_CAN_H_
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include
+#include
+
+#include "chip/lpc43_can.h"
+
+#ifndef __ASSEMBLY__
+
+/****************************************************************************
+ * Public Function Prototypes
+ ****************************************************************************/
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/****************************************************************************
+ * Name: lpc43_caninitialize
+ *
+ * Description:
+ * Initialize the selected can port
+ *
+ * Input Parameter:
+ * Port number (for hardware that has mutiple can interfaces)
+ *
+ * Returned Value:
+ * Valid can device structure reference on succcess; a NULL on failure
+ *
+ ****************************************************************************/
+
+#if defined(CONFIG_CAN) && (defined(CONFIG_LPC43_CAN0) || defined(CONFIG_LPC43_CAN1))
+struct can_dev_s;
+FAR struct can_dev_s *lpc43_caninitialize(int port);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* __ASSEMBLY__ */
+
+#endif /* __ARCH_ARM_SRC_LPC43XX_LPC43_CAN_H_ */
diff --git a/arch/arm/src/lpc43xx/lpc43_clrpend.c b/arch/arm/src/lpc43xx/lpc43_clrpend.c
index cb3ce5f095e1798f1550e77436457d426f6c234b..4363923e77dc1ae4f1ccdc8027af724ecf9fed14 100644
--- a/arch/arm/src/lpc43xx/lpc43_clrpend.c
+++ b/arch/arm/src/lpc43xx/lpc43_clrpend.c
@@ -1,6 +1,5 @@
/****************************************************************************
* arch/arm/src/lpc43/lpc43_clrpend.c
- * arch/arm/src/chip/lpc43_clrpend.c
*
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt
diff --git a/arch/arm/src/lpc43xx/lpc43_ethernet.c b/arch/arm/src/lpc43xx/lpc43_ethernet.c
index 955c30684e147e8b048bb8e71f431bac3c23b2a6..f5a9cb1e580215f2988447e8a629e9d314fafcf4 100644
--- a/arch/arm/src/lpc43xx/lpc43_ethernet.c
+++ b/arch/arm/src/lpc43xx/lpc43_ethernet.c
@@ -3210,11 +3210,11 @@ static int lpc43_phyinit(FAR struct lpc43_ethmac_s *priv)
#else /* Auto-negotion not selected */
#ifdef CONFIG_LPC43_ETHFD
- priv->mbps100 = 1;
+ priv->fduplex = 1;
#endif
#ifdef CONFIG_LPC43_ETH100MBPS
- priv->fduplex = 1;
+ priv->mbps100 = 1;
#endif
phyval = 0;
@@ -3238,11 +3238,14 @@ static int lpc43_phyinit(FAR struct lpc43_ethmac_s *priv)
up_mdelay(PHY_CONFIG_DELAY);
- /* Remember the selected speed and duplex modes */
+ /* Remember the selected speed and duplex modes
+ * REVISIT: Isn't this redundant?
+ */
#ifdef CONFIG_LPC43_ETHFD
priv->fduplex = 1;
#endif
+
#ifdef CONFIG_LPC43_ETH100MBPS
priv->mbps100 = 1;
#endif
diff --git a/arch/arm/src/lpc43xx/lpc43_gpdma.c b/arch/arm/src/lpc43xx/lpc43_gpdma.c
index d2c0f3bace5f1ce62c39a40f6076918ee0d8ec0e..f68577e1311aa059373ddd7a069ace4b60ee2340 100644
--- a/arch/arm/src/lpc43xx/lpc43_gpdma.c
+++ b/arch/arm/src/lpc43xx/lpc43_gpdma.c
@@ -269,13 +269,14 @@ static int gpdma_interrupt(int irq, FAR void *context, FAR void *arg)
****************************************************************************/
/****************************************************************************
- * Name: lpc43_dmainitialize
+ * Name: up_dmainitialize
*
* Description:
- * Initialize the GPDMA subsystem.
+ * Initialize the GPDMA subsystem. Called from up_initialize() early in the
+ * boot-up sequence. Prototyped in up_internal.h.
*
* Returned Value:
- * Zero on success; A negated errno value on failure.
+ * None
*
****************************************************************************/
@@ -628,7 +629,7 @@ void lpc43_dmastop(DMA_HANDLE handle)
DEBUGASSERT(dmach && dmach->inuse);
/* Disable this channel and mask any further interrupts from the channel.
- * this channel. The channel is disabled by clearning the channel
+ * this channel. The channel is disabled by clearing the channel
* enable bit. Any outstanding data in the FIFOs is lost.
*/
diff --git a/arch/arm/src/lpc43xx/lpc43_gpdma.h b/arch/arm/src/lpc43xx/lpc43_gpdma.h
index ecf35f0834f771e5e947a53e3f131099188547d7..db304c801af2fe31dbb5b263eb23fa89d2def8c3 100644
--- a/arch/arm/src/lpc43xx/lpc43_gpdma.h
+++ b/arch/arm/src/lpc43xx/lpc43_gpdma.h
@@ -119,19 +119,6 @@ extern "C"
* Public Functions
****************************************************************************/
-/****************************************************************************
- * Name: lpc43_dmainitialize
- *
- * Description:
- * Initialize the GPDMA subsystem.
- *
- * Returned Value:
- * None
- *
- ****************************************************************************/
-
-void lpc43_dmainitilaize(void);
-
/****************************************************************************
* Name: lpc43_dmachannel
*
diff --git a/arch/arm/src/lpc43xx/lpc43_mpuinit.c b/arch/arm/src/lpc43xx/lpc43_mpuinit.c
index 3ed8d8a8c740f23bb6f86337f18a8b7e918a6466..e1ad602ab313a4877d8a48f0bb137800e8ac93d8 100644
--- a/arch/arm/src/lpc43xx/lpc43_mpuinit.c
+++ b/arch/arm/src/lpc43xx/lpc43_mpuinit.c
@@ -60,14 +60,6 @@
# define MIN(a,b) a < b ? a : b
#endif
-/****************************************************************************
- * Private Data
- ****************************************************************************/
-
-/****************************************************************************
- * Private Functions
- ****************************************************************************/
-
/****************************************************************************
* Public Functions
****************************************************************************/
diff --git a/arch/arm/src/lpc43xx/lpc43_mpuinit.h b/arch/arm/src/lpc43xx/lpc43_mpuinit.h
index f4c6c59ca3479599330ca9f0a000d589b026ca0a..8b09dabad6c83c6b1a1526d66e3f1dcadc64a2a7 100644
--- a/arch/arm/src/lpc43xx/lpc43_mpuinit.h
+++ b/arch/arm/src/lpc43xx/lpc43_mpuinit.h
@@ -43,19 +43,7 @@
#include
/************************************************************************************
- * Pre-processor Definitions
- ************************************************************************************/
-
-/************************************************************************************
- * Public Types
- ************************************************************************************/
-
-/************************************************************************************
- * Public Data
- ************************************************************************************/
-
-/************************************************************************************
- * Public Functions
+ * Public Function Prototypes
************************************************************************************/
/****************************************************************************
diff --git a/arch/arm/src/lpc43xx/lpc43_rtc.c b/arch/arm/src/lpc43xx/lpc43_rtc.c
new file mode 100644
index 0000000000000000000000000000000000000000..9afc1529779cd72dd3d941b69828b59075ca2c1e
--- /dev/null
+++ b/arch/arm/src/lpc43xx/lpc43_rtc.c
@@ -0,0 +1,404 @@
+/************************************************************************************
+ * arch/arm/src/lpc43xx/lpc43_rtc.c
+ *
+ * Copyright (C) 2014, 2017 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt
+ *
+ * Adapted for the LPC43xx by Gintaras Drukteinis from the similar LCP176x RTC driver.
+ *
+ * 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 "up_arch.h"
+#include "up_internal.h"
+#include "chip.h"
+#include "chip/lpc43_creg.h"
+#include "chip/lpc43_rtc.h"
+#include "lpc43_rtc.h"
+
+#ifdef CONFIG_RTC
+
+/************************************************************************************
+ * Pre-processor Definitions
+ ************************************************************************************/
+
+/* Configuration ********************************************************************/
+/* This RTC implementation supports only date/time RTC hardware */
+
+#ifndef CONFIG_RTC_DATETIME
+# error "CONFIG_RTC_DATETIME must be set to use this driver"
+#endif
+
+#ifdef CONFIG_RTC_HIRES
+# error "CONFIG_RTC_HIRES must NOT be set with this driver"
+#endif
+
+/************************************************************************************
+ * Private Data
+ ************************************************************************************/
+
+/* Callback to use when the alarm expires */
+
+#ifdef CONFIG_RTC_ALARM
+static alarmcb_t g_alarmcb;
+#endif
+
+/************************************************************************************
+ * Public Data
+ ************************************************************************************/
+
+/* g_rtc_enabled is set true after the RTC has successfully initialized */
+
+volatile bool g_rtc_enabled = false;
+
+/************************************************************************************
+ * Private Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: rtc_dumpregs
+ *
+ * Description:
+ * Disable RTC write protection
+ *
+ * Input Parameters:
+ * None
+ *
+ * Returned Value:
+ * None
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_DEBUG_RTC_INFO
+static void rtc_dumpregs(FAR const char *msg)
+{
+ rtcinfo("%s:\n", msg);
+ rtcinfo(" DOM : %08x\n", (getreg32(LPC43_RTC_DOM) & RTC_DOM_MASK));
+ rtcinfo(" DOW : %08x\n", (getreg32(LPC43_RTC_DOW) & RTC_DOW_MASK));
+}
+#else
+# define rtc_dumpregs(msg)
+#endif
+
+/************************************************************************************
+ * Name: rtc_dumptime
+ *
+ * Description:
+ * Disable RTC write protection
+ *
+ * Input Parameters:
+ * None
+ *
+ * Returned Value:
+ * None
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_DEBUG_RTC_INFO
+static void rtc_dumptime(FAR struct tm *tp, FAR const char *msg)
+{
+ rtcinfo("%s:\n", msg);
+ rtcinfo(" tm_sec: %08x\n", tp->tm_sec);
+ rtcinfo(" tm_min: %08x\n", tp->tm_min);
+ rtcinfo(" tm_hour: %08x\n", tp->tm_hour);
+ rtcinfo(" tm_mday: %08x\n", tp->tm_mday);
+ rtcinfo(" tm_mon: %08x\n", tp->tm_mon);
+ rtcinfo(" tm_year: %08x\n", tp->tm_year);
+}
+#else
+# define rtc_dumptime(tp, msg)
+#endif
+
+/************************************************************************************
+ * Name: rtc_setup
+ *
+ * Description:
+ * Performs first time configuration of the RTC. A special value written into
+ * back-up register 0 will prevent this function from being called on sub-sequent
+ * resets or power up.
+ *
+ * Input Parameters:
+ * None
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno on failure
+ *
+ ************************************************************************************/
+
+static int rtc_setup(void)
+{
+ uint32_t regval;
+
+ /* Enable RTC Clock */
+
+ regval = getreg32(LPC43_CREG0);
+ regval &= ~(CREG0_RESET32KHZ | CREG0_PD32KHZ); /* Reset 32Khz oscillator */
+ putreg32(regval, LPC43_CREG0);
+
+ regval = getreg32(LPC43_CREG0);
+ regval |= (CREG0_EN1KHZ | CREG0_EN32KHZ); /* Enable 32 kHz & 1 kHz on osc32k and release reset */
+ putreg32(regval, LPC43_CREG0);
+
+ /* Clear all register to be default */
+
+ putreg32((uint32_t)0x00, LPC43_RTC_ILR);
+ putreg32((uint32_t)0x00, LPC43_RTC_CCR);
+ putreg32((uint32_t)0x00, LPC43_RTC_CIIR);
+ putreg32((uint32_t)0xff, LPC43_RTC_AMR);
+ putreg32((uint32_t)0x00, LPC43_RTC_CALIB);
+
+ /* Enable counters */
+
+ putreg32((uint32_t)0x01, LPC43_RTC_CCR);
+ return OK;
+}
+
+/************************************************************************************
+ * Name: rtc_interrupt
+ *
+ * Description:
+ * RTC interrupt service routine
+ *
+ * Input Parameters:
+ * irq - The IRQ number that generated the interrupt
+ * context - Architecture specific register save information.
+ *
+ * Returned Value:
+ * Zero (OK) on success; A negated errno value on failure.
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_RTC_ALARM
+static int rtc_interrupt(int irq, void *context)
+{
+#warning "Missing logic"
+ return OK;
+}
+#endif
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: up_rtc_initialize
+ *
+ * Description:
+ * Initialize the hardware RTC per the selected configuration. This function is
+ * called once during the OS initialization sequence
+ *
+ * Input Parameters:
+ * None
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno on failure
+ *
+ ************************************************************************************/
+
+int up_rtc_initialize(void)
+{
+ int ret;
+
+ rtc_dumpregs("On reset");
+
+#ifdef CONFIG_RTC_ALARM
+ /* Attach the RTC interrupt handler */
+
+ ret = irq_attach(LPC43M4_IRQ_RTC, rtc_interrupt);
+ if (ret == OK)
+ {
+ up_enable_irq(LPC43M4_IRQ_RTC);
+ }
+#endif /* CONFIG_RTC_ALARM */
+
+ /* Perform the one-time setup of the RTC */
+
+ ret = rtc_setup();
+
+ /* Configure RTC interrupt to catch alarm interrupts. All RTC interrupts are
+ * connected to the EXTI controller. To enable the RTC Alarm interrupt, the
+ * following sequence is required:
+ *
+ * 1. Configure and enable the EXTI Line 17 in interrupt mode and select the
+ * rising edge sensitivity.
+ * 2. Configure and enable the RTC_Alarm IRQ channel in the NVIC.
+ * 3. Configure the RTC to generate RTC alarms (Alarm A or Alarm B).
+ */
+
+ g_rtc_enabled = true;
+ rtc_dumpregs("After Initialization");
+ return ret;
+}
+
+/************************************************************************************
+ * Name: up_rtc_getdatetime
+ *
+ * Description:
+ * Get the current date and time from the date/time RTC. This interface
+ * is only supported by the date/time RTC hardware implementation.
+ * It is used to replace the system timer. It is only used by the RTOS during
+ * initialization to set up the system time when CONFIG_RTC and CONFIG_RTC_DATETIME
+ * are selected (and CONFIG_RTC_HIRES is not).
+ *
+ * NOTE: Some date/time RTC hardware is capability of sub-second accuracy. That
+ * sub-second accuracy is lost in this interface. However, since the system time
+ * is reinitialized on each power-up/reset, there will be no timing inaccuracy in
+ * the long run.
+ *
+ * Input Parameters:
+ * tp - The location to return the high resolution time value.
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno on failure
+ *
+ ************************************************************************************/
+
+int up_rtc_getdatetime(FAR struct tm *tp)
+{
+ rtc_dumpregs("Reading Time");
+
+ /* Convert the RTC time to fields in struct tm format.*/
+
+ tp->tm_sec = ((getreg32(LPC43_RTC_SEC) & RTC_SEC_MASK));
+ tp->tm_min = ((getreg32(LPC43_RTC_MIN) & RTC_MIN_MASK));
+ tp->tm_hour = ((getreg32(LPC43_RTC_HOUR) & RTC_HOUR_MASK));
+
+ /* Now convert the RTC date to fields in struct tm format*/
+
+ tp->tm_mday = ((getreg32(LPC43_RTC_DOM) & RTC_DOM_MASK));
+ tp->tm_mon = ((getreg32(LPC43_RTC_MONTH) & RTC_MONTH_MASK)) - 1;
+ tp->tm_year = ((getreg32(LPC43_RTC_YEAR) & RTC_YEAR_MASK)-1900);
+
+#if defined(CONFIG_LIBC_LOCALTIME) || defined(CONFIG_TIME_EXTENDED)
+ tp->tm_wday = ((getreg32(LPC43_RTC_DOW) & RTC_DOW_MASK));
+ tp->tm_yday = ((getreg32(LPC43_RTC_DOY) & RTC_DOY_MASK));
+#endif
+
+ rtc_dumptime(tp, "Returning");
+ return OK;
+}
+
+/************************************************************************************
+ * Name: up_rtc_settime
+ *
+ * Description:
+ * Set the RTC to the provided time. All RTC implementations must be able to
+ * set their time based on a standard timespec.
+ *
+ * Input Parameters:
+ * tp - the time to use
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno on failure
+ *
+ ************************************************************************************/
+
+int up_rtc_settime(FAR const struct timespec *tp)
+{
+ FAR struct tm newtime;
+
+ /* Break out the time values (not that the time is set only to units of seconds) */
+
+ (void)gmtime_r(&tp->tv_sec, &newtime);
+ rtc_dumptime(&newtime, "Setting time");
+
+ /* Then write the broken out values to the RTC */
+
+ putreg32(((newtime.tm_sec) & RTC_SEC_MASK), LPC43_RTC_SEC);
+ putreg32(((newtime.tm_min) & RTC_MIN_MASK), LPC43_RTC_MIN);
+ putreg32(((newtime.tm_hour) & RTC_HOUR_MASK), LPC43_RTC_HOUR);
+ putreg32(((newtime.tm_mday) & RTC_DOM_MASK), LPC43_RTC_DOM);
+ putreg32((((newtime.tm_mon)+1) & RTC_MONTH_MASK), LPC43_RTC_MONTH);
+ putreg32(((newtime.tm_year) & RTC_YEAR_MASK)+1900, LPC43_RTC_YEAR);
+
+#if defined(CONFIG_LIBC_LOCALTIME) || defined(CONFIG_TIME_EXTENDED)
+ putreg32(((newtime.tm_wday) & RTC_DOW_MASK), LPC43_RTC_DOW);
+ putreg32(((newtime.tm_yday) & RTC_DOY_MASK), LPC43_RTC_DOY);
+#endif
+
+ return OK;
+}
+
+/************************************************************************************
+ * Name: lpc43_rtc_setalarm
+ *
+ * Description:
+ * Set up an alarm. Up to two alarms can be supported (ALARM A and ALARM B).
+ *
+ * Input Parameters:
+ * tp - the time to set the alarm
+ * callback - the function to call when the alarm expires.
+ *
+ * Returned Value:
+ * Zero (OK) on success; a negated errno on failure
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_RTC_ALARM
+int lpc43_rtc_setalarm(FAR const struct timespec *tp, alarmcb_t callback)
+{
+ int ret = -EBUSY;
+
+ /* Is there already something waiting on the ALARM? */
+
+ if (g_alarmcb == NULL)
+ {
+ /* No.. Save the callback function pointer */
+
+ g_alarmcb = callback;
+
+ /* Break out the time values */
+#warning "Missing logic"
+
+ /* The set the alarm */
+#warning "Missing logic"
+
+ ret = OK;
+ }
+ return ret;
+}
+#endif
+
+#endif /* CONFIG_RTC */
diff --git a/arch/arm/src/lpc43xx/lpc43_rtc.h b/arch/arm/src/lpc43xx/lpc43_rtc.h
new file mode 100644
index 0000000000000000000000000000000000000000..11daa161d5c95e44187337d2f574525aeaa16230
--- /dev/null
+++ b/arch/arm/src/lpc43xx/lpc43_rtc.h
@@ -0,0 +1,51 @@
+/****************************************************************************
+ * arch/arm/src/lpc43xx/lpc43_rtc.h
+ *
+ * Copyright (C) 2012, 2017 Gregory Nutt. All rights reserved.
+ * Author: Brandon Warhurst
+ *
+ * Adapted from the similar LCP17xx RTC by Gintaras Drukteinis.
+ *
+ * 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_LPC43XX_LPC43_RTC_H
+#define __ARCH_ARM_SRC_LPC43XX_LPC43_RTC_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+#endif /* __ARCH_ARM_SRC_LPC43XX_LPC43_RTC_H */
\ No newline at end of file
diff --git a/arch/arm/src/lpc43xx/lpc43_sdmmc.c b/arch/arm/src/lpc43xx/lpc43_sdmmc.c
new file mode 100644
index 0000000000000000000000000000000000000000..5d4df400b3f00723a24d9da7dc3e03ff33cce892
--- /dev/null
+++ b/arch/arm/src/lpc43xx/lpc43_sdmmc.c
@@ -0,0 +1,2792 @@
+/****************************************************************************
+ * arch/arm/src/lpc43xx/lpc43_sdmmc.c
+ *
+ * Copyright (C) 2017 Alan Carvalho de Assis. All rights reserved.
+ * Copyright (C) 2017 Gregory Nutt. All rights reserved.
+ * Author: Alan Carvalho de Assis
+ *
+ * This code is based on arch/arm/src/lpc17xx/lpc17_sdcard.c:
+ *
+ * Copyright (C) 2013-2014, 2016-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
+#include
+#include
+#include
+
+#include
+
+#include "up_arch.h"
+
+#include "chip/lpc43_pinconfig.h"
+#include "lpc43_cgu.h"
+#include "lpc43_ccu.h"
+#include "lpc43_gpio.h"
+#include "lpc43_sdmmc.h"
+
+#include
+
+#ifdef CONFIG_LPC43_SDMMC
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+#define MCI_DMADES0_OWN (1UL << 31)
+#define MCI_DMADES0_CH (1 << 4)
+#define MCI_DMADES0_FS (1 << 3)
+#define MCI_DMADES0_LD (1 << 2)
+#define MCI_DMADES0_DIC (1 << 1)
+#define MCI_DMADES1_MAXTR 4096
+#define MCI_DMADES1_BS1(x) (x)
+
+/* Configuration ************************************************************/
+/* Required system configuration options in the sched/Kconfig:
+ *
+ * CONFIG_SCHED_WORKQUEUE -- Callback support requires work queue support.
+ *
+ * Driver-specific configuration options in the drivers/mmcd Kdonfig:
+ *
+ * CONFIG_SDIO_MUXBUS - Setting this configuration enables some locking
+ * APIs to manage concurrent accesses on the SD card bus. This is not
+ * needed for the simple case of a single SD card slot, for example.
+ * CONFIG_SDIO_WIDTH_D1_ONLY - This may be selected to force the driver
+ * operate with only a single data line (the default is to use all
+ * 4 SD data lines).
+ * CONFIG_MMCSD_HAVE_CARDDETECT - Select if the SD slot supports a card
+ * detect pin.
+ * CONFIG_MMCSD_HAVE_WRITEPROTECT - Select if the SD slots supports a
+ * write protected pin.
+ *
+ * Driver-specific configuration options in the arch/arm/src/lpc43xx/Kconfig
+ *
+ * CONFIG_LPC43_SDMMC_PWRCTRL - Select if the board supports an output
+ * pin to enable power to the SD slot.
+ * CONFIG_LPC43_SDMMC_DMA - Enable SD card DMA. This is a marginally
+ * optional. For most usages, SD accesses will cause data overruns if
+ * used without DMA. This will also select CONFIG_SDIO_DMA.
+ * CONFIG_LPC43_SDMMC_REGDEBUG - Enables some very low-level debug output
+ * This also requires CONFIG_DEBUG_MEMCARD_INFO
+ */
+
+#ifndef CONFIG_SCHED_WORKQUEUE
+# error "Callback support requires CONFIG_SCHED_WORKQUEUE"
+#endif
+
+/* Timing */
+
+#define SDCARD_CMDTIMEOUT (10000)
+#define SDCARD_LONGTIMEOUT (0x7fffffff)
+
+/* Type of Card Bus Size */
+
+#define SDCARD_BUS_D1 0
+#define SDCARD_BUS_D4 1
+#define SDCARD_BUS_D8 0x100
+
+/* FIFO size in bytes */
+
+#define LPC43_TXFIFO_SIZE (LPC43_TXFIFO_DEPTH | LPC43_TXFIFO_WIDTH)
+#define LPC43_RXFIFO_SIZE (LPC43_RXFIFO_DEPTH | LPC43_RXFIFO_WIDTH)
+
+/* Data transfer interrupt mask bits */
+
+#define SDCARD_RECV_MASK (SDMMC_INT_DTO | SDMMC_INT_DCRC | SDMMC_INT_DRTO | \
+ SDMMC_INT_EBE | SDMMC_INT_RXDR | SDMMC_INT_SBE)
+#define SDCARD_SEND_MASK (SDMMC_INT_DTO | SDMMC_INT_DCRC | SDMMC_INT_DRTO | \
+ SDMMC_INT_EBE | SDMMC_INT_TXDR | SDMMC_INT_SBE)
+
+#define SDCARD_DMARECV_MASK (SDMMC_INT_DTO | SDMMC_INT_DCRC | SDMMC_INT_DRTO | \
+ SDMMC_INT_SBE | SDMMC_INT_EBE)
+#define SDCARD_DMASEND_MASK (SDMMC_INT_DTO | SDMMC_INT_DCRC | SDMMC_INT_DRTO | \
+ SDMMC_INT_EBE)
+
+#define SDCARD_DMAERROR_MASK (SDMMC_IDINTEN_FBE | SDMMC_IDINTEN_DU | \
+ SDMMC_IDINTEN_AIS)
+
+#define SDCARD_TRANSFER_ALL (SDMMC_INT_DTO | SDMMC_INT_DCRC | SDMMC_INT_DRTO | \
+ SDMMC_INT_EBE | SDMMC_INT_TXDR | SDMMC_INT_RXDR | \
+ SDMMC_INT_SBE)
+
+/* Event waiting interrupt mask bits */
+
+#define SDCARD_INT_RESPERR (SDMMC_INT_RE | SDMMC_INT_RCRC | SDMMC_INT_RTO)
+
+#ifdef CONFIG_MMCSD_HAVE_CARDDETECT
+# define SDCARD_INT_CDET SDMMC_INT_CDET
+#else
+# define SDCARD_INT_CDET 0
+#endif
+
+#define SDCARD_CMDDONE_STA (SDMMC_INT_CDONE)
+#define SDCARD_RESPDONE_STA (0)
+
+#define SDCARD_CMDDONE_MASK (SDMMC_INT_CDONE)
+#define SDCARD_RESPDONE_MASK (SDMMC_INT_CDONE | SDCARD_INT_RESPERR)
+#define SDCARD_XFRDONE_MASK (0) /* Handled by transfer masks */
+
+#define SDCARD_CMDDONE_CLEAR (SDMMC_INT_CDONE)
+#define SDCARD_RESPDONE_CLEAR (SDMMC_INT_CDONE | SDCARD_INT_RESPERR)
+
+#define SDCARD_XFRDONE_CLEAR (SDCARD_TRANSFER_ALL)
+
+#define SDCARD_WAITALL_CLEAR (SDCARD_CMDDONE_CLEAR | SDCARD_RESPDONE_CLEAR | \
+ SDCARD_XFRDONE_CLEAR)
+
+/* Let's wait until we have both SD card transfer complete and DMA complete. */
+
+#define SDCARD_XFRDONE_FLAG (1)
+#define SDCARD_DMADONE_FLAG (2)
+#define SDCARD_ALLDONE (3)
+
+/* Card debounce time. Number of host clocks (SD_CLK) used by debounce
+ * filter logic for card detect. typical debounce time is 5-25 ms.
+ *
+ * Eg. Fsd = 44MHz, ticks = 660,000
+ */
+
+#define DEBOUNCE_TICKS (15 * BOARD_SDMMC_FREQUENCY / 1000)
+
+/****************************************************************************
+ * Private Types
+ ****************************************************************************/
+
+struct sdmmc_dma_s
+{
+ volatile uint32_t des0; /* Control and status */
+ volatile uint32_t des1; /* Buffer size(s) */
+ volatile uint32_t des2; /* Buffer address pointer 1 */
+ volatile uint32_t des3; /* Buffer address pointer 2 */
+};
+
+/* This structure defines the state of the LPC43XX SD card interface */
+
+struct lpc43_dev_s
+{
+ struct sdio_dev_s dev; /* Standard, base SD card interface */
+
+ /* LPC43XX-specific extensions */
+ /* Event support */
+
+ sem_t waitsem; /* Implements event waiting */
+ sdio_eventset_t waitevents; /* Set of events to be waited for */
+ uint32_t waitmask; /* Interrupt enables for event waiting */
+ volatile sdio_eventset_t wkupevent; /* The event that caused the wakeup */
+ WDOG_ID waitwdog; /* Watchdog that handles event timeouts */
+
+ /* Callback support */
+
+ sdio_statset_t cdstatus; /* Card status */
+ sdio_eventset_t cbevents; /* Set of events to be cause callbacks */
+ worker_t callback; /* Registered callback function */
+ void *cbarg; /* Registered callback argument */
+ struct work_s cbwork; /* Callback work queue structure */
+
+ /* Interrupt mode data transfer support */
+
+ uint32_t *buffer; /* Address of current R/W buffer */
+ uint32_t xfrmask; /* Interrupt enables for data transfer */
+#ifdef CONFIG_LPC43_SDMMC_DMA
+ uint32_t dmamask; /* Interrupt enables for DMA transfer */
+#endif
+ ssize_t remaining; /* Number of bytes remaining in the transfer */
+ bool wrdir; /* True: Writing False: Reading */
+
+ /* DMA data transfer support */
+
+ bool widebus; /* Required for DMA support */
+#ifdef CONFIG_LPC43_SDMMC_DMA
+ bool dmamode; /* true: DMA mode transfer */
+#endif
+};
+
+/****************************************************************************
+ * Private Function Prototypes
+ ****************************************************************************/
+
+#ifdef CONFIG_LPC43_SDMMC_REGDEBUG
+static uint32_t lpc43_getreg(uint32_t addr);
+static void lpc43_putreg(uint32_t val, uint32_t addr);
+#else
+# define lpc43_getreg(addr) getreg32(addr)
+# define lpc43_putreg(val,addr) putreg32(val,addr)
+#endif
+
+/* Low-level helpers ********************************************************/
+
+static void lpc43_takesem(struct lpc43_dev_s *priv);
+#define lpc43_givesem(priv) (sem_post(&priv->waitsem))
+static inline void lpc43_setclock(uint32_t clkdiv);
+static inline void lpc43_sdcard_clock(bool enable);
+static int lpc43_ciu_sendcmd(uint32_t cmd, uint32_t arg);
+static void lpc43_enable_ints(struct lpc43_dev_s *priv);
+static void lpc43_disable_allints(struct lpc43_dev_s *priv);
+static void lpc43_config_waitints(struct lpc43_dev_s *priv, uint32_t waitmask,
+ sdio_eventset_t waitevents, sdio_eventset_t wkupevents);
+static void lpc43_config_xfrints(struct lpc43_dev_s *priv, uint32_t xfrmask);
+#ifdef CONFIG_LPC43_SDMMC_DMA
+static void lpc43_config_dmaints(struct lpc43_dev_s *priv, uint32_t xfrmask,
+ uint32_t dmamask);
+#endif
+
+/* Data Transfer Helpers ****************************************************/
+
+static void lpc43_eventtimeout(int argc, uint32_t arg);
+static void lpc43_endwait(struct lpc43_dev_s *priv, sdio_eventset_t wkupevent);
+static void lpc43_endtransfer(struct lpc43_dev_s *priv, sdio_eventset_t wkupevent);
+
+/* Interrupt Handling *******************************************************/
+
+static int lpc43_sdmmc_interrupt(int irq, void *context, FAR void *arg);
+
+/* SD Card Interface Methods ************************************************/
+
+/* Mutual exclusion */
+
+#ifdef CONFIG_SDIO_MUXBUS
+static int lpc43_lock(FAR struct sdio_dev_s *dev, bool lock);
+#endif
+
+/* Initialization/setup */
+
+static void lpc43_reset(FAR struct sdio_dev_s *dev);
+static sdio_capset_t lpc43_capabilities(FAR struct sdio_dev_s *dev);
+static uint8_t lpc43_status(FAR struct sdio_dev_s *dev);
+static void lpc43_widebus(FAR struct sdio_dev_s *dev, bool enable);
+static void lpc43_clock(FAR struct sdio_dev_s *dev,
+ enum sdio_clock_e rate);
+static int lpc43_attach(FAR struct sdio_dev_s *dev);
+
+/* Command/Status/Data Transfer */
+
+static int lpc43_sendcmd(FAR struct sdio_dev_s *dev, uint32_t cmd,
+ uint32_t arg);
+static int lpc43_recvsetup(FAR struct sdio_dev_s *dev, FAR uint8_t *buffer,
+ size_t nbytes);
+static int lpc43_sendsetup(FAR struct sdio_dev_s *dev,
+ FAR const uint8_t *buffer, uint32_t nbytes);
+static int lpc43_cancel(FAR struct sdio_dev_s *dev);
+
+static int lpc43_waitresponse(FAR struct sdio_dev_s *dev, uint32_t cmd);
+static int lpc43_recvshortcrc(FAR struct sdio_dev_s *dev, uint32_t cmd,
+ uint32_t *rshort);
+static int lpc43_recvlong(FAR struct sdio_dev_s *dev, uint32_t cmd,
+ uint32_t rlong[4]);
+static int lpc43_recvshort(FAR struct sdio_dev_s *dev, uint32_t cmd,
+ uint32_t *rshort);
+static int lpc43_recvnotimpl(FAR struct sdio_dev_s *dev, uint32_t cmd,
+ uint32_t *rnotimpl);
+
+/* EVENT handler */
+
+static void lpc43_waitenable(FAR struct sdio_dev_s *dev,
+ sdio_eventset_t eventset);
+static sdio_eventset_t
+ lpc43_eventwait(FAR struct sdio_dev_s *dev, uint32_t timeout);
+static void lpc43_callbackenable(FAR struct sdio_dev_s *dev,
+ sdio_eventset_t eventset);
+static void lpc43_callback(struct lpc43_dev_s *priv);
+static int lpc43_registercallback(FAR struct sdio_dev_s *dev,
+ worker_t callback, void *arg);
+
+#ifdef CONFIG_LPC43_SDMMC_DMA
+/* DMA */
+
+static int lpc43_dmarecvsetup(FAR struct sdio_dev_s *dev,
+ FAR uint8_t *buffer, size_t buflen);
+static int lpc43_dmasendsetup(FAR struct sdio_dev_s *dev,
+ FAR const uint8_t *buffer, size_t buflen);
+#endif
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+struct lpc43_dev_s g_scard_dev =
+{
+ .dev =
+ {
+#ifdef CONFIG_SDIO_MUXBUS
+ .lock = lpc43_lock,
+#endif
+ .reset = lpc43_reset,
+ .capabilities = lpc43_capabilities,
+ .status = lpc43_status,
+ .widebus = lpc43_widebus,
+ .clock = lpc43_clock,
+ .attach = lpc43_attach,
+ .sendcmd = lpc43_sendcmd,
+ .recvsetup = lpc43_recvsetup,
+ .sendsetup = lpc43_sendsetup,
+ .cancel = lpc43_cancel,
+ .waitresponse = lpc43_waitresponse,
+ .recvR1 = lpc43_recvshortcrc,
+ .recvR2 = lpc43_recvlong,
+ .recvR3 = lpc43_recvshort,
+ .recvR4 = lpc43_recvnotimpl,
+ .recvR5 = lpc43_recvnotimpl,
+ .recvR6 = lpc43_recvshortcrc,
+ .recvR7 = lpc43_recvshort,
+ .waitenable = lpc43_waitenable,
+ .eventwait = lpc43_eventwait,
+ .callbackenable = lpc43_callbackenable,
+ .registercallback = lpc43_registercallback,
+#ifdef CONFIG_LPC43_SDMMC_DMA
+ .dmarecvsetup = lpc43_dmarecvsetup,
+ .dmasendsetup = lpc43_dmasendsetup,
+#endif
+ },
+};
+
+#ifdef CONFIG_LPC43_SDMMC_DMA
+static struct sdmmc_dma_s g_sdmmc_dmadd[1 + (0x10000 / MCI_DMADES1_MAXTR)];
+#endif
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: lpc43_getreg
+ *
+ * Description:
+ * This function may to used to intercept an monitor all register accesses.
+ * Clearly this is nothing you would want to do unless you are debugging
+ * this driver.
+ *
+ * Input Parameters:
+ * addr - The register address to read
+ *
+ * Returned Value:
+ * The value read from the register
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_LPC43_SDMMC_REGDEBUG
+static uint32_t lpc43_getreg(uint32_t addr)
+{
+ static uint32_t prevaddr = 0;
+ static uint32_t preval = 0;
+ static uint32_t count = 0;
+
+ /* Read the value from the register */
+
+ uint32_t val = getreg32(addr);
+
+ /* Is this the same value that we read from the same register last time?
+ * Are we polling the register? If so, suppress some of the output.
+ */
+
+ if (addr == prevaddr && val == preval)
+ {
+ if (count == 0xffffffff || ++count > 3)
+ {
+ if (count == 4)
+ {
+ mcinfo("...\n");
+ }
+
+ return val;
+ }
+ }
+
+ /* No this is a new address or value */
+
+ else
+ {
+ /* Did we print "..." for the previous value? */
+
+ if (count > 3)
+ {
+ /* Yes.. then show how many times the value repeated */
+
+ mcinfo("[repeats %d more times]\n", count-3);
+ }
+
+ /* Save the new address, value, and count */
+
+ prevaddr = addr;
+ preval = val;
+ count = 1;
+ }
+
+ /* Show the register value read */
+
+ mcinfo("%08x->%08x\n", addr, val);
+ return val;
+}
+#endif
+
+/****************************************************************************
+ * Name: lpc43_putreg
+ *
+ * Description:
+ * This function may to used to intercept an monitor all register accesses.
+ * Clearly this is nothing you would want to do unless you are debugging
+ * this driver.
+ *
+ * Input Parameters:
+ * val - The value to write to the register
+ * addr - The register address to read
+ *
+ * Returned Value:
+ * None
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_LPC43_SDMMC_REGDEBUG
+static void lpc43_putreg(uint32_t val, uint32_t addr)
+{
+ /* Show the register value being written */
+
+ mcinfo("%08x<-%08x\n", addr, val);
+
+ /* Write the value */
+
+ putreg32(val, addr);
+}
+#endif
+
+/****************************************************************************
+ * Name: lpc43_takesem
+ *
+ * Description:
+ * Take the wait semaphore (handling false alarm wakeups due to the receipt
+ * of signals).
+ *
+ * Input Parameters:
+ * dev - Instance of the SD card device driver state structure.
+ *
+ * Returned Value:
+ * None
+ *
+ ****************************************************************************/
+
+static void lpc43_takesem(struct lpc43_dev_s *priv)
+{
+ /* Take the semaphore (perhaps waiting) */
+
+ while (sem_wait(&priv->waitsem) != 0)
+ {
+ /* The only case that an error should occr here is if the wait was
+ * awakened by a signal.
+ */
+
+ DEBUGASSERT(errno == EINTR);
+ }
+}
+
+/****************************************************************************
+ * Name: lpc43_setclock
+ *
+ * Description:
+ * Define the new clock frequency
+ *
+ * Input Parameters:
+ * clkdiv - A new division value to generate the needed frequency.
+ *
+ * Returned Value:
+ * None
+ *
+ ****************************************************************************/
+
+static inline void lpc43_setclock(uint32_t clkdiv)
+{
+ mcinfo("clkdiv=%08lx\n", (unsigned long)clkdiv);
+
+ /* Disable the clock before setting frequency */
+
+ lpc43_sdcard_clock(false);
+
+ /* Use the Divider0 */
+
+ lpc43_putreg(SDMMC_CLKSRC_CLKDIV0, LPC43_SDMMC_CLKSRC);
+
+ /* Inform CIU */
+
+ lpc43_ciu_sendcmd(SDMMC_CMD_UPDCLOCK | SDMMC_CMD_WAITPREV, 0);
+
+ /* Set Divider0 to desired value */
+
+ lpc43_putreg(clkdiv, LPC43_SDMMC_CLKDIV);
+
+ /* Inform CIU */
+
+ lpc43_ciu_sendcmd(SDMMC_CMD_UPDCLOCK | SDMMC_CMD_WAITPREV, 0);
+
+ /* Enable the clock */
+
+ lpc43_sdcard_clock(true);
+
+ /* Inform CIU */
+
+ lpc43_ciu_sendcmd(SDMMC_CMD_UPDCLOCK | SDMMC_CMD_WAITPREV, 0);
+}
+
+/****************************************************************************
+ * Name: lpc43_sdcard_clock
+ *
+ * Description: Enable/Disable the SDCard clock
+ *
+ * Input Parameters:
+ * enable - False = clock disabled; True = clock enabled.
+ *
+ * Returned Value:
+ * None
+ *
+ ****************************************************************************/
+
+static inline void lpc43_sdcard_clock(bool enable)
+{
+ if (enable)
+ {
+ lpc43_putreg(SDMMC_CLKENA_ENABLE, LPC43_SDMMC_CLKENA);
+ }
+ else
+ {
+ lpc43_putreg(0, LPC43_SDMMC_CLKENA);
+ }
+}
+
+/****************************************************************************
+ * Name: lpc43_ciu_sendcmd
+ *
+ * Description:
+ * Function to send command to Card interface unit (CIU)
+ *
+ * Input Parameters:
+ * cmd - The command to be executed
+ * arg - The argument to use with the command.
+ *
+ * Returned Value:
+ * None
+ *
+ ****************************************************************************/
+
+static int lpc43_ciu_sendcmd(uint32_t cmd, uint32_t arg)
+{
+ volatile int32_t tmo = SDCARD_CMDTIMEOUT;
+
+ mcinfo("cmd=%04lx arg=%04lx\n", (unsigned long)cmd, (unsigned long)arg);
+
+ /* Set command arg reg */
+
+ lpc43_putreg(arg, LPC43_SDMMC_CMDARG);
+ lpc43_putreg(SDMMC_CMD_STARTCMD | cmd, LPC43_SDMMC_CMD);
+
+ /* Poll until command is accepted by the CIU */
+
+ while (--tmo > 0 && (lpc43_getreg(LPC43_SDMMC_CMD) & SDMMC_CMD_STARTCMD) != 0)
+ {
+ }
+
+ return (tmo < 1) ? 1 : 0;
+}
+
+/****************************************************************************
+ * Name: lpc43_enable_ints
+ *
+ * Description:
+ * Enable/disable SD card interrupts per functional settings.
+ *
+ * Input Parameters:
+ * priv - A reference to the SD card device state structure
+ *
+ * Returned Value:
+ * None
+ *
+ ****************************************************************************/
+
+static void lpc43_enable_ints(struct lpc43_dev_s *priv)
+{
+ uint32_t regval;
+
+#ifdef CONFIG_LPC43_SDMMC_DMA
+ mcinfo("waitmask=%04lx xfrmask=%04lx dmamask=%04lx RINTSTS=%08lx\n",
+ (unsigned long)priv->waitmask, (unsigned long)priv->xfrmask,
+ (unsigned long)priv->dmamask,
+ (unsigned long)lpc43_getreg(LPC43_SDMMC_RINTSTS));
+
+ /* Enable DMA-related interrupts */
+
+ lpc43_putreg(priv->dmamask, LPC43_SDMMC_IDINTEN);
+
+#else
+ mcinfo("waitmask=%04lx xfrmask=%04lx RINTSTS=%08lx\n",
+ (unsigned long)priv->waitmask, (unsigned long)priv->xfrmask,
+ (unsigned long)lpc43_getreg(LPC43_SDMMC_RINTSTS));
+#endif
+
+ /* Enable SDMMC interrupts */
+
+ regval = priv->xfrmask | priv->waitmask | SDCARD_INT_CDET;
+ lpc43_putreg(regval, LPC43_SDMMC_INTMASK);
+}
+
+/****************************************************************************
+ * Name: lpc43_disable_allints
+ *
+ * Description:
+ * Disable all SD card interrupts.
+ *
+ * Input Parameters:
+ * priv - A reference to the SD card device state structure
+ *
+ * Returned Value:
+ * None
+ *
+ ****************************************************************************/
+
+static void lpc43_disable_allints(struct lpc43_dev_s *priv)
+{
+#ifdef CONFIG_LPC43_SDMMC_DMA
+ /* Disable DMA-related interrupts */
+
+ lpc43_putreg(0, LPC43_SDMMC_IDINTEN);
+ priv->dmamask = 0;
+#endif
+
+ /* Disable all SDMMC interrupts (except card detect) */
+
+ lpc43_putreg(SDCARD_INT_CDET, LPC43_SDMMC_INTMASK);
+ priv->waitmask = 0;
+ priv->xfrmask = 0;
+}
+
+/****************************************************************************
+ * Name: lpc43_config_waitints
+ *
+ * Description:
+ * Enable/disable SD card interrupts needed to suport the wait function
+ *
+ * Input Parameters:
+ * priv - A reference to the SD card device state structure
+ * waitmask - The set of bits in the SD card INTMASK register to set
+ * waitevents - Waited for events
+ * wkupevent - Wake-up events
+ *
+ * Returned Value:
+ * None
+ *
+ ****************************************************************************/
+
+static void lpc43_config_waitints(struct lpc43_dev_s *priv, uint32_t waitmask,
+ sdio_eventset_t waitevents,
+ sdio_eventset_t wkupevent)
+{
+ irqstate_t flags;
+
+ mcinfo("waitevents=%04x wkupevent=%04x\n",
+ (unsigned)waitevents, (unsigned)wkupevent);
+
+ /* Save all of the data and set the new interrupt mask in one, atomic
+ * operation.
+ */
+
+ flags = enter_critical_section();
+ priv->waitevents = waitevents;
+ priv->wkupevent = wkupevent;
+ priv->waitmask = waitmask;
+
+ lpc43_enable_ints(priv);
+ leave_critical_section(flags);
+}
+
+/****************************************************************************
+ * Name: lpc43_config_xfrints
+ *
+ * Description:
+ * Enable SD card interrupts needed to support the data transfer event
+ *
+ * Input Parameters:
+ * priv - A reference to the SD card device state structure
+ * xfrmask - The set of bits in the SD card MASK register to set
+ *
+ * Returned Value:
+ * None
+ *
+ ****************************************************************************/
+
+static void lpc43_config_xfrints(struct lpc43_dev_s *priv, uint32_t xfrmask)
+{
+ irqstate_t flags;
+ flags = enter_critical_section();
+
+ priv->xfrmask = xfrmask;
+ lpc43_enable_ints(priv);
+
+ leave_critical_section(flags);
+}
+
+/****************************************************************************
+ * Name: lpc43_config_dmaints
+ *
+ * Description:
+ * Enable DMA transfer interrupts
+ *
+ * Input Parameters:
+ * priv - A reference to the SD card device state structure
+ * dmamask - The set of bits in the SD card MASK register to set
+ *
+ * Returned Value:
+ * None
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_LPC43_SDMMC_DMA
+static void lpc43_config_dmaints(struct lpc43_dev_s *priv, uint32_t xfrmask,
+ uint32_t dmamask)
+{
+ irqstate_t flags;
+ flags = enter_critical_section();
+
+ priv->xfrmask = xfrmask;
+ priv->dmamask = dmamask;
+ lpc43_enable_ints(priv);
+
+ leave_critical_section(flags);
+}
+#endif
+
+/****************************************************************************
+ * Name: lpc43_eventtimeout
+ *
+ * Description:
+ * The watchdog timeout setup when the event wait start has expired without
+ * any other waited-for event occurring.
+ *
+ * Input Parameters:
+ * argc - The number of arguments (should be 1)
+ * arg - The argument (state structure reference cast to uint32_t)
+ *
+ * Returned Value:
+ * None
+ *
+ * Assumptions:
+ * Always called from the interrupt level with interrupts disabled.
+ *
+ ****************************************************************************/
+
+static void lpc43_eventtimeout(int argc, uint32_t arg)
+{
+ struct lpc43_dev_s *priv = (struct lpc43_dev_s *)arg;
+
+ mcinfo("argc=%d, arg=%08lx\n", argc, (unsigned long)arg);
+
+ /* There is always race conditions with timer expirations. */
+
+ DEBUGASSERT((priv->waitevents & SDIOWAIT_TIMEOUT) != 0 || priv->wkupevent != 0);
+
+ /* Is a data transfer complete event expected? */
+
+ if ((priv->waitevents & SDIOWAIT_TIMEOUT) != 0)
+ {
+ /* Yes.. wake up any waiting threads */
+
+ lpc43_endwait(priv, SDIOWAIT_TIMEOUT);
+ mcerr("ERROR: Timeout: remaining: %d\n", priv->remaining);
+ }
+}
+
+/****************************************************************************
+ * Name: lpc43_endwait
+ *
+ * Description:
+ * Wake up a waiting thread if the waited-for event has occurred.
+ *
+ * Input Parameters:
+ * priv - An instance of the SD card device interface
+ * wkupevent - The event that caused the wait to end
+ *
+ * Returned Value:
+ * None
+ *
+ * Assumptions:
+ * Always called from the interrupt level with interrupts disabled.
+ *
+ ****************************************************************************/
+
+static void lpc43_endwait(struct lpc43_dev_s *priv, sdio_eventset_t wkupevent)
+{
+ mcinfo("wkupevent=%04x\n", (unsigned)wkupevent);
+
+ /* Cancel the watchdog timeout */
+
+ (void)wd_cancel(priv->waitwdog);
+
+ /* Disable event-related interrupts */
+
+ lpc43_config_waitints(priv, 0, 0, wkupevent);
+
+ /* Wake up the waiting thread */
+
+ lpc43_givesem(priv);
+}
+
+/****************************************************************************
+ * Name: lpc43_endtransfer
+ *
+ * Description:
+ * Terminate a transfer with the provided status. This function is called
+ * only from the SD card interrupt handler when end-of-transfer conditions
+ * are detected.
+ *
+ * Input Parameters:
+ * priv - An instance of the SD card device interface
+ * wkupevent - The event that caused the transfer to end
+ *
+ * Returned Value:
+ * None
+ *
+ * Assumptions:
+ * Always called from the interrupt level with interrupts disabled.
+ *
+ ****************************************************************************/
+
+static void lpc43_endtransfer(struct lpc43_dev_s *priv, sdio_eventset_t wkupevent)
+{
+ mcinfo("wkupevent=%04x\n", (unsigned)wkupevent);
+
+ /* Disable all transfer related interrupts */
+
+ lpc43_config_xfrints(priv, 0);
+
+ /* Clearing pending interrupt status on all transfer related interrupts */
+
+ lpc43_putreg(priv->waitmask, LPC43_SDMMC_RINTSTS);
+
+ /* Mark the transfer finished */
+
+ priv->remaining = 0;
+
+ /* Is a thread wait for these data transfer complete events? */
+
+ if ((priv->waitevents & wkupevent) != 0)
+ {
+ /* Yes.. wake up any waiting threads */
+
+ lpc43_endwait(priv, wkupevent);
+ }
+}
+
+/****************************************************************************
+ * Name: lpc43_sdmmc_interrupt
+ *
+ * Description:
+ * SD card interrupt handler
+ *
+ * Input Parameters:
+ * dev - An instance of the SD card device interface
+ *
+ * Returned Value:
+ * None
+ *
+ ****************************************************************************/
+
+static int lpc43_sdmmc_interrupt(int irq, void *context, FAR void *arg)
+{
+ struct lpc43_dev_s *priv = &g_scard_dev;
+ uint32_t enabled;
+ uint32_t pending;
+
+ /* Loop while there are pending interrupts. Check the SD card status
+ * register. Mask out all bits that don't correspond to enabled
+ * interrupts. (This depends on the fact that bits are ordered
+ * the same in both the STA and MASK register). If there are non-zero
+ * bits remaining, then we have work to do here.
+ */
+
+ while ((enabled = lpc43_getreg(LPC43_SDMMC_MINTSTS)) != 0)
+ {
+ /* Clear pending status */
+
+ lpc43_putreg(enabled, LPC43_SDMMC_RINTSTS);
+
+#ifdef CONFIG_MMCSD_HAVE_CARDDETECT
+ /* Handle in card detection events ************************************/
+
+ if ((enabled & SDMMC_INT_CDET) != 0)
+ {
+ sdio_statset_t cdstatus;
+
+ /* Update card status */
+
+ cdstatus = priv->cdstatus;
+ if ((lpc43_getreg(LPC43_SDMMC_CDETECT) & SDMMC_CDETECT_NOTPRESENT) == 0)
+ {
+ priv->cdstatus |= SDIO_STATUS_PRESENT;
+
+#ifdef CONFIG_MMCSD_HAVE_WRITEPROTECT
+ if ((lpc43_getreg(LPC43_SDMMC_WRTPRT) & SDMMC_WRTPRT_PROTECTED) != 0)
+ {
+ priv->cdstatus |= SDIO_STATUS_WRPROTECTED;
+ }
+ else
+#endif
+ {
+ priv->cdstatus &= ~SDIO_STATUS_WRPROTECTED;
+ }
+
+#ifdef CONFIG_LPC43_SDMMC_PWRCTRL
+ /* Enable/ power to the SD card */
+
+ lpc43_putreg(SDMMC_PWREN, LPC43_SDMMC_PWREN);
+#endif
+
+ }
+ else
+ {
+ priv->cdstatus &= ~(SDIO_STATUS_PRESENT | SDIO_STATUS_WRPROTECTED);
+
+#ifdef CONFIG_LPC43_SDMMC_PWRCTRL
+ /* Disable power to the SD card */
+
+ lpc43_putreg(0, LPC43_SDMMC_PWREN);
+#endif
+ }
+
+ mcinfo("cdstatus OLD: %02x NEW: %02x\n", cdstatus, priv->cdstatus);
+
+ /* Perform any requested callback if the status has changed */
+
+ if (cdstatus != priv->cdstatus)
+ {
+ lpc43_callback(priv);
+ }
+ }
+#endif
+
+ /* Handle idata transfer events ***************************************/
+
+ pending = enabled & priv->xfrmask;
+ if (pending != 0)
+ {
+ /* Handle data request events */
+
+ if ((pending & SDMMC_INT_TXDR) != 0)
+ {
+ uint32_t status;
+
+ /* Transfer data to the TX FIFO */
+
+ mcinfo("Write FIFO\n");
+ DEBUGASSERT(priv->wrdir);
+
+ for (status = lpc43_getreg(LPC43_SDMMC_STATUS);
+ (status & SDMMC_STATUS_FIFOFULL) == 0 &&
+ priv->remaining > 0;
+ status = lpc43_getreg(LPC43_SDMMC_STATUS))
+ {
+ lpc43_putreg(*priv->buffer, LPC43_SDMMC_DATA);
+ priv->buffer++;
+ priv->remaining -= 4;
+ }
+
+ /* If all of the data has been transferred to the FIFO, then
+ * disable further TX data requests and wait for the data end
+ * event.
+ */
+
+ if (priv->remaining <= 0)
+ {
+ uint32_t intmask = lpc43_getreg(LPC43_SDMMC_INTMASK);
+ intmask &= ~SDMMC_INT_TXDR;
+ lpc43_putreg(intmask, LPC43_SDMMC_INTMASK);
+
+ priv->xfrmask &= ~SDMMC_INT_TXDR;
+ }
+ }
+ else if ((pending & SDMMC_INT_RXDR) != 0)
+ {
+ uint32_t status;
+
+ /* Transfer data from the RX FIFO */
+
+ mcinfo("Read from FIFO\n");
+ DEBUGASSERT(!priv->wrdir);
+
+ for (status = lpc43_getreg(LPC43_SDMMC_STATUS);
+ (status & SDMMC_STATUS_FIFOEMPTY) == 0 &&
+ priv->remaining > 0;
+ status = lpc43_getreg(LPC43_SDMMC_STATUS))
+ {
+ *priv->buffer = lpc43_getreg(LPC43_SDMMC_DATA);
+ priv->buffer++;
+ priv->remaining -= 4;
+ }
+
+ /* If all of the data has been transferred to the FIFO, then
+ * just force DTO event processing (the DTO interrupt is not
+ * actually even enabled in this use case).
+ */
+
+ if (priv->remaining <= 0)
+ {
+ /* Force the DTO event */
+
+ pending |= SDMMC_INT_DTO;
+ }
+ }
+
+ /* Check for transfer errors */
+ /* Handle data block send/receive CRC failure */
+
+ if ((pending & SDMMC_INT_DCRC) != 0)
+ {
+ /* Terminate the transfer with an error */
+
+ mcerr("ERROR: Data CRC failure, pending=%08x remaining: %d\n",
+ pending, priv->remaining);
+ lpc43_endtransfer(priv, SDIOWAIT_TRANSFERDONE | SDIOWAIT_ERROR);
+ }
+
+ /* Handle data timeout error */
+
+ else if ((pending & SDMMC_INT_DRTO) != 0)
+ {
+ /* Terminate the transfer with an error */
+
+ mcerr("ERROR: Data timeout, pending=%08x remaining: %d\n",
+ pending, priv->remaining);
+ lpc43_endtransfer(priv, SDIOWAIT_TRANSFERDONE | SDIOWAIT_TIMEOUT);
+ }
+
+ /* Handle RX FIFO overrun error */
+
+ else if ((pending & SDMMC_INT_FRUN) != 0)
+ {
+ /* Terminate the transfer with an error */
+
+ mcerr("ERROR: RX FIFO overrun, pending=%08x remaining: %d\n",
+ pending, priv->remaining);
+ lpc43_endtransfer(priv, SDIOWAIT_TRANSFERDONE | SDIOWAIT_ERROR);
+ }
+
+ /* Handle TX FIFO underrun error */
+
+ else if ((pending & SDMMC_INT_FRUN) != 0)
+ {
+ /* Terminate the transfer with an error */
+
+ mcerr("ERROR: TX FIFO underrun, pending=%08x remaining: %d\n",
+ pending, priv->remaining);
+ lpc43_endtransfer(priv, SDIOWAIT_TRANSFERDONE | SDIOWAIT_ERROR);
+ }
+
+ /* Handle start bit error */
+
+ else if ((pending & SDMMC_INT_SBE) != 0)
+ {
+ /* Terminate the transfer with an error */
+
+ mcerr("ERROR: Start bit, pending=%08x remaining: %d\n",
+ pending, priv->remaining);
+ lpc43_endtransfer(priv, SDIOWAIT_TRANSFERDONE | SDIOWAIT_ERROR);
+ }
+
+ /* Handle data end events. Note that RXDR may accompany DTO, DTO
+ * will be set on received while there is still data in the FIFO.
+ * So for the case of receiving, we don't actually even enable the
+ * DTO interrupt.
+ */
+
+ else if ((pending & SDMMC_INT_DTO) != 0)
+ {
+ /* Finish the transfer */
+
+ lpc43_endtransfer(priv, SDIOWAIT_TRANSFERDONE);
+ }
+ }
+
+ /* Handle wait events *************************************************/
+
+ pending = enabled & priv->waitmask;
+ if (pending != 0)
+ {
+ /* Is this a response error event? */
+
+ if ((pending & SDCARD_INT_RESPERR) != 0)
+ {
+ /* If response errors are enabled, then we must certainly be
+ * waiting for a response.
+ */
+
+ DEBUGASSERT((priv->waitevents & SDIOWAIT_RESPONSEDONE) != 0);
+
+ /* Wake the thread up */
+
+ mcerr("ERROR: Response error, pending=%08x\n", pending);
+ lpc43_endwait(priv, SDIOWAIT_RESPONSEDONE | SDIOWAIT_ERROR);
+ }
+
+ /* Is this a command (plus response) completion event? */
+
+ else if ((pending & SDMMC_INT_CDONE) != 0)
+ {
+ /* Yes.. Is their a thread waiting for response done? */
+
+ if ((priv->waitevents & SDIOWAIT_RESPONSEDONE) != 0)
+ {
+ /* Yes.. wake the thread up */
+
+ lpc43_endwait(priv, SDIOWAIT_RESPONSEDONE);
+ }
+
+ /* NO.. Is their a thread waiting for command done? */
+
+ else if ((priv->waitevents & SDIOWAIT_CMDDONE) != 0)
+ {
+ /* Yes.. wake the thread up */
+
+ lpc43_endwait(priv, SDIOWAIT_CMDDONE);
+ }
+ }
+ }
+ }
+
+#ifdef CONFIG_LPC43_SDMMC_DMA
+ /* DMA error events *******************************************************/
+
+ pending = lpc43_getreg(LPC43_SDMMC_IDSTS);
+ if ((pending & priv->dmamask) != 0)
+ {
+ mcerr("ERROR: IDTS=%08lx\n", (unsigned long)pending);
+
+ /* Clear the pending interrupts */
+
+ lpc43_putreg(pending, LPC43_SDMMC_IDSTS);
+
+ /* Abort the transfer */
+
+ lpc43_endtransfer(priv, SDIOWAIT_TRANSFERDONE | SDIOWAIT_ERROR);
+ }
+#endif
+
+ return OK;
+}
+
+/****************************************************************************
+ * Name: lpc43_lock
+ *
+ * Description:
+ * Locks the bus. Function calls low-level multiplexed bus routines to
+ * resolve bus requests and acknowledgment issues.
+ *
+ * Input Parameters:
+ * dev - An instance of the SD card device interface
+ * lock - TRUE to lock, FALSE to unlock.
+ *
+ * Returned Value:
+ * OK on success; a negated errno on failure
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_SDIO_MUXBUS
+static int lpc43_lock(FAR struct sdio_dev_s *dev, bool lock)
+{
+ /* Single SD card instance so there is only one possibility. The multiplex
+ * bus is part of board support package.
+ */
+
+ lpc43_muxbus_sdio_lock(lock);
+ return OK;
+}
+#endif
+
+/****************************************************************************
+ * Name: lpc43_reset
+ *
+ * Description:
+ * Reset the SD card controller. Undo all setup and initialization.
+ *
+ * Input Parameters:
+ * dev - An instance of the SD card device interface
+ *
+ * Returned Value:
+ * None
+ *
+ ****************************************************************************/
+
+static void lpc43_reset(FAR struct sdio_dev_s *dev)
+{
+ FAR struct lpc43_dev_s *priv = (FAR struct lpc43_dev_s *)dev;
+ irqstate_t flags;
+ uint32_t regval;
+
+ mcinfo("Resetting...\n");
+
+ flags = enter_critical_section();
+
+ /* Reset DMA controller internal registers. */
+
+ lpc43_putreg(SDMMC_BMOD_SWR, LPC43_SDMMC_BMOD);
+
+ /* Reset all blocks */
+
+ lpc43_putreg(SDMMC_CTRL_CNTLRRESET | SDMMC_CTRL_FIFORESET |
+ SDMMC_CTRL_DMARESET, LPC43_SDMMC_CTRL);
+
+ while ((lpc43_getreg(LPC43_SDMMC_CTRL) &
+ (SDMMC_CTRL_CNTLRRESET | SDMMC_CTRL_FIFORESET | SDMMC_CTRL_DMARESET)) != 0)
+ {
+ }
+
+ /* Reset data */
+
+ priv->waitevents = 0; /* Set of events to be waited for */
+ priv->waitmask = 0; /* Interrupt enables for event waiting */
+ priv->wkupevent = 0; /* The event that caused the wakeup */
+
+ wd_cancel(priv->waitwdog); /* Cancel any timeouts */
+
+ /* Interrupt mode data transfer support */
+
+ priv->buffer = 0; /* Address of current R/W buffer */
+ priv->remaining = 0; /* Number of bytes remaining in the transfer */
+ priv->xfrmask = 0; /* Interrupt enables for data transfer */
+#ifdef CONFIG_LPC43_SDMMC_DMA
+ priv->dmamask = 0; /* Interrupt enables for DMA transfer */
+#endif
+
+ /* DMA data transfer support */
+
+ priv->widebus = true; /* Required for DMA support */
+ priv->cdstatus = 0; /* Card status is unknown */
+
+#ifdef CONFIG_LPC43_SDMMC_DMA
+ priv->dmamode = false; /* true: DMA mode transfer */
+#endif
+
+ /* Select 1-bit wide bus */
+
+ lpc43_putreg(SDMMC_CTYPE_WIDTH1, LPC43_SDMMC_CTYPE);
+
+ /* Enable interrupts */
+
+ regval = lpc43_getreg(LPC43_SDMMC_CTRL);
+ regval |= SDMMC_CTRL_INTENABLE;
+ lpc43_putreg(regval, LPC43_SDMMC_CTRL);
+
+ /* Disable Interrupts except for card detection. */
+
+ lpc43_putreg(SDCARD_INT_CDET, LPC43_SDMMC_INTMASK);
+
+#ifdef CONFIG_MMCSD_HAVE_CARDDETECT
+ /* Set the card debounce time. Number of host clocks (SD_CLK) used by
+ * debounce filter logic for card detect. typical debounce time is 5-25
+ * ms.
+ */
+
+ lpc43_putreg(DEBOUNCE_TICKS, LPC43_SDMMC_DEBNCE);
+#endif
+
+ /* Clear to Interrupts */
+
+ lpc43_putreg(0xffffffff, LPC43_SDMMC_RINTSTS);
+
+ /* Define MAX Timeout */
+
+ lpc43_putreg(SDCARD_LONGTIMEOUT, LPC43_SDMMC_TMOUT);
+
+ /* Disable clock to CIU (needs latch) */
+
+ lpc43_putreg(0, LPC43_SDMMC_CLKENA);
+ leave_critical_section(flags);
+
+#if defined(CONFIG_LPC43_SDMMC_PWRCTRL) && !defined(CONFIG_MMCSD_HAVE_CARDDETECT)
+ /* Enable power to the SD card */
+
+ lpc43_putreg(SDMMC_PWREN, LPC43_SDMMC_PWREN);
+#endif
+}
+
+/****************************************************************************
+ * Name: lpc43_capabilities
+ *
+ * Description:
+ * Get capabilities (and limitations) of the SDIO driver (optional)
+ *
+ * Input Parameters:
+ * dev - Device-specific state data
+ *
+ * Returned Value:
+ * Returns a bitset of status values (see SDIO_CAPS_* defines)
+ *
+ ****************************************************************************/
+
+static sdio_capset_t lpc43_capabilities(FAR struct sdio_dev_s *dev)
+{
+ sdio_capset_t caps = 0;
+
+ caps |= SDIO_CAPS_DMABEFOREWRITE;
+
+#ifdef CONFIG_SDIO_WIDTH_D1_ONLY
+ caps |= SDIO_CAPS_1BIT_ONLY;
+#endif
+#ifdef CONFIG_LPC43_SDMMC_DMA
+ caps |= SDIO_CAPS_DMASUPPORTED;
+#endif
+
+ return caps;
+}
+
+/****************************************************************************
+ * Name: lpc43_status
+ *
+ * Description:
+ * Get SD card status.
+ *
+ * Input Parameters:
+ * dev - Device-specific state data
+ *
+ * Returned Value:
+ * Returns a bitset of status values (see lpc43_status_* defines)
+ *
+ ****************************************************************************/
+
+static sdio_statset_t lpc43_status(FAR struct sdio_dev_s *dev)
+{
+ struct lpc43_dev_s *priv = (struct lpc43_dev_s *)dev;
+
+ mcinfo("cdstatus=%02x\n", priv->cdstatus);
+
+ return priv->cdstatus;
+}
+
+/****************************************************************************
+ * Name: lpc43_widebus
+ *
+ * Description:
+ * Called after change in Bus width has been selected (via ACMD6). Most
+ * controllers will need to perform some special operations to work
+ * correctly in the new bus mode.
+ *
+ * Input Parameters:
+ * dev - An instance of the SD card device interface
+ * wide - true: wide bus (4-bit) bus mode enabled
+ *
+ * Returned Value:
+ * None
+ *
+ ****************************************************************************/
+
+static void lpc43_widebus(FAR struct sdio_dev_s *dev, bool wide)
+{
+ mcinfo("wide=%d\n", wide);
+}
+
+/****************************************************************************
+ * Name: lpc43_clock
+ *
+ * Description:
+ * Enable/disable SD card clocking
+ *
+ * Input Parameters:
+ * dev - An instance of the SD card device interface
+ * rate - Specifies the clocking to use (see enum sdio_clock_e)
+ *
+ * Returned Value:
+ * None
+ *
+ ****************************************************************************/
+
+static void lpc43_clock(FAR struct sdio_dev_s *dev, enum sdio_clock_e rate)
+{
+ struct lpc43_dev_s *priv = (struct lpc43_dev_s *)dev;
+ uint8_t clkdiv;
+ uint8_t ctype;
+ bool enabled = false;
+ bool widebus = false;
+
+ switch (rate)
+ {
+ /* Disable clocking (with default ID mode divisor) */
+
+ default:
+ case CLOCK_SDIO_DISABLED:
+ clkdiv = SDMMC_CLKDIV0(BOARD_CLKDIV_INIT);
+ ctype = SDCARD_BUS_D1;
+ enabled = false;
+ widebus = false;
+ return;
+ break;
+
+ /* Enable in initial ID mode clocking (<400KHz) */
+
+ case CLOCK_IDMODE:
+ clkdiv = SDMMC_CLKDIV0(BOARD_CLKDIV_INIT);
+ ctype = SDCARD_BUS_D1;
+ enabled = true;
+ widebus = false;
+ break;
+
+ /* Enable in MMC normal operation clocking */
+
+ case CLOCK_MMC_TRANSFER:
+ clkdiv = SDMMC_CLKDIV0(BOARD_CLKDIV_MMCXFR);
+ ctype = SDCARD_BUS_D1;
+ enabled = true;
+ widebus = false;
+ break;
+
+ /* SD normal operation clocking (wide 4-bit mode) */
+
+ case CLOCK_SD_TRANSFER_4BIT:
+#ifndef CONFIG_SDIO_WIDTH_D1_ONLY
+ clkdiv = SDMMC_CLKDIV0(BOARD_CLKDIV_SDWIDEXFR);
+ ctype = SDCARD_BUS_D4;
+ enabled = true;
+ widebus = true;
+ break;
+#endif
+
+ /* SD normal operation clocking (narrow 1-bit mode) */
+
+ case CLOCK_SD_TRANSFER_1BIT:
+ clkdiv = SDMMC_CLKDIV0(BOARD_CLKDIV_SDXFR);
+ ctype = SDCARD_BUS_D1;
+ enabled = true;
+ widebus = false;
+ break;
+ }
+
+ /* Setup the card bus width */
+
+ mcinfo("widebus=%d\n", widebus);
+
+ priv->widebus = widebus;
+ lpc43_putreg(ctype, LPC43_SDMMC_CTYPE);
+
+ /* Set the new clock frequency division */
+
+ lpc43_setclock(clkdiv);
+
+ /* Enable the new clock */
+
+ lpc43_sdcard_clock(enabled);
+}
+
+/****************************************************************************
+ * Name: lpc43_attach
+ *
+ * Description:
+ * Attach and prepare interrupts
+ *
+ * Input Parameters:
+ * dev - An instance of the SD card device interface
+ *
+ * Returned Value:
+ * OK on success; A negated errno on failure.
+ *
+ ****************************************************************************/
+
+static int lpc43_attach(FAR struct sdio_dev_s *dev)
+{
+ int ret;
+ uint32_t regval;
+
+ mcinfo("Attaching..\n");
+
+ /* Attach the SD card interrupt handler */
+
+ ret = irq_attach(LPC43M4_IRQ_SDIO, lpc43_sdmmc_interrupt, NULL);
+ if (ret == OK)
+ {
+ /* Disable all interrupts at the SD card controller and clear static
+ * interrupt flags
+ */
+
+ lpc43_putreg(0, LPC43_SDMMC_INTMASK);
+ lpc43_putreg(SDMMC_INT_ALL, LPC43_SDMMC_RINTSTS);
+
+ /* Enable Interrupts to happen when the INTMASK is activated */
+
+ regval = lpc43_getreg(LPC43_SDMMC_CTRL);
+ regval |= SDMMC_CTRL_INTENABLE;
+ lpc43_putreg(regval, LPC43_SDMMC_CTRL);
+
+ /* Enable card detection interrupts */
+
+ lpc43_putreg(SDCARD_INT_CDET, LPC43_SDMMC_INTMASK);
+
+ /* Enable SD card interrupts at the NVIC. They can now be enabled at
+ * the SD card controller as needed.
+ */
+
+ up_enable_irq(LPC43M4_IRQ_SDIO);
+ }
+
+ return ret;
+}
+
+/****************************************************************************
+ * Name: lpc43_sendcmd
+ *
+ * Description:
+ * Send the SD card command
+ *
+ * Input Parameters:
+ * dev - An instance of the SD card device interface
+ * cmd - The command to send (32-bits, encoded)
+ * arg - 32-bit argument required with some commands
+ *
+ * Returned Value:
+ * None
+ *
+ ****************************************************************************/
+
+static int lpc43_sendcmd(FAR struct sdio_dev_s *dev, uint32_t cmd,
+ uint32_t arg)
+{
+ uint32_t regval = 0;
+ uint32_t cmdidx;
+
+ mcinfo("cmd=%04x arg=%04x\n", cmd, arg);
+
+ /* The CMD0 needs the SENDINIT CMD */
+
+ if (cmd == 0)
+ {
+ regval |= SDMMC_CMD_SENDINIT;
+ }
+
+ /* Is this a Read/Write Transfer Command ? */
+
+ if ((cmd & MMCSD_WRDATAXFR) == MMCSD_WRDATAXFR)
+ {
+ regval |= SDMMC_CMD_DATAXFREXPTD | SDMMC_CMD_WRITE | SDMMC_CMD_WAITPREV;
+ }
+ else if ((cmd & MMCSD_RDDATAXFR) == MMCSD_RDDATAXFR)
+ {
+ regval |= SDMMC_CMD_DATAXFREXPTD | SDMMC_CMD_WAITPREV;
+ }
+
+ /* Set WAITRESP bits */
+
+ switch (cmd & MMCSD_RESPONSE_MASK)
+ {
+ case MMCSD_NO_RESPONSE:
+ regval |= SDMMC_CMD_NORESPONSE;
+ break;
+
+ case MMCSD_R1B_RESPONSE:
+ regval |= SDMMC_CMD_WAITPREV;
+ case MMCSD_R1_RESPONSE:
+ case MMCSD_R3_RESPONSE:
+ case MMCSD_R4_RESPONSE:
+ case MMCSD_R5_RESPONSE:
+ case MMCSD_R6_RESPONSE:
+ case MMCSD_R7_RESPONSE:
+ regval |= SDMMC_CMD_SHORTRESPONSE;
+ break;
+
+ case MMCSD_R2_RESPONSE:
+ regval |= SDMMC_CMD_LONGRESPONSE;
+ break;
+ }
+
+ /* Set the command index */
+
+ cmdidx = (cmd & MMCSD_CMDIDX_MASK) >> MMCSD_CMDIDX_SHIFT;
+ regval |= cmdidx;
+
+ mcinfo("cmd: %04x arg: %04x regval: %08x\n", cmd, arg, regval);
+
+ /* Write the SD card CMD */
+
+ lpc43_putreg(SDCARD_RESPDONE_CLEAR | SDCARD_CMDDONE_CLEAR,
+ LPC43_SDMMC_RINTSTS);
+ lpc43_ciu_sendcmd(regval, arg);
+
+ return OK;
+}
+
+/****************************************************************************
+ * Name: lpc43_recvsetup
+ *
+ * Description:
+ * Setup hardware in preparation for data transfer from the card in non-DMA
+ * (interrupt driven mode). This method will do whatever controller setup
+ * is necessary. This would be called for SD memory just BEFORE sending
+ * CMD13 (SEND_STATUS), CMD17 (READ_SINGLE_BLOCK), CMD18
+ * (READ_MULTIPLE_BLOCKS), ACMD51 (SEND_SCR), etc. Normally, SDCARD_WAITEVENT
+ * will be called to receive the indication that the transfer is complete.
+ *
+ * Input Parameters:
+ * dev - An instance of the SD card device interface
+ * buffer - Address of the buffer in which to receive the data
+ * nbytes - The number of bytes in the transfer
+ *
+ * Returned Value:
+ * Number of bytes sent on success; a negated errno on failure
+ *
+ ****************************************************************************/
+
+static int lpc43_recvsetup(FAR struct sdio_dev_s *dev, FAR uint8_t *buffer,
+ size_t nbytes)
+{
+ struct lpc43_dev_s *priv = (struct lpc43_dev_s *)dev;
+ uint32_t blocksize;
+ uint32_t bytecnt;
+#ifdef CONFIG_LPC43_SDMMC_DMA
+ uint32_t regval;
+#endif
+
+ mcinfo("nbytes=%ld\n", (long) nbytes);
+
+ DEBUGASSERT(priv != NULL && buffer != NULL && nbytes > 0);
+ DEBUGASSERT(((uint32_t)buffer & 3) == 0);
+
+ /* Save the destination buffer information for use by the interrupt handler */
+
+ priv->buffer = (uint32_t *)buffer;
+ priv->remaining = nbytes;
+ priv->wrdir = false;
+#ifdef CONFIG_LPC43_SDMMC_DMA
+ priv->dmamode = false;
+#endif
+
+ /* Then set up the SD card data path */
+
+ if (nbytes < 64)
+ {
+ blocksize = nbytes;
+ bytecnt = nbytes;
+ }
+ else
+ {
+ blocksize = 64;
+ bytecnt = nbytes;
+ DEBUGASSERT((nbytes & 0x3f) == 0);
+ }
+
+ lpc43_putreg(blocksize, LPC43_SDMMC_BLKSIZ);
+ lpc43_putreg(bytecnt, LPC43_SDMMC_BYTCNT);
+
+ /* Configure the FIFO so that we will receive the RXDR interrupt whenever
+ * there are more than 1 words (at least 8 bytes) in the RX FIFO.
+ */
+
+ lpc43_putreg(SDMMC_FIFOTH_RXWMARK(1), LPC43_SDMMC_FIFOTH);
+
+#ifdef CONFIG_LPC43_SDMMC_DMA
+ /* Make sure that internal DMA is disabled */
+
+ lpc43_putreg(0, LPC43_SDMMC_BMOD);
+
+ regval = lpc43_getreg(LPC43_SDMMC_CTRL);
+ regval &= ~SDMMC_CTRL_INTDMA;
+ lpc43_putreg(regval, LPC43_SDMMC_CTRL);
+#endif
+
+ /* Configure the transfer interrupts */
+
+ lpc43_config_xfrints(priv, SDCARD_RECV_MASK);
+ return OK;
+}
+
+/****************************************************************************
+ * Name: lpc43_sendsetup
+ *
+ * Description:
+ * Setup hardware in preparation for data transfer from the card. This
+ * method will do whatever controller setup is necessary. This would be
+ * called for SD memory just AFTER sending CMD24 (WRITE_BLOCK), CMD25
+ * (WRITE_MULTIPLE_BLOCK), ... and before SDCARD_SENDDATA is called.
+ *
+ * Input Parameters:
+ * dev - An instance of the SD card device interface
+ * buffer - Address of the buffer containing the data to send
+ * nbytes - The number of bytes in the transfer
+ *
+ * Returned Value:
+ * Number of bytes sent on success; a negated errno on failure
+ *
+ ****************************************************************************/
+
+static int lpc43_sendsetup(FAR struct sdio_dev_s *dev, FAR const uint8_t *buffer,
+ size_t nbytes)
+{
+ struct lpc43_dev_s *priv = (struct lpc43_dev_s *)dev;
+#ifdef CONFIG_LPC43_SDMMC_DMA
+ uint32_t regval;
+#endif
+
+ mcinfo("nbytes=%ld\n", (long)nbytes);
+
+ DEBUGASSERT(priv != NULL && buffer != NULL && nbytes > 0);
+ DEBUGASSERT(((uint32_t)buffer & 3) == 0);
+
+ /* Save the source buffer information for use by the interrupt handler */
+
+ priv->buffer = (uint32_t *)buffer;
+ priv->remaining = nbytes;
+ priv->wrdir = true;
+#ifdef CONFIG_LPC43_SDMMC_DMA
+ priv->dmamode = false;
+#endif
+
+ /* Configure the FIFO so that we will receive the TXDR interrupt whenever
+ * there the TX FIFO is at least half empty.
+ */
+
+ lpc43_putreg(SDMMC_FIFOTH_TXWMARK(LPC43_TXFIFO_DEPTH / 2),
+ LPC43_SDMMC_FIFOTH);
+
+#ifdef CONFIG_LPC43_SDMMC_DMA
+ /* Make sure that internal DMA is disabled */
+
+ lpc43_putreg(0, LPC43_SDMMC_BMOD);
+
+ regval = lpc43_getreg(LPC43_SDMMC_CTRL);
+ regval &= ~SDMMC_CTRL_INTDMA;
+ lpc43_putreg(regval, LPC43_SDMMC_CTRL);
+#endif
+
+ /* Configure the transfer interrupts */
+
+ lpc43_config_xfrints(priv, SDCARD_SEND_MASK);
+ return OK;
+}
+
+/****************************************************************************
+ * Name: lpc43_cancel
+ *
+ * Description:
+ * Cancel the data transfer setup of SDCARD_RECVSETUP, SDCARD_SENDSETUP,
+ * SDCARD_DMARECVSETUP or SDCARD_DMASENDSETUP. This must be called to cancel
+ * the data transfer setup if, for some reason, you cannot perform the
+ * transfer.
+ *
+ * Input Parameters:
+ * dev - An instance of the SD card device interface
+ *
+ * Returned Value:
+ * OK is success; a negated errno on failure
+ *
+ ****************************************************************************/
+
+static int lpc43_cancel(FAR struct sdio_dev_s *dev)
+{
+ struct lpc43_dev_s *priv = (struct lpc43_dev_s *)dev;
+
+ mcinfo("Cancelling..\n");
+
+ /* Disable all transfer- and event- related interrupts */
+
+ lpc43_disable_allints(priv);
+
+ /* Clearing pending interrupt status on all transfer- and event- related
+ * interrupts
+ */
+
+ lpc43_putreg(SDCARD_WAITALL_CLEAR, LPC43_SDMMC_RINTSTS);
+
+ /* Cancel any watchdog timeout */
+
+ (void)wd_cancel(priv->waitwdog);
+
+ /* Mark no transfer in progress */
+
+ priv->remaining = 0;
+ return OK;
+}
+
+/****************************************************************************
+ * Name: lpc43_waitresponse
+ *
+ * Description:
+ * Poll-wait for the response to the last command to be ready.
+ *
+ * Input Parameters:
+ * dev - An instance of the SD card device interface
+ * cmd - The command that was sent. See 32-bit command definitions above.
+ *
+ * Returned Value:
+ * OK is success; a negated errno on failure
+ *
+ ****************************************************************************/
+
+static int lpc43_waitresponse(FAR struct sdio_dev_s *dev, uint32_t cmd)
+{
+ volatile int32_t timeout;
+ uint32_t events;
+
+ mcinfo("cmd=%04x\n", cmd);
+
+ switch (cmd & MMCSD_RESPONSE_MASK)
+ {
+ case MMCSD_NO_RESPONSE:
+ events = SDCARD_CMDDONE_STA;
+ timeout = SDCARD_CMDTIMEOUT;
+ break;
+
+ case MMCSD_R1_RESPONSE:
+ case MMCSD_R1B_RESPONSE:
+ case MMCSD_R2_RESPONSE:
+ case MMCSD_R6_RESPONSE:
+ events = (SDCARD_CMDDONE_STA | SDCARD_RESPDONE_STA);
+ timeout = SDCARD_LONGTIMEOUT;
+ break;
+
+ case MMCSD_R4_RESPONSE:
+ case MMCSD_R5_RESPONSE:
+ return -ENOSYS;
+
+ case MMCSD_R3_RESPONSE:
+ case MMCSD_R7_RESPONSE:
+ events = (SDCARD_CMDDONE_STA | SDCARD_RESPDONE_STA);
+ timeout = SDCARD_CMDTIMEOUT;
+ break;
+
+ default:
+ return -EINVAL;
+ }
+
+ mcinfo("cmd: %04x events: %04x STATUS: %08x RINTSTS: %08x\n",
+ cmd, events, lpc43_getreg(LPC43_SDMMC_STATUS),
+ lpc43_getreg(LPC43_SDMMC_RINTSTS));
+
+ /* Then wait for the response (or timeout or error) */
+
+ while ((lpc43_getreg(LPC43_SDMMC_RINTSTS) & events) != events)
+ {
+ if (--timeout <= 0)
+ {
+ mcerr("ERROR: Timeout cmd: %04x events: %04x STA: %08x RINTSTS: %08x\n",
+ cmd, events, lpc43_getreg(LPC43_SDMMC_STATUS),
+ lpc43_getreg(LPC43_SDMMC_RINTSTS));
+ return -ETIMEDOUT;
+ }
+ else if ((lpc43_getreg(LPC43_SDMMC_RINTSTS) & SDCARD_INT_RESPERR) != 0)
+ {
+ mcerr("ERROR: SDMMC failure cmd: %04x events: %04x STA: %08x RINTSTS: %08x\n",
+ cmd, events, lpc43_getreg(LPC43_SDMMC_STATUS),
+ lpc43_getreg(LPC43_SDMMC_RINTSTS));
+ return -EIO;
+ }
+ }
+
+ lpc43_putreg(SDCARD_CMDDONE_CLEAR, LPC43_SDMMC_RINTSTS);
+ return OK;
+}
+
+/****************************************************************************
+ * Name: lpc43_recvRx
+ *
+ * Description:
+ * Receive response to SD card command. Only the critical payload is
+ * returned -- that is 32 bits for 48 bit status and 128 bits for 136 bit
+ * status. The driver implementation should verify the correctness of
+ * the remaining, non-returned bits (CRCs, CMD index, etc.).
+ *
+ * Input Parameters:
+ * dev - An instance of the SD card device interface
+ * Rx - Buffer in which to receive the response
+ *
+ * Returned Value:
+ * Number of bytes sent on success; a negated errno on failure. Here a
+ * failure means only a faiure to obtain the requested reponse (due to
+ * transport problem -- timeout, CRC, etc.). The implementation only
+ * assures that the response is returned intacta and does not check errors
+ * within the response itself.
+ *
+ ****************************************************************************/
+
+static int lpc43_recvshortcrc(FAR struct sdio_dev_s *dev, uint32_t cmd,
+ uint32_t *rshort)
+{
+ uint32_t regval;
+
+ int ret = OK;
+
+ mcinfo("cmd=%04x\n", cmd);
+
+ /* R1 Command response (48-bit)
+ * 47 0 Start bit
+ * 46 0 Transmission bit (0=from card)
+ * 45:40 bit5 - bit0 Command index (0-63)
+ * 39:8 bit31 - bit0 32-bit card status
+ * 7:1 bit6 - bit0 CRC7
+ * 0 1 End bit
+ *
+ * R1b Identical to R1 with the additional busy signaling via the data
+ * line.
+ *
+ * R6 Published RCA Response (48-bit, SD card only)
+ * 47 0 Start bit
+ * 46 0 Transmission bit (0=from card)
+ * 45:40 bit5 - bit0 Command index (0-63)
+ * 39:8 bit31 - bit0 32-bit Argument Field, consisting of:
+ * [31:16] New published RCA of card
+ * [15:0] Card status bits {23,22,19,12:0}
+ * 7:1 bit6 - bit0 CRC7
+ * 0 1 End bit
+ */
+
+
+#ifdef CONFIG_DEBUG_FEATURES
+ if (!rshort)
+ {
+ mcerr("ERROR: rshort=NULL\n");
+ ret = -EINVAL;
+ }
+
+ /* Check that this is the correct response to this command */
+
+ else if ((cmd & MMCSD_RESPONSE_MASK) != MMCSD_R1_RESPONSE &&
+ (cmd & MMCSD_RESPONSE_MASK) != MMCSD_R1B_RESPONSE &&
+ (cmd & MMCSD_RESPONSE_MASK) != MMCSD_R6_RESPONSE)
+ {
+ mcerr("ERROR: Wrong response CMD=%04x\n", cmd);
+ ret = -EINVAL;
+ }
+ else
+#endif
+ {
+ /* Check if a timeout or CRC error occurred */
+
+ regval = lpc43_getreg(LPC43_SDMMC_RINTSTS);
+ if ((regval & SDMMC_INT_RTO) != 0)
+ {
+ mcerr("ERROR: Command timeout: %08x\n", regval);
+ ret = -ETIMEDOUT;
+ }
+ else if ((regval & SDMMC_INT_RCRC) != 0)
+ {
+ mcerr("ERROR: CRC failure: %08x\n", regval);
+ ret = -EIO;
+ }
+ }
+
+ /* Clear all pending message completion events and return the R1/R6
+ * response.
+ */
+
+ lpc43_putreg(SDCARD_RESPDONE_CLEAR | SDCARD_CMDDONE_CLEAR,
+ LPC43_SDMMC_RINTSTS);
+ *rshort = lpc43_getreg(LPC43_SDMMC_RESP0);
+ mcinfo("CRC=%04x\n", *rshort);
+
+ return ret;
+}
+
+static int lpc43_recvlong(FAR struct sdio_dev_s *dev, uint32_t cmd,
+ uint32_t rlong[4])
+{
+ uint32_t regval;
+ int ret = OK;
+
+ mcinfo("cmd=%04x\n", cmd);
+
+ /* R2 CID, CSD register (136-bit)
+ * 135 0 Start bit
+ * 134 0 Transmission bit (0=from card)
+ * 133:128 bit5 - bit0 Reserved
+ * 127:1 bit127 - bit1 127-bit CID or CSD register
+ * (including internal CRC)
+ * 0 1 End bit
+ */
+
+#ifdef CONFIG_DEBUG_FEATURES
+ /* Check that R1 is the correct response to this command */
+
+ if ((cmd & MMCSD_RESPONSE_MASK) != MMCSD_R2_RESPONSE)
+ {
+ mcerr("ERROR: Wrong response CMD=%04x\n", cmd);
+ ret = -EINVAL;
+ }
+ else
+#endif
+ {
+ /* Check if a timeout or CRC error occurred */
+
+ regval = lpc43_getreg(LPC43_SDMMC_RINTSTS);
+ if (regval & SDMMC_INT_RTO)
+ {
+ mcerr("ERROR: Timeout STA: %08x\n", regval);
+ ret = -ETIMEDOUT;
+ }
+ else if (regval & SDMMC_INT_RCRC)
+ {
+ mcerr("ERROR: CRC fail STA: %08x\n", regval);
+ ret = -EIO;
+ }
+ }
+
+ /* Return the long response */
+
+ lpc43_putreg(SDCARD_RESPDONE_CLEAR | SDCARD_CMDDONE_CLEAR,
+ LPC43_SDMMC_RINTSTS);
+ if (rlong)
+ {
+ rlong[0] = lpc43_getreg(LPC43_SDMMC_RESP3);
+ rlong[1] = lpc43_getreg(LPC43_SDMMC_RESP2);
+ rlong[2] = lpc43_getreg(LPC43_SDMMC_RESP1);
+ rlong[3] = lpc43_getreg(LPC43_SDMMC_RESP0);
+ }
+
+ return ret;
+}
+
+static int lpc43_recvshort(FAR struct sdio_dev_s *dev, uint32_t cmd, uint32_t *rshort)
+{
+ uint32_t regval;
+ int ret = OK;
+
+ mcinfo("cmd=%04x\n", cmd);
+
+ /* R3 OCR (48-bit)
+ * 47 0 Start bit
+ * 46 0 Transmission bit (0=from card)
+ * 45:40 bit5 - bit0 Reserved
+ * 39:8 bit31 - bit0 32-bit OCR register
+ * 7:1 bit6 - bit0 Reserved
+ * 0 1 End bit
+ */
+
+ /* Check that this is the correct response to this command */
+
+#ifdef CONFIG_DEBUG_FEATURES
+ if ((cmd & MMCSD_RESPONSE_MASK) != MMCSD_R3_RESPONSE &&
+ (cmd & MMCSD_RESPONSE_MASK) != MMCSD_R7_RESPONSE)
+ {
+ mcerr("ERROR: Wrong response CMD=%04x\n", cmd);
+ ret = -EINVAL;
+ }
+ else
+#endif
+ {
+ /* Check if a timeout occurred (Apparently a CRC error can terminate
+ * a good response)
+ */
+
+ regval = lpc43_getreg(LPC43_SDMMC_RINTSTS);
+ if (regval & SDMMC_INT_RTO)
+ {
+ mcerr("ERROR: Timeout STA: %08x\n", regval);
+ ret = -ETIMEDOUT;
+ }
+ }
+
+ lpc43_putreg(SDCARD_RESPDONE_CLEAR | SDCARD_CMDDONE_CLEAR,
+ LPC43_SDMMC_RINTSTS);
+ if (rshort)
+ {
+ *rshort = lpc43_getreg(LPC43_SDMMC_RESP0);
+ }
+
+ return ret;
+}
+
+/* MMC responses not supported */
+
+static int lpc43_recvnotimpl(FAR struct sdio_dev_s *dev, uint32_t cmd,
+ uint32_t *rnotimpl)
+{
+ mcinfo("cmd=%04x\n", cmd);
+
+ lpc43_putreg(SDCARD_RESPDONE_CLEAR | SDCARD_CMDDONE_CLEAR,
+ LPC43_SDMMC_RINTSTS);
+ return -ENOSYS;
+}
+
+/****************************************************************************
+ * Name: lpc43_waitenable
+ *
+ * Description:
+ * Enable/disable of a set of SD card wait events. This is part of the
+ * the SDCARD_WAITEVENT sequence. The set of to-be-waited-for events is
+ * configured before calling lpc43_eventwait. This is done in this way
+ * to help the driver to eliminate race conditions between the command
+ * setup and the subsequent events.
+ *
+ * The enabled events persist until either (1) SDCARD_WAITENABLE is called
+ * again specifying a different set of wait events, or (2) SDCARD_EVENTWAIT
+ * returns.
+ *
+ * Input Parameters:
+ * dev - An instance of the SD card device interface
+ * eventset - A bitset of events to enable or disable (see SDIOWAIT_*
+ * definitions). 0=disable; 1=enable.
+ *
+ * Returned Value:
+ * None
+ *
+ ****************************************************************************/
+
+static void lpc43_waitenable(FAR struct sdio_dev_s *dev,
+ sdio_eventset_t eventset)
+{
+ struct lpc43_dev_s *priv = (struct lpc43_dev_s *)dev;
+ uint32_t waitmask;
+
+ mcinfo("eventset=%04x\n", (unsigned int)eventset);
+ DEBUGASSERT(priv != NULL);
+
+ /* Disable event-related interrupts */
+
+ lpc43_config_waitints(priv, 0, 0, 0);
+
+ /* Select the interrupt mask that will give us the appropriate wakeup
+ * interrupts.
+ */
+
+ waitmask = 0;
+ if ((eventset & SDIOWAIT_CMDDONE) != 0)
+ {
+ waitmask |= SDCARD_CMDDONE_MASK;
+ }
+
+ if ((eventset & SDIOWAIT_RESPONSEDONE) != 0)
+ {
+ waitmask |= SDCARD_RESPDONE_MASK;
+ }
+
+ if ((eventset & SDIOWAIT_TRANSFERDONE) != 0)
+ {
+ waitmask |= SDCARD_XFRDONE_MASK;
+ }
+
+ /* Enable event-related interrupts */
+
+ lpc43_config_waitints(priv, waitmask, eventset, 0);
+}
+
+/****************************************************************************
+ * Name: lpc43_eventwait
+ *
+ * Description:
+ * Wait for one of the enabled events to occur (or a timeout). Note that
+ * all events enabled by SDCARD_WAITEVENTS are disabled when lpc43_eventwait
+ * returns. SDCARD_WAITEVENTS must be called again before lpc43_eventwait
+ * can be used again.
+ *
+ * Input Parameters:
+ * dev - An instance of the SD card device interface
+ * timeout - Maximum time in milliseconds to wait. Zero means immediate
+ * timeout with no wait. The timeout value is ignored if
+ * SDIOWAIT_TIMEOUT is not included in the waited-for eventset.
+ *
+ * Returned Value:
+ * Event set containing the event(s) that ended the wait. Should always
+ * be non-zero. All events are disabled after the wait concludes.
+ *
+ ****************************************************************************/
+
+static sdio_eventset_t lpc43_eventwait(FAR struct sdio_dev_s *dev,
+ uint32_t timeout)
+{
+ struct lpc43_dev_s *priv = (struct lpc43_dev_s *)dev;
+ sdio_eventset_t wkupevent = 0;
+ irqstate_t flags;
+ int ret;
+
+ mcinfo("timeout=%lu\n", (unsigned long)timeout);
+
+ /* There is a race condition here... the event may have completed before
+ * we get here. In this case waitevents will be zero, but wkupevents will
+ * be non-zero (and, hopefully, the semaphore count will also be non-zero.
+ */
+
+ flags = enter_critical_section();
+ DEBUGASSERT(priv->waitevents != 0 || priv->wkupevent != 0);
+
+ /* Check if the timeout event is specified in the event set */
+
+ if ((priv->waitevents & SDIOWAIT_TIMEOUT) != 0)
+ {
+ int delay;
+
+ /* Yes.. Handle a cornercase: The user request a timeout event but
+ * with timeout == 0?
+ */
+
+ if (!timeout)
+ {
+ /* Then just tell the caller that we already timed out */
+
+ wkupevent = SDIOWAIT_TIMEOUT;
+ goto errout;
+ }
+
+ /* Start the watchdog timer */
+
+ delay = MSEC2TICK(timeout);
+ ret = wd_start(priv->waitwdog, delay, (wdentry_t)lpc43_eventtimeout,
+ 1, (uint32_t)priv);
+ if (ret != OK)
+ {
+ mcerr("ERROR: wd_start failed: %d\n", ret);
+ }
+ }
+
+ /* Loop until the event (or the timeout occurs). Race conditions are avoided
+ * by calling lpc43_waitenable prior to triggering the logic that will cause
+ * the wait to terminate. Under certain race conditions, the waited-for
+ * may have already occurred before this function was called!
+ */
+
+ for (; ; )
+ {
+ /* Wait for an event in event set to occur. If this the event has already
+ * occurred, then the semaphore will already have been incremented and
+ * there will be no wait.
+ */
+
+ lpc43_takesem(priv);
+ wkupevent = priv->wkupevent;
+
+ /* Check if the event has occurred. When the event has occurred, then
+ * evenset will be set to 0 and wkupevent will be set to a nonzero value.
+ */
+
+ if (wkupevent != 0)
+ {
+ /* Yes... break out of the loop with wkupevent non-zero */
+
+ break;
+ }
+ }
+
+ /* Disable all transfer- and event- related interrupts */
+
+ lpc43_disable_allints(priv);
+
+errout:
+ leave_critical_section(flags);
+ mcinfo("wkupevent=%04x\n", wkupevent);
+ return wkupevent;
+}
+
+/****************************************************************************
+ * Name: lpc43_callbackenable
+ *
+ * Description:
+ * Enable/disable of a set of SD card callback events. This is part of the
+ * the SD card callback sequence. The set of events is configured to enabled
+ * callbacks to the function provided in lpc43_registercallback.
+ *
+ * Events are automatically disabled once the callback is performed and no
+ * further callback events will occur until they are again enabled by
+ * calling this methos.
+ *
+ * Input Parameters:
+ * dev - An instance of the SD card device interface
+ * eventset - A bitset of events to enable or disable (see SDIOMEDIA_*
+ * definitions). 0=disable; 1=enable.
+ *
+ * Returned Value:
+ * None
+ *
+ ****************************************************************************/
+
+static void lpc43_callbackenable(FAR struct sdio_dev_s *dev,
+ sdio_eventset_t eventset)
+{
+ struct lpc43_dev_s *priv = (struct lpc43_dev_s *)dev;
+
+ mcinfo("eventset: %02x\n", eventset);
+ DEBUGASSERT(priv != NULL);
+
+ priv->cbevents = eventset;
+ lpc43_callback(priv);
+}
+
+/****************************************************************************
+ * Name: lpc43_registercallback
+ *
+ * Description:
+ * Register a callback that that will be invoked on any media status
+ * change. Callbacks should not be made from interrupt handlers, rather
+ * interrupt level events should be handled by calling back on the work
+ * thread.
+ *
+ * When this method is called, all callbacks should be disabled until they
+ * are enabled via a call to SDCARD_CALLBACKENABLE
+ *
+ * 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.
+ *
+ ****************************************************************************/
+
+static int lpc43_registercallback(FAR struct sdio_dev_s *dev,
+ worker_t callback, void *arg)
+{
+ struct lpc43_dev_s *priv = (struct lpc43_dev_s *)dev;
+
+ mcinfo("callback=%p arg=%p\n", callback, arg);
+
+ /* Disable callbacks and register this callback and its argument */
+
+ mcinfo("Register %p(%p)\n", callback, arg);
+ DEBUGASSERT(priv != NULL);
+
+ priv->cbevents = 0;
+ priv->cbarg = arg;
+ priv->callback = callback;
+ return OK;
+}
+
+/****************************************************************************
+ * Name: lpc43_dmarecvsetup
+ *
+ * Description:
+ * Setup to perform a read DMA. If the processor supports a data cache,
+ * then this method will also make sure that the contents of the DMA memory
+ * and the data cache are coherent. For read transfers this may mean
+ * invalidating the data cache.
+ *
+ * Input Parameters:
+ * dev - An instance of the SD card device interface
+ * buffer - The memory to DMA from
+ * buflen - The size of the DMA transfer in bytes
+ *
+ * Returned Value:
+ * OK on success; a negated errno on failure
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_LPC43_SDMMC_DMA
+static int lpc43_dmarecvsetup(FAR struct sdio_dev_s *dev, FAR uint8_t *buffer,
+ size_t buflen)
+{
+ struct lpc43_dev_s *priv = (struct lpc43_dev_s *)dev;
+ uint32_t regval;
+ uint32_t ctrl;
+ uint32_t maxs;
+ int i;
+
+ /* Don't bother with DMA if the entire transfer will fit in the RX FIFO or
+ * if we do not have a 4-bit wide bus.
+ */
+
+ DEBUGASSERT(priv != NULL);
+
+ if (buflen <= LPC43_RXFIFO_SIZE || !priv->widebus)
+ {
+ return lpc43_recvsetup(dev, buffer, buflen);
+ }
+
+ mcinfo("buflen=%lu\n", (unsigned long)buflen);
+ DEBUGASSERT(buffer != NULL && buflen > 0 && ((uint32_t)buffer & 3) == 0);
+
+ /* Reset DMA controller internal registers. The SWR bit automatically
+ * clears in one clock cycle.
+ */
+
+ lpc43_putreg(SDMMC_BMOD_SWR, LPC43_SDMMC_BMOD);
+
+ /* Save the destination buffer information for use by the interrupt handler */
+
+ priv->buffer = (uint32_t *)buffer;
+ priv->remaining = buflen;
+ priv->wrdir = false;
+ priv->dmamode = true;
+
+ /* Reset the FIFO and DMA */
+
+ regval = lpc43_getreg(LPC43_SDMMC_CTRL);
+ regval |= SDMMC_CTRL_FIFORESET | SDMMC_CTRL_DMARESET;
+ lpc43_putreg(regval, LPC43_SDMMC_CTRL);
+
+ while ((lpc43_getreg(LPC43_SDMMC_CTRL) & SDMMC_CTRL_DMARESET) != 0)
+ {
+ }
+
+ /* Configure the FIFO so that we will receive the DMA/FIFO requests whenever
+ * there more than than (FIFO_DEPTH/2) - 1 words in the FIFO.
+ */
+
+ regval = SDMMC_FIFOTH_RXWMARK(LPC43_RXFIFO_DEPTH / 2 - 1) |
+ SDMMC_FIFOTH_DMABURST_4XFRS;
+ lpc43_putreg(regval, LPC43_SDMMC_FIFOTH);
+
+ /* Setup DMA list */
+
+ i = 0;
+ while (buflen > 0)
+ {
+ /* Limit size of the transfer to maximum buffer size */
+
+ maxs = buflen;
+
+ if (maxs > MCI_DMADES1_MAXTR)
+ {
+ maxs = MCI_DMADES1_MAXTR;
+ }
+
+ buflen -= maxs;
+
+ /* Set buffer size */
+
+ g_sdmmc_dmadd[i].des1 = MCI_DMADES1_BS1(maxs);
+
+ /* Setup buffer address (chained) */
+
+ g_sdmmc_dmadd[i].des2 = (uint32_t)priv->buffer + (i * MCI_DMADES1_MAXTR);
+
+ /* Setup basic control */
+
+ ctrl = MCI_DMADES0_OWN | MCI_DMADES0_CH;
+
+ if (i == 0)
+ {
+ ctrl |= MCI_DMADES0_FS; /* First DMA buffer */
+ }
+
+ /* No more data? Then this is the last descriptor */
+
+ if (buflen == 0)
+ {
+ ctrl |= MCI_DMADES0_LD;
+ }
+ else
+ {
+ ctrl |= MCI_DMADES0_DIC;
+ }
+
+ /* Another descriptor is needed */
+
+ g_sdmmc_dmadd[i].des0 = ctrl;
+ g_sdmmc_dmadd[i].des3 = (uint32_t) &g_sdmmc_dmadd[i + 1];
+ i++;
+ }
+
+ lpc43_putreg((uint32_t)&g_sdmmc_dmadd[0], LPC43_SDMMC_DBADDR);
+
+ /* Enable internal DMA, burst size of 4, fixed burst */
+
+ regval = lpc43_getreg(LPC43_SDMMC_CTRL);
+ regval |= SDMMC_CTRL_INTDMA;
+ lpc43_putreg(regval, LPC43_SDMMC_CTRL);
+
+ regval = SDMMC_BMOD_DE | SDMMC_BMOD_PBL_4XFRS | SDMMC_BMOD_DSL(4);
+ lpc43_putreg(regval, LPC43_SDMMC_BMOD);
+
+ /* Setup DMA error interrupts */
+
+ lpc43_config_dmaints(priv, SDCARD_DMARECV_MASK, SDCARD_DMAERROR_MASK);
+ return OK;
+}
+#endif
+
+/****************************************************************************
+ * Name: lpc43_dmasendsetup
+ *
+ * Description:
+ * Setup to perform a write DMA. If the processor supports a data cache,
+ * then this method will also make sure that the contents of the DMA memory
+ * and the data cache are coherent. For write transfers, this may mean
+ * flushing the data cache.
+ *
+ * Input Parameters:
+ * dev - An instance of the SD card device interface
+ * buffer - The memory to DMA into
+ * buflen - The size of the DMA transfer in bytes
+ *
+ * Returned Value:
+ * OK on success; a negated errno on failure
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_LPC43_SDMMC_DMA
+static int lpc43_dmasendsetup(FAR struct sdio_dev_s *dev,
+ FAR const uint8_t *buffer, size_t buflen)
+{
+ struct lpc43_dev_s *priv = (struct lpc43_dev_s *)dev;
+ uint32_t regval;
+
+ /* Don't bother with DMA if the entire transfer will fit in the TX FIFO or
+ * if we do not have a 4-bit wide bus.
+ */
+
+ DEBUGASSERT(priv != NULL);
+
+ if (buflen <= LPC43_TXFIFO_SIZE || !priv->widebus)
+ {
+ return lpc43_sendsetup(dev, buffer, buflen);
+ }
+
+ mcinfo("buflen=%lu\n", (unsigned long)buflen);
+ DEBUGASSERT(buffer != NULL && buflen > 0 && ((uint32_t)buffer & 3) == 0);
+
+ /* Reset DMA controller internal registers. The SWR bit automatically
+ * clears in one clock cycle.
+ */
+
+ lpc43_putreg(SDMMC_BMOD_SWR, LPC43_SDMMC_BMOD);
+
+ /* Save the destination buffer information for use by the interrupt
+ * handler.
+ */
+
+ priv->buffer = (uint32_t *)buffer;
+ priv->remaining = buflen;
+ priv->wrdir = true;
+ priv->dmamode = true;
+
+ /* Reset the FIFO and DMA */
+
+ regval = lpc43_getreg(LPC43_SDMMC_CTRL);
+ regval |= SDMMC_CTRL_FIFORESET | SDMMC_CTRL_DMARESET;
+ lpc43_putreg(regval, LPC43_SDMMC_CTRL);
+
+ while ((lpc43_getreg(LPC43_SDMMC_CTRL) & SDMMC_CTRL_DMARESET) != 0)
+ {
+ }
+
+ /* Configure the FIFO so that we will receive the DMA/FIFO requests whenever
+ * there are FIFO_DEPTH/2 or fewer words in the FIFO.
+ */
+
+ regval = SDMMC_FIFOTH_TXWMARK(LPC43_TXFIFO_DEPTH / 2) |
+ SDMMC_FIFOTH_DMABURST_4XFRS;
+ lpc43_putreg(regval, LPC43_SDMMC_FIFOTH);
+
+ /* Setup DMA descriptor list */
+
+ g_sdmmc_dmadd[0].des0 = MCI_DMADES0_OWN | MCI_DMADES0_CH | MCI_DMADES0_LD;
+ g_sdmmc_dmadd[0].des1 = 512;
+ g_sdmmc_dmadd[0].des2 = (uint32_t)priv->buffer;
+ g_sdmmc_dmadd[0].des3 = (uint32_t)&g_sdmmc_dmadd[1];
+
+ lpc43_putreg((uint32_t) &g_sdmmc_dmadd[0], LPC43_SDMMC_DBADDR);
+
+ /* Enable internal DMA, burst size of 4, fixed burst */
+
+ regval = lpc43_getreg(LPC43_SDMMC_CTRL);
+ regval |= SDMMC_CTRL_INTDMA;
+ lpc43_putreg(regval, LPC43_SDMMC_CTRL);
+
+ regval = SDMMC_BMOD_DE | SDMMC_BMOD_PBL_4XFRS | SDMMC_BMOD_DSL(4);
+ lpc43_putreg(regval, LPC43_SDMMC_BMOD);
+
+ /* Setup DMA error interrupts */
+
+ lpc43_config_dmaints(priv, SDCARD_DMASEND_MASK, SDCARD_DMAERROR_MASK);
+ return OK;
+}
+#endif
+
+/****************************************************************************
+ * Name: lpc43_callback
+ *
+ * Description:
+ * Perform callback.
+ *
+ * Assumptions:
+ * This function does not execute in the context of an interrupt handler.
+ * It may be invoked on any user thread or scheduled on the work thread
+ * from an interrupt handler.
+ *
+ ****************************************************************************/
+
+static void lpc43_callback(struct lpc43_dev_s *priv)
+{
+ /* Is a callback registered? */
+
+ mcinfo("Callback %p(%p) cbevents: %02x cdstatus: %02x\n",
+ priv->callback, priv->cbarg, priv->cbevents, priv->cdstatus);
+
+ if (priv->callback)
+ {
+ /* Yes.. Check for enabled callback events */
+
+ if ((priv->cdstatus & SDIO_STATUS_PRESENT) != 0)
+ {
+ /* Media is present. Is the media inserted event enabled? */
+
+ if ((priv->cbevents & SDIOMEDIA_INSERTED) == 0)
+ {
+ /* No... return without performing the callback */
+
+ return;
+ }
+ }
+ else
+ {
+ /* Media is not present. Is the media eject event enabled? */
+
+ if ((priv->cbevents & SDIOMEDIA_EJECTED) == 0)
+ {
+ /* No... return without performing the callback */
+
+ return;
+ }
+ }
+
+ /* Perform the callback, disabling further callbacks. Of course, the
+ * the callback can (and probably should) re-enable callbacks.
+ */
+
+ priv->cbevents = 0;
+
+ /* Callbacks cannot be performed in the context of an interrupt handler.
+ * If we are in an interrupt handler, then queue the callback to be
+ * performed later on the work thread.
+ */
+
+ if (up_interrupt_context())
+ {
+ /* Yes.. queue it */
+
+ mcinfo("Queuing callback to %p(%p)\n", priv->callback, priv->cbarg);
+ (void)work_queue(HPWORK, &priv->cbwork, (worker_t)priv->callback, priv->cbarg, 0);
+ }
+ else
+ {
+ /* No.. then just call the callback here */
+
+ mcinfo("Callback to %p(%p)\n", priv->callback, priv->cbarg);
+ priv->callback(priv->cbarg);
+ }
+ }
+}
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: lpc43_sdmmc_initialize
+ *
+ * Description:
+ * Initialize the SD/MMC peripheral for normal operation.
+ *
+ * Input Parameters:
+ * slotno - Not used.
+ *
+ * Returned Values:
+ * A reference to an SD card interface structure. NULL is returned on failures.
+ *
+ ****************************************************************************/
+
+FAR struct sdio_dev_s *lpc43_sdmmc_initialize(int slotno)
+{
+ struct lpc43_dev_s *priv = &g_scard_dev;
+ irqstate_t flags;
+ uint32_t regval;
+
+ mcinfo("slotno=%d\n", slotno);
+ flags = enter_critical_section();
+
+ /* Set up the clock source */
+
+ regval = getreg32(LPC43_BASE_SDIO_CLK);
+ regval &= ~BASE_SDIO_CLK_CLKSEL_MASK;
+ regval |= (BOARD_SDIO_CLKSRC | BASE_SDIO_CLK_AUTOBLOCK);
+ putreg32(regval, LPC43_BASE_SDIO_CLK);
+
+ /* Enable clocking to the SD/MMC peripheral */
+
+ regval = lpc43_getreg(LPC43_CCU1_M4_SDIO_CFG);
+ regval |= CCU_CLK_CFG_RUN;
+ regval |= CCU_CLK_CFG_AUTO;
+ regval |= CCU_CLK_CFG_WAKEUP;
+ lpc43_putreg(regval, LPC43_CCU1_M4_SDIO_CFG);
+
+ /* Initialize semaphores */
+
+ sem_init(&priv->waitsem, 0, 0);
+
+ /* The waitsem semaphore is used for signaling and, hence, should not have
+ * priority inheritance enabled.
+ */
+
+ sem_setprotocol(&priv->waitsem, SEM_PRIO_NONE);
+
+ /* Create a watchdog timer */
+
+ priv->waitwdog = wd_create();
+ DEBUGASSERT(priv->waitwdog != NULL);
+
+ /* Configure GPIOs for 4-bit, wide-bus operation */
+
+ lpc43_pin_config(GPIO_SD_D0);
+#ifndef CONFIG_SDIO_WIDTH_D1_ONLY
+ lpc43_pin_config(GPIO_SD_D1);
+ lpc43_pin_config(GPIO_SD_D2);
+ lpc43_pin_config(GPIO_SD_D3);
+#endif
+#ifdef CONFIG_MMCSD_HAVE_CARDDETECT
+ lpc43_pin_config(GPIO_SD_CARD_DET_N);
+#endif
+ lpc43_pin_config(GPIO_SD_CLK);
+ lpc43_pin_config(GPIO_SD_CMD);
+#ifdef CONFIG_LPC43_SDMMC_PWRCTRL
+ lpc43_pin_config(GPIO_SD_POW_EN);
+#endif
+#ifdef CONFIG_MMCSD_HAVE_WRITEPROTECT
+ lpc43_pin_config(GPIO_SD_WR_PRT);
+#endif
+
+ regval = getreg32(LPC43_SCU_SFSCLK2);
+ regval |= (2 << 3); /* Disable pull-down and pull-up resistor */
+ regval |= (1 << 6); /* Enable Input buffer */
+ regval |= (4); /* Selects pin function 4 */
+ putreg32(regval, LPC43_SCU_SFSCLK2);
+
+ /* Reset the card and assure that it is in the initial, unconfigured
+ * state.
+ */
+
+ lpc43_reset(&priv->dev);
+
+ leave_critical_section(flags);
+ return &g_scard_dev.dev;
+}
+
+#endif /* CONFIG_LPC43_SDMMC */
diff --git a/arch/arm/src/lpc43xx/lpc43_sdmmc.h b/arch/arm/src/lpc43xx/lpc43_sdmmc.h
new file mode 100644
index 0000000000000000000000000000000000000000..7a27088415cf16f294218165fe6fc3f73b2d846d
--- /dev/null
+++ b/arch/arm/src/lpc43xx/lpc43_sdmmc.h
@@ -0,0 +1,88 @@
+/************************************************************************************
+ * arch/arm/src/lpc43xx/lpc43_sdmmc.h
+ *
+ * Copyright (C) 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.
+ *
+ ************************************************************************************/
+
+#ifndef __ARCH_ARM_SRC_LPC43XX_LPC43_SDMMC_H
+#define __ARCH_ARM_SRC_LPC43XX_LPC43_SDMMC_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include
+#include
+#include
+
+#include "chip.h"
+#include "chip/lpc43_sdmmc.h"
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+#undef EXTERN
+#if defined(__cplusplus)
+#define EXTERN extern "C"
+extern "C"
+{
+#else
+#define EXTERN extern
+#endif
+
+/****************************************************************************
+ * Name: lpc43_sdmmc_initialize
+ *
+ * Description:
+ * Initialize the SD/MMC peripheral for normal operation.
+ *
+ * Input Parameters:
+ * slotno - Not used.
+ *
+ * Returned Values:
+ * A reference to an SDIO interface structure. NULL is returned on failures.
+ *
+ ****************************************************************************/
+
+struct lpc43_sdmmc_dev_s; /* See include/nuttx/sdio.h */
+FAR struct sdio_dev_s *lpc43_sdmmc_initialize(int slotno);
+
+#undef EXTERN
+#if defined(__cplusplus)
+}
+#endif
+
+#endif /* __ASSEMBLY__ */
+#endif /* __ARCH_ARM_SRC_LPC43XX_LPC43_SDMMC_H */
diff --git a/arch/arm/src/lpc43xx/lpc43_start.c b/arch/arm/src/lpc43xx/lpc43_start.c
index e3fe5c552e8b37ff2f652875cd35027fdac61b51..5b3103197d26e2aaa0f805cd6345c1212ef36c54 100644
--- a/arch/arm/src/lpc43xx/lpc43_start.c
+++ b/arch/arm/src/lpc43xx/lpc43_start.c
@@ -1,7 +1,7 @@
/****************************************************************************
* arch/arm/src/lpc43xx/lpc43_start.c
*
- * Copyright (C) 2012, 2015 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2012, 2015, 2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt
*
* Redistribution and use in source and binary forms, with or without
@@ -60,7 +60,6 @@
#include
#include
-#include
#include
#include "up_arch.h"
@@ -74,6 +73,7 @@
#include "lpc43_emc.h"
#include "lpc43_uart.h"
#include "lpc43_userspace.h"
+#include "lpc43_start.h"
/****************************************************************************
* Pre-processor Definitions
diff --git a/arch/arm/src/lpc43xx/lpc43_start.h b/arch/arm/src/lpc43xx/lpc43_start.h
new file mode 100644
index 0000000000000000000000000000000000000000..27e4e754ae84d00828beb3b1271b702b3d844fa2
--- /dev/null
+++ b/arch/arm/src/lpc43xx/lpc43_start.h
@@ -0,0 +1,62 @@
+/************************************************************************************
+ * arch/arm/src/lpc43xx/lpc43_start.h
+ *
+ * Copyright (C) 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.
+ *
+ ************************************************************************************/
+
+#ifndef __ARCH_ARM_SRC_LPC43XX_LPC43_START_H
+#define __ARCH_ARM_SRC_LPC43XX_LPC43_START_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include
+
+/************************************************************************************
+ * Public Function Prototypes
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: lpc43_boardinitialize
+ *
+ * Description:
+ * All LPC43xx architectures must provide the following entry point. This entry
+ * point is called early in the initialization -- after clocking and memory have
+ * been configured but before caches have been enabled and before any devices have
+ * been initialized.
+ *
+ ************************************************************************************/
+
+void lpc43_boardinitialize(void);
+
+#endif /* __ARCH_ARM_SRC_LPC43XX_LPC43_START_H */
diff --git a/arch/arm/src/lpc43xx/lpc43_tickless_rit.c b/arch/arm/src/lpc43xx/lpc43_tickless_rit.c
index cacfb47c91b0a6a3c955dda7b7cc0c7f34b09968..6ffaac8f80f387490abfb2cf940013db4a044920 100644
--- a/arch/arm/src/lpc43xx/lpc43_tickless_rit.c
+++ b/arch/arm/src/lpc43xx/lpc43_tickless_rit.c
@@ -197,7 +197,7 @@ static inline bool lpc43_tl_get_interrupt(void)
/* Converters */
-static uint32_t commonDev(uint32_t a, uint32_t b)
+static uint32_t common_dev(uint32_t a, uint32_t b)
{
while (b != 0)
{
@@ -449,17 +449,17 @@ static void lpc43_tl_looped_forced_set_compare(void)
static bool lpc43_tl_set_calc_arm(uint32_t curr, uint32_t to_set, bool arm)
{
- uint32_t calcTime;
+ uint32_t calc_time;
if (curr < TO_RESET_NEXT)
{
- calcTime = min(TO_RESET_NEXT, to_set);
+ calc_time = min(TO_RESET_NEXT, to_set);
}
else
{
if (curr < TO_END)
{
- calcTime = min(curr + RESET_TICKS, to_set);
+ calc_time = min(curr + RESET_TICKS, to_set);
}
else
{
@@ -468,9 +468,9 @@ static bool lpc43_tl_set_calc_arm(uint32_t curr, uint32_t to_set, bool arm)
}
}
- bool set = lpc43_tl_set_safe_compare(calcTime);
+ bool set = lpc43_tl_set_safe_compare(calc_time);
- if (arm && set && (calcTime == to_set))
+ if (arm && set && (calc_time == to_set))
{
armed = true;
}
@@ -557,17 +557,17 @@ static int lpc43_tl_isr(int irq, FAR void *context, FAR void *arg)
{
if (alarm_time_set) /* need to set alarm time */
{
- uint32_t toSet = lpc43_tl_calc_to_set();
+ uint32_t toset = lpc43_tl_calc_to_set();
- if (toSet > curr)
+ if (toset > curr)
{
- if (toSet > TO_END)
+ if (toset > TO_END)
{
lpc43_tl_set_default_compare(curr);
}
else
{
- bool set = lpc43_tl_set_calc_arm(curr, toSet, true);
+ bool set = lpc43_tl_set_calc_arm(curr, toset, true);
if (!set)
{
lpc43_tl_alarm(curr);
@@ -605,7 +605,7 @@ void arm_timer_initialize(void)
mask_cache = getreg32(LPC43_RIT_MASK);
compare_cache = getreg32(LPC43_RIT_COMPVAL);
- COMMON_DEV = commonDev(NSEC_PER_SEC, LPC43_CCLK);
+ COMMON_DEV = common_dev(NSEC_PER_SEC, LPC43_CCLK);
MIN_TICKS = LPC43_CCLK/COMMON_DEV;
MIN_NSEC = NSEC_PER_SEC/COMMON_DEV;
@@ -651,16 +651,16 @@ int up_timer_gettime(FAR struct timespec *ts)
if (lpc43_tl_get_reset_on_match())
{
- bool resetAfter = lpc43_tl_get_interrupt();
+ bool reset_after = lpc43_tl_get_interrupt();
/* Was a reset during processing? get new counter */
- if (reset != resetAfter)
+ if (reset != reset_after)
{
count = lpc43_tl_get_counter();
}
- if (resetAfter)
+ if (reset_after)
{
/* Count should be smaller then UINT32_MAX-TO_END -> no overflow */
@@ -710,19 +710,19 @@ int up_alarm_start(FAR const struct timespec *ts)
alarm_time_ts.tv_sec = ts->tv_sec;
alarm_time_ts.tv_nsec = ts->tv_nsec;
- uint32_t toSet = lpc43_tl_calc_to_set();
+ uint32_t toset = lpc43_tl_calc_to_set();
uint32_t curr = lpc43_tl_get_counter();
- if (toSet > curr)
+ if (toset > curr)
{
- if (toSet > TO_END) /* Future set */
+ if (toset > TO_END) /* Future set */
{
lpc43_tl_set_default_compare(curr);
}
else
{
- bool set = lpc43_tl_set_calc_arm(curr, toSet, true);
+ bool set = lpc43_tl_set_calc_arm(curr, toset, true);
if (!set) /* Signal call, force interrupt handler */
{
call = true;
diff --git a/arch/arm/src/lpc43xx/lpc43_userspace.c b/arch/arm/src/lpc43xx/lpc43_userspace.c
index 43ded6b4abeb24b0593121058351594e5dbd0042..c884e3c77bf094a721866d81fb3509c698c0f40c 100644
--- a/arch/arm/src/lpc43xx/lpc43_userspace.c
+++ b/arch/arm/src/lpc43xx/lpc43_userspace.c
@@ -49,18 +49,6 @@
#ifdef CONFIG_BUILD_PROTECTED
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-
-/****************************************************************************
- * Private Data
- ****************************************************************************/
-
-/****************************************************************************
- * Private Functions
- ****************************************************************************/
-
/****************************************************************************
* Public Functions
****************************************************************************/
diff --git a/arch/arm/src/lpc43xx/lpc43_userspace.h b/arch/arm/src/lpc43xx/lpc43_userspace.h
index 77b6d1e609225a5c72cf34b173ef6ef995384ac0..46d16637a9473cb76dda9702bdf8385a261525de 100644
--- a/arch/arm/src/lpc43xx/lpc43_userspace.h
+++ b/arch/arm/src/lpc43xx/lpc43_userspace.h
@@ -1,5 +1,5 @@
/************************************************************************************
- * arch/arm/src/lpc43xx/lpc43_qei.h
+ * arch/arm/src/lpc43xx/lpc43_userspace.h
*
* Copyright (C) 2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt
@@ -43,19 +43,7 @@
#include
/************************************************************************************
- * Pre-processor Definitions
- ************************************************************************************/
-
-/************************************************************************************
- * Public Types
- ************************************************************************************/
-
-/************************************************************************************
- * Public Data
- ************************************************************************************/
-
-/************************************************************************************
- * Public Functions
+ * Public Function Prototypes
************************************************************************************/
/****************************************************************************
diff --git a/arch/arm/src/lpc43xx/lpc43_wdt.h b/arch/arm/src/lpc43xx/lpc43_wdt.h
new file mode 100644
index 0000000000000000000000000000000000000000..af427504e4dc53fa8c75031ea4d12165852756f7
--- /dev/null
+++ b/arch/arm/src/lpc43xx/lpc43_wdt.h
@@ -0,0 +1,97 @@
+/****************************************************************************
+ * arch/arm/src/lpc43xx/lpc43_wdt.h
+ *
+ * Copyright (C) 2012, 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.
+ *
+ ****************************************************************************/
+
+#ifndef __ARCH_ARM_SRC_LPC43XX_CHIP_LPC43_WDT_H
+#define __ARCH_ARM_SRC_LPC43XX_CHIP_LPC43_WDT_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include
+
+#include "chip.h"
+#include "chip/lpc43_wdt.h"
+
+#ifdef CONFIG_WATCHDOG
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+#undef EXTERN
+#if defined(__cplusplus)
+#define EXTERN extern "C"
+extern "C"
+{
+#else
+#define EXTERN extern
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: lpc43_wwtginitialize
+ *
+ * Description:
+ * Initialize the WWDG watchdog time. The watchdog timer is initializeed and
+ * registers as 'devpath. The initial state of the watchdog time is
+ * disabled.
+ *
+ * Input Parameters:
+ * devpath - The full path to the watchdog. This should be of the form
+ * /dev/watchdog0
+ *
+ * Returned Values:
+ * None
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_LPC43_WWDT
+void lpc43_wwdtinitialize(FAR const char *devpath);
+#endif
+
+#undef EXTERN
+#if defined(__cplusplus)
+}
+#endif
+
+#endif /* __ASSEMBLY__ */
+#endif /* CONFIG_WATCHDOG */
+#endif /* __ARCH_ARM_SRC_LPC43XX_CHIP_LPC43_WDT_H */
diff --git a/arch/arm/src/lpc43xx/lpc43_wwdt.c b/arch/arm/src/lpc43xx/lpc43_wwdt.c
new file mode 100644
index 0000000000000000000000000000000000000000..872e8d5f3f5b063c11f0b129cabf09bc0ccd397c
--- /dev/null
+++ b/arch/arm/src/lpc43xx/lpc43_wwdt.c
@@ -0,0 +1,662 @@
+/****************************************************************************
+ * arch/arm/src/lpc43xx/lpc43_wwdt.c
+ *
+ * Copyright (C) 2012, 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 "up_arch.h"
+#include "lpc43_wdt.h"
+#include "chip/lpc43_wwdt.h"
+
+#if defined(CONFIG_WATCHDOG) && defined(CONFIG_LPC43_WWDT)
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+/* Clocking *****************************************************************/
+
+#define WWDT_FREQ 3000000 /* Watchdog clock is IRC 12MHz, but
+ * it has fixed divider by 4 */
+#define LPC43_MAX_WWDT_TC 0xFFFFFF /* 24-bit counter max value */
+#define LPC43_MIN_WWDT_TC 0xFF /* 8-bit counter min value */
+#define LPC43_MAX_WWDT_WINDOW 0xFFFFFF /* 24-bit max value */
+#define LPC43_MIN_WWDT_WINDOW 0x100 /* Minimum window value allowed */
+#define WWDT_WARNINT_VALUE 0x3FF /* 10-bit max value */
+#define WWDT_MAXTIMEOUT 5592 /* Max timeout value in miliseconds */
+
+/* Configuration ************************************************************/
+
+#ifndef CONFIG_LPC43_WWDT_DEFTIMOUT
+# define CONFIG_LPC43_WWDT_DEFTIMOUT WWDT_MAXTIMEOUT
+#endif
+
+/****************************************************************************
+ * Private Types
+ ****************************************************************************/
+
+/* This structure provides the private representation of the "lower-half"
+ * driver state structure. This structure must be cast-compatible with the
+ * well-known watchdog_lowerhalf_s structure.
+ */
+
+struct lpc43_lowerhalf_wwdt_s
+{
+ FAR const struct watchdog_ops_s *ops; /* Lower half operations */
+ xcpt_t handler; /* Current watchdog interrupt handler */
+ uint32_t timeout; /* The actual timeout value */
+ bool started; /* The timer has been started */
+ uint32_t reload; /* The 24-bit reload field reset value */
+};
+
+/****************************************************************************
+ * Private Function Prototypes
+ ****************************************************************************/
+
+static void lpc43_setwindow(uint32_t window);
+static void lpc43_setwarning(uint32_t warning);
+
+/* Interrupt hanlding *******************************************************/
+
+static int lpc43_interrupt(int irq, FAR void *context);
+
+/* "Lower half" driver methods **********************************************/
+
+static int lpc43_start(FAR struct watchdog_lowerhalf_s *lower);
+static int lpc43_stop(FAR struct watchdog_lowerhalf_s *lower);
+static int lpc43_keepalive(FAR struct watchdog_lowerhalf_s *lower);
+static int lpc43_getstatus(FAR struct watchdog_lowerhalf_s *lower,
+ FAR struct watchdog_status_s *status);
+static int lpc43_settimeout(FAR struct watchdog_lowerhalf_s *lower,
+ uint32_t timeout);
+static xcpt_t lpc43_capture(FAR struct watchdog_lowerhalf_s *lower,
+ xcpt_t handler);
+static int lpc43_ioctl(FAR struct watchdog_lowerhalf_s *lower, int cmd,
+ unsigned long arg);
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/* "Lower half" driver methods */
+
+static const struct watchdog_ops_s g_wdgops =
+{
+ .start = lpc43_start,
+ .stop = lpc43_stop,
+ .keepalive = lpc43_keepalive,
+ .getstatus = lpc43_getstatus,
+ .settimeout = lpc43_settimeout,
+ .capture = lpc43_capture,
+ .ioctl = lpc43_ioctl,
+};
+
+/* "Lower half" driver state */
+
+static struct lpc43_lowerhalf_wwdt_s g_wdgdev;
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: lpc43_setwindow
+ *
+ * Description:
+ * The window register determines the highest timeout value allowed when a
+ * watchdog feed is performed. If a feed valid sequence completes prior to
+ * timeout value reaching the value in window, a watchdog event will occur.
+ *
+ * window resets to the maximum possible timeout value, so windowing is not
+ * in effect. Values of window below 0x100 will make it impossible to ever
+ * feed the watchdog successfully
+ *
+ ****************************************************************************/
+
+static void lpc43_setwindow(uint32_t window)
+{
+ /* WWDT window minimum value limiting */
+
+ if (window < 0x100)
+ {
+ window = 0x100;
+ }
+
+ putreg32(window, LPC43_WWDT_WINDOW);
+}
+
+/****************************************************************************
+ * Name: lpc43_setwarning
+ *
+ * Description:
+ * The WDWARNINT register determines the watchdog timer counter value that
+ * will generate a watchdog interrupt. When the watchdog timer counter
+ * matches the value defined by WDWARNINT, an interrupt will be generated
+ * after the subsequent WDCLK. A match of the watchdog timer counter to
+ * WDWARNINT occurs when the bottom 10 bits of the counter have the same
+ * value as the 10 bits of WARNINT, and the remaining upper bits of the
+ * counter are all 0. This gives a maximum time of 1,023 watchdog timer
+ * counts (4,096 watchdog clocks) for the interrupt to occur prior to a
+ * watchdog event. If WDWARNINT is set to 0, the interrupt will occur at
+ * the same time as the watchdog event.
+ *
+ ****************************************************************************/
+
+static void lpc43_setwarning(uint32_t warning)
+{
+ /* WWDT warning maximum value limiting */
+
+ if (warning > 0x3FF)
+ {
+ warning = 0x3FF;
+ }
+
+ putreg32(warning, LPC43_WWDT_WARNINT);
+}
+
+/****************************************************************************
+ * Name: lpc43_interrupt
+ *
+ * Description:
+ * WWDT warning interrupt
+ *
+ * Input Parameters:
+ * Usual interrupt handler arguments.
+ *
+ * Returned Values:
+ * Always returns OK.
+ *
+ ****************************************************************************/
+
+static int lpc43_interrupt(int irq, FAR void *context)
+{
+ FAR struct lpc43_lowerhalf_wwdt_s *priv = &g_wdgdev;
+ uint32_t regval;
+
+ /* Check if the watchdog warning interrupt is really pending */
+
+ regval = getreg32(LPC43_WWDT_MOD);
+ if ((regval & WWDT_MOD_WDINT) != 0)
+ {
+ /* Is there a registered handler? */
+
+ if (priv->handler)
+ {
+ /* Yes... NOTE: This interrupt service routine (ISR) must reload
+ * the WWDT counter to prevent the reset. Otherwise, we will
+ * reset upon return.
+ */
+
+ priv->handler(irq, context);
+ }
+
+ /* The watchdog interrupt flag is cleared by writing '1' to the WDINT
+ * bit in the WDMOD register.
+ */
+
+ regval |= WWDT_MOD_WDINT;
+ putreg32(regval, LPC43_WWDT_MOD);
+ }
+
+ return OK;
+}
+
+/****************************************************************************
+ * Name: lpc43_start
+ *
+ * Description:
+ * Start the watchdog timer, resetting the time to the current timeout,
+ *
+ * Input Parameters:
+ * lower - A pointer the publicly visible representation of the
+ * "lower-half" driver state structure.
+ *
+ * Returned Values:
+ * Zero on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+static int lpc43_start(FAR struct watchdog_lowerhalf_s *lower)
+{
+ FAR struct lpc43_lowerhalf_wwdt_s *priv =
+ (FAR struct lpc43_lowerhalf_wwdt_s *)lower;
+
+ wdinfo("Entry\n");
+ DEBUGASSERT(priv);
+
+ /* The watchdog is always disabled after a reset. It is enabled by setting
+ * the WDEN bit in the WDMOD register, then it cannot be disabled again
+ * except by a reset.
+ *
+ * Watchdog is enabled and will reset the chip
+ */
+
+ putreg32(WWDT_MOD_WDEN | WWDT_MOD_WDRESET , LPC43_WWDT_MOD);
+
+ /* Feed the watchdog to enable it */
+
+ putreg32(0xAA, LPC43_WWDT_FEED);
+ putreg32(0x55, LPC43_WWDT_FEED);
+
+ priv->started = true;
+ return OK;
+}
+
+/****************************************************************************
+ * Name: lpc43_stop
+ *
+ * Description:
+ * Stop the watchdog timer
+ *
+ * Input Parameters:
+ * lower - A pointer the publicly visible representation of the "lower-half"
+ * driver state structure.
+ *
+ * Returned Values:
+ * Zero on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+static int lpc43_stop(FAR struct watchdog_lowerhalf_s *lower)
+{
+
+ /* The watchdog is always disabled after a reset. It is enabled by setting
+ * the WDEN bit in the WDMOD register, then it cannot be disabled again
+ * except by a reset.
+ */
+
+ wdinfo("Entry\n");
+ return -ENOSYS;
+}
+
+/****************************************************************************
+ * Name: lpc43_keepalive
+ *
+ * Description:
+ * Reset the watchdog timer to the current timeout value, prevent any
+ * imminent watchdog timeouts. This is sometimes referred as "pinging"
+ * the watchdog timer or "feeding the dog".
+ *
+ * The application program must write in the FEED register at regular
+ * intervals during normal operation to prevent an MCU reset. This operation
+ * must occur only when the counter value is lower than the window register
+ * value.
+ *
+ * Input Parameters:
+ * lower - A pointer the publicly visible representation of the "lower-half"
+ * driver state structure.
+ *
+ * Returned Values:
+ * Zero on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+static int lpc43_keepalive(FAR struct watchdog_lowerhalf_s *lower)
+{
+ FAR struct lpc43_lowerhalf_wwdt_s *priv =
+ (FAR struct lpc43_lowerhalf_wwdt_s *)lower;
+
+ wdinfo("Entry\n");
+ DEBUGASSERT(priv);
+
+ /* Feed the watchdog */
+
+ putreg32(0xAA, LPC43_WWDT_FEED);
+ putreg32(0x55, LPC43_WWDT_FEED);
+
+ return OK;
+}
+
+/****************************************************************************
+ * Name: lpc43_getstatus
+ *
+ * Description:
+ * Get the current watchdog timer status
+ *
+ * Input Parameters:
+ * lower - A pointer the publicly visible representation of the "lower-half"
+ * driver state structure.
+ * status - The location to return the watchdog status information.
+ *
+ * Returned Values:
+ * Zero on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+static int lpc43_getstatus(FAR struct watchdog_lowerhalf_s *lower,
+ FAR struct watchdog_status_s *status)
+{
+ FAR struct lpc43_lowerhalf_wwdt_s *priv =
+ (FAR struct lpc43_lowerhalf_wwdt_s *)lower;
+ uint32_t elapsed;
+ uint32_t reload;
+
+ wdinfo("Entry\n");
+ DEBUGASSERT(priv);
+
+ /* Return the status bit */
+
+ status->flags = WDFLAGS_RESET;
+ if (priv->started)
+ {
+ status->flags |= WDFLAGS_ACTIVE;
+ }
+
+ if (priv->handler)
+ {
+ status->flags |= WDFLAGS_CAPTURE;
+ }
+
+ /* Return the actual timeout is milliseconds */
+
+ status->timeout = priv->timeout;
+
+ /* Get the time remaining until the watchdog expires (in milliseconds) */
+
+
+ reload = getreg32(LPC43_WWDT_TC);
+ elapsed = priv->reload - reload;
+ status->timeleft = (priv->timeout * elapsed) / (priv->reload + 1);
+
+ wdinfo("Status :\n");
+ wdinfo(" flags : %08x\n", status->flags);
+ wdinfo(" timeout : %d\n", status->timeout);
+ wdinfo(" timeleft : %d\n", status->flags);
+ return OK;
+}
+
+/****************************************************************************
+ * Name: lpc43_settimeout
+ *
+ * Description:
+ * Set a new timeout value (and reset the watchdog timer)
+ *
+ * Input Parameters:
+ * lower - A pointer the publicly visible representation of the
+ * "lower-half" driver state structure.
+ * timeout - The new timeout value in milliseconds.
+ *
+ * Returned Values:
+ * Zero on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+static int lpc43_settimeout(FAR struct watchdog_lowerhalf_s *lower,
+ uint32_t timeout)
+{
+ FAR struct lpc43_lowerhalf_wwdt_s *priv =
+ (FAR struct lpc43_lowerhalf_wwdt_s *)lower;
+ uint32_t reload;
+ uint32_t regval;
+
+ DEBUGASSERT(priv);
+ wdinfo("Entry: timeout=%d\n", timeout);
+
+ /* Can this timeout be represented? */
+
+ if (timeout < 1 || timeout > WWDT_MAXTIMEOUT)
+ {
+ wderr("ERROR: Cannot represent timeout=%d > %d\n",
+ timeout, WWDT_MAXTIMEOUT_MS);
+ return -ERANGE;
+ }
+
+ /* Determine timeout value */
+
+ reload = WWDT_FREQ/1000;
+ reload = timeout * reload;
+
+ /* Make sure that the final reload value is within range */
+
+ if (reload > LPC43_MAX_WWDT_TC)
+ {
+ reload = LPC43_MAX_WWDT_TC;
+ }
+
+ /* Save the actual timeout value in milliseconds*/
+
+ priv->timeout = timeout;
+
+ /* Remember the selected values */
+
+ priv->reload = reload;
+ wdinfo("reload=%d timout=%d\n", reload, priv->timeout);
+ regval = reload;
+ putreg32(regval, LPC43_WWDT_TC);
+
+ /* Reset the t window value to the maximum value.. essentially disabling
+ * the lower limit of the watchdog reset time.
+ */
+
+ lpc43_setwindow(LPC43_MAX_WWDT_WINDOW);
+
+ /* Set the warning interrupt register value */
+
+ lpc43_setwarning(WWDT_WARNINT_VALUE);
+ return OK;
+}
+
+/****************************************************************************
+ * Name: lpc43_capture
+ *
+ * Description:
+ * Don't reset on watchdog timer timeout; instead, call this user provider
+ * timeout handler. NOTE: Providing handler==NULL will restore the reset
+ * behavior.
+ *
+ * Input Parameters:
+ * lower - A pointer the publicly visible representation of the "lower-half"
+ * driver state structure.
+ * newhandler - The new watchdog expiration function pointer. If this
+ * function pointer is NULL, then the reset-on-expiration
+ * behavior is restored,
+ *
+ * Returned Values:
+ * The previous watchdog expiration function pointer or NULL is there was
+ * no previous function pointer, i.e., if the previous behavior was
+ * reset-on-expiration (NULL is also returned if an error occurs).
+ *
+ ****************************************************************************/
+
+static xcpt_t lpc43_capture(FAR struct watchdog_lowerhalf_s *lower,
+ xcpt_t handler)
+{
+ FAR struct lpc43_lowerhalf_wwdt_s *priv =
+ (FAR struct lpc43_lowerhalf_wwdt_s *)lower;
+ irqstate_t flags;
+ xcpt_t oldhandler;
+ uint16_t regval;
+
+ DEBUGASSERT(priv);
+ wdinfo("Entry: handler=%p\n", handler);
+
+ /* Get the old handler return value */
+
+ flags = enter_critical_section();
+ oldhandler = priv->handler;
+
+ /* Save the new handler */
+
+ priv->handler = handler;
+
+ /* Are we attaching or detaching the handler? */
+
+ regval = getreg32(LPC43_WWDT_MOD);
+ if (handler)
+ {
+ /* Attaching... Enable the watchdog interrupt */
+
+ regval |= WWDT_MOD_WDINT;
+ putreg32(regval, LPC43_WWDT_MOD);
+
+ up_enable_irq(LPC43M4_IRQ_WWDT);
+ }
+ else
+ {
+ /* Detaching... Disable the EWI interrupt */
+
+ regval &= ~WWDT_MOD_WDINT;
+ putreg32(regval, LPC43_WWDT_MOD);
+
+ up_disable_irq(LPC43M4_IRQ_WWDT);
+ }
+
+ leave_critical_section(flags);
+ return oldhandler;
+}
+
+/****************************************************************************
+ * Name: lp43_ioctl
+ *
+ * Description:
+ * Any ioctl commands that are not recognized by the "upper-half" driver
+ * are forwarded to the lower half driver through this method.
+ *
+ * Input Parameters:
+ * lower - A pointer the publicly visible representation of the "lower-half"
+ * driver state structure.
+ * cmd - The ioctl command value
+ * arg - The optional argument that accompanies the 'cmd'. The
+ * interpretation of this argument depends on the particular
+ * command.
+ *
+ * Returned Values:
+ * Zero on success; a negated errno value on failure.
+ *
+ ****************************************************************************/
+
+static int lpc43_ioctl(FAR struct watchdog_lowerhalf_s *lower, int cmd,
+ unsigned long arg)
+{
+ FAR struct lpc43_lowerhalf_wwdt_s *priv =
+ (FAR struct lpc43_lowerhalf_wwdt_s *)lower;
+ int ret = -ENOTTY;
+
+ DEBUGASSERT(priv);
+ wdinfo("Entry: cmd=%d arg=%ld\n", cmd, arg);
+
+ /* WDIOC_MINTIME: Set the minimum ping time. If two keepalive ioctls
+ * are received within this time, a reset event will be generated.
+ * Argument: A 32-bit time value in milliseconds.
+ */
+
+ if (cmd == WDIOC_MINTIME)
+ {
+ uint32_t mintime = (uint32_t)arg;
+
+ /* The minimum time should be strictly less than the total delay
+ * which, in turn, will be less than or equal to LPC43_MAX_WWDT_TC
+ */
+
+ ret = -EINVAL;
+ if (mintime < priv->timeout)
+ {
+ uint32_t window = mintime*WWDT_FREQ/1000;
+ DEBUGASSERT(window < priv->reload);
+ lpc43_setwindow( window );
+ ret = OK;
+ }
+ }
+
+ return ret;
+}
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: lpc43_wwdginitialize
+ *
+ * Description:
+ * Initialize the WWDT watchdog time. The watchdog timer is initialized and
+ * registers as 'devpath. The initial state of the watchdog time is
+ * disabled.
+ *
+ * Input Parameters:
+ * devpath - The full path to the watchdog. This should be of the form
+ * /dev/watchdog0
+ *
+ * Returned Values:
+ * None
+ *
+ ****************************************************************************/
+
+void lpc43_wwdginitialize(FAR const char *devpath)
+{
+ FAR struct lpc43_lowerhalf_wwdt_s *priv = &g_wdgdev;
+
+ wdinfo("Entry: devpath=%s\n", devpath);
+
+ /* Initialize the driver state structure. Here we assume: (1) the state
+ * structure lies in .bss and was zeroed at reset time. (2) This function
+ * is only called once so it is never necessary to re-zero the structure.
+ */
+
+ priv->ops = &g_wdgops;
+
+ /* Set watchdog mode register to zero */
+
+ putreg32(0, LPC43_WWDT_MOD);
+
+ /* Attach our watchdog interrupt handler (But don't enable it yet) */
+
+ (void)irq_attach(LPC43M4_IRQ_WWDT, lpc43_interrupt);
+
+ /* Select an arbitrary initial timeout value. But don't start the watchdog
+ * yet. NOTE: If the "Hardware watchdog" feature is enabled through the
+ * device option bits, the watchdog is automatically enabled at power-on.
+ */
+
+ lpc43_settimeout((FAR struct watchdog_lowerhalf_s *)priv,
+ CONFIG_LPC43_WWDT_DEFTIMOUT);
+
+ /* Register the watchdog driver as /dev/watchdog0 */
+
+ (void)watchdog_register(devpath, (FAR struct watchdog_lowerhalf_s *)priv);
+}
+
+#endif /* CONFIG_WATCHDOG && CONFIG_LPC43_WWDT */
diff --git a/arch/arm/src/lpc54xx/Kconfig b/arch/arm/src/lpc54xx/Kconfig
new file mode 100644
index 0000000000000000000000000000000000000000..bc77fb071992cfa6024976919edebd97e1ddb5e3
--- /dev/null
+++ b/arch/arm/src/lpc54xx/Kconfig
@@ -0,0 +1,1043 @@
+#
+# For a description of the syntax of this configuration file,
+# see the file kconfig-language.txt in the NuttX tools repository.
+#
+
+comment "LPC54xx Configuration Options"
+
+choice
+ prompt "LPC54XX Chip Selection"
+ default ARCH_CHIP_LPC54628
+ depends on ARCH_CHIP_LPC54XX
+
+config ARCH_CHIP_LPC54628
+ bool "LPC54628"
+ select ARCH_FAMILY_LPC546XX
+ select ARCH_LPC54_HAVE_FSUSB
+ select ARCH_LPC54_HAVE_HSUSB
+ select ARCH_LPC54_HAVE_ETHERNET
+ select ARCH_LPC54_HAVE_CAN20
+ select ARCH_LPC54_HAVE_CANFD
+ select ARCH_LPC54_HAVE_LCD
+ select ARCH_LPC54_HAVE_SHA
+
+config ARCH_CHIP_LPC54618
+ bool "LPC54618"
+ select ARCH_FAMILY_LPC546XX
+ select ARCH_LPC54_HAVE_FSUSB
+ select ARCH_LPC54_HAVE_HSUSB
+ select ARCH_LPC54_HAVE_ETHERNET
+ select ARCH_LPC54_HAVE_CAN20
+ select ARCH_LPC54_HAVE_CANFD
+ select ARCH_LPC54_HAVE_LCD
+
+config ARCH_CHIP_LPC54616
+ bool "LPC54616"
+ select ARCH_FAMILY_LPC546XX
+ select ARCH_LPC54_HAVE_FSUSB
+ select ARCH_LPC54_HAVE_HSUSB
+ select ARCH_LPC54_HAVE_ETHERNET
+ select ARCH_LPC54_HAVE_CAN20
+ select ARCH_LPC54_HAVE_CANFD
+
+config ARCH_CHIP_LPC54608
+ bool "LPC54608"
+ select ARCH_FAMILY_LPC546XX
+ select ARCH_LPC54_HAVE_FSUSB
+ select ARCH_LPC54_HAVE_ETHERNET
+ select ARCH_LPC54_HAVE_CAN20
+ select ARCH_LPC54_HAVE_LCD
+
+config ARCH_CHIP_LPC54607
+ bool "LPC54607"
+ select ARCH_FAMILY_LPC546XX
+ select ARCH_LPC54_HAVE_FSUSB
+ select ARCH_LPC54_HAVE_HSUSB
+ select ARCH_LPC54_HAVE_ETHERNET
+
+config ARCH_CHIP_LPC54606
+ bool "LPC54606"
+ select ARCH_FAMILY_LPC546XX
+ select ARCH_LPC54_HAVE_FSUSB
+ select ARCH_LPC54_HAVE_HSUSB
+ select ARCH_LPC54_HAVE_ETHERNET
+ select ARCH_LPC54_HAVE_CAN20
+
+config ARCH_CHIP_LPC54605
+ bool "LPC54605"
+ select ARCH_FAMILY_LPC546XX
+ select ARCH_LPC54_HAVE_FSUSB
+ select ARCH_LPC54_HAVE_HSUSB
+
+endchoice # LPC54XX Chip Selection
+
+# LPC54xx Families
+
+config ARCH_FAMILY_LPC546XX
+ bool
+ default n
+
+# Peripheral support
+
+config ARCH_LPC54_HAVE_FSUSB
+ bool
+ default n
+
+config ARCH_LPC54_HAVE_HSUSB
+ bool
+ default n
+
+config ARCH_LPC54_HAVE_ETHERNET
+ bool
+ default n
+
+config ARCH_LPC54_HAVE_CAN20
+ bool
+ default n
+
+config ARCH_LPC54_HAVE_CANFD
+ bool
+ default n
+
+config ARCH_LPC54_HAVE_LCD
+ bool
+ default n
+
+config ARCH_LPC54_HAVE_SHA
+ bool
+ default n
+
+# Peripheral Selection
+
+config LPC54_HAVE_I2C_MASTER
+ bool
+ default n
+
+config LPC54_HAVE_FLEXCOMM
+ bool
+ default n
+
+config LPC54_FLEXCOMM0
+ bool
+ default n
+ select LPC54_HAVE_FLEXCOMM
+
+config LPC54_FLEXCOMM1
+ bool
+ default n
+ select LPC54_HAVE_FLEXCOMM
+
+config LPC54_FLEXCOMM2
+ bool
+ default n
+ select LPC54_HAVE_FLEXCOMM
+
+config LPC54_FLEXCOMM3
+ bool
+ default n
+ select LPC54_HAVE_FLEXCOMM
+
+config LPC54_FLEXCOMM4
+ bool
+ default n
+ select LPC54_HAVE_FLEXCOMM
+
+config LPC54_FLEXCOMM5
+ bool
+ default n
+ select LPC54_HAVE_FLEXCOMM
+
+config LPC54_FLEXCOMM6
+ bool
+ default n
+ select LPC54_HAVE_FLEXCOMM
+
+config LPC54_FLEXCOMM7
+ bool
+ default n
+ select LPC54_HAVE_FLEXCOMM
+
+config LPC54_FLEXCOMM8
+ bool
+ default n
+ select LPC54_HAVE_FLEXCOMM
+
+config LPC54_FLEXCOMM9
+ bool
+ default n
+ select LPC54_HAVE_FLEXCOMM
+
+config LPC54_HAVE_SPI_MASTER
+ bool
+ default n
+
+config LPC54_HAVE_USART
+ bool
+ default n
+
+menu "LPC54xx Peripheral Selection"
+
+config LPC54_DMA
+ bool "DMA"
+ default n
+ select ARCH_DMA
+ depends on EXPERIMENTAL
+
+menu "Flexcomm Peripherals"
+
+config LPC54_I2C0_MASTER
+ bool "I2C0 Master"
+ default n
+ select LPC54_FLEXCOMM0
+ select LPC54_HAVE_I2C_MASTER
+
+config LPC54_I2C1_MASTER
+ bool "I2C1 Master"
+ default n
+ select LPC54_FLEXCOMM1
+ select LPC54_HAVE_I2C_MASTER
+
+config LPC54_I2C2_MASTER
+ bool "I2C2 Master"
+ default n
+ select LPC54_FLEXCOMM2
+ select LPC54_HAVE_I2C_MASTER
+
+config LPC54_I2C3_MASTER
+ bool "I2C3 Master"
+ default n
+ select LPC54_FLEXCOMM3
+ select LPC54_HAVE_I2C_MASTER
+
+config LPC54_I2C4_MASTER
+ bool "I2C4 Master"
+ default n
+ select LPC54_FLEXCOMM4
+ select LPC54_HAVE_I2C_MASTER
+
+config LPC54_I2C5_MASTER
+ bool "I2C5 Master"
+ default n
+ select LPC54_FLEXCOMM5
+ select LPC54_HAVE_I2C_MASTER
+
+config LPC54_I2C6_MASTER
+ bool "I2C6 Master"
+ default n
+ select LPC54_FLEXCOMM6
+ select LPC54_HAVE_I2C_MASTER
+
+config LPC54_I2C7_MASTER
+ bool "I2C7 Master"
+ default n
+ select LPC54_FLEXCOMM7
+ select LPC54_HAVE_I2C_MASTER
+
+config LPC54_I2C8_MASTER
+ bool "I2C8 Master"
+ default n
+ select LPC54_FLEXCOMM8
+ select LPC54_HAVE_I2C_MASTER
+
+config LPC54_I2C9_MASTER
+ bool "I2C9 Master"
+ default n
+ select LPC54_FLEXCOMM9
+ select LPC54_HAVE_I2C_MASTER
+
+config LPC54_SPI0_MASTER
+ bool "SPI0 Master"
+ default n
+ depends on !LPC54_I2C0_MASTER && EXPERIMENTAL
+ select LPC54_FLEXCOMM0
+ select LPC54_HAVE_SPI_MASTER
+
+config LPC54_SPI1_MASTER
+ bool "SPI1 Master"
+ default n
+ depends on !LPC54_I2C1_MASTER && EXPERIMENTAL
+ select LPC54_FLEXCOMM1
+ select LPC54_HAVE_SPI_MASTER
+
+config LPC54_SPI2_MASTER
+ bool "SPI2 Master"
+ default n
+ depends on !LPC54_I2C2_MASTER && EXPERIMENTAL
+ select LPC54_FLEXCOMM2
+ select LPC54_HAVE_SPI_MASTER
+
+config LPC54_SPI3_MASTER
+ bool "SPI3 Master"
+ default n
+ depends on !LPC54_I2C3_MASTER && EXPERIMENTAL
+ select LPC54_FLEXCOMM3
+ select LPC54_HAVE_SPI_MASTER
+
+config LPC54_SPI4_MASTER
+ bool "SPI4 Master"
+ default n
+ depends on !LPC54_I2C4_MASTER && EXPERIMENTAL
+ select LPC54_FLEXCOMM4
+ select LPC54_HAVE_SPI_MASTER
+
+config LPC54_SPI5_MASTER
+ bool "SPI5 Master"
+ default n
+ depends on !LPC54_I2C5_MASTER && EXPERIMENTAL
+ select LPC54_FLEXCOMM5
+ select LPC54_HAVE_SPI_MASTER
+
+config LPC54_SPI6_MASTER
+ bool "SPI6 Master"
+ default n
+ depends on !LPC54_I2C6_MASTER && EXPERIMENTAL
+ select LPC54_FLEXCOMM6
+ select LPC54_HAVE_SPI_MASTER
+
+config LPC54_SPI7_MASTER
+ bool "SPI7 Master"
+ default n
+ depends on !LPC54_I2C7_MASTER && EXPERIMENTAL
+ select LPC54_FLEXCOMM7
+ select LPC54_HAVE_SPI_MASTER
+
+config LPC54_SPI8_MASTER
+ bool "SPI8 Master"
+ default n
+ depends on !LPC54_I2C8_MASTER && EXPERIMENTAL
+ select LPC54_FLEXCOMM8
+ select LPC54_HAVE_SPI_MASTER
+
+config LPC54_SPI9_MASTER
+ bool "SPI9 Master"
+ default n
+ depends on !LPC54_I2C9_MASTER && EXPERIMENTAL
+ select LPC54_FLEXCOMM9
+ select LPC54_HAVE_SPI_MASTER
+
+config LPC54_USART0
+ bool "USART0"
+ default n
+ depends on !LPC54_I2C0_MASTER && !LPC54_SPI0_MASTER
+ select LPC54_FLEXCOMM0
+ select USART0_SERIALDRIVER
+ select LPC54_HAVE_USART
+
+config LPC54_USART1
+ bool "USART1"
+ default n
+ depends on !LPC54_I2C1_MASTER && !LPC54_SPI1_MASTER
+ select LPC54_FLEXCOMM1
+ select USART1_SERIALDRIVER
+ select LPC54_HAVE_USART
+
+config LPC54_USART2
+ bool "USART2"
+ default n
+ depends on !LPC54_I2C2_MASTER && !LPC54_SPI2_MASTER
+ select LPC54_FLEXCOMM2
+ select USART2_SERIALDRIVER
+ select LPC54_HAVE_USART
+
+config LPC54_USART3
+ bool "USART3"
+ default n
+ depends on !LPC54_I2C3_MASTER && !LPC54_SPI3_MASTER
+ select LPC54_FLEXCOMM3
+ select USART3_SERIALDRIVER
+ select LPC54_HAVE_USART
+
+config LPC54_USART4
+ bool "USART4"
+ default n
+ depends on !LPC54_I2C4_MASTER && !LPC54_SPI4_MASTER
+ select LPC54_FLEXCOMM4
+ select USART4_SERIALDRIVER
+ select LPC54_HAVE_USART
+
+config LPC54_USART5
+ bool "USART5"
+ default n
+ depends on !LPC54_I2C5_MASTER && !LPC54_SPI5_MASTER
+ select LPC54_FLEXCOMM5
+ select USART5_SERIALDRIVER
+ select LPC54_HAVE_USART
+
+config LPC54_USART6
+ bool "USART6"
+ default n
+ depends on !LPC54_I2C6_MASTER && !LPC54_SPI6_MASTER
+ select LPC54_FLEXCOMM6
+ select USART6_SERIALDRIVER
+ select LPC54_HAVE_USART
+
+config LPC54_USART7
+ bool "USART7"
+ default n
+ depends on !LPC54_I2C7_MASTER && !LPC54_SPI7_MASTER
+ select LPC54_FLEXCOMM7
+ select USART7_SERIALDRIVER
+ select LPC54_HAVE_USART
+
+config LPC54_USART8
+ bool "USART8"
+ default n
+ depends on !LPC54_I2C8_MASTER && !LPC54_SPI8_MASTER
+ select LPC54_FLEXCOMM8
+ select USART8_SERIALDRIVER
+ select LPC54_HAVE_USART
+
+config LPC54_USART9
+ bool "USART9"
+ default n
+ depends on !LPC54_I2C9_MASTER && !LPC54_SPI9_MASTER
+ select LPC54_FLEXCOMM9
+ select USART9_SERIALDRIVER
+ select LPC54_HAVE_USART
+
+endmenu # Flexcomm Peripherals
+
+config LPC54_EMC
+ bool "External Memory Controller (EMC)"
+ default n
+
+config LPC54_ETHERNET
+ bool "Ethernet"
+ default n
+ select NETDEVICES
+ select ARCH_HAVE_PHY
+
+config LPC54_LCD
+ bool "LCD controller"
+ default n
+ depends on ARCH_LPC54_HAVE_LCD
+
+config LPC54_RNG
+ bool "Random Number Generator (RNG)"
+ default n
+ select ARCH_HAVE_RNG
+
+config LPC54_RTC
+ bool "Real Time Clock (RTC)"
+ default n
+ select RTC
+
+config LPC54_SDMMC
+ bool "SD/MMC"
+ default n
+ select ARCH_HAVE_SDIO
+ depends on EXPERIMENTAL
+
+config LPC54_WWDT
+ bool "Windowing Watchdog Timer (WWDT)"
+ default n
+ depends on EXPERIMENTAL
+
+endmenu # LPC54xx Peripheral Selection
+
+menu "GPIO Interrupt Configuration"
+
+config LPC54_GPIOIRQ
+ bool "Support GPIO Interrupts"
+ default n
+
+config LPC54_GPIOIRQ_GROUPS
+ bool "Support GPIO Interrupt groups"
+ default n
+ depends on LPC54_GPIOIRQ && EXPERIMENTAL
+
+endmenu # GPIO Interrupt Configuration
+
+menu "EMC Configuration"
+depends on LPC54_EMC
+
+config LPC54_EMC_STATIC
+ bool "EMC static memory support"
+ default n
+
+if LPC54_EMC_STATIC
+
+config LPC54_EMC_STATIC_CS0
+ bool "SRAM on CS0"
+ default n
+
+if LPC54_EMC_STATIC_CS0
+
+config LPC54_EMC_STATIC_CS0_OFFSET
+ hex "Heap offset"
+ default 0x0
+ ---help---
+ May be used to reserve memory at the beginning of SRAM for other
+ usage.
+
+config LPC54_EMC_STATIC_CS0_SIZE
+ hex "SRAM size"
+ default 0x0
+ ---help---
+ Total amount of RAM (after the heap offset) that will be added to
+ the heap. The may be zero, in which case none of the SRAM will be
+ added to heap, it may be less than the size of heap if memory of
+ reserved at the beginning or end of the SRAM form other purpose, or
+ it may be the full SRAM size to add the entire SRAM to the heap
+
+endif # LPC54_EMC_STATIC_CS0
+
+config LPC54_EMC_STATIC_CS1
+ bool "SRAM on CS1"
+ default n
+
+if LPC54_EMC_STATIC_CS1
+
+config LPC54_EMC_STATIC_CS1_OFFSET
+ hex "Heap offset"
+ default 0x0
+ ---help---
+ May be used to reserve memory at the beginning of SRAM for other
+ usage.
+
+config LPC54_EMC_STATIC_CS1_SIZE
+ hex "Heap size"
+ default 0x0
+ ---help---
+ Total amount of RAM (after the heap offset) that will be added to
+ the heap. The may be zero, in which case none of the SRAM will be
+ added to heap, it may be less than the size of heap if memory of
+ reserved at the beginning or end of the SRAM form other purpose, or
+ it may be the full SRAM size to add the entire SRAM to the heap
+
+endif # LPC54_EMC_STATIC_CS1
+
+config LPC54_EMC_STATIC_CS2
+ bool "SRAM on CS2"
+ default n
+
+if LPC54_EMC_STATIC_CS2
+
+config LPC54_EMC_STATIC_CS2_OFFSET
+ hex "Heap offset"
+ default 0x0
+ ---help---
+ May be used to reserve memory at the beginning of SRAM for other
+ usage.
+
+config LPC54_EMC_STATIC_CS2_SIZE
+ hex "Heap size"
+ default 0x0
+ ---help---
+ Total amount of RAM (after the heap offset) that will be added to
+ the heap. The may be zero, in which case none of the SRAM will be
+ added to heap, it may be less than the size of heap if memory of
+ reserved at the beginning or end of the SRAM form other purpose, or
+ it may be the full SRAM size to add the entire SRAM to the heap
+
+endif # LPC54_EMC_STATIC_CS2
+
+config LPC54_EMC_STATIC_CS3
+ bool "SRAM on CS3"
+ default n
+
+if LPC54_EMC_STATIC_CS3
+
+config LPC54_EMC_STATIC_CS3_OFFSET
+ hex "Heap offset"
+ default 0x0
+ ---help---
+ May be used to reserve memory at the beginning of SRAM for other
+ usage.
+
+config LPC54_EMC_STATIC_CS3_SIZE
+ hex "Heap size"
+ default 0x0
+ ---help---
+ Total amount of RAM (after the heap offset) that will be added to
+ the heap. The may be zero, in which case none of the SRAM will be
+ added to heap, it may be less than the size of heap if memory of
+ reserved at the beginning or end of the SRAM form other purpose, or
+ it may be the full SRAM size to add the entire SRAM to the heap
+
+endif # LPC54_EMC_STATIC_CS3
+endif # LPC54_EMC_STATIC
+
+config LPC54_EMC_DYNAMIC
+ bool "EMC dynamic memory support"
+ default y
+
+if LPC54_EMC_DYNAMIC
+
+config LPC54_EMC_DYNAMIC_CS0
+ bool "SDRAM on CS0"
+ default n
+
+if LPC54_EMC_DYNAMIC_CS0
+
+config LPC54_EMC_DYNAMIC_CS0_OFFSET
+ hex "Heap offset"
+ default 0x0
+ ---help---
+ May be used to reserve memory at the beginning of SDRAM for other
+ usage.
+
+config LPC54_EMC_DYNAMIC_CS0_SIZE
+ hex "Heap size"
+ default 0x0
+ ---help---
+ Total amount of RAM (after the heap offset) that will be added to
+ the heap. The may be zero, in which case none of the SDRAM will be
+ added to heap, it may be less than the size of heap if memory of
+ reserved at the beginning or end of the SDRAM form other purpose, or
+ it may be the full SDRAM size to add the entire SDRAM to the heap
+
+endif # LPC54_EMC_DYNAMIC_CS0
+
+config LPC54_EMC_DYNAMIC_CS1
+ bool "SDRAM on CS1"
+ default n
+
+if LPC54_EMC_DYNAMIC_CS1
+
+config LPC54_EMC_DYNAMIC_CS1_OFFSET
+ hex "Heap offset"
+ default 0x0
+ ---help---
+ May be used to reserve memory at the beginning of SDRAM for other
+ usage.
+
+config LPC54_EMC_DYNAMIC_CS1_SIZE
+ hex "Heap size"
+ default 0x0
+ ---help---
+ Total amount of RAM (after the heap offset) that will be added to
+ the heap. The may be zero, in which case none of the SDRAM will be
+ added to heap, it may be less than the size of heap if memory of
+ reserved at the beginning or end of the SDRAM form other purpose, or
+ it may be the full SDRAM size to add the entire SDRAM to the heap
+
+endif # LPC54_EMC_DYNAMIC_CS1
+
+config LPC54_EMC_DYNAMIC_CS2
+ bool "SDRAM on CS2"
+ default n
+
+if LPC54_EMC_DYNAMIC_CS2
+
+config LPC54_EMC_DYNAMIC_CS2_OFFSET
+ hex "Heap offset"
+ default 0x0
+ ---help---
+ May be used to reserve memory at the beginning of SDRAM for other
+ usage.
+
+config LPC54_EMC_DYNAMIC_CS2_SIZE
+ hex "Heap size"
+ default 0x0
+ ---help---
+ Total amount of RAM (after the heap offset) that will be added to
+ the heap. The may be zero, in which case none of the SDRAM will be
+ added to heap, it may be less than the size of heap if memory of
+ reserved at the beginning or end of the SDRAM form other purpose, or
+ it may be the full SDRAM size to add the entire SDRAM to the heap
+
+endif # LPC54_EMC_DYNAMIC_CS2
+
+config LPC54_EMC_DYNAMIC_CS3
+ bool "SDRAM on CS3"
+ default n
+
+if LPC54_EMC_DYNAMIC_CS3
+
+config LPC54_EMC_DYNAMIC_CS3_OFFSET
+ hex "Heap offset"
+ default 0x0
+ ---help---
+ May be used to reserve memory at the beginning of SDRAM for other
+ usage.
+
+config LPC54_EMC_DYNAMIC_CS3_SIZE
+ hex "Heap size"
+ default 0x0
+ ---help---
+ Total amount of RAM (after the heap offset) that will be added to
+ the heap. The may be zero, in which case none of the SDRAM will be
+ added to heap, it may be less than the size of heap if memory of
+ reserved at the beginning or end of the SDRAM form other purpose, or
+ it may be the full SDRAM size to add the entire SDRAM to the heap
+
+endif # LPC54_EMC_DYNAMIC_CS3
+endif # LPC54_EMC_DYNAMIC
+
+endmenu # EMC Configuration
+
+menu "Ethernet configuration"
+ depends on LPC54_ETHERNET
+
+config LPC54_ETH_PHYADDR
+ int "PHY address"
+ default 1
+ ---help---
+ The 5-bit address of the PHY on the board. Default: 1
+
+config LPC54_ETH_MII
+ bool "Use MII interface"
+ default n
+ ---help---
+ Support Ethernet MII interface. Default: Use RMII interface.
+
+config LPC54_ETH_MULTIQUEUE
+ bool "IEEE 802.1q VLAN AVBTP support"
+ default n
+ depends on EXPERIMENTAL
+ ---help---
+ Enables software drivers for the special hardware support of
+ IEEE 802.1q VLAN Audio/Visual Bridge Types (AVBTP). In this
+ configuration two queues are available: One for normal traffic
+ and one dedicated to the AVBTP traffic.
+
+if LPC54_ETH_MULTIQUEUE
+
+config LPC54_ETH_BURSTLEN
+ int "DMA Tx burst length"
+ default 1
+ range 1 256
+ ---help---
+ Transmit programmable burst length. These bits indicate the maximum
+ number of beats to be transferred in one DMA data transfer. This is
+ the maximum value that is used in a single block read or write. The
+ DMA always attempts to burst as specified in PBL each time it starts
+ a burst transfer on the application bus. You can program PBL with
+ any of the following values: 1, 2, 4, 8, 16, 32, 64, 128, or 256.
+ Any other value results in undefined behavior.
+
+config LPC54_ETH_TXRR
+ bool "Tx round robin"
+ default y
+ ---help---
+ Selects round-robin Tx scheduling. The alternative is strict
+ priority scheduling.
+
+config LPC54_ETH_RXRR
+ bool "Rx round robin"
+ default y
+ ---help---
+ Selects round-robin Rx scheduling. The alternative is strict
+ priority scheduling.
+
+config LPC54_ETH_DYNAMICMAP
+ bool "Dynamic Rx queue mapping"
+ default n
+ ---help---
+ If selected, the received frame in in Rx Qn, n=0..1, maps to the DMA
+ channel m, m=0..1 related with the same MAC. Otherwise, static
+ mapping is used: The received fame in Rx Qn, n=0..1 maps directly
+ to DMA channel n.
+
+config LPC54_ETH_RXQ0WEIGHT
+ int "Rx queue 0 weight"
+ default 0
+ range 0 7
+
+config LPC54_ETH_RXQ1WEIGHT
+ int "Rx queue 1 weight"
+ default 0
+ range 0 7
+
+config LPC54_ETH_TXQ0WEIGHT
+ int "Tx queue 0 weight"
+ default 0
+ range 0 2097151
+
+config LPC54_ETH_TXQ1WEIGHT
+ int "Tx queue 1 weight"
+ default 0
+ range 0 2097151
+
+endif # LPC54_ETH_MULTIQUEUE
+
+config LPC54_ETH_TX_STRFWD
+ bool "Tx store and forward"
+ default n
+ ---help---
+ Transmission starts when a full packet resides in the MTL Tx Queue.
+ This disables the default Tx threshold controls.
+
+config LPC54_ETH_RX_STRFWD
+ bool "Rx store and forward"
+ default n
+ ---help---
+ Read packets from the Rx Queue only after the complete packet has
+ been written to it. By default, the Rx Queue operates in the
+ threshold (cut-through) mode.
+
+config LPC54_ETH_RX_PROMISCUOUS
+ bool "Enable Rx promiscuous mode"
+ default n
+ ---help---
+ If selected, the address filter module accepts all incoming frames
+ regardless of its destination or source address.
+
+config LPC54_ETH_RX_BROADCAST
+ bool "Enable Rx broadcast"
+ default y
+ ---help---
+ If selected, all received frames with a broadcast destination
+ address are accepted.
+
+config LPC54_ETH_RX_ALLMULTICAST
+ bool "Accept all multicast packets"
+ default y if NET_BROADCAST
+ default n if !NET_BROADCAST
+ ---help---
+ If selected, all received frames with a multicast destination
+ address (first bit in the destination address field is '1') are
+ accepted.
+
+ This feature will will be selected automatically if ICMPv6 or
+ IGMP are enabled. Unlike other Ethernet hardware, the LPC54xx
+ does not seem to support explicit Multicast address filtering
+ as needed for ICMPv6 and for IGMP. In these cases, I am simpl
+ accepting all multicast packets.
+
+config LPC54_ETH_FLOWCONTROL
+ bool "Enable flow control"
+ default n
+ ---help---
+ Enable TX and RX flow control.
+
+config LPC54_ETH_TX_PAUSETIME
+ int "Tx pause time"
+ default 0
+ range 0 65535
+ depends on LPC54_ETH_FLOWCONTROL
+ ---help---
+ Value to be used in the pause time field in the transmit control
+ frame.
+
+config LPC54_ETH_8023AS2K
+ bool "Enable 8023as support for 2K packets"
+ default n
+
+config LPC54_ETH_NRXDESC0
+ int "Number of Rx DMA descriptors (ch0)"
+ default 8
+ range 4 1024
+ ---help---
+ The number of Rx DMA descriptors to configure for Rx Channel 0. The
+ minimum is 4; the upper limit is 1024.
+
+ NOTE: Each Rx descriptor will require a receive buffer at the size
+ of the configured MTU.
+
+config LPC54_ETH_NRXDESC1
+ int "Number of Rx DMA descriptors (ch1)"
+ default 8
+ range 4 1024
+ depends on LPC54_ETH_MULTIQUEUE
+ ---help---
+ The number of Rx DMA descriptors to configure for Rx Channel 1. The
+ minimum is 4; the upper limit is 1024.
+
+ NOTE: Each Rx descriptor will require a receive buffer at the size
+ of the configured MTU.
+
+config LPC54_ETH_NTXDESC0
+ int "Number of Tx DMA descriptors (ch0)"
+ default 8
+ range 4 1024
+ ---help---
+ The number of Tx DMA descriptors to configure for Rx Channel 0. The
+ minimum is 4; the upper limit is 1024.
+
+ NOTE: Each Rx descriptor will require a transmit buffer at the size
+ of the configured MTU.
+
+config LPC54_ETH_NTXDESC1
+ int "Number of Tx DMA descriptors (ch1)"
+ default 8
+ range 4 1024
+ depends on LPC54_ETH_MULTIQUEUE
+ ---help---
+ The number of Tx DMA descriptors to configure for Rx Channel 1. The
+ minimum is 4; the upper limit is 1024.
+
+ NOTE: Each Rx descriptor will require a transmit buffer at the size
+ of the configured MTU.
+
+config LPC54_ETH_REGDEBUG
+ bool "Register level debug"
+ default n
+ depends on DEBUG_NET_INFO
+ ---help---
+ Output detailed register-level Ethernet debug information.
+
+endmenu # Ethernet configuration
+
+menu "SD/MMC Configuration"
+ depends on LPC54_SDMMC
+
+config LPC54_SDMMC_PWRCTRL
+ bool "Power-enable pin"
+ default n
+ ---help---
+ Select if the board supports a power-enable pin that must be selected
+ to provide power to the SD card.
+
+config LPC54_SDMMC_DMA
+ bool "Support DMA data transfers"
+ default y
+ select SDIO_DMA
+ ---help---
+ Support DMA data transfers.
+
+config LPC54_SDMMC_REGDEBUG
+ bool "Register level debug"
+ default n
+ depends on DEBUG_MEMCARD_INFO
+ ---help---
+ Output detailed register-level SD/MMC debug information.
+
+endmenu # SD/MMC Configuration
+
+menu "LCD Configuration"
+ depends on LPC54_LCD
+
+config LPC54_LCD_VRAMBASE
+ hex "Video RAM base address"
+ default 0xa0010000
+ ---help---
+ Base address of the video RAM frame buffer. The default is
+ (LPC54_EXTDRAM_CS0 + 0x00010000)
+
+config LPC54_LCD_USE_CLKIN
+ bool "Use optional input clock"
+ default n
+
+config LPC54_LCD_CLKIN_FREQUENCY
+ int "Input clock frequency"
+ default 0
+ depends on LPC54_LCD_USE_CLKIN
+
+config LPC54_LCD_REFRESH_FREQ
+ int "LCD refesh rate (Hz)"
+ default 50
+ ---help---
+ LCD refesh rate (Hz)
+
+config LPC54_LCD_BACKLIGHT
+ bool "Enable backlight"
+ default y
+ ---help---
+ Enable backlight support. If LPC54_LCD_BACKLIGHT is selected, then
+ the board-specific logic must provide this lpc54_backlight()
+ interface so that the LCD driver can turn the backlight on and off
+ as necessary. You should select this option and implement
+ lpc54_backlight() if your board provides GPIO control over the
+ backlight. This interface provides only ON/OFF control of the
+ backlight. If you want finer control over the backlight level (for
+ example, using PWM), then this interface would need to be extended.
+
+config LPC54_LCD_TFTPANEL
+ bool "TFT Panel"
+ default y
+ ---help---
+ TFT Panel vs. STN display. STN display panels require algorithmic
+ pixel pattern generation to provide pseudo gray scaling on
+ monochrome displays, or color creation on color displays. TFT
+ display panels require the digital color value of each pixel to be
+ applied to the display data inputs.
+
+config LPC54_LCD_MONOCHROME
+ bool "Monochrome LCD"
+ default n
+ depends on !LPC54_LCD_TFTPANEL
+ ---help---
+ STN LCD monochrome/color selection. Selects monochrome LCD. This
+ selection has no meaning for a TFT panel.
+
+choice
+ prompt "Bits per pixel"
+ default LPC54_LCD_BPP24 if LPC54_LCD_TFTPANEL
+ default LPC54_LCD_BPP16_565 if !LPC54_LCD_TFTPANEL
+
+config LPC54_LCD_BPP1
+ bool "1 BPP"
+ depends on LPC54_LCD_MONOCHROME
+
+config LPC54_LCD_BPP2
+ bool "2 BPP"
+ depends on LPC54_LCD_MONOCHROME
+
+config LPC54_LCD_BPP4
+ bool "4 BPP"
+ depends on LPC54_LCD_MONOCHROME
+
+config LPC54_LCD_BPP8
+ bool "8 BPP"
+ depends on LPC54_LCD_MONOCHROME
+
+config LPC54_LCD_BPP12_444
+ bool "12 bpp, 4:4:4 mode"
+ depends on !LPC54_LCD_MONOCHROME
+
+config LPC54_LCD_BPP16
+ bool "16 BPP"
+ depends on LPC54_LCD_MONOCHROME
+
+config LPC54_LCD_BPP16_565
+ bool "16 BPP, 5:6:5 mode"
+ depends on !LPC54_LCD_MONOCHROME
+
+config LPC54_LCD_BPP24
+ bool "24 BPP, 8:8:8 mode"
+ depends on LPC54_LCD_TFTPANEL
+
+endchoice
+
+config LPC54_LCD_BGR
+ bool "Blue-Green-Red color order"
+ default n
+ depends on !LPC54_LCD_MONOCHROME
+ ---help---
+ This option selects BGR color order vs. default RGB
+
+config LPC54_LCD_BACKCOLOR
+ hex "Initial background color"
+ default 0x0
+ ---help---
+ Initial background color
+
+config LPC54_LCD_HWIDTH
+ int "Display width (pixels)"
+ default 480
+ ---help---
+ Horizontal width the display in pixels
+
+config LPC54_LCD_HPULSE
+ int "Horizontal pulse"
+ default 2
+
+config LPC54_LCD_HFRONTPORCH
+ int "Horizontal front porch"
+ default 5
+
+config LPC54_LCD_HBACKPORCH
+ int "Horizontal back porch"
+ default 40
+
+config LPC54_LCD_VHEIGHT
+ int "Display height (rows)"
+ default 272
+ ---help---
+ Vertical height of the display in rows
+
+config LPC54_LCD_VPULSE
+ int "Vertical pulse"
+ default 2
+
+config LPC54_LCD_VFRONTPORCH
+ int "Vertical front porch"
+ default 8
+
+config LPC54_LCD_VBACKPORCH
+ int "Vertical back porch"
+ default 8
+
+endmenu # LCD Configuration
diff --git a/arch/arm/src/lpc54xx/Make.defs b/arch/arm/src/lpc54xx/Make.defs
new file mode 100644
index 0000000000000000000000000000000000000000..4ba8c0d6f8f3d21e02bbf01d3157ac8ee755a4a5
--- /dev/null
+++ b/arch/arm/src/lpc54xx/Make.defs
@@ -0,0 +1,149 @@
+############################################################################
+# arch/arm/src/lpc54xx/Make.defs
+#
+# Copyright (C) 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.
+#
+############################################################################
+
+HEAD_ASRC =
+
+CMN_ASRCS = up_saveusercontext.S up_fullcontextrestore.S up_switchcontext.S
+CMN_ASRCS += up_testset.S vfork.S
+
+CMN_CSRCS = 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_memfault.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_unblocktask.c up_usestack.c up_doirq.c up_hardfault.c
+CMN_CSRCS += up_svcall.c up_vfork.c
+
+ifeq ($(CONFIG_ARMV7M_LAZYFPU),y)
+CMN_ASRCS += up_lazyexception.S
+else
+CMN_ASRCS += up_exception.S
+endif
+CMN_CSRCS += up_vectors.c
+
+ifeq ($(CONFIG_ARCH_RAMVECTORS),y)
+CMN_CSRCS += up_ramvec_initialize.c up_ramvec_attach.c
+endif
+
+ifeq ($(CONFIG_BUILD_PROTECTED),y)
+CMN_CSRCS += up_mpu.c up_task_start.c up_pthread_start.c
+ifneq ($(CONFIG_DISABLE_SIGNALS),y)
+CMN_CSRCS += up_signal_dispatch.c
+CMN_UASRCS += up_signal_handler.S
+endif
+endif
+
+ifeq ($(CONFIG_STACK_COLORATION),y)
+CMN_CSRCS += up_checkstack.c
+endif
+
+ifeq ($(CONFIG_ARCH_FPU),y)
+CMN_ASRCS += up_fpu.S
+ifneq ($(CONFIG_ARMV7M_CMNVECTOR),y)
+CMN_CSRCS += up_copyarmstate.c
+else ifeq ($(CONFIG_ARMV7M_LAZYFPU),y)
+CMN_CSRCS += up_copyarmstate.c
+endif
+endif
+
+CHIP_ASRCS =
+CHIP_CSRCS = lpc54_start.c lpc54_clockconfig.c lpc54_irq.c lpc54_clrpend.c
+CHIP_CSRCS += lpc54_allocateheap.c lpc54_lowputc.c lpc54_gpio.c lpc54_reset.c
+
+ifneq ($(CONFIG_SCHED_TICKLESS),y)
+CHIP_CSRCS += lpc54_timerisr.c
+else
+CHIP_CSRCS += lpc54_tickless.c
+endif
+
+ifeq ($(CONFIG_BUILD_PROTECTED),y)
+CHIP_CSRCS += lpc54_userspace.c lpc54_mpuinit.c
+endif
+
+ifeq ($(CONFIG_LPC54_DMA),y)
+CHIP_CSRCS += lpc54_dma.c
+endif
+
+ifneq ($(CONFIG_ARCH_IDLE_CUSTOM),y)
+CHIP_CSRCS += lpc54_idle.c
+endif
+
+ifeq ($(CONFIG_LPC54_GPIOIRQ),y)
+CHIP_CSRCS += lpc54_gpioirq.c
+endif
+
+ifeq ($(CONFIG_RTC),y)
+CHIP_CSRCS += lpc54_rtc.c
+ifeq ($(CONFIG_RTC_DRIVER),y)
+CHIP_CSRCS += lpc54_rtc_lowerhalf.c
+endif
+endif
+
+ifeq ($(CONFIG_LPC54_WWDT),y)
+CHIP_CSRCS += lpc54_wwdt.c
+endif
+
+ifeq ($(CONFIG_LPC54_RNG),y)
+CHIP_CSRCS += lpc54_rng.c
+endif
+
+ifeq ($(CONFIG_LPC54_HAVE_USART),y)
+CHIP_CSRCS += lpc54_serial.c
+endif
+
+ifeq ($(CONFIG_LPC54_HAVE_I2C_MASTER),y)
+CHIP_CSRCS += lpc54_i2c_master.c
+endif
+
+ifeq ($(CONFIG_LPC54_HAVE_SPI_MASTER),y)
+CHIP_CSRCS += lpc54_spi_master.c
+endif
+
+ifeq ($(CONFIG_LPC54_EMC),y)
+CHIP_CSRCS += lpc54_emc.c
+endif
+
+ifeq ($(CONFIG_LPC54_ETHERNET),y)
+CHIP_CSRCS += lpc54_ethernet.c
+endif
+ifeq ($(CONFIG_LPC54_LCD),y)
+CHIP_CSRCS += lpc54_lcd.c
+endif
+
+ifeq ($(CONFIG_LPC54_SDMMC),y)
+CHIP_CSRCS += lpc54_sdmmc.c
+endif
+
diff --git a/arch/arm/src/lpc54xx/chip.h b/arch/arm/src/lpc54xx/chip.h
new file mode 100644
index 0000000000000000000000000000000000000000..2d906c01ab5fcf5a0c00ae866e3e1a77139044f6
--- /dev/null
+++ b/arch/arm/src/lpc54xx/chip.h
@@ -0,0 +1,77 @@
+/************************************************************************************
+ * arch/arm/src/lpc54xx/chip.h
+ *
+ * Copyright (C) 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.
+ *
+ ************************************************************************************/
+
+#ifndef __ARCH_ARM_SRC_LPC54XX_CHIP_H
+#define __ARCH_ARM_SRC_LPC54XX_CHIP_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include
+
+/* Include the memory map and the chip definitions file. Other chip hardware files
+ * should then include this file for the proper setup.
+ */
+
+#include
+#include
+#include "chip/lpc54_memorymap.h"
+
+/* If the common ARMv7-M vector handling logic is used, then it expects the
+ * following definition in this file that provides the number of supported external
+ * interrupts which, for this architecture, is provided in the arch/lpc54xx/chip.h
+ * header file.
+ */
+
+#define ARMV7M_PERIPHERAL_INTERRUPTS LPC54_IRQ_NEXTINT
+
+/************************************************************************************
+ * Pre-processor Definitions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Types
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Data
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+#endif /* __ARCH_ARM_SRC_LPC54XX_CHIP_H */
diff --git a/arch/arm/src/lpc54xx/chip/lpc546x_memorymap.h b/arch/arm/src/lpc54xx/chip/lpc546x_memorymap.h
new file mode 100644
index 0000000000000000000000000000000000000000..c6878580f8c3f89f9caf69846de62483e8dc33b5
--- /dev/null
+++ b/arch/arm/src/lpc54xx/chip/lpc546x_memorymap.h
@@ -0,0 +1,145 @@
+/****************************************************************************************************
+ * arch/arm/src/lpc54xx/chip/lpc546x_memorymap.h
+ *
+ * Copyright (C) 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.
+ *
+ ****************************************************************************************************/
+
+#ifndef __ARCH_ARM_SRC_LPC54XX_CHIP_LPC546X_MEMORYMAP_H
+#define __ARCH_ARM_SRC_LPC54XX_CHIP_LPC546X_MEMORYMAP_H
+
+/****************************************************************************************************
+ * Included Files
+ ****************************************************************************************************/
+
+#include
+
+/****************************************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************************************/
+
+/* Memory Map */
+
+#define LPC54_FLASH_BASE 0x00000000 /* Flash memory (512 KB) */
+#define LPC54_BOOTROM_BASE 0x03000000 /* Boot ROM with flash services in a 64 KB space. */
+#define LPC54_SRAMX_BASE 0x04000000 /* I&D SRAM bank (32 KB) */
+#define LPC54_SPIFLASH_BASE 0x10000000 /* SPIFI memory mapped access space (128 MB). */
+#define LPC54_SRAM_BASE 0x20000000 /* SRAM banks (160 KB) */
+#define LPC54_SRAMBB_BASE 0x22000000 /* SRAM bit band alias addressing (32 MB) */
+#define LPC54_APB0_BASE 0x40000000 /* APB slave group 0 (128 KB) */
+#define LPC54_APB1_BASE 0x40020000 /* APB slave group 1 (128 KB) */
+#define LPC54_APB2_BASE 0x40040000 /* APB slave group 2 (128 KB) */
+#define LPC54_AHB_BASE 0x40080000 /* AHB peripherals (256 KB) */
+#define LPC54_USBSRAM_BASE 0x40100000 /* USB SRAM (8 KB) */
+#define LPC54_PERIPHBB_BASE 0x42000000 /* Peripheral bit band alias addressing (32 MB) */
+#define LPC54_SRAMCS0_BASE 0x80000000 /* Static memory chip select 0 (<=64MB) */
+#define LPC54_SRAMCS1_BASE 0x88000000 /* Static memory chip select 1 (<=64MB) */
+#define LPC54_SRAMCS2_BASE 0x90000000 /* Static memory chip select 2 (<=64MB) */
+#define LPC54_SRAMCS3_BASE 0x98000000 /* Static memory chip select 3 (<=64MB) */
+#define LPC54_DRAMCS0_BASE 0xa0000000 /* Dynamic memory chip select 0 (<=256MB) */
+#define LPC54_DRAMCS1_BASE 0xa8000000 /* Dynamic memory chip select 1 (<=256MB) */
+#define LPC54_DRAMCS2_BASE 0xb0000000 /* Dynamic memory chip select 2 (<=256MB) */
+#define LPC54_DRAMCS3_BASE 0xb8000000 /* Dynamic memory chip select 3 (<=256MB) */
+#define LPC54_CORTEXM4_BASE 0xe0000000 /* Cortex-M4 Private Peripheral Bus */
+
+/* ROM Driver Table */
+
+#define LPC54_ROM_DRIVERTAB 0x03000200 /* Beginning of the ROM driver table */
+
+/* AHB Peripherals */
+
+#define LPC54_SPIFI_BASE 0x40080000 /* SPIFI registers */
+#define LPC54_EMC_BASE 0x40081000 /* EMC registers */
+#define LPC54_DMA_BASE 0x40082000 /* DMA registers */
+#define LPC54_LCD_BASE 0x40083000 /* LCD registers */
+#define LPC54_FSUSB_BASE 0x40084000 /* FS USB device registers */
+#define LPC54_SCTPWM_BASE 0x40085000 /* SC Timer / PWM */
+#define LPC54_FLEXCOMM0_BASE 0x40086000 /* Flexcomm 0 */
+#define LPC54_FLEXCOMM1_BASE 0x40087000 /* Flexcomm 1 */
+#define LPC54_FLEXCOMM2_BASE 0x40088000 /* Flexcomm 2 */
+#define LPC54_FLEXCOMM3_BASE 0x40089000 /* Flexcomm 3 */
+#define LPC54_FLEXCOMM4_BASE 0x4008a000 /* Flexcomm 4 */
+#define LPC54_GPIO_BASE 0x4008c000 /* High Speed GPIO */
+#define LPC54_DMIC_BASE 0x40090000 /* D-Mic interface */
+#define LPC54_ETHERNET_BASE 0x40092000 /* Ethernet */
+#define LPC54_HSUSB_BASE 0x40094000 /* HS USB device */
+#define LPC54_CRC_BASE 0x40095000 /* CRC engine */
+#define LPC54_FLEXCOMM5_BASE 0x40096000 /* Flexcomm 5 */
+#define LPC54_FLEXCOMM6_BASE 0x40097000 /* Flexcomm 6 */
+#define LPC54_FLEXCOMM7_BASE 0x40098000 /* Flexcomm 7 */
+#define LPC54_FLEXCOMM8_BASE 0x40099000 /* Flexcomm 8 */
+#define LPC54_FLEXCOMM9_BASE 0x4009a000 /* Flexcomm 9 */
+#define LPC54_SDMMC_BASE 0x4009b000 /* SD/MMC */
+#define LPC54_ISPAP_BASE 0x4009c000 /* ISP-AP interface */
+#define LPC54_CAN0_BASE 0x4009d000 /* CAN 0 */
+#define LPC54_CAN1_BASE 0x4009e000 /* CAN 1 */
+#define LPC54_ADC_BASE 0x400a0000 /* ADC */
+#define LPC54_SHA_BASE 0x400a1000 /* SHA registers */
+#define LPC54_FSUSBHOST_BASE 0x400a2000 /* FS USB host registers */
+#define LPC54_HSUSBHOST_BASE 0x400a3000 /* HS USB host registers */
+#define LPC54_USBSRAM_BASE 0x40100000 /* USB SRAM (8 kB) */
+#define LPC54_EPROM_BASE 0x40108000 /* EPROM (16 kB) */
+
+/* APB Bridge 0 */
+
+#define LPC54_SYSCON_BASE 0x40000000 /* Syscon */
+#define LPC54_IOCON_BASE 0x40001000 /* IOCON */
+#define LPC54_GINT0_BASE 0x40002000 /* GINT0 */
+#define LPC54_GINT1_BASE 0x40003000 /* GINT1 */
+#define LPC54_PINT_BASE 0x40004000 /* Pin Interrupts (PINT) */
+#define LPC54_MUX_BASE 0x40005000 /* Input muxes */
+#define LPC54_CTIMER0_BASE 0x40008000 /* CTIMER0 */
+#define LPC54_CTIMER1_BASE 0x40009000 /* CTIMER1 */
+#define LPC54_WWDT_BASE 0x4000c000 /* WDT */
+#define LPC54_MRT_BASE 0x4000d000 /* MRT */
+#define LPC54_MTICK_BASE 0x4000e000 /* Micro-Tick */
+#define LPC54_EEPROMC_BASE 0x40014000 /* EEPROM controller */
+#define LPC54_OTP_BASE 0x40016000 /* OTP controller */
+
+/* APB Bridge 1 */
+
+#define LPC54_OSYSCON_BASE 0x40020000 /* Other system registers */
+#define LPC54_CTIMER2_BASE 0x40028000 /* CTIMER2 */
+#define LPC54_RTC_BASE 0x4002c000 /* RTC */
+#define LPC54_RIT_BASE 0x4002d000 /* RIT */
+#define LPC54_FLASHC_BASE 0x40034000 /* Flash controller */
+#define LPC54_SMARCARD0_BASE 0x40036000 /* Smart card 0 */
+#define LPC54_SMARCARD1_BASE 0x40037000 /* Smart card 1 */
+#define LPC54_RNG_BASE 0x4003a000 /* RNG */
+
+/* Asynchronous APB bridge */
+
+#define LPC54_ASYSCON_BASE 0x40040000 /* Asynchronous Syscon */
+#define LPC54_CTIMER3_BASE 0x40048000 /* CTIMER3 */
+#define LPC54_CTIMER4_BASE 0x40049000 /* CTIMER4 */
+
+#endif /* __ARCH_ARM_SRC_LPC54XX_CHIP_LPC546X_MEMORYMAP_H */
+
diff --git a/arch/arm/src/lpc54xx/chip/lpc546x_pinmux.h b/arch/arm/src/lpc54xx/chip/lpc546x_pinmux.h
new file mode 100644
index 0000000000000000000000000000000000000000..c4e6d39b57c95d53c135d12d22dabb35b8aec338
--- /dev/null
+++ b/arch/arm/src/lpc54xx/chip/lpc546x_pinmux.h
@@ -0,0 +1,907 @@
+/************************************************************************************
+ * arch/arm/src/lpc54xx/chip/lpc546x_pinmux.h
+ *
+ * Copyright (C) 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.
+ *
+ ************************************************************************************/
+
+#ifndef __ARCH_ARM_SRC_LPC54XX_CHIP_LPC546X_PINMUX_H
+#define __ARCH_ARM_SRC_LPC54XX_CHIP_LPC546X_PINMUX_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include
+
+/************************************************************************************
+ * Pre-processor Definitions
+ ************************************************************************************/
+/* Alternate Pin Functions.
+ *
+ * Alternative pin selections are provided with a numeric suffix like _1, _2, etc.
+ * Drivers, however, will use the pin selection without the numeric suffix.
+ * Additional definitions are required in the board.h file. For example, if
+ * CAN0 RX connects vis P0.4 on some board, then the following definitions should
+ * appear in the board.h header file for that board:
+ *
+ * #define GPIO_CAN0_RD GPIO_CAN0_RD_1
+ *
+ * The driver will then automatically configre P0.4 as the CAN0 RX pin.
+ *
+ * All pins are Type D unless otherwise noted.
+ */
+
+/* WARNING!!! WARNING!!! WARNING!!! WARNING!!! WARNING!!! WARNING!!! WARNING!!!
+ * Additional effort is required to select specific GPIO options such as frequency,
+ * open-drain/push-pull, and pull-up/down! Just the basics are defined for most
+ * pins in this file.
+ */
+
+ /* Analog-to-Digital Conversion (ADC) */
+
+#define GPIO_ADC0_0 (GPIO_INPUT | GPIO_MODE_ANALOG | GPIO_PORT0 | GPIO_PIN10) /* Type A */
+#define GPIO_ADC0_1 (GPIO_INPUT | GPIO_MODE_ANALOG | GPIO_PORT0 | GPIO_PIN11) /* Type A */
+#define GPIO_ADC0_2 (GPIO_INPUT | GPIO_MODE_ANALOG | GPIO_PORT0 | GPIO_PIN12) /* Type A */
+#define GPIO_ADC0_3 (GPIO_INPUT | GPIO_MODE_ANALOG | GPIO_PORT0 | GPIO_PIN15) /* Type A */
+#define GPIO_ADC0_4 (GPIO_INPUT | GPIO_MODE_ANALOG | GPIO_PORT0 | GPIO_PIN16) /* Type A */
+#define GPIO_ADC0_5 (GPIO_INPUT | GPIO_MODE_ANALOG | GPIO_PORT0 | GPIO_PIN31) /* Type A */
+#define GPIO_ADC0_6 (GPIO_INPUT | GPIO_MODE_ANALOG | GPIO_PORT1 | GPIO_PIN0) /* Type A */
+#define GPIO_ADC0_7 (GPIO_INPUT | GPIO_MODE_ANALOG | GPIO_PORT2 | GPIO_PIN0) /* Type A */
+#define GPIO_ADC0_8 (GPIO_INPUT | GPIO_MODE_ANALOG | GPIO_PORT2 | GPIO_PIN1) /* Type A */
+#define GPIO_ADC0_9 (GPIO_INPUT | GPIO_MODE_ANALOG | GPIO_PORT3 | GPIO_PIN21) /* Type A */
+#define GPIO_ADC0_10 (GPIO_INPUT | GPIO_MODE_ANALOG | GPIO_PORT3 | GPIO_PIN22) /* Type A */
+#define GPIO_ADC0_11 (GPIO_INPUT | GPIO_MODE_ANALOG | GPIO_PORT0 | GPIO_PIN23) /* Type A */
+
+/* Controller Area Network (CAN) */
+
+#define GPIO_CAN0_RD_1 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN4)
+#define GPIO_CAN0_RD_2 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN3)
+#define GPIO_CAN0_RD_3 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT3 | GPIO_PIN19)
+#define GPIO_CAN0_TD_1 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN5)
+#define GPIO_CAN0_TD_2 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN2)
+#define GPIO_CAN0_TD_3 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT3 | GPIO_PIN18)
+
+#define GPIO_CAN1_RD_1 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN0)
+#define GPIO_CAN1_RD_2 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN18)
+#define GPIO_CAN1_RD_3 (GPIO_ALT5 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN18)
+#define GPIO_CAN1_TD_1 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN1)
+#define GPIO_CAN1_TD_2 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN17)
+#define GPIO_CAN1_TD_3 (GPIO_ALT5 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN17)
+
+/* CLKOUT */
+
+#define GPIO_CLKOUT_1 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN16) /* Type A */
+#define GPIO_CLKOUT_2 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN26)
+#define GPIO_CLKOUT_3 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT3 | GPIO_PIN20)
+#define GPIO_CLKOUT_4 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN27)
+#define GPIO_CLKOUT_5 (GPIO_ALT5 | GPIO_MODE_DIGITAL | GPIO_PORT2 | GPIO_PIN29)
+#define GPIO_CLKOUT_6 (GPIO_ALT5 | GPIO_MODE_DIGITAL | GPIO_PORT3 | GPIO_PIN12)
+
+/* Standard counter/timer (CTIMER) */
+
+#define GPIO_CTIMER0_CAP0_1 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN1)
+#define GPIO_CTIMER0_CAP0_2 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN13) /* Type D+I */
+#define GPIO_CTIMER0_CAP0_3 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT2 | GPIO_PIN6)
+#define GPIO_CTIMER0_CAP1_1 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN2)
+#define GPIO_CTIMER0_CAP1_2 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN14) /* Type D+I */
+#define GPIO_CTIMER0_CAP1_3 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT2 | GPIO_PIN7)
+#define GPIO_CTIMER0_CAP2_1 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN0) /* Type A */
+#define GPIO_CTIMER0_CAP2_2 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN28)
+#define GPIO_CTIMER0_CAP2_3 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT3 | GPIO_PIN9)
+#define GPIO_CTIMER0_CAP3_1 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN1)
+#define GPIO_CTIMER0_CAP3_2 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN26)
+#define GPIO_CTIMER0_CAP3_3 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN3)
+#define GPIO_CTIMER0_MAT0_1 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN0)
+#define GPIO_CTIMER0_MAT0_2 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN30)
+#define GPIO_CTIMER0_MAT0_3 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT2 | GPIO_PIN8)
+#define GPIO_CTIMER0_MAT1_1 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN3)
+#define GPIO_CTIMER0_MAT1_2 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN31) /* Type A */
+#define GPIO_CTIMER0_MAT1_3 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT2 | GPIO_PIN9)
+#define GPIO_CTIMER0_MAT2_1 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN19)
+#define GPIO_CTIMER0_MAT2_2 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN31)
+#define GPIO_CTIMER0_MAT2_3 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT2 | GPIO_PIN14)
+#define GPIO_CTIMER0_MAT3_1 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN2)
+#define GPIO_CTIMER0_MAT3_2 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN27)
+#define GPIO_CTIMER0_MAT3_3 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT2 | GPIO_PIN15)
+
+#define GPIO_CTIMER1_CAP0_1 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN16) /* Type A */
+#define GPIO_CTIMER1_CAP0_2 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN9)
+#define GPIO_CTIMER1_CAP0_3 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT2 | GPIO_PIN0) /* Type A */
+#define GPIO_CTIMER1_CAP0_4 (GPIO_ALT5 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN27)
+#define GPIO_CTIMER1_CAP1_1 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN11)
+#define GPIO_CTIMER1_CAP1_2 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT2 | GPIO_PIN17)
+#define GPIO_CTIMER1_CAP1_3 (GPIO_ALT5 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN28)
+#define GPIO_CTIMER1_CAP2_1 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN13)
+#define GPIO_CTIMER1_CAP2_2 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN17)
+#define GPIO_CTIMER1_CAP2_3 (GPIO_ALT5 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN29)
+#define GPIO_CTIMER1_CAP3_1 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN15)
+#define GPIO_CTIMER1_CAP3_2 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN18)
+#define GPIO_CTIMER1_CAP3_3 (GPIO_ALT5 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN30)
+#define GPIO_CTIMER1_MAT0_1 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN18)
+#define GPIO_CTIMER1_MAT0_2 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN10)
+#define GPIO_CTIMER1_MAT0_3 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT2 | GPIO_PIN1) /* Type A */
+#define GPIO_CTIMER1_MAT0_4 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT3 | GPIO_PIN0)
+#define GPIO_CTIMER1_MAT0_5 (GPIO_ALT5 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN23)
+#define GPIO_CTIMER1_MAT1_1 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN20)
+#define GPIO_CTIMER1_MAT1_2 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN12)
+#define GPIO_CTIMER1_MAT1_3 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT2 | GPIO_PIN2)
+#define GPIO_CTIMER1_MAT1_4 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT3 | GPIO_PIN1)
+#define GPIO_CTIMER1_MAT1_5 (GPIO_ALT5 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN24)
+#define GPIO_CTIMER1_MAT2_1 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN23) /* Type A */
+#define GPIO_CTIMER1_MAT2_2 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN14)
+#define GPIO_CTIMER1_MAT2_3 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT2 | GPIO_PIN5)
+#define GPIO_CTIMER1_MAT2_4 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT3 | GPIO_PIN2)
+#define GPIO_CTIMER1_MAT2_5 (GPIO_ALT5 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN25)
+#define GPIO_CTIMER1_MAT3_1 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN16)
+#define GPIO_CTIMER1_MAT3_2 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT2 | GPIO_PIN16)
+#define GPIO_CTIMER1_MAT3_3 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN22)
+#define GPIO_CTIMER1_MAT3_4 (GPIO_ALT5 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN26)
+
+#define GPIO_CTIMER2_CAP0_1 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN24)
+#define GPIO_CTIMER2_CAP0_2 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT2 | GPIO_PIN22)
+#define GPIO_CTIMER2_CAP1_1 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN25)
+#define GPIO_CTIMER2_CAP1_2 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT2 | GPIO_PIN26)
+#define GPIO_CTIMER2_CAP2_1 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN10) /* Type A */
+#define GPIO_CTIMER2_CAP2_2 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT2 | GPIO_PIN28)
+#define GPIO_CTIMER2_CAP3_1 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN28)
+#define GPIO_CTIMER2_CAP3_2 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT2 | GPIO_PIN29)
+#define GPIO_CTIMER2_MAT0_1 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN10) /* Type A */
+#define GPIO_CTIMER2_MAT0_2 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN5)
+#define GPIO_CTIMER2_MAT0_3 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT2 | GPIO_PIN3)
+#define GPIO_CTIMER2_MAT1_1 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN4)
+#define GPIO_CTIMER2_MAT1_2 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN6)
+#define GPIO_CTIMER2_MAT1_3 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT2 | GPIO_PIN4)
+#define GPIO_CTIMER2_MAT2_1 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN11) /* Type A */
+#define GPIO_CTIMER2_MAT2_2 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN7)
+#define GPIO_CTIMER2_MAT2_3 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT2 | GPIO_PIN30)
+#define GPIO_CTIMER2_MAT3_1 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN29)
+#define GPIO_CTIMER2_MAT3_2 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN22)
+#define GPIO_CTIMER2_MAT3_3 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN21)
+
+#define GPIO_CTIMER3_CAP0_1 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN4)
+#define GPIO_CTIMER3_CAP0_2 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT3 | GPIO_PIN12)
+#define GPIO_CTIMER3_CAP0_3 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT5 | GPIO_PIN2)
+#define GPIO_CTIMER3_CAP1_1 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN6)
+#define GPIO_CTIMER3_CAP1_2 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT3 | GPIO_PIN13)
+#define GPIO_CTIMER3_CAP1_3 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT5 | GPIO_PIN3)
+#define GPIO_CTIMER3_CAP2_1 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN26)
+#define GPIO_CTIMER3_CAP2_2 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN20)
+#define GPIO_CTIMER3_CAP2_3 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT5 | GPIO_PIN4)
+#define GPIO_CTIMER3_CAP3_1 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN20)
+#define GPIO_CTIMER3_CAP3_2 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN22)
+#define GPIO_CTIMER3_CAP3_3 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT5 | GPIO_PIN5)
+#define GPIO_CTIMER3_MAT0_1 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN5)
+#define GPIO_CTIMER3_MAT0_2 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT3 | GPIO_PIN10)
+#define GPIO_CTIMER3_MAT0_3 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN30)
+#define GPIO_CTIMER3_MAT0_4 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT2 | GPIO_PIN18)
+#define GPIO_CTIMER3_MAT1_1 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN19)
+#define GPIO_CTIMER3_MAT1_2 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT3 | GPIO_PIN14)
+#define GPIO_CTIMER3_MAT1_3 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN31)
+#define GPIO_CTIMER3_MAT1_4 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT2 | GPIO_PIN19)
+#define GPIO_CTIMER3_MAT2_1 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN27)
+#define GPIO_CTIMER3_MAT2_2 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN21)
+#define GPIO_CTIMER3_MAT2_3 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT5 | GPIO_PIN0)
+#define GPIO_CTIMER3_MAT2_4 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT2 | GPIO_PIN20)
+#define GPIO_CTIMER3_MAT3_1 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN21)
+#define GPIO_CTIMER3_MAT3_2 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN23) /* Type A */
+#define GPIO_CTIMER3_MAT3_3 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT5 | GPIO_PIN1)
+#define GPIO_CTIMER3_MAT3_4 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT2 | GPIO_PIN21)
+
+#define GPIO_CTIMER4_CAP0_1 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT3 | GPIO_PIN24) /* Type D+I */
+#define GPIO_CTIMER4_CAP0_2 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN15) /* Type A */
+#define GPIO_CTIMER4_CAP0_3 (GPIO_ALT5 | GPIO_MODE_DIGITAL | GPIO_PORT2 | GPIO_PIN20)
+#define GPIO_CTIMER4_CAP1_1 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN0)
+#define GPIO_CTIMER4_CAP1_2 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT3 | GPIO_PIN4)
+#define GPIO_CTIMER4_CAP2_1 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT3 | GPIO_PIN25)
+#define GPIO_CTIMER4_CAP2_2 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT3 | GPIO_PIN7)
+#define GPIO_CTIMER4_CAP2_3 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN19)
+#define GPIO_CTIMER4_CAP3_1 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN7)
+#define GPIO_CTIMER4_CAP3_2 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT3 | GPIO_PIN8)
+#define GPIO_CTIMER4_CAP3_3 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN20)
+#define GPIO_CTIMER4_MAT0_1 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN13)
+#define GPIO_CTIMER4_MAT0_2 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN6)
+#define GPIO_CTIMER4_MAT0_3 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT3 | GPIO_PIN18)
+#define GPIO_CTIMER4_MAT1_1 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN14)
+#define GPIO_CTIMER4_MAT1_2 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT3 | GPIO_PIN19)
+#define GPIO_CTIMER4_MAT1_3 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT3 | GPIO_PIN5)
+#define GPIO_CTIMER4_MAT2_1 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN15)
+#define GPIO_CTIMER4_MAT2_2 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT3 | GPIO_PIN31)
+#define GPIO_CTIMER4_MAT2_3 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT3 | GPIO_PIN6)
+#define GPIO_CTIMER4_MAT3_1 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN16)
+#define GPIO_CTIMER4_MAT3_2 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT3 | GPIO_PIN21) /* Type A */
+#define GPIO_CTIMER4_MAT3_3 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN5)
+
+/* External Memory Controller (EMC) */
+
+#define GPIO_EMC_A0 (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_SLEW_FAST | GPIO_PORT0 | GPIO_PIN18)
+#define GPIO_EMC_A1 (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_SLEW_FAST | GPIO_PORT0 | GPIO_PIN19)
+#define GPIO_EMC_A2 (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_SLEW_FAST | GPIO_PORT0 | GPIO_PIN20)
+#define GPIO_EMC_A3 (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_SLEW_FAST | GPIO_PORT0 | GPIO_PIN21)
+#define GPIO_EMC_A4 (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_SLEW_FAST | GPIO_PORT1 | GPIO_PIN5)
+#define GPIO_EMC_A5 (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_SLEW_FAST | GPIO_PORT1 | GPIO_PIN6)
+#define GPIO_EMC_A6 (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_SLEW_FAST | GPIO_PORT1 | GPIO_PIN7)
+#define GPIO_EMC_A7 (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_SLEW_FAST | GPIO_PORT1 | GPIO_PIN8)
+#define GPIO_EMC_A8 (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_SLEW_FAST | GPIO_PORT1 | GPIO_PIN26)
+#define GPIO_EMC_A9 (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_SLEW_FAST | GPIO_PORT1 | GPIO_PIN27)
+#define GPIO_EMC_A10 (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_SLEW_FAST | GPIO_PORT1 | GPIO_PIN16)
+#define GPIO_EMC_A11 (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_SLEW_FAST | GPIO_PORT1 | GPIO_PIN23)
+#define GPIO_EMC_A12 (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_SLEW_FAST | GPIO_PORT1 | GPIO_PIN24)
+#define GPIO_EMC_A13 (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_SLEW_FAST | GPIO_PORT1 | GPIO_PIN25)
+#define GPIO_EMC_A14 (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_SLEW_FAST | GPIO_PORT3 | GPIO_PIN25)
+#define GPIO_EMC_A15 (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_SLEW_FAST | GPIO_PORT3 | GPIO_PIN26)
+#define GPIO_EMC_A16 (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_SLEW_FAST | GPIO_PORT3 | GPIO_PIN27)
+#define GPIO_EMC_A17 (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_SLEW_FAST | GPIO_PORT3 | GPIO_PIN28)
+#define GPIO_EMC_A18 (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_SLEW_FAST | GPIO_PORT3 | GPIO_PIN29)
+#define GPIO_EMC_A19 (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_SLEW_FAST | GPIO_PORT3 | GPIO_PIN30)
+#define GPIO_EMC_A20 (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_SLEW_FAST | GPIO_PORT3 | GPIO_PIN31)
+#define GPIO_EMC_A21 (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_SLEW_FAST | GPIO_PORT5 | GPIO_PIN5)
+#define GPIO_EMC_A22 (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_SLEW_FAST | GPIO_PORT5 | GPIO_PIN6)
+#define GPIO_EMC_A23 (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_SLEW_FAST | GPIO_PORT5 | GPIO_PIN7)
+#define GPIO_EMC_A24 (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_SLEW_FAST | GPIO_PORT5 | GPIO_PIN8)
+#define GPIO_EMC_A25 (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_SLEW_FAST | GPIO_PORT5 | GPIO_PIN9)
+#define GPIO_EMC_BLSN0 (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_SLEW_FAST | GPIO_PORT1 | GPIO_PIN17)
+#define GPIO_EMC_BLSN1 (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_SLEW_FAST | GPIO_PORT1 | GPIO_PIN18)
+#define GPIO_EMC_BLSN2 (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_SLEW_FAST | GPIO_PORT4 | GPIO_PIN17)
+#define GPIO_EMC_BLSN3 (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_SLEW_FAST | GPIO_PORT4 | GPIO_PIN18)
+#define GPIO_EMC_CASN (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_SLEW_FAST | GPIO_PORT1 | GPIO_PIN9)
+#define GPIO_EMC_CKE0 (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_SLEW_FAST | GPIO_PORT1 | GPIO_PIN15)
+#define GPIO_EMC_CKE1 (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_SLEW_FAST | GPIO_PORT1 | GPIO_PIN22)
+#define GPIO_EMC_CKE2 (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_SLEW_FAST | GPIO_PORT4 | GPIO_PIN5)
+#define GPIO_EMC_CKE3 (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_SLEW_FAST | GPIO_PORT4 | GPIO_PIN6)
+#define GPIO_EMC_CLK0 (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_SLEW_FAST | GPIO_PORT1 | GPIO_PIN11)
+#define GPIO_EMC_CLK1 (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_SLEW_FAST | GPIO_PORT3 | GPIO_PIN12)
+#define GPIO_EMC_CSN0 (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_PORT0 | GPIO_PIN16) /* Type A */
+#define GPIO_EMC_CSN1 (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_SLEW_FAST | GPIO_PORT4 | GPIO_PIN0)
+#define GPIO_EMC_CSN2 (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_SLEW_FAST | GPIO_PORT4 | GPIO_PIN1)
+#define GPIO_EMC_CSN3 (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_SLEW_FAST | GPIO_PORT4 | GPIO_PIN2)
+#define GPIO_EMC_D0 (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_SLEW_FAST | GPIO_PORT0 | GPIO_PIN2)
+#define GPIO_EMC_D1 (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_SLEW_FAST | GPIO_PORT0 | GPIO_PIN3)
+#define GPIO_EMC_D2 (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_SLEW_FAST | GPIO_PORT0 | GPIO_PIN4)
+#define GPIO_EMC_D3 (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_SLEW_FAST | GPIO_PORT0 | GPIO_PIN5)
+#define GPIO_EMC_D4 (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_SLEW_FAST | GPIO_PORT0 | GPIO_PIN6)
+#define GPIO_EMC_D5 (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_SLEW_FAST | GPIO_PORT0 | GPIO_PIN7)
+#define GPIO_EMC_D6 (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_SLEW_FAST | GPIO_PORT0 | GPIO_PIN8)
+#define GPIO_EMC_D7 (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_SLEW_FAST | GPIO_PORT0 | GPIO_PIN9)
+#define GPIO_EMC_D8 (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_SLEW_FAST | GPIO_PORT1 | GPIO_PIN19)
+#define GPIO_EMC_D9 (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_SLEW_FAST | GPIO_PORT1 | GPIO_PIN20)
+#define GPIO_EMC_D10 (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_SLEW_FAST | GPIO_PORT1 | GPIO_PIN21)
+#define GPIO_EMC_D11 (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_SLEW_FAST | GPIO_PORT1 | GPIO_PIN4)
+#define GPIO_EMC_D12 (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_SLEW_FAST | GPIO_PORT1 | GPIO_PIN28)
+#define GPIO_EMC_D13 (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_SLEW_FAST | GPIO_PORT1 | GPIO_PIN29)
+#define GPIO_EMC_D14 (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_SLEW_FAST | GPIO_PORT1 | GPIO_PIN30)
+#define GPIO_EMC_D15 (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_SLEW_FAST | GPIO_PORT1 | GPIO_PIN31)
+#define GPIO_EMC_D16 (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_SLEW_FAST | GPIO_PORT4 | GPIO_PIN21)
+#define GPIO_EMC_D17 (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_SLEW_FAST | GPIO_PORT4 | GPIO_PIN22)
+#define GPIO_EMC_D18 (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_SLEW_FAST | GPIO_PORT4 | GPIO_PIN23)
+#define GPIO_EMC_D19 (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_SLEW_FAST | GPIO_PORT4 | GPIO_PIN24)
+#define GPIO_EMC_D20 (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_SLEW_FAST | GPIO_PORT4 | GPIO_PIN25)
+#define GPIO_EMC_D21 (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_SLEW_FAST | GPIO_PORT4 | GPIO_PIN26)
+#define GPIO_EMC_D22 (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_SLEW_FAST | GPIO_PORT4 | GPIO_PIN27)
+#define GPIO_EMC_D23 (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_SLEW_FAST | GPIO_PORT4 | GPIO_PIN28)
+#define GPIO_EMC_D24 (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_SLEW_FAST | GPIO_PORT4 | GPIO_PIN29)
+#define GPIO_EMC_D25 (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_SLEW_FAST | GPIO_PORT4 | GPIO_PIN30)
+#define GPIO_EMC_D26 (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_SLEW_FAST | GPIO_PORT4 | GPIO_PIN31)
+#define GPIO_EMC_D27 (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_SLEW_FAST | GPIO_PORT5 | GPIO_PIN0)
+#define GPIO_EMC_D28 (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_SLEW_FAST | GPIO_PORT5 | GPIO_PIN1)
+#define GPIO_EMC_D29 (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_SLEW_FAST | GPIO_PORT5 | GPIO_PIN2)
+#define GPIO_EMC_D30 (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_SLEW_FAST | GPIO_PORT5 | GPIO_PIN3)
+#define GPIO_EMC_D31 (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_SLEW_FAST | GPIO_PORT5 | GPIO_PIN4)
+#define GPIO_EMC_DQM0 (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_SLEW_FAST | GPIO_PORT1 | GPIO_PIN13)
+#define GPIO_EMC_DQM1 (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_SLEW_FAST | GPIO_PORT1 | GPIO_PIN14)
+#define GPIO_EMC_DQM2 (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_SLEW_FAST | GPIO_PORT4 | GPIO_PIN19)
+#define GPIO_EMC_DQM3 (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_SLEW_FAST | GPIO_PORT4 | GPIO_PIN20)
+#define GPIO_EMC_DYCSN0 (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_SLEW_FAST | GPIO_PORT1 | GPIO_PIN12)
+#define GPIO_EMC_DYCSN1 (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_SLEW_FAST | GPIO_PORT3 | GPIO_PIN10)
+#define GPIO_EMC_DYCSN2 (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_SLEW_FAST | GPIO_PORT4 | GPIO_PIN3)
+#define GPIO_EMC_DYCSN3 (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_SLEW_FAST | GPIO_PORT4 | GPIO_PIN4)
+#define GPIO_EMC_FBCK (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_SLEW_FAST | GPIO_PORT3 | GPIO_PIN13)
+#define GPIO_EMC_OEN (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_SLEW_FAST | GPIO_PORT0 | GPIO_PIN17)
+#define GPIO_EMC_RASN (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_SLEW_FAST | GPIO_PORT1 | GPIO_PIN10)
+#define GPIO_EMC_WEN (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_PORT0 | GPIO_PIN15) /* Type A */
+
+/* Ethernet (ENET) */
+
+#define GPIO_ENET_COL_1 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT2 | GPIO_PIN7)
+#define GPIO_ENET_COL_2 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT5 | GPIO_PIN2)
+#define GPIO_ENET_CRS_1 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT2 | GPIO_PIN2)
+#define GPIO_ENET_CRS_2 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT5 | GPIO_PIN1)
+#define GPIO_ENET_MDC_1 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN16)
+#define GPIO_ENET_MDC_2 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN15)
+#define GPIO_ENET_MDC_3 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT5 | GPIO_PIN3)
+#define GPIO_ENET_MDC_4 (GPIO_ALT7 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN4)
+#define GPIO_ENET_MDIO_1 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN17)
+#define GPIO_ENET_MDIO_2 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN16)
+#define GPIO_ENET_MDIO_3 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT5 | GPIO_PIN4)
+#define GPIO_ENET_MDIO_4 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN23)
+#define GPIO_ENET_MDIO_5 (GPIO_ALT7 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN5)
+#define GPIO_ENET_RX_CLK_1 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN15)
+#define GPIO_ENET_RX_CLK_2 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN14)
+#define GPIO_ENET_RX_CLK_3 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN31)
+#define GPIO_ENET_RX_CLK_4 (GPIO_ALT7 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN7)
+#define GPIO_ENET_RX_DV_1 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN14)
+#define GPIO_ENET_RX_DV_2 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN10)
+#define GPIO_ENET_RX_DV_3 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT5 | GPIO_PIN0)
+#define GPIO_ENET_RX_DV_4 (GPIO_ALT7 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN6)
+#define GPIO_ENET_RX_ER_1 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT2 | GPIO_PIN10)
+#define GPIO_ENET_RX_ER_2 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN29)
+#define GPIO_ENET_RXD0_1 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN12)
+#define GPIO_ENET_RXD0_2 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN11)
+#define GPIO_ENET_RXD0_3 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN23)
+#define GPIO_ENET_RXD0_4 (GPIO_ALT7 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN13) /* Type D+I */
+#define GPIO_ENET_RXD1_1 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN13)
+#define GPIO_ENET_RXD1_2 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN12)
+#define GPIO_ENET_RXD1_3 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN24)
+#define GPIO_ENET_RXD1_4 (GPIO_ALT7 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN14) /* Type D+I */
+#define GPIO_ENET_RXD2_1 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT2 | GPIO_PIN8)
+#define GPIO_ENET_RXD2_2 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN25)
+#define GPIO_ENET_RXD3_1 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT2 | GPIO_PIN9)
+#define GPIO_ENET_RXD3_2 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN26)
+#define GPIO_ENET_TX_CLK_1 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT2 | GPIO_PIN6)
+#define GPIO_ENET_TX_CLK_2 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN30)
+#define GPIO_ENET_TX_EN_1 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN11)
+#define GPIO_ENET_TX_EN_2 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN13)
+#define GPIO_ENET_TX_EN_3 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN27)
+#define GPIO_ENET_TX_EN_4 (GPIO_ALT7 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN15) /* Type A */
+#define GPIO_ENET_TX_ER_1 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT2 | GPIO_PIN5)
+#define GPIO_ENET_TX_ER_2 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN28)
+#define GPIO_ENET_TXD0_1 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN9)
+#define GPIO_ENET_TXD0_2 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN19)
+#define GPIO_ENET_TXD0_3 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN8)
+#define GPIO_ENET_TXD0_4 (GPIO_ALT7 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN16) /* Type A */
+#define GPIO_ENET_TXD1_1 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN10)
+#define GPIO_ENET_TXD1_2 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN20)
+#define GPIO_ENET_TXD1_3 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN9)
+#define GPIO_ENET_TXD1_4 (GPIO_ALT7 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN17)
+#define GPIO_ENET_TXD2_1 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT2 | GPIO_PIN3)
+#define GPIO_ENET_TXD2_2 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN21)
+#define GPIO_ENET_TXD3_1 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT2 | GPIO_PIN4)
+#define GPIO_ENET_TXD3_2 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN22)
+
+/* Flexcomm (FC)
+ *
+ * Pins used for I2C should add GPIO_FILTER_OFF in your board. h head file.
+ * For standard mode I2C, add GPIO_I2C_FILTER_OFF
+ * For fast speed mode plaseI2C, also add GPIO_I2CDRIVE_HIGH
+ * For high speed slave add both GPIO_I2C_FILTER_OFF and GPIO_I2CDRIVE_HIGH
+ */
+
+#define GPIO_FC0_CTS_SDA_SSEL0_1 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN31) /* Type A */
+#define GPIO_FC0_CTS_SDA_SSEL0_2 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN8)
+#define GPIO_FC0_CTS_SDA_SSEL0_3 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN5)
+#define GPIO_FC0_RTS_SCL_SSEL1_1 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN0) /* Type A */
+#define GPIO_FC0_RTS_SCL_SSEL1_2 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN7)
+#define GPIO_FC0_RTS_SCL_SSEL1_3 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN4)
+#define GPIO_FC0_RXD_SDA_MOSI_1 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN24)
+#define GPIO_FC0_RXD_SDA_MOSI_2 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN29)
+#define GPIO_FC0_RXD_SDA_MOSI_3 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN5)
+#define GPIO_FC0_RXD_SDA_MOSI_4 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT2 | GPIO_PIN0) /* Type A */
+#define GPIO_FC0_SCK_1 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN28)
+#define GPIO_FC0_SCK_2 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN4)
+#define GPIO_FC0_SCK_3 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT3 | GPIO_PIN11)
+#define GPIO_FC0_TXD_SCL_MISO_1 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN25)
+#define GPIO_FC0_TXD_SCL_MISO_2 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN30)
+#define GPIO_FC0_TXD_SCL_MISO_3 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN6)
+#define GPIO_FC0_TXD_SCL_MISO_4 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT2 | GPIO_PIN1) /* Type A */
+
+#define GPIO_FC1_CTS_SDA_SSEL0_1 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN13) /* Type D+I */
+#define GPIO_FC1_CTS_SDA_SSEL0_2 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT2 | GPIO_PIN5)
+#define GPIO_FC1_RTS_SCL_SSEL1_1 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN14) /* Type D+I */
+#define GPIO_FC1_RTS_SCL_SSEL1_2 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT2 | GPIO_PIN6)
+#define GPIO_FC1_RTS_SCL_SSEL1_3 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN30)
+#define GPIO_FC1_RXD_SDA_MOSI_1 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN10)
+#define GPIO_FC1_RXD_SDA_MOSI_2 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT2 | GPIO_PIN3)
+#define GPIO_FC1_RXD_SDA_MOSI_3 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN28)
+#define GPIO_FC1_SCK_1 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN9)
+#define GPIO_FC1_SCK_2 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT3 | GPIO_PIN11)
+#define GPIO_FC1_SCK_3 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN7)
+#define GPIO_FC1_SCK_4 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN27)
+#define GPIO_FC1_TXD_SCL_MISO_1 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN11)
+#define GPIO_FC1_TXD_SCL_MISO_2 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT2 | GPIO_PIN4)
+#define GPIO_FC1_TXD_SCL_MISO_3 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN10) /* Type A */
+#define GPIO_FC1_TXD_SCL_MISO_4 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN29)
+
+#define GPIO_FC2_CTS_SDA_SSEL0_1 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN26)
+#define GPIO_FC2_CTS_SDA_SSEL0_2 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT3 | GPIO_PIN23) /* Type D+I */
+#define GPIO_FC2_CTS_SDA_SSEL0_3 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN11)
+#define GPIO_FC2_CTS_SDA_SSEL0_4 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN23)
+#define GPIO_FC2_RTS_SCL_SSEL1_1 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN27)
+#define GPIO_FC2_RTS_SCL_SSEL1_2 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT3 | GPIO_PIN24) /* Type D+I */
+#define GPIO_FC2_RTS_SCL_SSEL1_3 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN12)
+#define GPIO_FC2_RTS_SCL_SSEL1_4 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN22)
+#define GPIO_FC2_RXD_SDA_MOSI_1 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN26)
+#define GPIO_FC2_RXD_SDA_MOSI_2 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN24)
+#define GPIO_FC2_RXD_SDA_MOSI_3 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN9)
+#define GPIO_FC2_RXD_SDA_MOSI_4 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN20)
+#define GPIO_FC2_SCK_1 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN23)
+#define GPIO_FC2_SCK_2 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN8)
+#define GPIO_FC2_SCK_3 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN19)
+#define GPIO_FC2_TXD_SCL_MISO_1 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN27)
+#define GPIO_FC2_TXD_SCL_MISO_2 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN25)
+#define GPIO_FC2_TXD_SCL_MISO_3 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN10)
+#define GPIO_FC2_TXD_SCL_MISO_4 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN21)
+
+#define GPIO_FC3_CTS_SDA_SSEL0_1 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN20)
+#define GPIO_FC3_CTS_SDA_SSEL0_2 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN1)
+#define GPIO_FC3_CTS_SDA_SSEL0_3 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT2 | GPIO_PIN21)
+#define GPIO_FC3_RTS_SCL_SSEL1_1 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN21)
+#define GPIO_FC3_RTS_SCL_SSEL1_2 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN7)
+#define GPIO_FC3_RTS_SCL_SSEL1_3 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT2 | GPIO_PIN20)
+#define GPIO_FC3_RXD_SDA_MOSI_1 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN3)
+#define GPIO_FC3_RXD_SDA_MOSI_2 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN1)
+#define GPIO_FC3_RXD_SDA_MOSI_3 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT2 | GPIO_PIN18)
+#define GPIO_FC3_SCK_1 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN6)
+#define GPIO_FC3_SCK_2 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN0)
+#define GPIO_FC3_SCK_3 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT2 | GPIO_PIN26)
+#define GPIO_FC3_SSEL2_1 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN9)
+#define GPIO_FC3_SSEL2_2 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT2 | GPIO_PIN27)
+#define GPIO_FC3_SSEL2_3 (GPIO_ALT5 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN23)
+#define GPIO_FC3_SSEL3_1 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN8)
+#define GPIO_FC3_SSEL3_2 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT2 | GPIO_PIN2)
+#define GPIO_FC3_SSEL3_3 (GPIO_ALT5 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN24)
+#define GPIO_FC3_TXD_SCL_MISO_1 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN12) /* Type A */
+#define GPIO_FC3_TXD_SCL_MISO_2 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN2)
+#define GPIO_FC3_TXD_SCL_MISO_3 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT2 | GPIO_PIN19)
+
+#define GPIO_FC4_CTS_SDA_SSEL0_1 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN18)
+#define GPIO_FC4_CTS_SDA_SSEL0_2 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT3 | GPIO_PIN28)
+#define GPIO_FC4_CTS_SDA_SSEL0_3 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT5 | GPIO_PIN2)
+#define GPIO_FC4_CTS_SDA_SSEL0_4 (GPIO_ALT5 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN9)
+#define GPIO_FC4_RTS_SCL_SSEL1_1 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN19)
+#define GPIO_FC4_RTS_SCL_SSEL1_2 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT3 | GPIO_PIN29)
+#define GPIO_FC4_RTS_SCL_SSEL1_3 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT5 | GPIO_PIN3)
+#define GPIO_FC4_RTS_SCL_SSEL1_4 (GPIO_ALT5 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN15)
+#define GPIO_FC4_RXD_SDA_MOSI_1 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN5)
+#define GPIO_FC4_RXD_SDA_MOSI_2 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT3 | GPIO_PIN26)
+#define GPIO_FC4_RXD_SDA_MOSI_3 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT5 | GPIO_PIN0)
+#define GPIO_FC4_RXD_SDA_MOSI_4 (GPIO_ALT5 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN21)
+#define GPIO_FC4_SCK_1 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN4)
+#define GPIO_FC4_SCK_2 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT3 | GPIO_PIN25)
+#define GPIO_FC4_SCK_3 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN31)
+#define GPIO_FC4_SCK_4 (GPIO_ALT5 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN19)
+#define GPIO_FC4_SSEL2_1 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN17)
+#define GPIO_FC4_SSEL2_2 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT3 | GPIO_PIN30)
+#define GPIO_FC4_SSEL2_3 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT5 | GPIO_PIN4)
+#define GPIO_FC4_SSEL2_4 (GPIO_ALT5 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN8)
+#define GPIO_FC4_SSEL3_1 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN4)
+#define GPIO_FC4_SSEL3_2 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT5 | GPIO_PIN5)
+#define GPIO_FC4_SSEL3_3 (GPIO_ALT5 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN22)
+#define GPIO_FC4_TXD_SCL_MISO_1 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN16) /* Type A */
+#define GPIO_FC4_TXD_SCL_MISO_2 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT3 | GPIO_PIN27)
+#define GPIO_FC4_TXD_SCL_MISO_3 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT5 | GPIO_PIN1)
+#define GPIO_FC4_TXD_SCL_MISO_4 (GPIO_ALT5 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN20)
+
+#define GPIO_FC5_CTS_SDA_SSEL0_1 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT5 | GPIO_PIN9)
+#define GPIO_FC5_CTS_SDA_SSEL0_2 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN14)
+#define GPIO_FC5_CTS_SDA_SSEL0_3 (GPIO_ALT5 | GPIO_MODE_DIGITAL | GPIO_PORT2 | GPIO_PIN14)
+#define GPIO_FC5_RTS_SCL_SSEL1_1 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT5 | GPIO_PIN10)
+#define GPIO_FC5_RTS_SCL_SSEL1_2 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN15)
+#define GPIO_FC5_RTS_SCL_SSEL1_3 (GPIO_ALT5 | GPIO_MODE_DIGITAL | GPIO_PORT2 | GPIO_PIN15)
+#define GPIO_FC5_RXD_SDA_MOSI_1 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN8)
+#define GPIO_FC5_RXD_SDA_MOSI_2 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT5 | GPIO_PIN7)
+#define GPIO_FC5_RXD_SDA_MOSI_3 (GPIO_ALT5 | GPIO_MODE_DIGITAL | GPIO_PORT2 | GPIO_PIN12)
+#define GPIO_FC5_SCK_1 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN7)
+#define GPIO_FC5_SCK_2 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT5 | GPIO_PIN6)
+#define GPIO_FC5_SCK_3 (GPIO_ALT5 | GPIO_MODE_DIGITAL | GPIO_PORT2 | GPIO_PIN11)
+#define GPIO_FC5_TXD_SCL_MISO_1 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN9)
+#define GPIO_FC5_TXD_SCL_MISO_2 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT5 | GPIO_PIN8)
+#define GPIO_FC5_TXD_SCL_MISO_3 (GPIO_ALT5 | GPIO_MODE_DIGITAL | GPIO_PORT2 | GPIO_PIN13)
+#define GPIO_FC6_CTS_SDA_SSEL0_1 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN15) /* Type A */
+
+#define GPIO_FC6_CTS_SDA_SSEL0_2 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN0)
+#define GPIO_FC6_RXD_SDA_MOSI_DATA_1 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN11) /* Type A */
+#define GPIO_FC6_RXD_SDA_MOSI_DATA_2 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN13)
+#define GPIO_FC6_RXD_SDA_MOSI_DATA_3 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN2)
+#define GPIO_FC6_SCK_1 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN10) /* Type A */
+#define GPIO_FC6_SCK_2 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN12)
+#define GPIO_FC6_SCK_3 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN1)
+#define GPIO_FC6_TXD_SCL_MISO (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN22)
+#define GPIO_FC6_TXD_SCL_MISO_WS_1 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN16)
+#define GPIO_FC6_TXD_SCL_MISO_WS_2 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN3)
+
+#define GPIO_FC7_CTS_SDA_SSEL0_1 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN21)
+#define GPIO_FC7_CTS_SDA_SSEL0_2 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT2 | GPIO_PIN28)
+#define GPIO_FC7_CTS_SDA_SSEL0_3 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN25)
+#define GPIO_FC7_RTS_SCL_SSEL1_1 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN20)
+#define GPIO_FC7_RTS_SCL_SSEL1_2 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT2 | GPIO_PIN29)
+#define GPIO_FC7_RTS_SCL_SSEL1_3 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN24)
+#define GPIO_FC7_RXD_SDA_MOSI (GPIO_ALT7 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN20)
+#define GPIO_FC7_RXD_SDA_MOSI_DATA_1 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN29)
+#define GPIO_FC7_RXD_SDA_MOSI_DATA_2 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT2 | GPIO_PIN19)
+#define GPIO_FC7_SCK_1 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN28)
+#define GPIO_FC7_SCK_2 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT2 | GPIO_PIN18)
+#define GPIO_FC7_SCK_3 (GPIO_ALT7 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN21)
+#define GPIO_FC7_TXD_SCL_MISO (GPIO_ALT7 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN19)
+#define GPIO_FC7_TXD_SCL_MISO_WS_1 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN30)
+#define GPIO_FC7_TXD_SCL_MISO_WS_2 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT2 | GPIO_PIN20)
+
+#define GPIO_FC8_CTS_SDA_SSEL0_1 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT3 | GPIO_PIN18)
+#define GPIO_FC8_CTS_SDA_SSEL0_2 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT3 | GPIO_PIN4)
+#define GPIO_FC8_CTS_SDA_SSEL0_3 (GPIO_ALT5 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN31)
+#define GPIO_FC8_RTS_SCL_SSEL1_1 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN22)
+#define GPIO_FC8_RTS_SCL_SSEL1_2 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT3 | GPIO_PIN19)
+#define GPIO_FC8_RTS_SCL_SSEL1_3 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT3 | GPIO_PIN5)
+#define GPIO_FC8_RXD_SDA_MOSI_1 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT3 | GPIO_PIN16)
+#define GPIO_FC8_RXD_SDA_MOSI_2 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN17)
+#define GPIO_FC8_RXD_SDA_MOSI_3 (GPIO_ALT5 | GPIO_MODE_DIGITAL | GPIO_PORT2 | GPIO_PIN17)
+#define GPIO_FC8_SCK_1 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN19)
+#define GPIO_FC8_SCK_2 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT3 | GPIO_PIN15)
+#define GPIO_FC8_SCK_3 (GPIO_ALT5 | GPIO_MODE_DIGITAL | GPIO_PORT2 | GPIO_PIN16)
+#define GPIO_FC8_TXD_SCL_MISO_1 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT3 | GPIO_PIN17)
+#define GPIO_FC8_TXD_SCL_MISO_2 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN18)
+#define GPIO_FC8_TXD_SCL_MISO_3 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT2 | GPIO_PIN29)
+
+#define GPIO_FC9_CTS_SDA_SSEL0_1 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT3 | GPIO_PIN30)
+#define GPIO_FC9_CTS_SDA_SSEL0_2 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT3 | GPIO_PIN13)
+#define GPIO_FC9_CTS_SDA_SSEL0_3 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN5)
+#define GPIO_FC9_RTS_SCL_SSEL1_1 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT3 | GPIO_PIN31)
+#define GPIO_FC9_RTS_SCL_SSEL1_2 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT3 | GPIO_PIN14)
+#define GPIO_FC9_RTS_SCL_SSEL1_3 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN6)
+#define GPIO_FC9_RXD_SDA_MOSI_1 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT3 | GPIO_PIN21) /* Type A */
+#define GPIO_FC9_RXD_SDA_MOSI_2 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT3 | GPIO_PIN2)
+#define GPIO_FC9_RXD_SDA_MOSI_3 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN15)
+#define GPIO_FC9_SCK_1 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT3 | GPIO_PIN20)
+#define GPIO_FC9_SCK_2 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT2 | GPIO_PIN27)
+#define GPIO_FC9_SCK_3 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN14)
+#define GPIO_FC9_TXD_SCL_MISO_1 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT3 | GPIO_PIN22) /* Type A */
+#define GPIO_FC9_TXD_SCL_MISO_2 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT3 | GPIO_PIN3)
+#define GPIO_FC9_TXD_SCL_MISO_3 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN16)
+
+/* Frequency Measurement (FREQME) */
+
+#define GPIO_FREQME_GPIO_CLK_A_1 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN11) /* Type A */
+#define GPIO_FREQME_GPIO_CLK_A_2 (GPIO_ALT5 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN4)
+#define GPIO_FREQME_GPIO_CLK_B_1 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN12) /* Type A */
+#define GPIO_FREQME_GPIO_CLK_B_2 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT2 | GPIO_PIN7)
+
+/* LCD */
+
+#define GPIO_LCD_AC (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_PORT2 | GPIO_PIN15)
+#define GPIO_LCD_CLKIN (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_PORT2 | GPIO_PIN17)
+#define GPIO_LCD_DCLK (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_PORT2 | GPIO_PIN13)
+#define GPIO_LCD_FP (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_PORT2 | GPIO_PIN14)
+#define GPIO_LCD_LE (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_PORT2 | GPIO_PIN12)
+#define GPIO_LCD_LP (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_PORT2 | GPIO_PIN16)
+#define GPIO_LCD_PWR (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_PORT2 | GPIO_PIN11)
+#define GPIO_LCD_VD0_1 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_PORT2 | GPIO_PIN18)
+#define GPIO_LCD_VD0_2 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_PORT3 | GPIO_PIN6)
+#define GPIO_LCD_VD1_1 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_PORT2 | GPIO_PIN19)
+#define GPIO_LCD_VD1_2 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_PORT3 | GPIO_PIN7)
+#define GPIO_LCD_VD2_1 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_PORT2 | GPIO_PIN20)
+#define GPIO_LCD_VD2_2 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_PORT3 | GPIO_PIN8)
+#define GPIO_LCD_VD3_1 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_PORT2 | GPIO_PIN21)
+#define GPIO_LCD_VD3_2 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_PORT3 | GPIO_PIN9)
+#define GPIO_LCD_VD4 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_PORT2 | GPIO_PIN22)
+#define GPIO_LCD_VD5 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_PORT2 | GPIO_PIN23)
+#define GPIO_LCD_VD6 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_PORT2 | GPIO_PIN24)
+#define GPIO_LCD_VD7 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_PORT2 | GPIO_PIN25)
+#define GPIO_LCD_VD8 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_PORT2 | GPIO_PIN26)
+#define GPIO_LCD_VD9 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_PORT2 | GPIO_PIN27)
+#define GPIO_LCD_VD10 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_PORT2 | GPIO_PIN28)
+#define GPIO_LCD_VD11 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_PORT2 | GPIO_PIN29)
+#define GPIO_LCD_VD12 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_PORT2 | GPIO_PIN30)
+#define GPIO_LCD_VD13 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_PORT2 | GPIO_PIN31)
+#define GPIO_LCD_VD14 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_PORT3 | GPIO_PIN0)
+#define GPIO_LCD_VD15 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_PORT3 | GPIO_PIN1)
+#define GPIO_LCD_VD16 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_PORT3 | GPIO_PIN2)
+#define GPIO_LCD_VD17 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_PORT3 | GPIO_PIN3)
+#define GPIO_LCD_VD18 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_PORT3 | GPIO_PIN4)
+#define GPIO_LCD_VD19 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_PORT3 | GPIO_PIN5)
+#define GPIO_LCD_VD20 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_PORT3 | GPIO_PIN6)
+#define GPIO_LCD_VD21 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_PORT3 | GPIO_PIN7)
+#define GPIO_LCD_VD22 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_PORT3 | GPIO_PIN8)
+#define GPIO_LCD_VD23 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_PORT3 | GPIO_PIN9)
+
+/* MCLK */
+
+#define GPIO_MCLK_1 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN23) /* Type A */
+#define GPIO_MCLK_2 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN31)
+#define GPIO_MCLK_3 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT3 | GPIO_PIN11)
+#define GPIO_MCLK_4 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT5 | GPIO_PIN7)
+#define GPIO_MCLK_5 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT2 | GPIO_PIN21)
+
+/* Microphone (PDM) */
+
+#define GPIO_PDM0_CLK_1 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT3 | GPIO_PIN0)
+#define GPIO_PDM0_CLK_2 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT5 | GPIO_PIN8)
+#define GPIO_PDM0_CLK_3 (GPIO_ALT5 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN0)
+#define GPIO_PDM0_CLK_4 (GPIO_ALT5 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN26)
+#define GPIO_PDM0_DATA_1 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT3 | GPIO_PIN1)
+#define GPIO_PDM0_DATA_2 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT5 | GPIO_PIN9)
+#define GPIO_PDM0_DATA_3 (GPIO_ALT5 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN1)
+#define GPIO_PDM0_DATA_4 (GPIO_ALT5 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN27)
+
+#define GPIO_PDM1_CLK_1 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT5 | GPIO_PIN5)
+#define GPIO_PDM1_CLK_2 (GPIO_ALT5 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN7)
+#define GPIO_PDM1_CLK_3 (GPIO_ALT5 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN2)
+#define GPIO_PDM1_DATA_1 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT5 | GPIO_PIN6)
+#define GPIO_PDM1_DATA_2 (GPIO_ALT5 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN8)
+#define GPIO_PDM1_DATA_3 (GPIO_ALT5 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN3)
+
+/* SmartCard Interface (SCI) */
+
+#define GPIO_SCI0_IO (GPIO_ALT5 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN20)
+#define GPIO_SCI0_SCLK (GPIO_ALT5 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN21)
+
+#define GPIO_SCI1_IO (GPIO_ALT5 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN9)
+#define GPIO_SCI1_SCLK (GPIO_ALT5 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN18)
+
+/* SCTimer */
+
+#define GPIO_SCT0_GPI0_1 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT5 | GPIO_PIN5)
+#define GPIO_SCT0_GPI0_2 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN0)
+#define GPIO_SCT0_GPI0_3 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN13) /* Type D+I */
+#define GPIO_SCT0_GPI0_4 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN24)
+#define GPIO_SCT0_GPI0_5 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN5)
+#define GPIO_SCT0_GPI0_6 (GPIO_ALT5 | GPIO_MODE_DIGITAL | GPIO_PORT3 | GPIO_PIN31)
+#define GPIO_SCT0_GPI0_7 (GPIO_ALT5 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN7)
+#define GPIO_SCT0_GPI1_1 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT5 | GPIO_PIN6)
+#define GPIO_SCT0_GPI1_2 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN1)
+#define GPIO_SCT0_GPI1_3 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN14) /* Type D+I */
+#define GPIO_SCT0_GPI1_4 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN25)
+#define GPIO_SCT0_GPI1_5 (GPIO_ALT5 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN0)
+#define GPIO_SCT0_GPI1_7 (GPIO_ALT5 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN8)
+#define GPIO_SCT0_GPI2_1 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT5 | GPIO_PIN7)
+#define GPIO_SCT0_GPI2_2 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN2)
+#define GPIO_SCT0_GPI2_3 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN20)
+#define GPIO_SCT0_GPI2_4 (GPIO_ALT5 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN1)
+#define GPIO_SCT0_GPI2_5 (GPIO_ALT5 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN9)
+#define GPIO_SCT0_GPI3_1 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT5 | GPIO_PIN8)
+#define GPIO_SCT0_GPI3_2 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN21)
+#define GPIO_SCT0_GPI3_3 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN3)
+#define GPIO_SCT0_GPI3_4 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN6)
+#define GPIO_SCT0_GPI3_5 (GPIO_ALT5 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN10)
+#define GPIO_SCT0_GPI3_6 (GPIO_ALT5 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN2)
+#define GPIO_SCT0_GPI4_1 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT5 | GPIO_PIN9)
+#define GPIO_SCT0_GPI4_2 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN4)
+#define GPIO_SCT0_GPI4_3 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN0) /* Type A */
+#define GPIO_SCT0_GPI4_4 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN7)
+#define GPIO_SCT0_GPI4_5 (GPIO_ALT5 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN11)
+#define GPIO_SCT0_GPI4_6 (GPIO_ALT5 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN3)
+#define GPIO_SCT0_GPI5_1 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT5 | GPIO_PIN10)
+#define GPIO_SCT0_GPI5_2 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN5)
+#define GPIO_SCT0_GPI5_3 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN1)
+#define GPIO_SCT0_GPI5_4 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN22)
+#define GPIO_SCT0_GPI5_5 (GPIO_ALT5 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN12)
+#define GPIO_SCT0_GPI5_6 (GPIO_ALT5 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN4)
+#define GPIO_SCT0_GPI6_1 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN29)
+#define GPIO_SCT0_GPI6_2 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN6)
+#define GPIO_SCT0_GPI6_3 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN2)
+#define GPIO_SCT0_GPI6_4 (GPIO_ALT5 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN13)
+#define GPIO_SCT0_GPI6_5 (GPIO_ALT5 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN5)
+#define GPIO_SCT0_GPI7_1 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN17)
+#define GPIO_SCT0_GPI7_2 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN30)
+#define GPIO_SCT0_GPI7_3 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN12) /* Type A */
+#define GPIO_SCT0_GPI7_4 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN19)
+#define GPIO_SCT0_GPI7_5 (GPIO_ALT5 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN14)
+#define GPIO_SCT0_GPI7_6 (GPIO_ALT5 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN6)
+#define GPIO_SCT0_OUT0_1 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN23)
+#define GPIO_SCT0_OUT0_2 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT3 | GPIO_PIN26)
+#define GPIO_SCT0_OUT0_3 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN2)
+#define GPIO_SCT0_OUT0_4 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN17)
+#define GPIO_SCT0_OUT0_5 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN4)
+#define GPIO_SCT0_OUT1_1 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN24)
+#define GPIO_SCT0_OUT1_2 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT3 | GPIO_PIN27)
+#define GPIO_SCT0_OUT1_3 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN3)
+#define GPIO_SCT0_OUT1_4 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN18)
+#define GPIO_SCT0_OUT1_5 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN8)
+#define GPIO_SCT0_OUT2_1 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN25)
+#define GPIO_SCT0_OUT2_2 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT3 | GPIO_PIN28)
+#define GPIO_SCT0_OUT2_3 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN15) /* Type A */
+#define GPIO_SCT0_OUT2_4 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN19)
+#define GPIO_SCT0_OUT2_5 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN9)
+#define GPIO_SCT0_OUT3_1 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT3 | GPIO_PIN10)
+#define GPIO_SCT0_OUT3_2 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN26)
+#define GPIO_SCT0_OUT3_3 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT3 | GPIO_PIN29)
+#define GPIO_SCT0_OUT3_4 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN22)
+#define GPIO_SCT0_OUT3_5 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN31) /* Type A */
+#define GPIO_SCT0_OUT3_6 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN10)
+#define GPIO_SCT0_OUT4_1 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT3 | GPIO_PIN14)
+#define GPIO_SCT0_OUT4_2 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT3 | GPIO_PIN30)
+#define GPIO_SCT0_OUT4_3 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN23) /* Type A */
+#define GPIO_SCT0_OUT4_4 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN17)
+#define GPIO_SCT0_OUT4_5 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN3)
+#define GPIO_SCT0_OUT5_1 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT3 | GPIO_PIN31)
+#define GPIO_SCT0_OUT5_2 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN26)
+#define GPIO_SCT0_OUT5_3 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN18)
+#define GPIO_SCT0_OUT5_4 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT5 | GPIO_PIN6)
+#define GPIO_SCT0_OUT5_5 (GPIO_ALT5 | GPIO_MODE_DIGITAL | GPIO_PORT3 | GPIO_PIN18)
+#define GPIO_SCT0_OUT6_1 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT2 | GPIO_PIN2)
+#define GPIO_SCT0_OUT6_2 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN27)
+#define GPIO_SCT0_OUT6_3 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN31)
+#define GPIO_SCT0_OUT6_4 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT5 | GPIO_PIN7)
+#define GPIO_SCT0_OUT6_5 (GPIO_ALT5 | GPIO_MODE_DIGITAL | GPIO_PORT3 | GPIO_PIN19)
+#define GPIO_SCT0_OUT7_1 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN19)
+#define GPIO_SCT0_OUT7_2 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT2 | GPIO_PIN22)
+#define GPIO_SCT0_OUT7_3 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN28)
+#define GPIO_SCT0_OUT7_4 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT5 | GPIO_PIN8)
+#define GPIO_SCT0_OUT7_5 (GPIO_ALT5 | GPIO_MODE_DIGITAL | GPIO_PORT3 | GPIO_PIN20)
+#define GPIO_SCT0_OUT8_1 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT3 | GPIO_PIN12)
+#define GPIO_SCT0_OUT8_2 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT2 | GPIO_PIN23)
+#define GPIO_SCT0_OUT8_3 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN29)
+#define GPIO_SCT0_OUT8_4 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT5 | GPIO_PIN9)
+#define GPIO_SCT0_OUT9_1 (GPIO_ALT1 | GPIO_MODE_DIGITAL | GPIO_PORT3 | GPIO_PIN13)
+#define GPIO_SCT0_OUT9_2 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT2 | GPIO_PIN24)
+#define GPIO_SCT0_OUT9_3 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN30)
+#define GPIO_SCT0_OUT9_4 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT5 | GPIO_PIN10)
+
+/* SD card */
+
+#define GPIO_SD_BACKEND_PWR_1 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT3 | GPIO_PIN21) /* Type A */
+#define GPIO_SD_BACKEND_PWR_2 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT5 | GPIO_PIN4)
+#define GPIO_SD_CARD_DET_N_1 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN17)
+#define GPIO_SD_CARD_DET_N_2 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT2 | GPIO_PIN10)
+#define GPIO_SD_CARD_DET_N_3 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN22)
+#define GPIO_SD_CARD_INT_N_1 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT3 | GPIO_PIN20)
+#define GPIO_SD_CARD_INT_N_2 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_SLEW_FAST | GPIO_FILTER_OFF | GPIO_PORT4 | GPIO_PIN24)
+#define GPIO_SD_CLK_1 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_SLEW_FAST | GPIO_FILTER_OFF | GPIO_PORT0 | GPIO_PIN7)
+#define GPIO_SD_CLK_2 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_SLEW_FAST | GPIO_FILTER_OFF | GPIO_PORT1 | GPIO_PIN8)
+#define GPIO_SD_CLK_3 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_SLEW_FAST | GPIO_FILTER_OFF | GPIO_PORT2 | GPIO_PIN3)
+#define GPIO_SD_CLK_4 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_SLEW_FAST | GPIO_FILTER_OFF | GPIO_PORT4 | GPIO_PIN19)
+#define GPIO_SD_CMD_1 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_SLEW_FAST | GPIO_FILTER_OFF | GPIO_PORT0 | GPIO_PIN8)
+#define GPIO_SD_CMD_2 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_SLEW_FAST | GPIO_FILTER_OFF | GPIO_PORT1 | GPIO_PIN22)
+#define GPIO_SD_CMD_3 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_SLEW_FAST | GPIO_FILTER_OFF | GPIO_PORT2 | GPIO_PIN4)
+#define GPIO_SD_CMD_4 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_SLEW_FAST | GPIO_FILTER_OFF | GPIO_PORT4 | GPIO_PIN20)
+#define GPIO_SD_CMD_5 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_SLEW_FAST | GPIO_FILTER_OFF | GPIO_PORT1 | GPIO_PIN16)
+#define GPIO_SD_D0_1 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_SLEW_FAST | GPIO_FILTER_OFF | GPIO_PORT0 | GPIO_PIN24)
+#define GPIO_SD_D0_2 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_SLEW_FAST | GPIO_FILTER_OFF | GPIO_PORT1 | GPIO_PIN4)
+#define GPIO_SD_D0_3 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_SLEW_FAST | GPIO_FILTER_OFF | GPIO_PORT2 | GPIO_PIN6)
+#define GPIO_SD_D0_4 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_SLEW_FAST | GPIO_FILTER_OFF | GPIO_PORT4 | GPIO_PIN25)
+#define GPIO_SD_D1_1 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_SLEW_FAST | GPIO_FILTER_OFF | GPIO_PORT0 | GPIO_PIN25)
+#define GPIO_SD_D1_2 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_SLEW_FAST | GPIO_FILTER_OFF | GPIO_PORT1 | GPIO_PIN7)
+#define GPIO_SD_D1_3 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_SLEW_FAST | GPIO_FILTER_OFF | GPIO_PORT2 | GPIO_PIN7)
+#define GPIO_SD_D1_4 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_SLEW_FAST | GPIO_FILTER_OFF | GPIO_PORT4 | GPIO_PIN26)
+#define GPIO_SD_D2_1 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_PORT0 | GPIO_PIN31) /* Type A */
+#define GPIO_SD_D2_2 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_SLEW_FAST | GPIO_FILTER_OFF | GPIO_PORT1 | GPIO_PIN5)
+#define GPIO_SD_D2_3 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_SLEW_FAST | GPIO_FILTER_OFF | GPIO_PORT2 | GPIO_PIN8)
+#define GPIO_SD_D2_4 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_SLEW_FAST | GPIO_FILTER_OFF | GPIO_PORT4 | GPIO_PIN27)
+#define GPIO_SD_D3_1 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_FILTER_OFF | GPIO_PORT1 | GPIO_PIN0) /* Type A */
+#define GPIO_SD_D3_2 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_SLEW_FAST | GPIO_FILTER_OFF | GPIO_PORT1 | GPIO_PIN6)
+#define GPIO_SD_D3_3 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_SLEW_FAST | GPIO_FILTER_OFF | GPIO_PORT2 | GPIO_PIN9)
+#define GPIO_SD_D3_4 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_SLEW_FAST | GPIO_FILTER_OFF | GPIO_PORT4 | GPIO_PIN28)
+#define GPIO_SD_D4_1 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_SLEW_FAST | GPIO_FILTER_OFF | GPIO_PORT1 | GPIO_PIN27)
+#define GPIO_SD_D4_2 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_SLEW_FAST | GPIO_FILTER_OFF | GPIO_PORT3 | GPIO_PIN16)
+#define GPIO_SD_D4_3 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_SLEW_FAST | GPIO_FILTER_OFF | GPIO_PORT4 | GPIO_PIN29)
+#define GPIO_SD_D5_1 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_SLEW_FAST | GPIO_FILTER_OFF | GPIO_PORT1 | GPIO_PIN28)
+#define GPIO_SD_D5_2 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_SLEW_FAST | GPIO_FILTER_OFF | GPIO_PORT3 | GPIO_PIN17)
+#define GPIO_SD_D5_3 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_SLEW_FAST | GPIO_FILTER_OFF | GPIO_PORT4 | GPIO_PIN30)
+#define GPIO_SD_D6_1 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_SLEW_FAST | GPIO_FILTER_OFF | GPIO_PORT1 | GPIO_PIN29)
+#define GPIO_SD_D6_2 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_SLEW_FAST | GPIO_FILTER_OFF | GPIO_PORT3 | GPIO_PIN18)
+#define GPIO_SD_D6_3 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_SLEW_FAST | GPIO_FILTER_OFF | GPIO_PORT4 | GPIO_PIN31)
+#define GPIO_SD_D7_1 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_SLEW_FAST | GPIO_FILTER_OFF | GPIO_PORT1 | GPIO_PIN30)
+#define GPIO_SD_D7_2 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_SLEW_FAST | GPIO_FILTER_OFF | GPIO_PORT3 | GPIO_PIN19)
+#define GPIO_SD_D7_3 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_SLEW_FAST | GPIO_FILTER_OFF | GPIO_PORT5 | GPIO_PIN0)
+#define GPIO_SD_POW_EN_1 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN9)
+#define GPIO_SD_POW_EN_2 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT2 | GPIO_PIN5)
+#define GPIO_SD_POW_EN_3 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN21)
+#define GPIO_SD_VOLT0_1 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT2 | GPIO_PIN11)
+#define GPIO_SD_VOLT0_2 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT5 | GPIO_PIN1)
+#define GPIO_SD_VOLT1_1 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT2 | GPIO_PIN12)
+#define GPIO_SD_VOLT1_2 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT5 | GPIO_PIN2)
+#define GPIO_SD_VOLT2_1 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT2 | GPIO_PIN13)
+#define GPIO_SD_VOLT2_2 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT5 | GPIO_PIN3)
+#define GPIO_SD_WR_PRT_1 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN18)
+#define GPIO_SD_WR_PRT_2 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT3 | GPIO_PIN15)
+#define GPIO_SD_WR_PRT_3 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN23)
+
+/* SPIFI */
+
+#define GPIO_SPIFI_CLK (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN26)
+#define GPIO_SPIFI_CSN (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN23) /* Type A */
+#define GPIO_SPIFI_IO0 (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN24)
+#define GPIO_SPIFI_IO1 (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN25)
+#define GPIO_SPIFI_IO2 (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN28)
+#define GPIO_SPIFI_IO3 (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN27)
+#define GPIO_SWCLK (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN11) /* Type A */
+
+/* SWD */
+
+#define GPIO_SWDIO (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN12) /* Type A */
+#define GPIO_SWO_1 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN8)
+#define GPIO_SWO_2 (GPIO_ALT6 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN10) /* Type A */
+
+/* Trace */
+
+#define GPIO_TRACECLK_1 (GPIO_ALT5 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN0) /* Type A */
+#define GPIO_TRACECLK_2 (GPIO_ALT5 | GPIO_MODE_DIGITAL | GPIO_PORT5 | GPIO_PIN5)
+#define GPIO_TRACECLK_3 (GPIO_ALT7 | GPIO_MODE_DIGITAL | GPIO_PORT3 | GPIO_PIN12)
+#define GPIO_TRACEDATA0_1 (GPIO_ALT5 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN31) /* Type A */
+#define GPIO_TRACEDATA0_2 (GPIO_ALT5 | GPIO_MODE_DIGITAL | GPIO_PORT5 | GPIO_PIN6)
+#define GPIO_TRACEDATA0_3 (GPIO_ALT7 | GPIO_MODE_DIGITAL | GPIO_PORT3 | GPIO_PIN10)
+#define GPIO_TRACEDATA1_1 (GPIO_ALT5 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN30)
+#define GPIO_TRACEDATA1_2 (GPIO_ALT5 | GPIO_MODE_DIGITAL | GPIO_PORT5 | GPIO_PIN7)
+#define GPIO_TRACEDATA1_3 (GPIO_ALT7 | GPIO_MODE_DIGITAL | GPIO_PORT3 | GPIO_PIN13)
+#define GPIO_TRACEDATA2_1 (GPIO_ALT5 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN29)
+#define GPIO_TRACEDATA2_2 (GPIO_ALT5 | GPIO_MODE_DIGITAL | GPIO_PORT5 | GPIO_PIN8)
+#define GPIO_TRACEDATA2_3 (GPIO_ALT7 | GPIO_MODE_DIGITAL | GPIO_PORT3 | GPIO_PIN14)
+#define GPIO_TRACEDATA3_1 (GPIO_ALT5 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN28)
+#define GPIO_TRACEDATA3_2 (GPIO_ALT5 | GPIO_MODE_DIGITAL | GPIO_PORT5 | GPIO_PIN9)
+#define GPIO_TRACEDATA3_3 (GPIO_ALT7 | GPIO_MODE_DIGITAL | GPIO_PORT3 | GPIO_PIN11)
+
+/* USBG */
+
+#define GPIO_USB0_FRAME_1 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT2 | GPIO_PIN14)
+#define GPIO_USB0_FRAME_2 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN7)
+#define GPIO_USB0_FRAME_3 (GPIO_ALT5 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN13)
+#define GPIO_USB0_IDVALUE_1 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT2 | GPIO_PIN12)
+#define GPIO_USB0_IDVALUE_2 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN11)
+#define GPIO_USB0_IDVALUE_3 (GPIO_ALT7 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN26)
+#define GPIO_USB0_LEDN_1 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT2 | GPIO_PIN15)
+#define GPIO_USB0_LEDN_2 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN8)
+#define GPIO_USB0_LEDN_3 (GPIO_ALT5 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN14)
+#define GPIO_USB0_OVERCURRENTN_1 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT2 | GPIO_PIN15)
+#define GPIO_USB0_OVERCURRENTN_2 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN8)
+#define GPIO_USB0_OVERCURRENTN_3 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN13)
+#define GPIO_USB0_OVERCURRENTN_4 (GPIO_ALT7 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN28)
+#define GPIO_USB0_PORTPWRN_1 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT2 | GPIO_PIN14)
+#define GPIO_USB0_PORTPWRN_2 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN7)
+#define GPIO_USB0_PORTPWRN_3 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN12)
+#define GPIO_USB0_PORTPWRN_4 (GPIO_ALT7 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN3)
+#define GPIO_USB0_VBUS_1 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT2 | GPIO_PIN25)
+#define GPIO_USB0_VBUS_2 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT3 | GPIO_PIN24) /* Type D+I */
+#define GPIO_USB0_VBUS_3 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN11)
+#define GPIO_USB0_VBUS_4 (GPIO_ALT7 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN22)
+
+#define GPIO_USB1_FRAME_1 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT2 | GPIO_PIN16)
+#define GPIO_USB1_FRAME_2 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN9)
+#define GPIO_USB1_FRAME_3 (GPIO_ALT5 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN29)
+#define GPIO_USB1_LEDN_1 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT2 | GPIO_PIN17)
+#define GPIO_USB1_LEDN_2 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN10)
+#define GPIO_USB1_LEDN_3 (GPIO_ALT5 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN30)
+#define GPIO_USB1_OVERCURRENTN_1 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT2 | GPIO_PIN17)
+#define GPIO_USB1_OVERCURRENTN_2 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN10)
+#define GPIO_USB1_OVERCURRENTN_3 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN30)
+#define GPIO_USB1_OVERCURRENTN_4 (GPIO_ALT7 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN1)
+#define GPIO_USB1_PORTPWRN_1 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT2 | GPIO_PIN16)
+#define GPIO_USB1_PORTPWRN_2 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN9)
+#define GPIO_USB1_PORTPWRN_3 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN29)
+#define GPIO_USB1_PORTPWRN_4 (GPIO_ALT7 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN2)
+
+/* Micro-tick Timer (UTICK) */
+
+#define GPIO_UTICK_CAP0_1 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN13) /* Type D+I */
+#define GPIO_UTICK_CAP0_2 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN19)
+#define GPIO_UTICK_CAP0_3 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN25)
+#define GPIO_UTICK_CAP0_4 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN17)
+#define GPIO_UTICK_CAP1_1 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN14) /* Type D+I */
+#define GPIO_UTICK_CAP1_2 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN22)
+#define GPIO_UTICK_CAP1_3 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN26)
+#define GPIO_UTICK_CAP1_4 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN18)
+#define GPIO_UTICK_CAP2_1 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN15) /* Type A */
+#define GPIO_UTICK_CAP2_2 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN14)
+#define GPIO_UTICK_CAP2_3 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT3 | GPIO_PIN21) /* Type A */
+#define GPIO_UTICK_CAP2_4 (GPIO_ALT4 | GPIO_MODE_DIGITAL | GPIO_PORT4 | GPIO_PIN26)
+#define GPIO_UTICK_CAP3_1 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT0 | GPIO_PIN21)
+#define GPIO_UTICK_CAP3_2 (GPIO_ALT2 | GPIO_MODE_DIGITAL | GPIO_PORT1 | GPIO_PIN15)
+#define GPIO_UTICK_CAP3_3 (GPIO_ALT3 | GPIO_MODE_DIGITAL | GPIO_PORT3 | GPIO_PIN23) /* Type D+I */
+#define GPIO_UTICK_CAP3_5 (GPIO_ALT5 | GPIO_MODE_DIGITAL | GPIO_PORT5 | GPIO_PIN10)
+
+#endif /* __ARCH_ARM_SRC_LPC54XX_CHIP_LPC546X_PINMUX_H */
diff --git a/arch/arm/src/lpc54xx/chip/lpc54_dma.h b/arch/arm/src/lpc54xx/chip/lpc54_dma.h
new file mode 100644
index 0000000000000000000000000000000000000000..f79b531f881b590961ef4546f57a5d28e79da49c
--- /dev/null
+++ b/arch/arm/src/lpc54xx/chip/lpc54_dma.h
@@ -0,0 +1,278 @@
+/********************************************************************************************
+ * arch/arm/src/lpc54xx/lpc54_dma.h
+ *
+ * Copyright (C) 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.
+ *
+ ********************************************************************************************/
+
+#ifndef __ARCH_ARM_SRC_LPC54XX_CHIP_LPC54_DMA_H
+#define __ARCH_ARM_SRC_LPC54XX_CHIP_LPC54_DMA_H
+
+/********************************************************************************************
+ * Included Files
+ ********************************************************************************************/
+
+#include
+#include "chip/lpc54_memorymap.h"
+
+/********************************************************************************************
+ * Pre-processor Definitions
+ ********************************************************************************************/
+
+#define LPC54_DMA_NCHANNELS 30 /* Channels 0..29 */
+#define LPC54_DMA_MAXXFRS 1024 /* Maximum number of transfers per DMA */
+
+/* Register offsets *************************************************************************/
+
+/* Global control and status registers */
+
+#define LPC54_DMA_CTRL_OFFSET 0x0000 /* DMA control */
+#define LPC54_DMA_INTSTAT_OFFSET 0x0004 /* Interrupt status */
+#define LPC54_DMA_SRAMBASE_OFFSET 0x0008 /* SRAM address of the channel configuration table */
+
+/* Shared registers */
+
+#define LPC54_DMA_ENABLESET0_OFFSET 0x0020 /* Channel enable read and Set for all DMA channels */
+#define LPC54_DMA_ENABLECLR0_OFFSET 0x0028 /* Channel enable clear for all DMA channels */
+#define LPC54_DMA_ACTIVE0_OFFSET 0x0030 /* Channel active status for all DMA channels */
+#define LPC54_DMA_BUSY0_OFFSET 0x0038 /* Channel busy status for all DMA channels */
+#define LPC54_DMA_ERRINT0_OFFSET 0x0040 /* Error interrupt status for all DMA channels */
+#define LPC54_DMA_INTENSET0_OFFSET 0x0048 /* Interrupt enable read and Set for all DMA channels */
+#define LPC54_DMA_INTENCLR0_OFFSET 0x0050 /* Interrupt enable clear for all DMA channels */
+#define LPC54_DMA_INTA0_OFFSET 0x0058 /* Interrupt A status for all DMA channels */
+#define LPC54_DMA_INTB0_OFFSET 0x0060 /* Interrupt B status for all DMA channels */
+#define LPC54_DMA_SETVALID0_OFFSET 0x0068 /* Set ValidPending control bits for all DMA channels */
+#define LPC54_DMA_SETTRIG0_OFFSET 0x0070 /* Set trigger control bits for all DMA channels */
+#define LPC54_DMA_ABORT0_OFFSET 0x0078 /* Channel abort control for all DMA channels */
+
+/* Channel registers */
+
+#define LPC54_DMA_CHAN_OFFSET(n) (0x0400 + ((n) << 4))
+#define LPC54_DMA_CFG_OFFSET 0x0000 /* Configuration register for DMA channel n */
+#define LPC54_DMA_CTLSTAT_OFFSET 0x0004 /* Control and status register for DMA channel n */
+#define LPC54_DMA_XFERCFG_OFFSET 0x0008 /* Transfer configuration register for DMA channel n */
+
+/* Register addresses ***********************************************************************/
+
+/* Global control and status registers */
+
+#define LPC54_DMA_CTRL (LPC54_DMA_BASE + LPC54_DMA_CTRL_OFFSET)
+#define LPC54_DMA_INTSTAT (LPC54_DMA_BASE + LPC54_DMA_INTSTAT_OFFSET)
+#define LPC54_DMA_SRAMBASE (LPC54_DMA_BASE + LPC54_DMA_SRAMBASE_OFFSET)
+
+/* Shared registers */
+
+#define LPC54_DMA_ENABLESET0 (LPC54_DMA_BASE + LPC54_DMA_ENABLESET0_OFFSET)
+#define LPC54_DMA_ENABLECLR0 (LPC54_DMA_BASE + LPC54_DMA_ENABLECLR0_OFFSET)
+#define LPC54_DMA_ACTIVE0 (LPC54_DMA_BASE + LPC54_DMA_ACTIVE0_OFFSET)
+#define LPC54_DMA_BUSY0 (LPC54_DMA_BASE + LPC54_DMA_BUSY0_OFFSET)
+#define LPC54_DMA_ERRINT0 (LPC54_DMA_BASE + LPC54_DMA_ERRINT0_OFFSET)
+#define LPC54_DMA_INTENSET0 (LPC54_DMA_BASE + LPC54_DMA_INTENSET0_OFFSET)
+#define LPC54_DMA_INTENCLR0 (LPC54_DMA_BASE + LPC54_DMA_INTENCLR0_OFFSET)
+#define LPC54_DMA_INTA0 (LPC54_DMA_BASE + LPC54_DMA_INTA0_OFFSET)
+#define LPC54_DMA_INTB0 (LPC54_DMA_BASE + LPC54_DMA_INTB0_OFFSET)
+#define LPC54_DMA_SETVALID0 (LPC54_DMA_BASE + LPC54_DMA_SETVALID0_OFFSET)
+#define LPC54_DMA_SETTRIG0 (LPC54_DMA_BASE + LPC54_DMA_SETTRIG0_OFFSET)
+#define LPC54_DMA_ABORT0 (LPC54_DMA_BASE + LPC54_DMA_ABORT0_OFFSET)
+
+/* Channel registers */
+
+#define LPC54_DMA_CHAN_BASE(n) (LPC54_DMA_BASE + LPC54_DMA_CHAN_OFFSET(n))
+#define LPC54_DMA_CFG(n) (LPC54_DMA_CHAN_BASE(n) + LPC54_DMA_CFG_OFFSET)
+#define LPC54_DMA_CTLSTAT(n) (LPC54_DMA_CHAN_BASE(n) + LPC54_DMA_CTLSTAT_OFFSET)
+#define LPC54_DMA_XFERCFG(n) (LPC54_DMA_CHAN_BASE(n) + LPC54_DMA_XFERCFG_OFFSET)
+
+/* Register bit definitions *****************************************************************/
+
+/* DMA control */
+
+#define DMA_CTRL_ENABLE (1 << 0) /* Bit 0: DMA controller master enable */
+
+/* Interrupt status */
+
+#define DMA_INTSTAT_ACTIVEINT (1 << 1) /* Bit 1: Summarizes pending enabled interrupts */
+#define DMA_INTSTAT_ACTIVEERRINT (1 << 2) /* Bit 2: Summarizes pending error interrupts */
+
+/* SRAM address of the channel configuration table */
+
+#define DMA_SRAMBASE_MASK 0xfffffe00
+
+/* The remaining shared registers are all 32 bit encoded fieldss with bit n corresponding to
+ * Channel n.
+ */
+
+#define DMA_CHANNEL(n) (1 << (n))
+#define DMA_ALL_CHANNELS 0x3fffffff
+
+/* Channel registers */
+
+/* Configuration register for DMA channel n */
+
+#define DMA_CFG_PERIPHREQEN (1 << 0) /* Bit 0: Peripheral request Enable */
+#define DMA_CFG_HWTRIGEN (1 << 1) /* Bit 1: Hardware Triggering Enable */
+#define DMA_CFG_TRIGPOL (1 << 4) /* Bit 4: Trigger Polarity */
+# define DMA_CFG_ACTIVE_LOW (0)
+# define DMA_CFG_FALLING_EDGE (0)
+# define DMA_CFG_ACTIVE_HIGH DMA_CFG_TRIGPOL
+# define DMA_CFG_RISING_EDGE DMA_CFG_TRIGPOL
+#define DMA_CFG_TRIGTYPE (1 << 5) /* Bit 5: Trigger Type */
+# define DMA_CFG_EDGE_TRIGGER (0)
+# define DMA_CFG_LEVEL_TRIGGER DMA_CFG_TRIGTYPE
+#define DMA_CFG_TRIGBURST (1 << 6) /* Bit 6: Trigger Burst */
+#define DMA_CFG_BURSTPOWER_SHIFT (8) /* Bits 8-11: Burst Power */
+#define DMA_CFG_BURSTPOWER_MASK (15 << DMA_CFG_BURSTPOWER_SHIFT)
+# define DMA_CFG_BURSTPOWER_1 (0 << DMA_CFG_BURSTPOWER_SHIFT) /* Burst size = 1 (2^0) */
+# define DMA_CFG_BURSTPOWER_2 (1 << DMA_CFG_BURSTPOWER_SHIFT) /* Burst size = 2 (2^1) */
+# define DMA_CFG_BURSTPOWER_3 (2 << DMA_CFG_BURSTPOWER_SHIFT) /* Burst size = 4 (2^2) */
+# define DMA_CFG_BURSTPOWER_8 (3 << DMA_CFG_BURSTPOWER_SHIFT) /* Burst size = 8 (2^2) */
+# define DMA_CFG_BURSTPOWER_16 (4 << DMA_CFG_BURSTPOWER_SHIFT) /* Burst size = 16 (2^2) */
+# define DMA_CFG_BURSTPOWER_32 (5 << DMA_CFG_BURSTPOWER_SHIFT) /* Burst size = 32 (2^2) */
+# define DMA_CFG_BURSTPOWER_64 (6 << DMA_CFG_BURSTPOWER_SHIFT) /* Burst size = 64 (2^2) */
+# define DMA_CFG_BURSTPOWER_128 (7 << DMA_CFG_BURSTPOWER_SHIFT) /* Burst size = 128 (2^2) */
+# define DMA_CFG_BURSTPOWER_256 (8 << DMA_CFG_BURSTPOWER_SHIFT) /* Burst size = 256 (2^2) */
+# define DMA_CFG_BURSTPOWER_512 (9 << DMA_CFG_BURSTPOWER_SHIFT) /* Burst size = 256 (2^2) */
+# define DMA_CFG_BURSTPOWER_1024 (10 << DMA_CFG_BURSTPOWER_SHIFT) /* Burst size = 1024 (2^10) */
+#define DMA_CFG_SRCBURSTWRAP (1 << 14) /* Bit 14: Source Burst Wrap */
+#define DMA_CFG_DSTBURSTWRAP (1 << 15) /* Bit 15: Destination Burst Wrap */
+#define DMA_CFG_CHPRIORITY_SHIFT (16) /* Bits 16-18: Priority of this channel */
+#define DMA_CFG_CHPRIORITY_MASK (7 << DMA_CFG_CHPRIORITY_SHIFT)
+# define DMA_CFG_CHPRIORITY(n) ((uint32_t)(n) << DMA_CFG_CHPRIORITY_SHIFT)
+# define DMA_CFG_CHPRIORITY_HIGH (0 << DMA_CFG_CHPRIORITY_SHIFT) /* Highest priority */
+# define DMA_CFG_CHPRIORITY_LOW (7 << DMA_CFG_CHPRIORITY_SHIFT) /* Lowest priority */
+
+/* Control and status register for DMA channel n */
+
+#define DMA_CTLSTAT_VALIDPENDING (1 << 0) /* Bit 0: Valid pending flag */
+#define DMA_CTLSTAT_TRIG (1 << 2) /* Bit 2: Trigger flag */
+
+/* Transfer configuration register for DMA channel n */
+
+#define DMA_XFERCFG_CFGVALID (1 << 0) /* Bit 0: Configuration Valid flag */
+#define DMA_XFERCFG_RELOAD (1 << 1) /* Bit 1: Reload channel’s control structure */
+#define DMA_XFERCFG_SWTRIG (1 << 2) /* Bit 2: Software Trigger */
+#define DMA_XFERCFG_CLRTRIG (1 << 3) /* Bit 3: Clear Trigger */
+#define DMA_XFERCFG_SETINTA (1 << 4) /* Bit 4: Set Interrupt flag A */
+#define DMA_XFERCFG_SETINTB (1 << 5) /* Bit 5: Set Interrupt flag B */
+#define DMA_XFERCFG_WIDTH_SHIFT (8) /* Bits 8-9: Transfer width */
+#define DMA_XFERCFG_WIDTH_MASK (3 << DMA_XFERCFG_WIDTH_SHIFT)
+# define DMA_XFERCFG_WIDTH_8BIT (0 << DMA_XFERCFG_WIDTH_SHIFT) /* 8-bit transfers */
+# define DMA_XFERCFG_WIDTH_16BIT (1 << DMA_XFERCFG_WIDTH_SHIFT) /* 16-bit transfers */
+# define DMA_XFERCFG_WIDTH_32BIT (2 << DMA_XFERCFG_WIDTH_SHIFT) /* 32-bit transfers */
+#define DMA_XFERCFG_SRCINC_SHIFT (12) /* Bits 12-13: Source address increment */
+#define DMA_XFERCFG_SRCINC_MASK (3 << DMA_XFERCFG_SRCINC_SHIFT)
+# define DMA_XFERCFG_SRCINC_NONE (0 << DMA_XFERCFG_SRCINC_SHIFT) /* No increment */
+# define DMA_XFERCFG_SRCINC_1X (1 << DMA_XFERCFG_SRCINC_SHIFT) /* 1 x width */
+# define DMA_XFERCFG_SRCINC_2X (2 << DMA_XFERCFG_SRCINC_SHIFT) /* 2 x width */
+# define DMA_XFERCFG_SRCINC_4X (3 << DMA_XFERCFG_SRCINC_SHIFT) /* 4 x width */
+#define DMA_XFERCFG_DSTINC_SHIFT (14) /* Bits 14-15: Destination address increment */
+#define DMA_XFERCFG_DSTINC_MASK (3 << DMA_XFERCFG_DSTINC_SHIFT)
+# define DMA_XFERCFG_DSTINC_NONE (0 << DMA_XFERCFG_DSTINC_SHIFT) /* No increment */
+# define DMA_XFERCFG_DSTINC_1X (1 << DMA_XFERCFG_DSTINC_SHIFT) /* 1 x width */
+# define DMA_XFERCFG_DSTINC_2X (2 << DMA_XFERCFG_DSTINC_SHIFT) /* 2 x width */
+# define DMA_XFERCFG_DSTINC_4X (3 << DMA_XFERCFG_DSTINC_SHIFT) /* 4 x width */
+#define DMA_XFERCFG_XFERCOUNT_SHIFT (16) /* Bits 16-25: Total number of transfers to be performed */
+#define DMA_XFERCFG_XFERCOUNT_MASK (0x3ff << DMA_XFERCFG_XFERCOUNT_SHIFT)
+# define DMA_XFERCFG_XFERCOUNT(n) ((uint32_t)((n)-1) << DMA_XFERCFG_XFERCOUNT_SHIFT)
+
+/* DMA requests *****************************************************************************/
+/* DMA requests are directly connected to the peripherals. Each channel supports one DMA
+ * request line and one trigger input. Some DMA requests allow a selection of requests
+ * sources. DMA triggers are selected from many possible input sources.
+ */
+
+/* Peripheral request inputs to DMA channel. For DMA channel 'n', the corresponding DMA
+ * trigger input is provided by the setting of the INPUT MUX register DMA_ITRIG_INMUXn
+ */
+
+#define FLEXCOMM0_RX_DMACHAN (0) /* Flexcomm Interface 0 RX */
+#define FLEXCOMM0_I2CSLAVE_DMACHAN (0) /* Flexcomm Interface 0 I2C Slave */
+#define FLEXCOMM0_TX_DMACHAN (1) /* Flexcomm Interface 0 TX */
+#define FLEXCOMM0_I2CMASTER_DMACHAN (1) /* Flexcomm Interface 0 I2C Master */
+#define FLEXCOMM1_RX_DMACHAN (2) /* Flexcomm Interface 1 RX */
+#define FLEXCOMM1_I2CSLAVE_DMACHAN (2) /* Flexcomm Interface 1 I2C Slave */
+#define FLEXCOMM1_TX_DMACHAN (3) /* Flexcomm Interface 1 TX */
+#define FLEXCOMM1_I2CMASTER_DMACHAN (3) /* Flexcomm Interface 1 I2C Master */
+#define FLEXCOMM2_RX_DMACHAN (4) /* Flexcomm Interface 2 RX */
+#define FLEXCOMM2_I2CSLAVE_DMACHAN (4) /* Flexcomm Interface 2 I2C Slave */
+#define FLEXCOMM2_TX_DMACHAN (5) /* Flexcomm Interface 2 TX */
+#define FLEXCOMM2_I2CMASTER_DMACHAN (5) /* Flexcomm Interface 2 I2C Master */
+#define FLEXCOMM3_RX_DMACHAN (6) /* Flexcomm Interface 3 RX */
+#define FLEXCOMM3_I2CSLAVE_DMACHAN (6) /* Flexcomm Interface 3 I2C Slave */
+#define FLEXCOMM3_TX_DMACHAN (7) /* Flexcomm Interface 3 TX */
+#define FLEXCOMM3_I2CMASTER_DMACHAN (7) /* Flexcomm Interface 3 I2C Master */
+#define FLEXCOMM4_RX_DMACHAN (8) /* Flexcomm Interface 4 RX */
+#define FLEXCOMM4_I2CSLAVE_DMACHAN (8) /* Flexcomm Interface 4 I2C Slave */
+#define FLEXCOMM4_TX_DMACHAN (9) /* Flexcomm Interface 4 TX */
+#define FLEXCOMM4_I2CMASTER_DMACHAN (9) /* Flexcomm Interface 4 I2C Master */
+#define FLEXCOMM5_RX_DMACHAN (10) /* Flexcomm Interface 5 RX */
+#define FLEXCOMM5_I2CSLAVE_DMACHAN (10) /* Flexcomm Interface 5 I2C Slave */
+#define FLEXCOMM5_TX_DMACHAN (11) /* Flexcomm Interface 5 TX */
+#define FLEXCOMM5_I2CMASTER_DMACHAN (11) /* Flexcomm Interface 5 I2C Master */
+#define FLEXCOMM6_RX_DMACHAN (12) /* Flexcomm Interface 6 RX */
+#define FLEXCOMM6_I2CSLAVE_DMACHAN (12) /* Flexcomm Interface 6 I2C Slave */
+#define FLEXCOMM6_TX_DMACHAN (13) /* Flexcomm Interface 6 TX */
+#define FLEXCOMM6_I2CMASTER_DMACHAN (13) /* Flexcomm Interface 6 I2C Master */
+#define FLEXCOMM7_RX_DMACHAN (14) /* Flexcomm Interface 7 RX */
+#define FLEXCOMM7_I2CSLAVE_DMACHAN (14) /* Flexcomm Interface 7 I2C Slave */
+#define FLEXCOMM7_TX_DMACHAN (15) /* Flexcomm Interface 7 TX */
+#define FLEXCOMM7_I2CMASTER_DMACHAN (15) /* Flexcomm Interface 7 I2C Master */
+#define DMIC0_DMACHAN (16) /* DMIC0 */
+#define DMIC1_DMACHAN (17) /* DMIC1 */
+#define SPIFI_DMACHAN (18) /* SPIFI */
+#define SHA_DMACHAN (19) /* SHA */
+#define FLEXCOMM8_RX_DMACHAN (20) /* Flexcomm Interface 8 RX */
+#define FLEXCOMM8_I2CSLAVE_DMACHAN (20) /* Flexcomm Interface 8 I2C Slave */
+#define FLEXCOMM8_TX_DMACHAN (21) /* Flexcomm Interface 8 TX */
+#define FLEXCOMM8_I2CMASTER_DMACHAN (21) /* Flexcomm Interface 8 I2C Slave (?) */
+#define FLEXCOMM9_RX_DMACHAN (22) /* Flexcomm Interface 9 RX */
+#define FLEXCOMM9_I2CSLAVE_DMACHAN (22) /* Flexcomm Interface 9 I2C Slave */
+#define FLEXCOMM9_TX_DMACHAN (23) /* Flexcomm Interface 9 TX */
+#define FLEXCOMM9_I2CMASTER_DMACHAN (23) /* Flexcomm Interface 9 I2C Slave (?) */
+#define SMARTCARD0_RX_DMACHAN (24) /* SMARTCARD0_RX */
+#define SMARTCARD0_TX_DMACHAN (25) /* SMARTCARD0_TX */
+#define SMARTCARD1_RX_DMACHAN (26) /* SMARTCARD1_RX */
+#define SMARTCARD1_TX_DMACHAN (27) /* SMARTCARD1_TX */
+
+/********************************************************************************************
+ * Public Types
+ ********************************************************************************************/
+
+/* DMA channel descriptor */
+
+struct lpc54_dmachan_desc_s
+{
+ uint32_t reserved;
+ uint32_t srcend; /* Source data end address */
+ uint32_t dstend; /* Destination end address */
+ uint32_t link; /* Link to next descriptor */
+};
+
+#endif /* __ARCH_ARM_SRC_LPC54XX_CHIP_LPC54_DMA_H */
diff --git a/arch/arm/src/lpc54xx/chip/lpc54_emc.h b/arch/arm/src/lpc54xx/chip/lpc54_emc.h
new file mode 100644
index 0000000000000000000000000000000000000000..9a722b86b2db0eda4ee9b23754477c2c2d09fedb
--- /dev/null
+++ b/arch/arm/src/lpc54xx/chip/lpc54_emc.h
@@ -0,0 +1,343 @@
+/****************************************************************************************************
+ * arch/arm/src/lpc54xx/lpc54_emc.h
+ *
+ * Copyright (C) 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.
+ *
+ ****************************************************************************************************/
+
+#ifndef __ARCH_ARM_SRC_LPC54XX_CHIP_LPC54_EMC_H
+#define __ARCH_ARM_SRC_LPC54XX_CHIP_LPC54_EMC_H
+
+/****************************************************************************************************
+ * Included Files
+ ****************************************************************************************************/
+
+#include
+#include "chip/lpc54_memorymap.h"
+
+/****************************************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************************************/
+
+#define LPC54_EMC_CS0 0
+#define LPC54_EMC_CS1 1
+#define LPC54_EMC_CS2 2
+#define LPC54_EMC_CS3 3
+#define LPC54_EMC_NCS 4
+
+/* Register offsets *********************************************************************************/
+
+#define LPC54_EMC_CONTROL_OFFSET 0x0000 /* Controls operation of the memory controller */
+#define LPC54_EMC_STATUS_OFFSET 0x0004 /* Provides EMC status information */
+#define LPC54_EMC_CONFIG_OFFSET 0x0008 /* Configures operation of the memory controller */
+#define LPC54_EMC_DYNCONTROL_OFFSET 0x0020 /* Controls dynamic memory operation */
+#define LPC54_EMC_DYNREFRESH_OFFSET 0x0024 /* Configures dynamic memory refresh */
+#define LPC54_EMC_DYNREADCONFIG_OFFSET 0x0028 /* Configures dynamic memory read strategy */
+#define LPC54_EMC_DYNRP_OFFSET 0x0030 /* Precharge command period */
+#define LPC54_EMC_DYNRAS_OFFSET 0x0034 /* Active to precharge command period */
+#define LPC54_EMC_DYNSREX_OFFSET 0x0038 /* Self-refresh exit time */
+#define LPC54_EMC_DYNAPR_OFFSET 0x003c /* Last-data-out to active command time */
+#define LPC54_EMC_DYNDAL_OFFSET 0x0040 /* Data-in to active command time */
+#define LPC54_EMC_DYNWR_OFFSET 0x0044 /* Write recovery time */
+#define LPC54_EMC_DYNRC_OFFSET 0x0048 /* Selects the active to active command period */
+#define LPC54_EMC_DYNRFC_OFFSET 0x004c /* Selects the auto-refresh period */
+#define LPC54_EMC_DYNXSR_OFFSET 0x0050 /* Time for exit self-refresh to active command */
+#define LPC54_EMC_DYNRRD_OFFSET 0x0054 /* Latency for active bank A to active bank B */
+#define LPC54_EMC_DYNMRD_OFFSET 0x0058 /* Time for load mode register to active command */
+#define LPC54_EMC_STATEXTWAIT_OFFSET 0x0080 /* Time for long static memory read and write transfers */
+
+/* Per-chip select dynamic memory registers */
+
+#define LPC54_EMC_DYNCS_OFFSET(n) (0x0100 + ((uintptr_t)(n) << 5))
+#define LPC54_EMC_DYNCONFIG_OFFSET 0x0000 /* Configuration information for CSn */
+#define LPC54_EMC_DYNRASCAS_OFFSET 0x0004 /* RAS and CAS latencies for CSn */
+
+#define LPC54_EMC_DYNCONFIGn_OFFSET(n) (0x0100 + ((uintptr_t)(n) << 5))
+#define LPC54_EMC_DYNRASCASn_OFFSET(n) (0x0104 + ((uintptr_t)(n) << 5))
+
+/* Per-chip select static memory registers */
+
+#define LPC54_EMC_STATCS_OFFSET(n) (0x0200 + ((uintptr_t)(n) << 5))
+#define LPC54_EMC_STATCONFIG_OFFSET 0x0000 /* Configuration for CSn */
+#define LPC54_EMC_STATWAITWEN_OFFSET 0x0004 /* Delay to write enable */
+#define LPC54_EMC_STATWAITOEN_OFFSET 0x0008 /* Delay to output enable */
+#define LPC54_EMC_STATWAITRD_OFFSET 0x000c /* Delay to read access */
+#define LPC54_EMC_STATWAITPAGE_OFFSET 0x0010 /* Delay for asynchronous page mode accesses */
+#define LPC54_EMC_STATWAITWR_OFFSET 0x0014 /* Delay from EMC_CS0 to a write access */
+#define LPC54_EMC_STATWAITTURN_OFFSET 0x0018 /* Number of bus turnaround cycles */
+
+#define LPC54_EMC_STATCONFIGn_OFFSET(n) (0x0200 + ((uintptr_t)(n) << 5))
+#define LPC54_EMC_STATWAITWENn_OFFSET(n) (0x0204 + ((uintptr_t)(n) << 5))
+#define LPC54_EMC_STATWAITOENn_OFFSET(n) (0x0208 + ((uintptr_t)(n) << 5))
+#define LPC54_EMC_STATWAITRDn_OFFSET(n) (0x020c + ((uintptr_t)(n) << 5))
+#define LPC54_EMC_STATWAITPAGEn_OFFSET(n) (0x0210 + ((uintptr_t)(n) << 5))
+#define LPC54_EMC_STATWAITWRn_OFFSET(n) (0x0214 + ((uintptr_t)(n) << 5))
+#define LPC54_EMC_STATWAITTURNn_OFFSET(n) (0x0218 + ((uintptr_t)(n) << 5))
+
+/* Register addresses *******************************************************************************/
+
+#define LPC54_EMC_CONTROL (LPC54_EMC_BASE + LPC54_EMC_CONTROL_OFFSET)
+#define LPC54_EMC_STATUS (LPC54_EMC_BASE + LPC54_EMC_STATUS_OFFSET)
+#define LPC54_EMC_CONFIG (LPC54_EMC_BASE + LPC54_EMC_CONFIG_OFFSET)
+#define LPC54_EMC_DYNCONTROL (LPC54_EMC_BASE + LPC54_EMC_DYNCONTROL_OFFSET)
+#define LPC54_EMC_DYNREFRESH (LPC54_EMC_BASE + LPC54_EMC_DYNREFRESH_OFFSET)
+#define LPC54_EMC_DYNREADCONFIG (LPC54_EMC_BASE + LPC54_EMC_DYNREADCONFIG_OFFSET)
+#define LPC54_EMC_DYNRP (LPC54_EMC_BASE + LPC54_EMC_DYNRP_OFFSET)
+#define LPC54_EMC_DYNRAS (LPC54_EMC_BASE + LPC54_EMC_DYNRAS_OFFSET)
+#define LPC54_EMC_DYNSREX (LPC54_EMC_BASE + LPC54_EMC_DYNSREX_OFFSET)
+#define LPC54_EMC_DYNAPR (LPC54_EMC_BASE + LPC54_EMC_DYNAPR_OFFSET)
+#define LPC54_EMC_DYNDAL (LPC54_EMC_BASE + LPC54_EMC_DYNDAL_OFFSET)
+#define LPC54_EMC_DYNWR (LPC54_EMC_BASE + LPC54_EMC_DYNWR_OFFSET)
+#define LPC54_EMC_DYNRC (LPC54_EMC_BASE + LPC54_EMC_DYNRC_OFFSET)
+#define LPC54_EMC_DYNRFC (LPC54_EMC_BASE + LPC54_EMC_DYNRFC_OFFSET)
+#define LPC54_EMC_DYNXSR (LPC54_EMC_BASE + LPC54_EMC_DYNXSR_OFFSET)
+#define LPC54_EMC_DYNRRD (LPC54_EMC_BASE + LPC54_EMC_DYNRRD_OFFSET)
+#define LPC54_EMC_DYNMRD (LPC54_EMC_BASE + LPC54_EMC_DYNMRD_OFFSET)
+#define LPC54_EMC_STATEXTWAIT (LPC54_EMC_BASE + LPC54_EMC_STATEXTWAIT_OFFSET)
+
+/* Per-chip select dynamic memory registers */
+
+#define LPC54_EMC_DYNCS_BASE(n) (LPC54_EMC_BASE + LPC54_EMC_DYNCS_OFFSET(n))
+#define LPC54_EMC_DYNCONFIG(n) (LPC54_EMC_DYNCS_BASE(n) + LPC54_EMC_DYNCONFIG_OFFSET)
+#define LPC54_EMC_DYNRASCAS(n) (LPC54_EMC_DYNCS_BASE(n) + LPC54_EMC_DYNRASCAS_OFFSET)
+
+/* Per-chip select static memory registers */
+
+#define LPC54_EMC_STATCS_BASE(n) (LPC54_EMC_BASE + LPC54_EMC_STATCS_OFFSET(n))
+#define LPC54_EMC_STATCONFIG(n) (LPC54_EMC_STATCS_BASE(n) + LPC54_EMC_STATCONFIG_OFFSET)
+#define LPC54_EMC_STATWAITWEN(n) (LPC54_EMC_STATCS_BASE(n) + LPC54_EMC_STATWAITWEN_OFFSET)
+#define LPC54_EMC_STATWAITOEN(n) (LPC54_EMC_STATCS_BASE(n) + LPC54_EMC_STATWAITOEN_OFFSET)
+#define LPC54_EMC_STATWAITRD(n) (LPC54_EMC_STATCS_BASE(n) + LPC54_EMC_STATWAITRD_OFFSET)
+#define LPC54_EMC_STATWAITPAGE(n) (LPC54_EMC_STATCS_BASE(n) + LPC54_EMC_STATWAITPAGE_OFFSET)
+#define LPC54_EMC_STATWAITWR(n) (LPC54_EMC_STATCS_BASE(n) + LPC54_EMC_STATWAITWR_OFFSET)
+#define LPC54_EMC_STATWAITTURN(n) (LPC54_EMC_STATCS_BASE(n) + LPC54_EMC_STATWAITTURN_OFFSET)
+
+/* Register bit definitions *************************************************************************/
+
+/* Controls operation of the memory controller */
+
+#define EMC_CONTROL_E (1 << 0) /* Bit 0: EMC Enable */
+#define EMC_CONTROL_M (1 << 1) /* Bit 1: Address mirror */
+#define EMC_CONTROL_L (1 << 2) /* Bit 2: Low-power mode */
+
+/* Provides EMC status information */
+
+#define EMC_STATUS_B (1 << 0) /* Bit 0: Busy */
+#define EMC_STATUS_S (1 << 1) /* Bit 1: Write buffer status */
+#define EMC_STATUS_SA (1 << 2) /* Bit 2: Self-refresh acknowledge */
+
+/* Configures operation of the memory controller */
+
+#define EMC_CONFIG_EM (1 << 0) /* Bit 0: EM Endian mode */
+#define EMC_CONFIG_CLKR (1 << 8) /* Bit 8: Must be zero */
+
+/* Controls dynamic memory operation */
+
+#define EMC_DYNCONTROL_CE (1 << 0) /* Bit 0: Dynamic memory clock enable */
+#define EMC_DYNCONTROL_CS (1 << 1) /* Bit 1: Dynamic memory clock control */
+#define EMC_DYNCONTROL_SR (1 << 2) /* Bit 2: Self-refresh request, EMCSREFREQ */
+#define EMC_DYNCONTROL_MMC (1 << 5) /* Bit 5: Memory clock control */
+#define EMC_DYNCONTROL_I_SHIFT (7) /* Bit 7-8: SDRAM initialization */
+#define EMC_DYNCONTROL_I_MASK (3 << EMC_DYNCONTROL_I_SHIFT)
+# define EMC_DYNCONTROL_I_NORMAL (0 << EMC_DYNCONTROL_I_SHIFT) /* Issue SDRAM NORMAL operation command */
+# define EMC_DYNCONTROL_I_MODE (1 << EMC_DYNCONTROL_I_SHIFT) /* Issue SDRAM MODE command */
+# define EMC_DYNCONTROL_I_PALL (2 << EMC_DYNCONTROL_I_SHIFT) /* Issue SDRAM PALL (precharge all) command */
+# define EMC_DYNCONTROL_I_NOP (3 << EMC_DYNCONTROL_I_SHIFT) /* Issue SDRAM NOP (no operation) command */
+
+/* Configures dynamic memory refresh */
+
+#define EMC_DYNREFRESH_SHIFT (0) /* Bits 0-10: Refresh timer */
+#define EMC_DYNREFRESH_MASK (0x7ff << EMC_DYNREFRESH_SHIFT)
+# define EMC_DYNREFRESH_DISABLE(n) (0 << EMC_DYNREFRESH_SHIFT)
+# define EMC_DYNREFRESH(n) ((uint32_t)((n) >> 4) << EMC_DYNREFRESH_SHIFT)
+
+/* Configures dynamic memory read strategy */
+
+#define EMC_DYNREADCONFIG_SHIFT (0) /* Bits 0-1: Read data strategy */
+#define EMC_DYNREADCONFIG_MASK (3 << EMC_DYNREADCONFIG_SHIFT)
+# define EMC_DYNREADCONFIG(n) ((uint32_t)(n) << EMC_DYNREADCONFIG_SHIFT)
+# define EMC_DYNREADCONFIG_PLUS0 (1 << EMC_DYNREADCONFIG_SHIFT) /* Using EMCCLKDELAY */
+# define EMC_DYNREADCONFIG_PLUS1 (2 << EMC_DYNREADCONFIG_SHIFT) /* Plus one clock cycle using EMCCLKDELAY */
+# define EMC_DYNREADCONFIG_PLUS2 (3 << EMC_DYNREADCONFIG_SHIFT) /* Plus two clock cycles using EMCCLKDELAY */
+
+/* Precharge command period */
+
+#define EMC_DYNRP_SHIFT (0) /* Bits 0-3: Precharge command period */
+#define EMC_DYNRP_MASK (15 << EMC_DYNRP_SHIFT)
+# define EMC_DYNRP(n) ((uint32_t)((n)-1) << EMC_DYNRP_SHIFT)
+
+/* Active to precharge command period */
+
+#define EMC_DYNRAS_SHIFT (0) /* Bits 0-3: Active to precharge command period */
+#define EMC_DYNRAS_MASK (15 << EMC_DYNRAS_SHIFT)
+# define EMC_DYNRAS(n) ((uint32_t)((n)-1) << EMC_DYNRAS_SHIFT)
+
+/* Self-refresh exit time */
+
+#define EMC_DYNSREX_SHIFT (0) /* Bits 0-3: Self-refresh exit time */
+#define EMC_DYNSREX_MASK (15 << EMC_DYNSREX_SHIFT)
+# define EMC_DYNSREX(n) ((uint32_t)((n)-1) << EMC_DYNSREX_SHIFT)
+
+/* Last-data-out to active command time */
+
+#define EMC_DYNAPR_SHIFT (0) /* Bits 0-3: Self-refresh exit time */
+#define EMC_DYNAPR_MASK (15 << EMC_DYNAPR_SHIFT)
+# define EMC_DYNAPR(n) ((uint32_t)((n)-1) << EMC_DYNAPR_SHIFT)
+
+/* Data-in to active command time */
+
+#define EMC_DYNDAL_SHIFT (0) /* Bits 0-3: Data-in to active command */
+#define EMC_DYNDAL_MASK (15 << EMC_DYNDAL_SHIFT)
+# define EMC_DYNDAL(n) ((uint32_t)(n) << EMC_DYNDAL_SHIFT)
+
+/* Write recovery time */
+
+#define EMC_DYNWR_SHIFT (0) /* Bits 0-3: Data-in to active command */
+#define EMC_DYNWR_MASK (15 << EMC_DYNWR_SHIFT)
+# define EMC_DYNWR(n) ((uint32_t)((n)-1) << EMC_DYNWR_SHIFT)
+
+/* Selects the active to active command period */
+
+#define EMC_DYNRC_SHIFT (0) /* Bits 0-4: Data-in to active command */
+#define EMC_DYNRC_MASK (31 << EMC_DYNRC_SHIFT)
+# define EMC_DYNRC(n) ((uint32_t)((n)-1) << EMC_DYNRC_SHIFT)
+
+/* Selects the auto-refresh period */
+
+#define EMC_DYNRFC_SHIFT (0) /* Bits 0-4: Auto-refresh period and auto-refresh to active command period */
+#define EMC_DYNRFC_MASK (31 << EMC_DYNRFC_SHIFT)
+# define EMC_DYNRFC(n) ((uint32_t)((n)-1) << EMC_DYNRFC_SHIFT)
+
+/* Time for exit self-refresh to active command */
+
+#define EMC_DYNXSR_SHIFT (0) /* Bits 0-4: Exit self-refresh to active command time */
+#define EMC_DYNXSR_MASK (31 << EMC_DYNXSR_SHIFT)
+# define EMC_DYNXSR(n) ((uint32_t)((n)-1) << EMC_DYNXSR_SHIFT)
+
+/* Latency for active bank A to active bank B */
+
+#define EMC_DYNRRD_SHIFT (0) /* Bits 0-3: Active bank A to active bank B latency */
+#define EMC_DYNRRD_MASK (15 << EMC_DYNRRD_SHIFT)
+# define EMC_DYNRRD(n) ((uint32_t)((n)-1) << EMC_DYNRRD_SHIFT)
+
+/* Time for load mode register to active command */
+
+#define EMC_DYNMRD_SHIFT (0) /* Bits 0-3: Load mode register to active command time */
+#define EMC_DYNMRD_MASK (15 << EMC_DYNMRD_SHIFT)
+# define EMC_DYNMRD(n) ((uint32_t)((n)-1) << EMC_DYNMRD_SHIFT)
+
+/* Time for long static memory read and write transfers */
+
+#define EMC_STATEXTWAIT_SHIFT (0) /* Bits 0-9: Extended wait time out */
+#define EMC_STATEXTWAIT_MASK (0x3ff << EMC_STATEXTWAIT_SHIFT)
+# define EMC_STATEXTWAIT(n) ((uint32_t)((n)-1) << EMC_STATEXTWAIT_SHIFT)
+
+/* Per-chip select dynamic memory registers */
+/* Dynamic Memory Configuration registers */
+#define EMC_DYNCONFIG_
+#define EMC_DYNCONFIG_MD_SHIFT (3) /* Bits 3-4: Memory device */
+#define EMC_DYNCONFIG_MD_MASK (3 << EMC_DYNCONFIG_MD_SHIFT)
+# define EMC_DYNCONFIG_MD(n) ((uint32_t)(n) << EMC_DYNCONFIG_MD_SHIFT)
+# define EMC_DYNCONFIG_MD_SDRAM (0 << EMC_DYNCONFIG_MD_SHIFT) /* SDRAM */
+# define EMC_DYNCONFIG_MD_LPDRAM (1 << EMC_DYNCONFIG_MD_SHIFT) /* Low-power SDRAM */
+#define EMC_DYNCONFIG_AM0_SHIFT (7) /* Bits 7-12: See Table 656 in User Manual */
+#define EMC_DYNCONFIG_AM0_MASK (0x3f << EMC_DYNCONFIG_AM0_SHIFT)
+# define EMC_DYNCONFIG_AM0(n) ((uint32_t)(n) << EMC_DYNCONFIG_AM0_SHIFT)
+#define EMC_DYNCONFIG_AM1 (1 << 14) /* Bit 14: See Table 656 in User Manual */
+#define EMC_DYNCONFIG_B (1 << 19) /* Bit 19: Buffer enable */
+#define EMC_DYNCONFIG_P (1 << 20) /* Bit 20: Write protect */
+
+#define EMC_DYNCONFIG_ADDRMAP_SHIFT EMC_DYNCONFIG_AM0_SHIFT
+#define EMC_DYNCONFIG_ADDRMAP_MASK (EMC_DYNCONFIG_AM0_MASK | EMC_DYNCONFIG_AM1)
+# define EMC_DYNCONFIG_ADDRMAP(n) ((uint32_t)(n) << EMC_DYNCONFIG_ADDRMAP_SHIFT)
+
+/* Dynamic Memory RAS and CAS Delay registers */
+
+#define EMC_DYNRASCAS_RAS_SHIFT (0) /* Bits 0-1: RAS latency */
+#define EMC_DYNRASCAS_RAS_MASK (3 << EMC_DYNRASCAS_RAS_SHIFT)
+# define EMC_DYNRASCAS_RAS(n) ((uint32_t)(n) << EMC_DYNRASCAS_RAS_SHIFT)
+#define EMC_DYNRASCAS_CAS_SHIFT (8) /* Bits 8-9: CAS latency */
+#define EMC_DYNRASCAS_CAS_MASK (3 << EMC_DYNRASCAS_CAS_SHIFT)
+# define EMC_DYNRASCAS_CAS(n) ((uint32_t)(n) << EMC_DYNRASCAS_CAS_SHIFT)
+
+/* Per-chip select static memory registers */
+/* Static Memory Configuration registers */
+
+#define EMC_STATCONFIG_MW_SHIFT (0) /* Bits 0-1: Memory width */
+#define EMC_STATCONFIG_MW_MASK (3 << EMC_STATCONFIG_MW_SHIFT)
+# define EMC_STATCONFIG_MW_8BIT (0 << EMC_STATCONFIG_MW_SHIFT) /* 8 bit */
+# define EMC_STATCONFIG_MW_16BIT (1 << EMC_STATCONFIG_MW_SHIFT) /* 16 bit */
+# define EMC_STATCONFIG_MW_32BIT (2 << EMC_STATCONFIG_MW_SHIFT) /* 32 bit */
+#define EMC_STATCONFIG_PM (1 << 3) /* Bit 3: Page mode */
+#define EMC_STATCONFIG_PC (1 << 6) /* Bit 6: Chip select polarity */
+#define EMC_STATCONFIG_PB (1 << 7) /* Bit 7: Byte lane state */
+#define EMC_STATCONFIG_EW (1 << 8) /* Bit 8: Extended wait */
+#define EMC_STATCONFIG_B (1 << 19) /* Bit 19: Buffer enable */
+#define EMC_STATCONFIG_P (1 << 20) /* Bit 20: Write protect */
+
+/* Static Memory Write Enable Delay registers */
+
+#define EMC_STATWAITWEN_SHIFT (0) /* Bits 0-3: Wait write enable */
+#define EMC_STATWAITWEN_MASK (15 << EMC_STATWAITWEN_SHIFT)
+# define EMC_STATWAITWEN(n) ((uint32_t)((n)-1) << EMC_STATWAITWEN_SHIFT)
+
+/* Static Memory Output Enable delay registers */
+
+#define EMC_STATWAITOEN_SHIFT (0) /* Bits 0-3: Wait output enable */
+#define EMC_STATWAITOEN_MASK (15 << EMC_STATWAITOEN_SHIFT)
+# define EMC_STATWAITOEN_NONE (0 << EMC_STATWAITOEN_SHIFT)
+# define EMC_STATWAITOEN(n) ((uint32_t)(n) << EMC_STATWAITOEN_SHIFT)
+
+/* Static Memory Read Delay registers */
+
+#define EMC_STATWAITRD_SHIFT (0) /* Bits 0-4: Non-page mode read wait states */
+#define EMC_STATWAITRD_MASK (31 << EMC_STATWAITRD_SHIFT)
+# define EMC_STATWAITRD(n) ((uint32_t)((n)-1) << EMC_STATWAITRD_SHIFT)
+
+/* Static Memory Page Mode Read Delay registers */
+
+#define EMC_STATWAITPAGE_SHIFT (0) /* Bits 0-4: Page mode erad wait states */
+#define EMC_STATWAITPAGE_MASK (31 << EMC_STATWAITPAGE_SHIFT)
+# define EMC_STATWAITPAGE(n) ((uint32_t)((n)-1) << EMC_STATWAITPAGE_SHIFT)
+
+/* Static Memory Write Delay registers */
+
+#define EMC_STATWAITWR_SHIFT (0) /* Bits 0-4: Write wait states */
+#define EMC_STATWAITWR_MASK (31 << EMC_STATWAITWR_SHIFT)
+# define EMC_STATWAITWR(n) ((uint32_t)((n)-2) << EMC_STATWAITWR_SHIFT)
+
+/* Static Memory Turn-around Delay registers */
+
+#define EMC_STATWAITTURN_SHIFT (0) /* Bits 0-3: Bus turn-around cycles */
+#define EMC_STATWAITTURN_MASK (15 << EMC_STATWAITTURN_SHIFT)
+# define EMC_STATWAITTURN(n) ((uint32_t)((n)-1) << EMC_STATWAITTURN_SHIFT)
+
+#endif /* __ARCH_ARM_SRC_LPC54XX_CHIP_LPC54_EMC_H */
diff --git a/arch/arm/src/lpc54xx/chip/lpc54_ethernet.h b/arch/arm/src/lpc54xx/chip/lpc54_ethernet.h
new file mode 100644
index 0000000000000000000000000000000000000000..12b282ea4a3df2b38010c65784aba341dd26bd53
--- /dev/null
+++ b/arch/arm/src/lpc54xx/chip/lpc54_ethernet.h
@@ -0,0 +1,865 @@
+/************************************************************************************************************
+ * arch/arm/src/lpc54xx/lpc54_ethernet.h
+ *
+ * Copyright (C) 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.
+ *
+ ************************************************************************************************************/
+
+#ifndef __ARCH_ARM_SRC_LPC54XX_CHIP_LPC54_ETHERNET_H
+#define __ARCH_ARM_SRC_LPC54XX_CHIP_LPC54_ETHERNET_H
+
+/************************************************************************************************************
+ * Included Files
+ ************************************************************************************************************/
+
+#include
+#include "chip/lpc54_memorymap.h"
+
+/************************************************************************************************************
+ * Pre-processor Definitions
+ ************************************************************************************************************/
+
+/* Register offsets *****************************************************************************************/
+
+#define LPC54_ETH_MAC_CONFIG_OFFSET 0x0000 /* MAC configuration */
+#define LPC54_ETH_MAC_EXT_CONFIG_OFFSET 0x0004 /* MAC extended configuration */
+#define LPC54_ETH_MAC_FRAME_FILTER_OFFSET 0x0008 /* MAC frame filter */
+#define LPC54_ETH_MAC_WD_TIMEROUT_OFFSET 0x000c /* MAC watchdog timeout */
+#define LPC54_ETH_MAC_VLAN_TAG_OFFSET 0x0050 /* VLAN tag */
+#define LPC54_ETH_MAC_TX_FLOW_CTRL_Q0_OFFSET 0x0070 /* Transmit flow control 0 */
+#define LPC54_ETH_MAC_TX_FLOW_CTRL_Q1_OFFSET 0x0074 /* Transmit flow control 1 */
+#define LPC54_ETH_MAC_RX_FLOW_CTRL_OFFSET 0x0090 /* Receive flow control */
+#define LPC54_ETH_MAC_TXQ_PRIO_MAP_OFFSET 0x0098 /* Transmit Queue priority mapping */
+#define LPC54_ETH_MAC_RXQ_CTRL0_OFFSET 0x00a0 /* Receive Queue control 0 */
+#define LPC54_ETH_MAC_RXQ_CTRL1_OFFSET 0x00a4 /* Receive Queue control 1 */
+#define LPC54_ETH_MAC_RXQ_CTRL2_OFFSET 0x00a8 /* Receive Queue control 2 */
+#define LPC54_ETH_MAC_INTR_STAT_OFFSET 0x00b0 /* Interrupt status */
+#define LPC54_ETH_MAC_INTR_EN_OFFSET 0x00b4 /* Interrupt enable */
+#define LPC54_ETH_MAC_RXTX_STAT_OFFSET 0x00b8 /* Receive transmit status */
+#define LPC54_ETH_MAC_PMT_CRTL_STAT_OFFSET 0x00c0 /* MAC PMT control and status */
+#define LPC54_ETH_MAC_RWK_PKT_FLT_OFFSET 0x00c4 /* Wake-up packet filter */
+#define LPC54_ETH_MAC_LPI_CTRL_STAT_OFFSET 0x00d0 /* LPI control and status */
+#define LPC54_ETH_MAC_LPI_TIMER_CTRL_OFFSET 0x00d4 /* LPI timers control */
+#define LPC54_ETH_MAC_LPI_ENTR_TIMR_OFFSET 0x00d8 /* LPI entry timer */
+#define LPC54_ETH_MAC_1US_TIC_COUNTR_OFFSET 0x00dc /* MAC 1 usec tick counter */
+#define LPC54_ETH_MAC_VERSION_OFFSET 0x0110 /* MAC version */
+#define LPC54_ETH_MAC_DBG_OFFSET 0x0114 /* MAC debug */
+#define LPC54_ETH_MAC_HW_FEAT0_OFFSET 0x011c /* MAC hardware feature 0 */
+#define LPC54_ETH_MAC_HW_FEAT1_OFFSET 0x0120 /* MAC hardware feature 1 */
+#define LPC54_ETH_MAC_HW_FEAT2_OFFSET 0x0124 /* MAC hardware feature 2 */
+
+#define LPC54_ETH_MAC_MDIO_ADDR_OFFSET 0x0200 /* MIDO address */
+#define LPC54_ETH_MAC_MDIO_DATA_OFFSET 0x0204 /* MDIO data */
+#define LPC54_ETH_MAC_ADDR_HIGH_OFFSET 0x0300 /* MAC address0 high */
+#define LPC54_ETH_MAC_ADDR_LOW_OFFSET 0x0304 /* MAC address0 low */
+
+#define LPC54_ETH_MAC_TIMESTAMP_CTRL_OFFSET 0x0b00 /* Timestamp control */
+#define LPC54_ETH_MAC_SUB_SCND_INCR_OFFSET 0x0b04 /* Sub-second increment */
+#define LPC54_ETH_MAC_SYS_TIME_SCND_OFFSET 0x0b08 /* System time seconds */
+#define LPC54_ETH_MAC_SYS_TIME_NSCND_OFFSET 0x0b0c /* System time nanoseconds */
+#define LPC54_ETH_MAC_SYS_TIME_SCND_UPD_OFFSET 0x0b10 /* System time seconds update */
+#define LPC54_ETH_MAC_SYS_TIME_NSCND_UPD_OFFSET 0x0b14 /* System time nanoseconds update */
+#define LPC54_ETH_MAC_SYS_TIMESTMP_ADDEND_OFFSET 0x0b18 /* Timestamp addend */
+#define LPC54_ETH_MAC_SYS_TIME_HWORD_SCND_OFFSET 0x0b1c /* System time-higher word seconds */
+#define LPC54_ETH_MAC_SYS_TIMESTMP_STAT_OFFSET 0x0b20 /* Timestamp status */
+#define LPC54_ETH_MAC_Tx_TIMESTAMP_STATUS_NSECS_OFFSET 0x0b30 /* Tx timestamp status nanoseconds */
+#define LPC54_ETH_MAC_Tx_TIMESTAMP_STATUS_SECS_OFFSET 0x0b34 /* Tx timestamp status seconds */
+#define LPC54_ETH_MAC_TIMESTAMP_INGRESS_CORR_NSEC_OFFSET 0x0b58 /* Timestamp ingress correction */
+#define LPC54_ETH_MAC_TIMESTAMP_EGRESS_CORR_NSEC_OFFSET 0x0b5c /* Timestamp egress correction */
+
+#define LPC54_ETH_MTL_OP_MODE_OFFSET 0x0c00 /* MTL operation mode */
+#define LPC54_ETH_MTL_INTR_STAT_OFFSET 0x0c20 /* MTL interrupt status */
+#define LPC54_ETH_MTL_RXQ_DMA_MAP_OFFSET 0x0c30 /* MTL Rx Queue and DMA channel mapping */
+
+#define LPC54_ETH_MTL_Qn_OFFSET(n) (0x0d00 + ((n) << 6))
+
+#define LPC54_ETH_MTL_TXQ_OP_MODE_OFFSET 0x0000 /* MTL TxQn operation mode */
+#define LPC54_ETH_MTL_TXQ_UNDRFLW_OFFSET 0x0004 /* MTL TxQn underflow */
+#define LPC54_ETH_MTL_TXQ_DBG_OFFSET 0x0008 /* MTL TxQn debug */
+#define LPC54_ETH_MTL_TXQ_ETS_CTRL_OFFSET 0x0010 /* MTL TxQ1 (only) ETS control */
+#define LPC54_ETH_MTL_TXQ_ETS_STAT_OFFSET 0x0014 /* MTL TxQn ETS status */
+#define LPC54_ETH_MTL_TXQ_QNTM_WGHT_OFFSET 0x0018 /* MTL TxQn idleSlopeCredit, quantum or weights */
+#define LPC54_ETH_MTL_TXQ_SNDSLP_CRDT_OFFSET 0x001c /* MTL TxQ1 (only) SendSlopCredit */
+#define LPC54_ETH_MTL_TXQ_HI_CRDT_OFFSET 0x0020 /* MTL TxQ1 (only) hiCredit */
+#define LPC54_ETH_MTL_TXQ_LO_CRDT_OFFSET 0x0024 /* MTL TxQ1 (only) loCredit */
+#define LPC54_ETH_MTL_TXQ_INTCTRL_STAT_OFFSET 0x002c /* MTL TxQn interrupt control status */
+#define LPC54_ETH_MTL_RXQ_OP_MODE_OFFSET 0x0030 /* MTL RxQn operation mode */
+#define LPC54_ETH_MTL_RXQ_MISSPKT_OVRFLW_CNT_OFFSET 0x0034 /* MTL RxQn missed packet overflow counter */
+#define LPC54_ETH_MTL_RXQ_DBG_OFFSET 0x0038 /* MTL RxQn debug */
+#define LPC54_ETH_MTL_RXQ_CTRL_OFFSET 0x003c /* MTL RxQn control */
+
+#define LPC54_ETH_DMA_MODE_OFFSET 0x1000 /* DMA mode */
+#define LPC54_ETH_DMA_SYSBUS_MODE_OFFSET 0x1004 /* DMA system bus mode */
+#define LPC54_ETH_DMA_INTR_STAT_OFFSET 0x1008 /* DMA interrupt status */
+#define LPC54_ETH_DMA_DBG_STAT_OFFSET 0x100c /* DMA debug status */
+
+#define LPC54_ETH_DMACH_OFFSET(n) (0x1100 + ((n) << 7))
+
+#define LPC54_ETH_DMACH_CTRL_OFFSET 0x0000 /* DMA channel n control */
+#define LPC54_ETH_DMACH_TX_CTRL_OFFSET 0x0004 /* DMA channel n transmit control */
+#define LPC54_ETH_DMACH_RX_CTRL_OFFSET 0x0008 /* DMA channel n receive control */
+#define LPC54_ETH_DMACH_TXDESC_LIST_ADDR_OFFSET 0x0014 /* DMA channel n Tx descriptor list address */
+#define LPC54_ETH_DMACH_RXDESC_LIST_ADDR_OFFSET 0x001c /* DMA channel n Rx descriptor list address */
+#define LPC54_ETH_DMACH_TXDESC_TAIL_PTR_OFFSET 0x0020 /* DMA channel n Tx descriptor tail pointer */
+#define LPC54_ETH_DMACH_RXDESC_TAIL_PTR_OFFSET 0x0028 /* DMA channel n Rx descriptor tail pointer */
+#define LPC54_ETH_DMACH_TXDESC_RING_LENGTH_OFFSET 0x002c /* DMA channel n Tx descriptor ring length */
+#define LPC54_ETH_DMACH_RXDESC_RING_LENGTH_OFFSET 0x0030 /* DMA channel n Rx descriptor ring length */
+#define LPC54_ETH_DMACH_INT_EN_OFFSET 0x0034 /* DMA channel n interrupt enable */
+#define LPC54_ETH_DMACH_RX_INT_WDTIMER_OFFSET 0x0038 /* DMA channel n receive interrupt watchdog timer */
+#define LPC54_ETH_DMACH_SLOT_FUNC_CTRL_STAT_OFFSET 0x003c /* DMA channel n slot function control and status */
+#define LPC54_ETH_DMACH_CUR_HST_TXDESC_OFFSET 0x0044 /* DMA channel n current host transmit descriptor */
+#define LPC54_ETH_DMACH_CUR_HST_RXDESC_OFFSET 0x004c /* DMA channel n current host receive descriptor */
+#define LPC54_ETH_DMACH_CUR_HST_TXBUF_OFFSET 0x0054 /* DMA channel n current host transmit buffer address */
+#define LPC54_ETH_DMACH_CUR_HST_RXBUF_OFFSET 0x005c /* DMA channel n current application receive buffer address */
+#define LPC54_ETH_DMACH_STAT_OFFSET 0x0060 /* DMA channel n DMA status */
+#define LPC54_ETH_DMACH_MISS_FRAME_CNT_OFFSET 0x006c /* DMA channel n missed frame count */
+
+/* Register addresses ***************************************************************************************/
+
+#define LPC54_ETH_MAC_CONFIG (LPC54_ETHERNET_BASE + LPC54_ETH_MAC_CONFIG_OFFSET)
+#define LPC54_ETH_MAC_EXT_CONFIG (LPC54_ETHERNET_BASE + LPC54_ETH_MAC_EXT_CONFIG_OFFSET)
+#define LPC54_ETH_MAC_FRAME_FILTER (LPC54_ETHERNET_BASE + LPC54_ETH_MAC_FRAME_FILTER_OFFSET)
+#define LPC54_ETH_MAC_WD_TIMEROUT (LPC54_ETHERNET_BASE + LPC54_ETH_MAC_WD_TIMEROUT_OFFSET)
+#define LPC54_ETH_MAC_VLAN_TAG (LPC54_ETHERNET_BASE + LPC54_ETH_MAC_VLAN_TAG_OFFSET)
+#define LPC54_ETH_MAC_TX_FLOW_CTRL_Q0 (LPC54_ETHERNET_BASE + LPC54_ETH_MAC_TX_FLOW_CTRL_Q0_OFFSET)
+#define LPC54_ETH_MAC_TX_FLOW_CTRL_Q1 (LPC54_ETHERNET_BASE + LPC54_ETH_MAC_TX_FLOW_CTRL_Q1_OFFSET)
+#define LPC54_ETH_MAC_RX_FLOW_CTRL (LPC54_ETHERNET_BASE + LPC54_ETH_MAC_RX_FLOW_CTRL_OFFSET)
+#define LPC54_ETH_MAC_TXQ_PRIO_MAP (LPC54_ETHERNET_BASE + LPC54_ETH_MAC_TXQ_PRIO_MAP_OFFSET)
+#define LPC54_ETH_MAC_RXQ_CTRL0 (LPC54_ETHERNET_BASE + LPC54_ETH_MAC_RXQ_CTRL0_OFFSET)
+#define LPC54_ETH_MAC_RXQ_CTRL1 (LPC54_ETHERNET_BASE + LPC54_ETH_MAC_RXQ_CTRL1_OFFSET)
+#define LPC54_ETH_MAC_RXQ_CTRL2 (LPC54_ETHERNET_BASE + LPC54_ETH_MAC_RXQ_CTRL2_OFFSET)
+#define LPC54_ETH_MAC_INTR_STAT (LPC54_ETHERNET_BASE + LPC54_ETH_MAC_INTR_STAT_OFFSET)
+#define LPC54_ETH_MAC_INTR_EN (LPC54_ETHERNET_BASE + LPC54_ETH_MAC_INTR_EN_OFFSET)
+#define LPC54_ETH_MAC_RXTX_STAT (LPC54_ETHERNET_BASE + LPC54_ETH_MAC_RXTX_STAT_OFFSET)
+#define LPC54_ETH_MAC_PMT_CRTL_STAT (LPC54_ETHERNET_BASE + LPC54_ETH_MAC_PMT_CRTL_STAT_OFFSET)
+#define LPC54_ETH_MAC_RWK_PKT_FLT (LPC54_ETHERNET_BASE + LPC54_ETH_MAC_RWK_PKT_FLT_OFFSET)
+#define LPC54_ETH_MAC_LPI_CTRL_STAT (LPC54_ETHERNET_BASE + LPC54_ETH_MAC_LPI_CTRL_STAT_OFFSET)
+#define LPC54_ETH_MAC_LPI_TIMER_CTRL (LPC54_ETHERNET_BASE + LPC54_ETH_MAC_LPI_TIMER_CTRL_OFFSET)
+#define LPC54_ETH_MAC_LPI_ENTR_TIMR (LPC54_ETHERNET_BASE + LPC54_ETH_MAC_LPI_ENTR_TIMR_OFFSET)
+#define LPC54_ETH_MAC_1US_TIC_COUNTR (LPC54_ETHERNET_BASE + LPC54_ETH_MAC_1US_TIC_COUNTR_OFFSET)
+#define LPC54_ETH_MAC_VERSION (LPC54_ETHERNET_BASE + LPC54_ETH_MAC_VERSION_OFFSET)
+#define LPC54_ETH_MAC_DBG (LPC54_ETHERNET_BASE + LPC54_ETH_MAC_DBG_OFFSET)
+#define LPC54_ETH_MAC_HW_FEAT0 (LPC54_ETHERNET_BASE + LPC54_ETH_MAC_HW_FEAT0_OFFSET)
+#define LPC54_ETH_MAC_HW_FEAT1 (LPC54_ETHERNET_BASE + LPC54_ETH_MAC_HW_FEAT1_OFFSET)
+#define LPC54_ETH_MAC_HW_FEAT2 (LPC54_ETHERNET_BASE + LPC54_ETH_MAC_HW_FEAT2_OFFSET)
+
+#define LPC54_ETH_MAC_MDIO_ADDR (LPC54_ETHERNET_BASE + LPC54_ETH_MAC_MDIO_ADDR_OFFSET)
+#define LPC54_ETH_MAC_MDIO_DATA (LPC54_ETHERNET_BASE + LPC54_ETH_MAC_MDIO_DATA_OFFSET)
+#define LPC54_ETH_MAC_ADDR_HIGH (LPC54_ETHERNET_BASE + LPC54_ETH_MAC_ADDR_HIGH_OFFSET)
+#define LPC54_ETH_MAC_ADDR_LOW (LPC54_ETHERNET_BASE + LPC54_ETH_MAC_ADDR_LOW_OFFSET)
+
+#define LPC54_ETH_MAC_TIMESTAMP_CTRL (LPC54_ETHERNET_BASE + LPC54_ETH_MAC_TIMESTAMP_CTRL_OFFSET)
+#define LPC54_ETH_MAC_SUB_SCND_INCR (LPC54_ETHERNET_BASE + LPC54_ETH_MAC_SUB_SCND_INCR_OFFSET)
+#define LPC54_ETH_MAC_SYS_TIME_SCND (LPC54_ETHERNET_BASE + LPC54_ETH_MAC_SYS_TIME_SCND_OFFSET)
+#define LPC54_ETH_MAC_SYS_TIME_NSCND (LPC54_ETHERNET_BASE + LPC54_ETH_MAC_SYS_TIME_NSCND_OFFSET)
+#define LPC54_ETH_MAC_SYS_TIME_SCND_UPD (LPC54_ETHERNET_BASE + LPC54_ETH_MAC_SYS_TIME_SCND_UPD_OFFSET)
+#define LPC54_ETH_MAC_SYS_TIME_NSCND_UPD (LPC54_ETHERNET_BASE + LPC54_ETH_MAC_SYS_TIME_NSCND_UPD_OFFSET)
+#define LPC54_ETH_MAC_SYS_TIMESTMP_ADDEND (LPC54_ETHERNET_BASE + LPC54_ETH_MAC_SYS_TIMESTMP_ADDEND_OFFSET)
+#define LPC54_ETH_MAC_SYS_TIME_HWORD_SCND (LPC54_ETHERNET_BASE + LPC54_ETH_MAC_SYS_TIME_HWORD_SCND_OFFSET)
+#define LPC54_ETH_MAC_SYS_TIMESTMP_STAT (LPC54_ETHERNET_BASE + LPC54_ETH_MAC_SYS_TIMESTMP_STAT_OFFSET)
+#define LPC54_ETH_MAC_Tx_TIMESTAMP_STATUS_NSECS (LPC54_ETHERNET_BASE + LPC54_ETH_MAC_Tx_TIMESTAMP_STATUS_NSECS_OFFSET)
+#define LPC54_ETH_MAC_Tx_TIMESTAMP_STATUS_SECS (LPC54_ETHERNET_BASE + LPC54_ETH_MAC_Tx_TIMESTAMP_STATUS_SECS_OFFSET)
+#define LPC54_ETH_MAC_TIMESTAMP_INGRESS_CORR_NSEC (LPC54_ETHERNET_BASE + LPC54_ETH_MAC_TIMESTAMP_INGRESS_CORR_NSEC_OFFSET)
+#define LPC54_ETH_MAC_TIMESTAMP_EGRESS_CORR_NSEC (LPC54_ETHERNET_BASE + LPC54_ETH_MAC_TIMESTAMP_EGRESS_CORR_NSEC_OFFSET)
+
+#define LPC54_ETH_MTL_OP_MODE (LPC54_ETHERNET_BASE + LPC54_ETH_MTL_OP_MODE_OFFSET)
+#define LPC54_ETH_MTL_INTR_STAT (LPC54_ETHERNET_BASE + LPC54_ETH_MTL_INTR_STAT_OFFSET)
+#define LPC54_ETH_MTL_RXQ_DMA_MAP (LPC54_ETHERNET_BASE + LPC54_ETH_MTL_RXQ_DMA_MAP_OFFSET)
+
+#define LPC54_ETH_MTL_Q_BASE(n) (LPC54_ETHERNET_BASE + LPC54_ETH_MTL_Qn_OFFSET(n))
+
+#define LPC54_ETH_MTL_TXQ_OP_MODE(n) (LPC54_ETH_MTL_Q_BASE(n) + LPC54_ETH_MTL_TXQ_OP_MODE_OFFSET)
+#define LPC54_ETH_MTL_TXQ_UNDRFLW(n) (LPC54_ETH_MTL_Q_BASE(n) + LPC54_ETH_MTL_TXQ_UNDRFLW_OFFSET)
+#define LPC54_ETH_MTL_TXQ_DBG(n) (LPC54_ETH_MTL_Q_BASE(n) + LPC54_ETH_MTL_TXQ_DBG_OFFSET)
+#define LPC54_ETH_MTL_TXQ_ETS_CTRL(n) (LPC54_ETH_MTL_Q_BASE(n) + LPC54_ETH_MTL_TXQ_ETS_CTRL_OFFSET)
+#define LPC54_ETH_MTL_TXQ_ETS_STAT(n) (LPC54_ETH_MTL_Q_BASE(n) + LPC54_ETH_MTL_TXQ_ETS_STAT_OFFSET)
+#define LPC54_ETH_MTL_TXQ_QNTM_WGHT(n) (LPC54_ETH_MTL_Q_BASE(n) + LPC54_ETH_MTL_TXQ_QNTM_WGHT_OFFSET)
+#define LPC54_ETH_MTL_TXQ_SNDSLP_CRDT(n) (LPC54_ETH_MTL_Q_BASE(n) + LPC54_ETH_MTL_TXQ_SNDSLP_CRDT_OFFSET)
+#define LPC54_ETH_MTL_TXQ_HI_CRDT(n) (LPC54_ETH_MTL_Q_BASE(n) + LPC54_ETH_MTL_TXQ_HI_CRDT_OFFSET)
+#define LPC54_ETH_MTL_TXQ_LO_CRDT(n) (LPC54_ETH_MTL_Q_BASE(n) + LPC54_ETH_MTL_TXQ_LO_CRDT_OFFSET)
+#define LPC54_ETH_MTL_TXQ_INTCTRL_STAT(n) (LPC54_ETH_MTL_Q_BASE(n) + LPC54_ETH_MTL_TXQ_INTCTRL_STAT_OFFSET)
+#define LPC54_ETH_MTL_RXQ_OP_MODE(n) (LPC54_ETH_MTL_Q_BASE(n) + LPC54_ETH_MTL_RXQ_OP_MODE_OFFSET)
+#define LPC54_ETH_MTL_RXQ_MISSPKT_OVRFLW_CNT(n) (LPC54_ETH_MTL_Q_BASE(n) + LPC54_ETH_MTL_RXQ_MISSPKT_OVRFLW_CNT_OFFSET)
+#define LPC54_ETH_MTL_RXQ_DBG(n) (LPC54_ETH_MTL_Q_BASE(n) + LPC54_ETH_MTL_RXQ_DBG_OFFSET)
+#define LPC54_ETH_MTL_RXQ_CTRL(n) (LPC54_ETH_MTL_Q_BASE(n) + LPC54_ETH_MTL_RXQ_CTRL_OFFSET)
+
+#define LPC54_ETH_DMA_MODE (LPC54_ETHERNET_BASE + LPC54_ETH_DMA_MODE_OFFSET)
+#define LPC54_ETH_DMA_SYSBUS_MODE (LPC54_ETHERNET_BASE + LPC54_ETH_DMA_SYSBUS_MODE_OFFSET)
+#define LPC54_ETH_DMA_INTR_STAT (LPC54_ETHERNET_BASE + LPC54_ETH_DMA_INTR_STAT_OFFSET)
+#define LPC54_ETH_DMA_DBG_STAT (LPC54_ETHERNET_BASE + LPC54_ETH_DMA_DBG_STAT_OFFSET)
+
+#define LPC54_ETH_DMACH_BASE(n) (LPC54_ETHERNET_BASE + LPC54_ETH_DMACH_OFFSET(n))
+
+#define LPC54_ETH_DMACH_CTRL(n) (LPC54_ETH_DMACH_BASE(n) + LPC54_ETH_DMACH_CTRL_OFFSET)
+#define LPC54_ETH_DMACH_TX_CTRL(n) (LPC54_ETH_DMACH_BASE(n) + LPC54_ETH_DMACH_TX_CTRL_OFFSET)
+#define LPC54_ETH_DMACH_RX_CTRL(n) (LPC54_ETH_DMACH_BASE(n) + LPC54_ETH_DMACH_RX_CTRL_OFFSET)
+#define LPC54_ETH_DMACH_TXDESC_LIST_ADDR(n) (LPC54_ETH_DMACH_BASE(n) + LPC54_ETH_DMACH_TXDESC_LIST_ADDR_OFFSET)
+#define LPC54_ETH_DMACH_RXDESC_LIST_ADDR(n) (LPC54_ETH_DMACH_BASE(n) + LPC54_ETH_DMACH_RXDESC_LIST_ADDR_OFFSET)
+#define LPC54_ETH_DMACH_TXDESC_TAIL_PTR(n) (LPC54_ETH_DMACH_BASE(n) + LPC54_ETH_DMACH_TXDESC_TAIL_PTR_OFFSET)
+#define LPC54_ETH_DMACH_RXDESC_TAIL_PTR(n) (LPC54_ETH_DMACH_BASE(n) + LPC54_ETH_DMACH_RXDESC_TAIL_PTR_OFFSET)
+#define LPC54_ETH_DMACH_TXDESC_RING_LENGTH(n) (LPC54_ETH_DMACH_BASE(n) + LPC54_ETH_DMACH_TXDESC_RING_LENGTH_OFFSET)
+#define LPC54_ETH_DMACH_RXDESC_RING_LENGTH(n) (LPC54_ETH_DMACH_BASE(n) + LPC54_ETH_DMACH_RXDESC_RING_LENGTH_OFFSET)
+#define LPC54_ETH_DMACH_INT_EN(n) (LPC54_ETH_DMACH_BASE(n) + LPC54_ETH_DMACH_INT_EN_OFFSET)
+#define LPC54_ETH_DMACH_RX_INT_WDTIMER(n) (LPC54_ETH_DMACH_BASE(n) + LPC54_ETH_DMACH_RX_INT_WDTIMER_OFFSET)
+#define LPC54_ETH_DMACH_SLOT_FUNC_CTRL_STAT(n) (LPC54_ETH_DMACH_BASE(n) + LPC54_ETH_DMACH_SLOT_FUNC_CTRL_STAT_OFFSET)
+#define LPC54_ETH_DMACH_CUR_HST_TXDESC(n) (LPC54_ETH_DMACH_BASE(n) + LPC54_ETH_DMACH_CUR_HST_TXDESC_OFFSET)
+#define LPC54_ETH_DMACH_CUR_HST_RXDESC(n) (LPC54_ETH_DMACH_BASE(n) + LPC54_ETH_DMACH_CUR_HST_RXDESC_OFFSET)
+#define LPC54_ETH_DMACH_CUR_HST_TXBUF(n) (LPC54_ETH_DMACH_BASE(n) + LPC54_ETH_DMACH_CUR_HST_TXBUF_OFFSET)
+#define LPC54_ETH_DMACH_CUR_HST_RXBUF(n) (LPC54_ETH_DMACH_BASE(n) + LPC54_ETH_DMACH_CUR_HST_RXBUF_OFFSET)
+#define LPC54_ETH_DMACH_STAT(n) (LPC54_ETH_DMACH_BASE(n) + LPC54_ETH_DMACH_STAT_OFFSET)
+#define LPC54_ETH_DMACH_MISS_FRAME_CNT(n) (LPC54_ETH_DMACH_BASE(n) + LPC54_ETH_DMACH_MISS_FRAME_CNT_OFFSET)
+
+/* Register bit definitions *********************************************************************************/
+
+/* MAC configuration */
+
+#define ETH_MAC_CONFIG_RE (1 << 0) /* Bit 0: Receiver enable */
+#define ETH_MAC_CONFIG_TE (1 << 1) /* Bit 1: Transmitter enable */
+#define ETH_MAC_CONFIG_PRELEN_SHIFT (2) /* Bits 2-3: Preamble length for transmit packets */
+#define ETH_MAC_CONFIG_PRELEN_MASK (3 << ETH_MAC_CONFIG_PRELEN_SHIFT)
+# define ETH_MAC_CONFIG_PRELEN_7 (0 << ETH_MAC_CONFIG_PRELEN_SHIFT) /* 7 bytes of preamble */
+# define ETH_MAC_CONFIG_PRELEN_5 (1 << ETH_MAC_CONFIG_PRELEN_SHIFT) /* 5 bytes of preamble */
+# define ETH_MAC_CONFIG_PRELEN_3 (2 << ETH_MAC_CONFIG_PRELEN_SHIFT) /* 3 bytes of preamble */
+#define ETH_MAC_CONFIG_DC (1 << 4) /* Bit 4: Deferral check */
+#define ETH_MAC_CONFIG_BL_SHIFT (5) /* Bits 5-6: Back-off limit */
+#define ETH_MAC_CONFIG_BL_MASK (3 << ETH_MAC_CONFIG_BL_SHIFT)
+# define ETH_MAC_CONFIG_BL_10 (0 << ETH_MAC_CONFIG_BL_SHIFT) /* k = min (n, 10) */
+# define ETH_MAC_CONFIG_BL_8 (1 << ETH_MAC_CONFIG_BL_SHIFT) /* k = min (n, 8) */
+# define ETH_MAC_CONFIG_BL_4 (2 << ETH_MAC_CONFIG_BL_SHIFT) /* k = min (n, 4) */
+# define ETH_MAC_CONFIG_BL_1 (3 << ETH_MAC_CONFIG_BL_SHIFT) /* k = min (n, 1) */
+#define ETH_MAC_CONFIG_DR (1 << 8) /* Bit 8: Disable retry */
+#define ETH_MAC_CONFIG_DCRS (1 << 9) /* Bit 9: Disable carrier sense during transmission */
+#define ETH_MAC_CONFIG_DO (1 << 10) /* Bit 10: Disable receive own */
+#define ETH_MAC_CONFIG_ECRSFD (1 << 11) /* Bit 11: Enable carrier sense full-duplex mode before transmission */
+#define ETH_MAC_CONFIG_LM (1 << 12) /* Bit 12: Loopback mode */
+#define ETH_MAC_CONFIG_DM (1 << 13) /* Bit 13: Duplex mode */
+#define ETH_MAC_CONFIG_FES (1 << 14) /* Bit 14: Speed */
+#define ETH_MAC_CONFIG_PS (1 << 15) /* Bit 15: Port select */
+#define ETH_MAC_CONFIG_JE (1 << 16) /* Bit 16: Jumbo frame enable */
+#define ETH_MAC_CONFIG_JD (1 << 17) /* Bit 17: Jabber disable */
+#define ETH_MAC_CONFIG_BE (1 << 18) /* Bit 18: Packet burst enable */
+#define ETH_MAC_CONFIG_WD (1 << 19) /* Bit 19: Watchdog disable */
+#define ETH_MAC_CONFIG_ACS (1 << 20) /* Bit 20: Automatic pad or CRC stripping */
+#define ETH_MAC_CONFIG_CST (1 << 21) /* Bit 21: CRC stripping for type packets */
+#define ETH_MAC_CONFIG_S2KP (1 << 22) /* Bit 22: IEEE 802.3as support for 2K packets */
+#define ETH_MAC_CONFIG_GPSLCE (1 << 23) /* Bit 23: Giant packet size limit control enable */
+#define ETH_MAC_CONFIG_IPG_SHIFT (24) /* Bits 24-26: Inter-packet gap */
+#define ETH_MAC_CONFIG_IPG_MASK (7 << ETH_MAC_CONFIG_IPG_SHIFT)
+# define ETH_MAC_CONFIG_IPG_96 (0 << ETH_MAC_CONFIG_IPG_SHIFT) /* 96 bit times */
+# define ETH_MAC_CONFIG_IPG_88 (1 << ETH_MAC_CONFIG_IPG_SHIFT) /* 88 bit times */
+# define ETH_MAC_CONFIG_IPG_80 (2 << ETH_MAC_CONFIG_IPG_SHIFT) /* 80 bit times */
+# define ETH_MAC_CONFIG_IPG_72 (3 << ETH_MAC_CONFIG_IPG_SHIFT) /* 72 bit times */
+# define ETH_MAC_CONFIG_IPG_64 (4 << ETH_MAC_CONFIG_IPG_SHIFT) /* 64 bit times */
+# define ETH_MAC_CONFIG_IPG_56 (5 << ETH_MAC_CONFIG_IPG_SHIFT) /* 56 bit times */
+# define ETH_MAC_CONFIG_IPG_48 (6 << ETH_MAC_CONFIG_IPG_SHIFT) /* 48 bit times */
+# define ETH_MAC_CONFIG_IPG_40 (7 << ETH_MAC_CONFIG_IPG_SHIFT) /* 40 bit times */
+#define ETH_MAC_CONFIG_IPC (1 << 27) /* Bit 27: Checksum offload */
+
+/* MAC extended configuration */
+#define ETH_MAC_EXT_CONFIG_
+
+/* MAC frame filter */
+
+#define ETH_MAC_FRAME_FILTER_PR (1 << 0) /* Bit 0: Promiscuous mode */
+#define ETH_MAC_FRAME_FILTER_DAIF (1 << 3) /* Bit 3: DA inverse filtering */
+#define ETH_MAC_FRAME_FILTER_PM (1 << 4) /* Bit 4: Pass all multicast */
+#define ETH_MAC_FRAME_FILTER_DBF (1 << 5) /* Bit 5: Disable broadcast frames */
+#define ETH_MAC_FRAME_FILTER_PCF_SHIFT (6) /* Bits 6-7: Pass control frames */
+#define ETH_MAC_FRAME_FILTER_PCF_MASK (3 << ETH_MAC_FRAME_FILTER_PCF_SHIFT)
+# define ETH_MAC_FRAME_FILTER_PCF_NONE (0 << ETH_MAC_FRAME_FILTER_PCF_SHIFT) /* All control frames filtered */
+# define ETH_MAC_FRAME_FILTER_PCF_PAUSE (1 << ETH_MAC_FRAME_FILTER_PCF_SHIFT) /* All but pause control frames accepted */
+# define ETH_MAC_FRAME_FILTER_PCF_ALL (2 << ETH_MAC_FRAME_FILTER_PCF_SHIFT) /* All control frames accepted */
+# define ETH_MAC_FRAME_FILTER_PCF_FILTERED (3 << ETH_MAC_FRAME_FILTER_PCF_SHIFT) /* Control frames accepted if pass the address filter */
+#define ETH_MAC_FRAME_FILTER_SAIF (1 << 8) /* Bit 8: SA inverse filtering */
+#define ETH_MAC_FRAME_FILTER_SAF (1 << 9) /* Bit 9: Source address filter enable */
+#define ETH_MAC_FRAME_FILTER_RA (1 << 31) /* Bit 31: Receive all */
+
+/* MAC watchdog timeout */
+#define ETH_MAC_WD_TIMEROUT_
+/* VLAN tag */
+#define ETH_MAC_VLAN_TAG_
+
+/* Transmit flow control 0/1 */
+
+#define ETH_MAC_TX_FLOW_CTRL_Q_FCB (1 << 0) /* Bit 0: Flow control busy/backpressure activate */
+#define ETH_MAC_TX_FLOW_CTRL_Q_TFE (1 << 1) /* Bit 1: Transmit flow control enable */
+#define ETH_MAC_TX_FLOW_CTRL_Q_PLT_SHIFT (4) /* Bits 4-6: Pause low threshold */
+#define ETH_MAC_TX_FLOW_CTRL_Q_PLT_MASK (7 << ETH_MAC_TX_FLOW_CTRL_Q_PLT_SHIFT)
+# define ETH_MAC_TX_FLOW_CTRL_Q_PLT(n) ((uint32_t)(n) << ETH_MAC_TX_FLOW_CTRL_Q_PLT_SHIFT)
+#define ETH_MAC_TX_FLOW_CTRL_Q_DZPQ (1 << 7) /* Bit 7: Disable zero-quanta pause */
+#define ETH_MAC_TX_FLOW_CTRL_Q_PT_SHIFT (16) /* Bits 16-31: Pause time */
+#define ETH_MAC_TX_FLOW_CTRL_Q_PT_MASK (0xffff << ETH_MAC_TX_FLOW_CTRL_Q_PT_SHIFT)
+# define ETH_MAC_TX_FLOW_CTRL_Q_PT(n) ((uint32_t)(n) << ETH_MAC_TX_FLOW_CTRL_Q_PT_SHIFT)
+
+/* Receive flow control */
+
+#define ETH_MAC_RX_FLOW_CTRL_RFE (1 << 0) /* Bit 0: Receive flow control enable */
+#define ETH_MAC_RX_FLOW_CTRL_UP (1 << 1) /* Bit 1: Unicast pause packet detect */
+
+/* Transmit Queue priority mapping */
+
+#define ETH_MAC_TXQ_PRIO_MAP_PSTQ0_SHIFT (0) /* Bits 0-7: Priorities selected in Tx Queue 0 */
+#define ETH_MAC_TXQ_PRIO_MAP_PSTQ0_MASK (0xff << ETH_MAC_TXQ_PRIO_MAP_PSTQ0_SHIFT)
+# define ETH_MAC_TXQ_PRIO_MAP_PSTQ0(n) ((uint32_t)(n) << ETH_MAC_TXQ_PRIO_MAP_PSTQ0_SHIFT)
+#define ETH_MAC_TXQ_PRIO_MAP_PSTQ1_SHIFT (8) /* Bits 8-15: Priorities selected in Tx Queue 1 */
+#define ETH_MAC_TXQ_PRIO_MAP_PSTQ1_MASK (0xff << ETH_MAC_TXQ_PRIO_MAP_PSTQ1_SHIFT)
+# define ETH_MAC_TXQ_PRIO_MAP_PSTQ1(n) ((uint32_t)(n) << ETH_MAC_TXQ_PRIO_MAP_PSTQ1_SHIFT)
+
+/* Receive Queue control 0 */
+
+#define ETH_MAC_RXQ_CTRL0_RXQ0EN_SHIFT (0) /* Bits 0-1: Rx Queue 0 enable */
+#define ETH_MAC_RXQ_CTRL0_RXQ0EN_MASK (3 << ETH_MAC_RXQ_CTRL0_RXQ0EN_SHIFT)
+# define ETH_MAC_RXQ_CTRL0_RXQ0EN_DISABLE (0 << ETH_MAC_RXQ_CTRL0_RXQ0EN_SHIFT) /* Disable */
+# define ETH_MAC_RXQ_CTRL0_RXQ0EN_ENABLE (1 << ETH_MAC_RXQ_CTRL0_RXQ0EN_SHIFT) /* Queue 0 enabled for AV */
+#define ETH_MAC_RXQ_CTRL0_RXQ1EN_SHIFT (2) /* Bits 2-3: Rx Queue 1 enable */
+#define ETH_MAC_RXQ_CTRL0_RXQ1EN_MASK (3 << ETH_MAC_RXQ_CTRL0_RXQ1EN_SHIFT)
+# define ETH_MAC_RXQ_CTRL0_RXQ1EN_DISABLE (0 << ETH_MAC_RXQ_CTRL0_RXQ1EN_SHIFT) /* Disable */
+# define ETH_MAC_RXQ_CTRL0_RXQ1EN_ENABLE (1 << ETH_MAC_RXQ_CTRL0_RXQ1EN_SHIFT) /* Queue 1 enabled for AV */
+
+/* Receive Queue control 1 */
+
+#define ETH_MAC_RXQ_CTRL1_AVCPQ_SHIFT (0) /* Bits 0-2: AV untagged control packets queue */
+#define ETH_MAC_RXQ_CTRL1_AVCPQ_MASK (7 < ETH_MAC_RXQ_CTRL1_AVCPQ_SHIFT)
+# define ETH_MAC_RXQ_CTRL1_AVCPQ(n) ((uint32_t)(n) < ETH_MAC_RXQ_CTRL1_AVCPQ_SHIFT) /* Rx Queue n, n=0..1 */
+#define ETH_MAC_RXQ_CTRL1_AVPTPQ_SHIFT (4) /* Bits 4-6: AV PTP packets queue */
+#define ETH_MAC_RXQ_CTRL1_AVPTPQ_MASK (7 < ETH_MAC_RXQ_CTRL1_AVCPQ_SHIFT)
+# define ETH_MAC_RXQ_CTRL1_AVPTPQ(n) ((uint32_t)(n) < ETH_MAC_RXQ_CTRL1_AVCPQ_SHIFT) /* Rx Queue n, n=0..1 */
+#define ETH_MAC_RXQ_CTRL1_UPQ_SHIFT (12) /* Bits 12-14: Untagged packet queue */
+#define ETH_MAC_RXQ_CTRL1_UPQ_MASK (7 < ETH_MAC_RXQ_CTRL1_AVCPQ_SHIFT)
+# define ETH_MAC_RXQ_CTRL1_UPQ(n) ((uint32_t)(n) < ETH_MAC_RXQ_CTRL1_AVCPQ_SHIFT) /* Rx Queue n, n=0..1 */
+#define ETH_MAC_RXQ_CTRL1_MCBCQ_SHIFT (16) /* Bits 16-18: Multicast and broadcast queue */
+#define ETH_MAC_RXQ_CTRL1_MCBCQ_MASK (7 < ETH_MAC_RXQ_CTRL1_AVCPQ_SHIFT)
+# define ETH_MAC_RXQ_CTRL1_MCBCQ(n) ((uint32_t)(n) < ETH_MAC_RXQ_CTRL1_AVCPQ_SHIFT) /* Rx Queue n, n=0..1 */
+#define ETH_MAC_RXQ_CTRL1_MCBCQEN (1 << 20) /* Bit 20: Multicast and broadcast queue enable */
+
+/* Receive Queue control 2 */
+
+#define ETH_MAC_RXQ_CTRL2_PSRQ0_SHIFT (0) /* Bits 0-7: Priorities selected in the Rx Queue 0 */
+#define ETH_MAC_RXQ_CTRL2_PSRQ0_MASK (0xff << ETH_MAC_RXQ_CTRL2_PSRQ0_SHIFT)
+# define ETH_MAC_RXQ_CTRL2_PSRQ0(n) ((uint32_t)(n) << ETH_MAC_RXQ_CTRL2_PSRQ0_SHIFT)
+#define ETH_MAC_RXQ_CTRL2_PSRQ1_SHIFT (8) /* Bits 8-15: Priorities selected in the Rx Queue 1 */
+#define ETH_MAC_RXQ_CTRL2_PSRQ1_MASK (0xff << ETH_MAC_RXQ_CTRL2_PSRQ1_SHIFT)
+# define ETH_MAC_RXQ_CTRL2_PSRQ1(n) ((uint32_t)(n) << ETH_MAC_RXQ_CTRL2_PSRQ1_SHIFT)
+#define ETH_MAC_RXQ_CTRL2_PSRQ2_SHIFT (16) /* Bits 16-23: Priorities selected in the Rx Queue 2 */
+#define ETH_MAC_RXQ_CTRL2_PSRQ2_MASK (0xff << ETH_MAC_RXQ_CTRL2_PSRQ2_SHIFT)
+# define ETH_MAC_RXQ_CTRL2_PSRQ2(n) ((uint32_t)(n) << ETH_MAC_RXQ_CTRL2_PSRQ2_SHIFT)
+#define ETH_MAC_RXQ_CTRL2_PSRQ3_SHIFT (24) /* Bits 24-31: Priorities selected in the Rx Queue 3 */
+#define ETH_MAC_RXQ_CTRL2_PSRQ3_MASK (0xff << ETH_MAC_RXQ_CTRL2_PSRQ3_SHIFT)
+# define ETH_MAC_RXQ_CTRL2_PSRQ3(n) ((uint32_t)(n) << ETH_MAC_RXQ_CTRL2_PSRQ3_SHIFT)
+
+/* Interrupt enable and interrupt status */
+
+#define ETH_MAC_INTR_PHYI (1 << 3) /* Bit 3: PHY interrupt */
+#define ETH_MAC_INTR_PMTI (1 << 4) /* Bit 4: PMT interrupt */
+#define ETH_MAC_INTR_LPII (1 << 5) /* Bit 5: LPI interrupt */
+#define ETH_MAC_INTR_TSI (1 << 12) /* Bit 12: Timestamp interrupt */
+#define ETH_MAC_INTR_TXSTSI (1 << 13) /* Bit 13: Transmit status interrupt */
+#define ETH_MAC_INTR_RXSTSI (1 << 14) /* Bit 14: Receive status interrupt */
+
+/* Receive transmit status */
+#define ETH_MAC_RXTX_STAT_
+/* MAC PMT control and status */
+#define ETH_MAC_PMT_CRTL_STAT_
+/* Wake-up packet filter */
+#define ETH_MAC_RWK_PKT_FLT_
+/* LPI control and status */
+#define ETH_MAC_LPI_CTRL_STAT_
+/* LPI timers control */
+#define ETH_MAC_LPI_TIMER_CTRL_
+/* LPI entry timer */
+#define ETH_MAC_LPI_ENTR_TIMR_
+
+/* MAC 1 usec tick counter */
+
+#define ETH_MAC_1US_TIC_COUNTR_SHIFT (0) /* Bits 0-11: 1uS TIC counter */
+#define ETH_MAC_1US_TIC_COUNTR_MASK (0xfff << ETH_MAC_1US_TIC_COUNTR_SHIFT)
+# define ETH_MAC_1US_TIC_COUNTR(n) ((uint32_t)((n)-1) << ETH_MAC_1US_TIC_COUNTR_SHIFT)
+
+/* MAC version */
+#define ETH_MAC_VERSION_
+/* MAC debug */
+#define ETH_MAC_DBG_
+/* MAC hardware feature 0 */
+#define ETH_MAC_HW_FEAT0_
+/* MAC hardware feature 1 */
+#define ETH_MAC_HW_FEAT1_
+/* MAC hardware feature 2 */
+#define ETH_MAC_HW_FEAT2_
+
+/* MIDO address */
+
+#define ETH_MAC_MDIO_ADDR_MB (1 << 0) /* Bit 0 MII busy */
+#define ETH_MAC_MDIO_ADDR_MOC_SHIFT (2) /* Bits 2-3: MII operation command */
+#define ETH_MAC_MDIO_ADDR_MOC_MASK (3 << ETH_MAC_MDIO_ADDR_MOC_SHIFT)
+# define ETH_MAC_MDIO_ADDR_MOC_WRITE (1 << ETH_MAC_MDIO_ADDR_MOC_SHIFT) /* Write */
+# define ETH_MAC_MDIO_ADDR_MOC_READ (3 << ETH_MAC_MDIO_ADDR_MOC_SHIFT) /* Read */
+#define ETH_MAC_MDIO_ADDR_CR_SHIFT (8) /* Bits 8-11: CSR clock range */
+#define ETH_MAC_MDIO_ADDR_CR_MASK (15 << ETH_MAC_MDIO_ADDR_CR_SHIFT)
+# define ETH_MAC_MDIO_ADDR_CR_DIV42 (0 << ETH_MAC_MDIO_ADDR_CR_SHIFT) /* CSR=60-100 MHz; MDC=CSR/42 */
+# define ETH_MAC_MDIO_ADDR_CR_DIV62 (1 << ETH_MAC_MDIO_ADDR_CR_SHIFT) /* CSR=100-150 MHz; MDC=CSR/62 */
+# define ETH_MAC_MDIO_ADDR_CR_DIV16 (2 << ETH_MAC_MDIO_ADDR_CR_SHIFT) /* CSR=20-35 MHz; MDC=CSR/16 */
+# define ETH_MAC_MDIO_ADDR_CR_DIV26 (3 << ETH_MAC_MDIO_ADDR_CR_SHIFT) /* CSR=35-60 MHz; MDC=CSR/26 */
+#define ETH_MAC_MDIO_ADDR_NTC_SHIFT (12) /* Bits 12-14: Number of training clocks */
+#define ETH_MAC_MDIO_ADDR_NTC_MASK (7 << ETH_MAC_MDIO_ADDR_NTC_SHIFT)
+# define ETH_MAC_MDIO_ADDR_NTC(n) ((uint32_t)(n) << ETH_MAC_MDIO_ADDR_NTC_SHIFT)
+#define ETH_MAC_MDIO_ADDR_RDA_SHIFT (16) /* Bits 16-20: Register/device address */
+#define ETH_MAC_MDIO_ADDR_RDA_MASK (31 << ETH_MAC_MDIO_ADDR_RDA_SHIFT)
+# define ETH_MAC_MDIO_ADDR_RDA(n) ((uint32_t)(n) << ETH_MAC_MDIO_ADDR_RDA_SHIFT)
+#define ETH_MAC_MDIO_ADDR_PA_SHIFT (21) /* Bits 21-25: Physical layer address */
+#define ETH_MAC_MDIO_ADDR_PA_MASK (31 << ETH_MAC_MDIO_ADDR_PA_SHIFT)
+# define ETH_MAC_MDIO_ADDR_PA(n) ((uint32_t)(n) << ETH_MAC_MDIO_ADDR_PA_SHIFT)
+#define ETH_MAC_MDIO_ADDR_BTB (1 << 26) /* Bit 26 Back to back transactions */
+#define ETH_MAC_MDIO_ADDR_PSE (1 << 27) /* Bit 27 Preamble suppression enable */
+
+/* MDIO data */
+
+#define ETH_MAC_MDIO_DATA_MASK 0xffff /* Bits 0-15: 16 bit PHY data */
+
+/* MAC address0 high */
+
+#define ETH_MAC_ADDR_HIGH_A32_47_SHIFT (0) /* Bits 9-15: MAC address 32-47 */
+#define ETH_MAC_ADDR_HIGH_A32_47_MASK (0xffff << ETH_MAC_ADDR_HIGH_A32_47_SHIFT)
+# define ETH_MAC_ADDR_HIGH_A32_47(n) ((uint32_t)(n) << ETH_MAC_ADDR_HIGH_A32_47_SHIFT)
+#define ETH_MAC_ADDR_HIGH_DCS (1 << 16) /* Bit 16: DMA channel select */
+
+/* MAC address0 low (32-bit MAC address 0-31) */
+
+/* Timestamp control */
+#define ETH_MAC_TIMESTAMP_CTRL_
+/* Sub-second increment */
+#define ETH_MAC_SUB_SCND_INCR_
+/* System time seconds */
+#define ETH_MAC_SYS_TIME_SCND_
+/* System time nanoseconds */
+#define ETH_MAC_SYS_TIME_NSCND_
+/* System time seconds update */
+#define ETH_MAC_SYS_TIME_SCND_UPD_
+/* System time nanoseconds update */
+#define ETH_MAC_SYS_TIME_NSCND_UPD_
+/* Timestamp addend */
+#define ETH_MAC_SYS_TIMESTMP_ADDEND_
+/* System time-higher word seconds */
+#define ETH_MAC_SYS_TIME_HWORD_SCND_
+/* Timestamp status */
+#define ETH_MAC_SYS_TIMESTMP_STAT_
+/* Tx timestamp status nanoseconds */
+#define ETH_MAC_Tx_TIMESTAMP_STATUS_NSECS_
+/* Tx timestamp status seconds */
+#define ETH_MAC_Tx_TIMESTAMP_STATUS_SECS_
+/* Timestamp ingress correction */
+#define ETH_MAC_TIMESTAMP_INGRESS_CORR_NSEC_
+/* Timestamp egress correction */
+#define ETH_MAC_TIMESTAMP_EGRESS_CORR_NSEC_
+
+/* MTL operation mode */
+
+#define ETH_MTL_OP_MODE_DTXSTS (1 << 1) /* Bit 1: Drop transmit status */
+#define ETH_MTL_OP_MODE_RAA (1 << 1) /* Bit 2: Receive arbitration algorithm */
+# define ETH_MTL_OP_MODE_RAA_SP (0) /* Strict priority */
+# define ETH_MTL_OP_MODE_RAA_WSP (1 << 1) /* Weighted Strict Priority */
+#define ETH_MTL_OP_MODE_SHALG_SHIFT (5) /* Bits 5-6: Tx Scheduling Algorithm */
+#define ETH_MTL_OP_MODE_SHALG_MASK (3 << ETH_MTL_OP_MODE_SHALG_SHIFT)
+# define ETH_MTL_OP_MODE_SHALG_SP (0 << ETH_MTL_OP_MODE_SHALG_SHIFT) /* Strict priority */
+# define ETH_MTL_OP_MODE_SHALG_WSP (3 << ETH_MTL_OP_MODE_SHALG_SHIFT) /* Weighted Strict */
+
+/* MTL interrupt status */
+#define ETH_MTL_INTR_STAT_
+
+/* MTL Rx Queue and DMA channel mapping */
+
+#define ETH_MTL_RXQ_DMA_MAP_Q0MDMACH (1 << 0) /* Bit 0: Queue 0 mapped to DMA channel 1 */
+#define ETH_MTL_RXQ_DMA_MAP_Q0DDMACH (1 << 4) /* Bit 4: Queue 0 enabled for DA-based DMA channel selection */
+#define ETH_MTL_RXQ_DMA_MAP_Q1MDMACH (1 << 8) /* Bit 8: Queue 1 mapped to DMA channel 1 */
+#define ETH_MTL_RXQ_DMA_MAP_Q1DDMACH (1 << 12) /* Bit 12: Queue 1 enabled for DA-based DMA channel selection */
+
+/* MTL TxQn operation mode */
+
+#define ETH_MTL_TXQ_OP_MODE_FTQ (1 << 0) /* Bit 0: Flush Tx Queue */
+#define ETH_MTL_TXQ_OP_MODE_TSF (1 << 1) /* Bit 1: Transmit store and forward */
+#define ETH_MTL_TXQ_OP_MODE_TXQEN_SHIFT (2) /* Bits 2-3: Tx Queue enable */
+#define ETH_MTL_TXQ_OP_MODE_TXQEN_MASK (3 << ETH_MTL_TXQ_OP_MODE_TXQEN_SHIFT)
+# define ETH_MTL_TXQ_OP_MODE_TXQEN_DISABLE (0 << ETH_MTL_TXQ_OP_MODE_TXQEN_SHIFT) /* Not enabled */
+# define ETH_MTL_TXQ_OP_MODE_TXQEN_ENABLE (2 << ETH_MTL_TXQ_OP_MODE_TXQEN_SHIFT) /* Enabled */
+#define ETH_MTL_TXQ_OP_MODE_TTC_SHIFT (4) /* Bits 4-6: Transmit threshold control */
+#define ETH_MTL_TXQ_OP_MODE_TTC_MASK (7 << ETH_MTL_TXQ_OP_MODE_TTC_SHIFT)
+# define ETH_MTL_TXQ_OP_MODE_TTC_32 (0 << ETH_MTL_TXQ_OP_MODE_TTC_SHIFT)
+# define ETH_MTL_TXQ_OP_MODE_TTC_64 (1 << ETH_MTL_TXQ_OP_MODE_TTC_SHIFT)
+# define ETH_MTL_TXQ_OP_MODE_TTC_96 (2 << ETH_MTL_TXQ_OP_MODE_TTC_SHIFT)
+# define ETH_MTL_TXQ_OP_MODE_TTC_128 (3 << ETH_MTL_TXQ_OP_MODE_TTC_SHIFT)
+# define ETH_MTL_TXQ_OP_MODE_TTC_192 (4 << ETH_MTL_TXQ_OP_MODE_TTC_SHIFT)
+# define ETH_MTL_TXQ_OP_MODE_TTC_256 (5 << ETH_MTL_TXQ_OP_MODE_TTC_SHIFT)
+# define ETH_MTL_TXQ_OP_MODE_TTC_384 (6 << ETH_MTL_TXQ_OP_MODE_TTC_SHIFT)
+# define ETH_MTL_TXQ_OP_MODE_TTC_512 (7 << ETH_MTL_TXQ_OP_MODE_TTC_SHIFT)
+#define ETH_MTL_TXQ_OP_MODE_TQS_SHIFT (16) /* Bits 16-18: Tx Queue size (x256) */
+#define ETH_MTL_TXQ_OP_MODE_TQS_MASK (7 << ETH_MTL_TXQ_OP_MODE_TQS_SHIFT)
+# define ETH_MTL_TXQ_OP_MODE_TQS(n) ((uint32_t)((n)-1) << ETH_MTL_TXQ_OP_MODE_TQS_SHIFT)
+
+/* MTL TxQn underflow */
+#define ETH_MTL_TXQ_UNDRFLW_
+/* MTL TxQn debug */
+#define ETH_MTL_TXQ_DBG_
+/* MTL TxQ1 (only) ETS control */
+#define ETH_MTL_TXQ1_ETS_CTRL_
+/* MTL TxQn ETS status */
+#define ETH_MTL_TXQ_ETS_STAT_
+
+/* MTL TxQn idleSlopeCredit,quantum or weights */
+
+#define ETH_MTL_TXQ_QNTM_WGHT_MASK 0x001fffff /* Bits 0-20: IdleSlopeCredit, quantum or weights */
+
+/* MTL TxQ1 (only) SendSlopCredit */
+#define ETH_MTL_TXQ1_SNDSLP_CRDT_
+/* MTL TxQ1 (only) hiCredit */
+#define ETH_MTL_TXQ1_HI_CRDT_
+/* MTL TxQ1 (only) loCredit */
+#define ETH_MTL_TXQ1_LO_CRDT_
+/* MTL TxQn interrupt control status */
+#define ETH_MTL_TXQ_INTCTRL_STAT_
+
+/* MTL RxQn operation mode */
+
+#define ETH_MTL_RXQ_OP_MODE_RTC_SHIFT (0) /* Bits 0-1: Rx Queue threshold control */
+#define ETH_MTL_RXQ_OP_MODE_RTC_MASK (3 << ETH_MTL_RXQ_OP_MODE_RTC_SHIFT)
+# define ETH_MTL_RXQ_OP_MODE_RTC_64 (0 << ETH_MTL_RXQ_OP_MODE_RTC_SHIFT)
+# define ETH_MTL_RXQ_OP_MODE_RTC_32 (1 << ETH_MTL_RXQ_OP_MODE_RTC_SHIFT)
+# define ETH_MTL_RXQ_OP_MODE_RTC_96 (2 << ETH_MTL_RXQ_OP_MODE_RTC_SHIFT)
+# define ETH_MTL_RXQ_OP_MODE_RTC_128 (3 << ETH_MTL_RXQ_OP_MODE_RTC_SHIFT)
+#define ETH_MTL_RXQ_OP_MODE_FUP (1 << 3) /* Bit 3 Forward undersized good packets */
+#define ETH_MTL_RXQ_OP_MODE_FEP (1 << 4) /* Bit 4 Forward error packets */
+#define ETH_MTL_RXQ_OP_MODE_RSF (1 << 5) /* Bit 5 Rx Queue store and forward */
+#define ETH_MTL_RXQ_OP_MODE_DIS_TCP_EF (1 << 6) /* Bit 6 Disable dropping of TCP/IP checksum error packets */
+#define ETH_MTL_RXQ_OP_MODE_RQS_SHIFT (20) /* Bits 20-22: Rx Queue size (x256) */
+#define ETH_MTL_RXQ_OP_MODE_RQS_MASK (7 << ETH_MTL_RXQ_OP_MODE_RQS_SHIFT)
+# define ETH_MTL_RXQ_OP_MODE_RQS(n) ((uint32_t)((n)-1) << ETH_MTL_RXQ_OP_MODE_RQS_SHIFT)
+
+/* MTL RxQn missed packet overflow counter */
+#define ETH_MTL_RXQ_MISSPKT_OVRFLW_CNT_
+/* MTL RxQn debug */
+#define ETH_MTL_RXQ_DBG_
+
+/* MTL RxQn control */
+
+#define ETH_MTL_RXQ_CTRL_WEGT_SHIFT (0) /* Bits 0-2: Rx Queue weight */
+#define ETH_MTL_RXQ_CTRL_WEGT_MASK (7 << ETH_MTL_RXQ_CTRL_WEGT)
+# define ETH_MTL_RXQ_CTRL_WEGT(n) ((uint32_t)(n) << ETH_MTL_RXQ_CTRL_WEGT)
+#define ETH_MTL_RXQ_CTRL_FRM_ARBIT (1 << 3) /* Bit 3: Rx Queue packet arbitration */
+
+/* DMA mode */
+
+#define ETH_DMA_MODE_SWR (1 << 0) /* Bit 0: Software reset */
+#define ETH_DMA_MODE_DA_MASK (1 << 1) /* Bit 1: DMA Tx or Rx arbitration scheme */
+# define ETH_DMA_MODE_DA_WRR (0) /* Weighted round-robin with Rx:Tx or Tx:Rx */
+# define ETH_DMA_MODE_DA_FIXED (1 << 1) /* Fixed priority */
+#define ETH_DMA_MODE_TAA_SHIFT (2) /* Bits 2-4: Transmit arbitration algorithm */
+#define ETH_DMA_MODE_TAA_MASK (7 << ETH_DMA_MODE_TAA_SHIFT)
+# define ETH_DMA_MODE_TAA_FIXED (0 << ETH_DMA_MODE_TAA_SHIFT) /* Fixed priority */
+# define ETH_DMA_MODE_TAA_WSP (1 << ETH_DMA_MODE_TAA_SHIFT) /* Weighted strict priority */
+# define ETH_DMA_MODE_TAA_WRR (2 << ETH_DMA_MODE_TAA_SHIFT) /* Weighted round-robin */
+#define ETH_DMA_MODE_TXPR (1 << 11) /* Bit 11: Transmit priority */
+#define ETH_DMA_MODE_PR_SHIFT (12) /* Bits 12-14: Priority ratio */
+#define ETH_DMA_MODE_PR_MASK (7 << ETH_DMA_MODE_PR_SHIFT)
+# define ETH_DMA_MODE_PR_1TO1 (0 << ETH_DMA_MODE_PR_SHIFT) /* Priority ratio is 1:1 */
+# define ETH_DMA_MODE_PR_3TO1 (2 << ETH_DMA_MODE_PR_SHIFT) /* Priority ratio is 3:1 */
+# define ETH_DMA_MODE_PR_4TO1 (3 << ETH_DMA_MODE_PR_SHIFT) /* Priority ratio is 4:1 */
+# define ETH_DMA_MODE_PR_5TO1 (4 << ETH_DMA_MODE_PR_SHIFT) /* Priority ratio is 5:1 */
+# define ETH_DMA_MODE_PR_6TO1 (5 << ETH_DMA_MODE_PR_SHIFT) /* Priority ratio is 6:1 */
+# define ETH_DMA_MODE_PR_7TO1 (6 << ETH_DMA_MODE_PR_SHIFT) /* Priority ratio is 7:1 */
+# define ETH_DMA_MODE_PR_8TO1 (7 << ETH_DMA_MODE_PR_SHIFT) /* Priority ratio is 8:1 */
+
+/* DMA system bus mode */
+
+#define ETH_DMA_SYSBUS_MODE_FB (1 << 0) /* Bit 0: Fixed burst length */
+#define ETH_DMA_SYSBUS_MODE_AAL (1 << 12) /* Bit 12: Address-aligned beats */
+#define ETH_DMA_SYSBUS_MODE_MB (1 << 14) /* Bit 14: Mixed burst */
+#define ETH_DMA_SYSBUS_MODE_RB (1 << 15) /* Bit 15: Rebuild INCRx burst */
+
+/* DMA interrupt status */
+
+#define ETH_DMA_INTR_STAT_DC0IS (1 << 0) /* Bit 0: DMA channel 0 interrupt status */
+#define ETH_DMA_INTR_STAT_DC1IS (1 << 1) /* Bit 1: DMA channel 1 interrupt status */
+#define ETH_DMA_INTR_STAT_MTLIS (1 << 16) /* Bit 16: MTL interrupt status */
+#define ETH_DMA_INTR_STAT_MACIS (1 << 17) /* Bit 17: MAC interrupt status */
+
+/* DMA debug status */
+#define ETH_DMA_DBG_STAT_
+
+/* DMA channel n control */
+
+#define ETH_DMACH_CTRL_PBLx8 (1 << 16) /* Bit 16: 8xPBL mode */
+#define ETH_DMACH_CTRL_DSL_SHIFT (18) /* Bits 18-20: Skip length */
+
+/* DMA channel n transmit control */
+
+#define ETH_DMACH_TX_CTRL_ST (1 << 0) /* Bit 0: Start or stop transmission command */
+#define ETH_DMACH_TX_CTRL_TCW_SHIFT (1) /* Bits 1-3: Transmit channel weight */
+#define ETH_DMACH_TX_CTRL_TCW_MASK (7 << ETH_DMACH_TX_CTRL_TCW_SHIFT)
+# define ETH_DMACH_TX_CTRL_TCW(n) ((uint32_t)(n) << ETH_DMACH_TX_CTRL_TCW_SHIFT)
+#define ETH_DMACH_TX_CTRL_OSF (1 << 4) /* Bit 4: Operate on second frame */
+#define ETH_DMACH_TX_CTRL_TxPBL_SHIFT (16) /* Bits 16-21: Transmit programmable burst length */
+#define ETH_DMACH_TX_CTRL_TxPBL_MASK (0x3f << ETH_DMACH_TX_CTRL_TxPBL_SHIFT)
+# define ETH_DMACH_TX_CTRL_TxPBL(n) ((uint32_t)(n) << ETH_DMACH_TX_CTRL_TxPBL_SHIFT)
+
+/* DMA channel n receive control */
+
+#define ETH_DMACH_RX_CTRL_SR (1 << 0) /* Bit 0: Start or stop receive command */
+#define ETH_DMACH_RX_CTRL_RBSZ_SHIFT (3) /* Bits 3-14: Receive buffer size */
+#define ETH_DMACH_RX_CTRL_RBSZ_MASK (0xfff << ETH_DMACH_RX_CTRL_RBSZ_SHIFT)
+# define ETH_DMACH_RX_CTRL_RBSZ(n) ((uint32_t)(n) << ETH_DMACH_RX_CTRL_RBSZ_SHIFT)
+#define ETH_DMACH_RX_CTRL_RxPBL_SHIFT (16) /* Bits 16-21: Receive programmable burst length */
+#define ETH_DMACH_RX_CTRL_RxPBL_MASK (0x3f << ETH_DMACH_RX_CTRL_RxPBL_SHIFT)
+# define ETH_DMACH_RX_CTRL_RxPBL(n) ((uint32_t)(n) << ETH_DMACH_RX_CTRL_RxPBL_SHIFT)
+#define ETH_DMACH_RX_CTRL_RPF (1 << 31) /* Bit 31: DMA Rx channel n packet flush */
+
+/* DMA channel n Tx descriptor list address (32-bit, word-aligned address) */
+/* DMA channel n Rx descriptor list address (32-bit, word-aligned address) */
+/* DMA channel n Tx descriptor tail pointer (32-bit, word-aligned address) */
+/* DMA channel n Rx descriptor tail pointer (32-bit, word-aligned address) */
+
+/* DMA channel n Tx descriptor ring length */
+
+#define ETH_DMACH_TXDESC_RING_LENGTH_SHIFT (0) /* Bits 0-9: Transmit ring length */
+#define ETH_DMACH_TXDESC_RING_LENGTH_MASK (0x3ff << ETH_DMACH_TXDESC_RING_LENGTH_SHIFT)
+# define ETH_DMACH_TXDESC_RING_LENGTH(n) ((uint32_t)((n)-1) << ETH_DMACH_TXDESC_RING_LENGTH_SHIFT)
+
+/* DMA channel n Rx descriptor ring length */
+
+#define ETH_DMACH_RXDESC_RING_LENGTH_SHIFT (0) /* Bits 0-9: Receive ring length */
+#define ETH_DMACH_RXDESC_RING_LENGTH_MASK (0x3ff << ETH_DMACH_RXDESC_RING_LENGTH_SHIFT)
+# define ETH_DMACH_RXDESC_RING_LENGTH(n) ((uint32_t)((n)-1) << ETH_DMACH_RXDESC_RING_LENGTH_SHIFT)
+
+/* DMA channel n interrupt enable and DMA channel n DMA status */
+
+#define ETH_DMACH_INT_TI (1 << 0) /* Bit 0: Transmit interrupt */
+#define ETH_DMACH_INT_TS (1 << 1) /* Bit 1: Transmitter stopped */
+#define ETH_DMACH_INT_TBU (1 << 2) /* Bit 2: Transmit buffer unavailable */
+#define ETH_DMACH_INT_RI (1 << 6) /* Bit 6: Receive interrupt */
+#define ETH_DMACH_INT_RBU (1 << 7) /* Bit 7: Receive buffer unavailable */
+#define ETH_DMACH_INT_RS (1 << 8) /* Bit 8: Receiver stopped */
+#define ETH_DMACH_INT_RWT (1 << 9) /* Bit 9: Receive watchdog timeout */
+#define ETH_DMACH_INT_ETI (1 << 10) /* Bit 10: Early transmit interrupt */
+#define ETH_DMACH_INT_ERI (1 << 11) /* Bit 11: Early receive interrupt */
+#define ETH_DMACH_INT_FBE (1 << 12) /* Bit 12: Fatal bus error */
+#define ETH_DMACH_INT_AI (1 << 14) /* Bit 14: Abnormal interrupt summary */
+#define ETH_DMACH_INT_NI (1 << 15) /* Bit 15: Normal interrupt summary */
+
+/* DMA channel n receive interrupt watchdog timer */
+#define ETH_DMACH_RX_INT_WDTIMER_
+/* DMA channel n slot function control and status */
+#define ETH_DMACH_SLOT_FUNC_CTRL_STAT_
+/* DMA channel n current host transmit descriptor */
+#define ETH_DMACH_CUR_HST_TXDESC_
+/* DMA channel n current host receive descriptor */
+#define ETH_DMACH_CUR_HST_RXDESC_
+/* DMA channel n current host transmit buffer address */
+#define ETH_DMACH_CUR_HST_TXBUF_
+/* DMA channel n current application receive buffer address */
+#define ETH_DMACH_CUR_HST_RXBUF_
+
+/* DMA channel n missed frame count */
+#define ETH_DMACH_MISS_FRAME_CNT_
+
+/* DMA descriptors ******************************************************************************************/
+
+/* Receive descriptor (read-format) */
+/* RDES0: 32-bit address */
+/* RDES1: Reserved */
+/* RDES2: 32-bit address */
+
+/* RDES3: */
+
+#define ETH_RXDES3_BUF1V (1 << 24) /* Bit 24: Buffer 1 address valid */
+#define ETH_RXDES3_BUF2V (1 << 25) /* Bit 25: Buffer 1 address valid */
+#define ETH_RXDES3_IOC (1 << 30) /* Bit 30: Interrupt enabled on completion */
+#define ETH_RXDES3_OWN (1 << 31) /* Bit 31: Own bit */
+
+/* Receive descriptor (writeback-format) */
+/* RDES0: Reserved */
+
+/* RDES1: */
+
+#define ETH_RXDES1_PT_SHIFT (0) /* Bits 0-2: Payload type */
+#define ETH_RXDES1_PT_MASK (7 << ETH_RXDES1_PT_SHIFT)
+# define ETH_RXDES1_PT_UNKNOWN (0 << ETH_RXDES1_PT_SHIFT) /* Unknown */
+# define ETH_RXDES1_PT_UDP (1 << ETH_RXDES1_PT_SHIFT) /* UDP */
+# define ETH_RXDES1_PT_TCP (2 << ETH_RXDES1_PT_SHIFT) /* TCP */
+# define ETH_RXDES1_PT_ICMP (3 << ETH_RXDES1_PT_SHIFT) /* ICMP */
+# define ETH_RXDES1_PT_IGMP (4 << ETH_RXDES1_PT_SHIFT) /* IGMP */
+# define ETH_RXDES1_PT_AVUCP (5 << ETH_RXDES1_PT_SHIFT) /* AV untagged control packet */
+# define ETH_RXDES1_PT_AVTDP (6 << ETH_RXDES1_PT_SHIFT) /* AV tagged data packet */
+# define ETH_RXDES1_PT_AVTCP (7 << ETH_RXDES1_PT_SHIFT) /* AV tagged control packet */
+#define ETH_RXDES1_IPHE (1 << 3) /* Bit 3: IP header error */
+#define ETH_RXDES1_IPV4 (1 << 4) /* Bit 4: IPV4 header present */
+#define ETH_RXDES1_IPV6 (1 << 5) /* Bit 5: IPv6 header present */
+#define ETH_RXDES1_IPCB (1 << 6) /* Bit 6: IP checksum bypassed */
+#define ETH_RXDES1_IPCE (1 << 7) /* Bit 7: IP payload error */
+#define ETH_RXDES1_PMT_SHIFT (8) /* Bits 8-11: PTP message type */
+#define ETH_RXDES1_PMT_MASK (15 << ETH_RXDES1_PMT_SHIFT)
+# define ETH_RXDES1_PMT_NONE (0 << ETH_RXDES1_PMT_SHIFT) /* No PTP message received */
+# define ETH_RXDES1_PMT_SYNC (1 << ETH_RXDES1_PMT_SHIFT) /* SYNC */
+# define ETH_RXDES1_PMT_FOLLOWUP (2 << ETH_RXDES1_PMT_SHIFT) /* Follow_Up */
+# define ETH_RXDES1_PMT_DELAYREQ (3 << ETH_RXDES1_PMT_SHIFT) /* Delay Req */
+# define ETH_RXDES1_PMT_DELAYRESP (4 << ETH_RXDES1_PMT_SHIFT) /* Delay Resp */
+# define ETH_RXDES1_PMT_PDELAYREQ (5 << ETH_RXDES1_PMT_SHIFT) /* Pdelay Req */
+# define ETH_RXDES1_PMT_PDELAYRESP (6 << ETH_RXDES1_PMT_SHIFT) /* Pdelay Resp */
+# define ETH_RXDES1_PMT_PDELAYFOLLOWUP (7 << ETH_RXDES1_PMT_SHIFT) /* Pdelay Resp follow-up */
+# define ETH_RXDES1_PMT_ANNOUNCE (8 << ETH_RXDES1_PMT_SHIFT) /* Announce */
+# define ETH_RXDES1_PMT_MGMNT (9 << ETH_RXDES1_PMT_SHIFT) /* Management */
+# define ETH_RXDES1_PMT_SIGNALING (10 << ETH_RXDES1_PMT_SHIFT) /* Signaling */
+# define ETH_RXDES1_PMT_RESERVERD (15 << ETH_RXDES1_PMT_SHIFT) /* Reserved message type */
+#define ETH_RXDES1_PFT (1 << 12) /* Bit 12: PTP packet type */
+#define ETH_RXDES1_PV (1 << 13) /* Bit 13: PTP version */
+#define ETH_RXDES1_TSA (1 << 14) /* Bit 14: Timestamp available */
+#define ETH_RXDES1_TD (1 << 15) /* Bit 15: Timestamp dropped */
+#define ETH_RXDES1_OPC_SHIFT (16) /* Bits 16-31: OAM sub-type code */
+
+/* RXDES2: */
+
+#define ETH_RXDES2_SAF (1 << 16) /* Bit 16: SA address filter fail */
+#define ETH_RXDES2_DAF (1 << 17) /* Bit 17: Destination address filter fail */
+#define ETH_RXDES2_MADRM_SHIFT (19) /* Bits 19-26: MAC address match */
+#define ETH_RXDES2_MADRM_MASK (0xff << ETH_RXDES2_MADRM_SHIFT)
+
+/* RXDES3: */
+
+#define ETH_RXDES3_PL_SHIFT (0) /* Bits 0-14: Packet length */
+#define ETH_RXDES3_PL_MASK (0x7fff << ETH_RXDES3_PL_SHIFT)
+#define ETH_RXDES3_ES (1 << 15) /* Bit 15: Error summary */
+#define ETH_RXDES3_LT_SHIFT (16) /* Bits 16-18: Length/type */
+#define ETH_RXDES3_LT_MASK (7 << ETH_RXDES3_LT_SHIFT)
+# define ETH_RXDES3_LT_PKTLEN (0 << ETH_RXDES3_LT_SHIFT) /* Packet is a length packet */
+# define ETH_RXDES3_LT_PKTTYPE (1 << ETH_RXDES3_LT_SHIFT) /* Packet is a type packet */
+# define ETH_RXDES3_LT_ARPREQ (3 << ETH_RXDES3_LT_SHIFT) /* Packet is a ARP request packet type */
+# define ETH_RXDES3_LT_VLAN (4 << ETH_RXDES3_LT_SHIFT) /* Packet is a type packet with VLAN tag */
+# define ETH_RXDES3_LT_DVLAN (5 << ETH_RXDES3_LT_SHIFT) /* Packet is a type packet with double VLAN tag */
+# define ETH_RXDES3_LT_CTRLPKT (6 << ETH_RXDES3_LT_SHIFT) /* Packet is a MAC control packet type */
+# define ETH_RXDES3_LT_OAM (7 << ETH_RXDES3_LT_SHIFT) /* Packet is a OAM packet type */
+#define ETH_RXDES3_DE (1 << 19) /* Bit 19: Dribble bit error */
+#define ETH_RXDES3_RE (1 << 20) /* Bit 20: Receive error */
+#define ETH_RXDES3_OE (1 << 21) /* Bit 21: Overflow error */
+#define ETH_RXDES3_RWT (1 << 22) /* Bit 22: Receive watchdog timeout */
+#define ETH_RXDES3_GP (1 << 23) /* Bit 23: Giant packet */
+#define ETH_RXDES3_CE (1 << 24) /* Bit 24: CRC error */
+#define ETH_RXDES3_RS0V (1 << 25) /* Bit 25: Receive status RDES0 valid */
+#define ETH_RXDES3_RS1V (1 << 26) /* Bit 26: Receive status RDES1 valid */
+#define ETH_RXDES3_RS2V (1 << 27) /* Bit 27: Receive status RDES2 valid */
+#define ETH_RXDES3_LD (1 << 28) /* Bit 28: Last descriptor */
+#define ETH_RXDES3_FD (1 << 29) /* Bit 29: First descriptor */
+#define ETH_RXDES3_CTXT (1 << 30) /* Bit 30: Receive context descriptor */
+ /* Bit 31: Own bit (see read-format) */
+
+/* Transmit normal descriptor (read-format) */
+/* TDES0/1: 32-bit address */
+
+/* TDES2: */
+
+#define ETH_TXDES2_B1L_SHIFT (0) /* Bits 0-13: Buffer 1 length */
+#define ETH_TXDES2_B1L_MASK (0x3fff << ETH_TXDES2_B1L_SHIFT)
+# define ETH_TXDES2_B1L(n) ((uint32_t)(n) << ETH_TXDES2_B1L_SHIFT)
+#define ETH_TXDES2_B2L_SHIFT (16) /* Bits 16-29: Buffer 2 length */
+#define ETH_TXDES2_B2L_MASK (0x3fff << ETH_TXDES2_B2L_SHIFT)
+# define ETH_TXDES2_B2L(n) ((uint32_t)(n) << ETH_TXDES2_B2L_SHIFT)
+#define ETH_TXDES2_TTSE (1 << 30) /* Bit 30: Transmit timestamp enable */
+#define ETH_TXDES2_IOC (1 << 31) /* Bit 31: Interrupt on completion */
+
+/* TDES3: */
+
+#define ETH_TXDES3_FL_SHIFT (0) /* Bits 0-14: Frame length */
+#define ETH_TXDES3_FL_MASK (0x7fff << ETH_TXDES3_FL_SHIFT)
+# define ETH_TXDES3_FL(n) ((uint32_t)(n) << ETH_TXDES3_FL_SHIFT)
+#define ETH_TXDES3_CIC_SHIFT (16) /* Bits 16-17: Checksum insertion control */
+#define ETH_TXDES3_CIC_MASK (3 << ETH_TXDES3_CIC_SHIFT)
+# define ETH_TXDES3_CIC_DISABLED (0 << ETH_TXDES3_CIC_SHIFT) /* Checksum insertion disabled */
+# define ETH_TXDES3_CIC_IPHDR (1 << ETH_TXDES3_CIC_SHIFT) /* Only IP header checksum */
+# define ETH_TXDES3_CIC_PAYLOAD (2 << ETH_TXDES3_CIC_SHIFT) /* IP header checksum and payload checksum */
+# define ETH_TXDES3_CIC_ALL (3 << ETH_TXDES3_CIC_SHIFT) /* IP Header checksum, payload, and pseudo-header checksum */
+#define ETH_TXDES3_SLOTNUM_SHIFT (19) /* Bits 19-22: Slot number control bits in AV mode */
+#define ETH_TXDES3_SLOTNUM_MASK (15 << ETH_TXDES3_SLOTNUM_SHIFT)
+#define ETH_TXDES3_CPC_SHIFT (26) /* Bits 26-27: CRC pad control */
+#define ETH_TXDES3_CPC_MASK (3 << ETH_TXDES2_B1L_SHIFT)
+# define ETH_TXDES3_CPC_CRCPAD (0 << ETH_TXDES2_B1L_SHIFT) /* CRC and pad insertion */
+# define ETH_TXDES3_CPC_CRC (1 << ETH_TXDES2_B1L_SHIFT) /* CRC insertion (disable pad insertion) */
+# define ETH_TXDES3_CPC_DISABLED (2 << ETH_TXDES2_B1L_SHIFT) /* Disable CRC insertion */
+# define ETH_TXDES3_CPC_REPLACMENT (3 << ETH_TXDES2_B1L_SHIFT) /* CRC replacement */
+#define ETH_TXDES3_LD (1 << 28) /* Bit 28: Last descriptor */
+#define ETH_TXDES3_FD (1 << 29) /* Bit 29: First descriptor */
+#define ETH_TXDES3_CTXT (1 << 30) /* Bit 30: Context type */
+#define ETH_TXDES3_OWN (1 << 31) /* Bit 31: Own bit */
+
+/* Transmit normal descriptor (writeback-format) */
+/* TDES0/1: 64-bit transmit packet timestamp */
+/* TDES2: Reserved */
+
+/* TDES3: */
+
+#define ETH_TXDES3_IHE (1 << 0) /* Bit 0: IP header error */
+#define ETH_TXDES3_DB (1 << 1) /* Bit 1: Deferred bit */
+#define ETH_TXDES3_UF (1 << 2) /* Bit 2: Underflow error */
+#define ETH_TXDES3_ED (1 << 3) /* Bit 3: Excessive deferral */
+#define ETH_TXDES3_CC_SHIFT (4) /* Bits 4-7: Collision count */
+#define ETH_TXDES3_EC (1 << 8) /* Bit 8: Excessive collision */
+#define ETH_TXDES3_LC (1 << 9) /* Bit 9: Late collision */
+#define ETH_TXDES3_NC (1 << 10) /* Bit 10: No carrier */
+#define ETH_TXDES3_LOC (1 << 11) /* Bit 11: Loss of carrier */
+#define ETH_TXDES3_PCE (1 << 12) /* Bit 12: Payload checksum error */
+#define ETH_TXDES3_FF (1 << 13) /* Bit 13: Packet flushed */
+#define ETH_TXDES3_JT (1 << 14) /* Bit 14: Jabber timeout */
+#define ETH_TXDES3_ES (1 << 15) /* Bit 15: Error summary */
+#define ETH_TXDES3_TTSS (1 << 17) /* Bit 17: Tx timestamp status */
+ /* Bit 28: (see read format) */
+ /* Bit 29: (see read format) */
+ /* Bit 30: (see read format) */
+ /* Bit 31: (see read format) */
+
+/************************************************************************************************************
+ * Public Types
+ ************************************************************************************************************/
+
+/* Receive descriptor structure (read format) */
+
+struct enet_rxdesc_s
+{
+ uint32_t buffer1; /* Buffer 1 address */
+ uint32_t reserved; /* Reserved */
+ uint32_t buffer2; /* Buffer 2 or next descriptor address */
+ uint32_t ctrl; /* Buffer 1/2 byte counts and control */
+};
+
+/* Transmit descriptor structure (read format) */
+
+struct enet_txdesc_s
+{
+ uint32_t buffer1; /* TDES0 Buffer 1 address */
+ uint32_t buffer2; /* TDES1 Buffer 2 address */
+ uint32_t buflen; /* TDES2 Buffer 1/2 byte counts */
+ uint32_t ctrlstat; /* TDES3 Control and status word */
+};
+
+#endif /* __ARCH_ARM_SRC_LPC54XX_CHIP_LPC54_ETHERNET_H */
diff --git a/arch/arm/src/lpc54xx/chip/lpc54_flexcomm.h b/arch/arm/src/lpc54xx/chip/lpc54_flexcomm.h
new file mode 100644
index 0000000000000000000000000000000000000000..e1c5badc150440483606c20ec9b519e3a3584cfa
--- /dev/null
+++ b/arch/arm/src/lpc54xx/chip/lpc54_flexcomm.h
@@ -0,0 +1,116 @@
+/************************************************************************************
+ * arch/arm/src/lpc54xx/chip/lpc54_flexcomm.h
+ *
+ * Copyright (C) 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.
+ *
+ ************************************************************************************/
+
+#ifndef __ARCH_ARM_SRC_LPC54XX_CHIP_LPC54_FLEXCOMM_H
+#define __ARCH_ARM_SRC_LPC54XX_CHIP_LPC54_FLEXCOMM_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include
+#include "chip/lpc54_memorymap.h"
+
+/************************************************************************************
+ * Pre-processor Definitions
+ ************************************************************************************/
+
+/* Register offsets *****************************************************************/
+
+#define LPC54_FLEXCOMM_PSELID_OFFSET 0x0ff8 /* Peripheral Select /Flexcomm Interface ID */
+#define LPC54_FLEXCOMM_PID_OFFSET 0x0ffc /* Peripheral identification register */
+
+/* Register addresses ***************************************************************/
+
+#define LPC54_FLEXCOMM0_PSELID (LPC54_FLEXCOMM0_BASE+LPC54_FLEXCOMM_PSELID_OFFSET)
+#define LPC54_FLEXCOMM0_PID (LPC54_FLEXCOMM0_BASE+LPC54_FLEXCOMM_PID_OFFSET)
+
+#define LPC54_FLEXCOMM1_PSELID (LPC54_FLEXCOMM1_BASE+LPC54_FLEXCOMM_PSELID_OFFSET)
+#define LPC54_FLEXCOMM1_PID (LPC54_FLEXCOMM1_BASE+LPC54_FLEXCOMM_PID_OFFSET)
+
+#define LPC54_FLEXCOMM2_PSELID (LPC54_FLEXCOMM2_BASE+LPC54_FLEXCOMM_PSELID_OFFSET)
+#define LPC54_FLEXCOMM2_PID (LPC54_FLEXCOMM2_BASE+LPC54_FLEXCOMM_PID_OFFSET)
+
+#define LPC54_FLEXCOMM3_PSELID (LPC54_FLEXCOMM3_BASE+LPC54_FLEXCOMM_PSELID_OFFSET)
+#define LPC54_FLEXCOMM3_PID (LPC54_FLEXCOMM3_BASE+LPC54_FLEXCOMM_PID_OFFSET)
+
+#define LPC54_FLEXCOMM4_PSELID (LPC54_FLEXCOMM4_BASE+LPC54_FLEXCOMM_PSELID_OFFSET)
+#define LPC54_FLEXCOMM4_PID (LPC54_FLEXCOMM4_BASE+LPC54_FLEXCOMM_PID_OFFSET)
+
+#define LPC54_FLEXCOMM5_PSELID (LPC54_FLEXCOMM5_BASE+LPC54_FLEXCOMM_PSELID_OFFSET)
+#define LPC54_FLEXCOMM5_PID (LPC54_FLEXCOMM5_BASE+LPC54_FLEXCOMM_PID_OFFSET)
+
+#define LPC54_FLEXCOMM6_PSELID (LPC54_FLEXCOMM6_BASE+LPC54_FLEXCOMM_PSELID_OFFSET)
+#define LPC54_FLEXCOMM6_PID (LPC54_FLEXCOMM6_BASE+LPC54_FLEXCOMM_PID_OFFSET)
+
+#define LPC54_FLEXCOMM7_PSELID (LPC54_FLEXCOMM7_BASE+LPC54_FLEXCOMM_PSELID_OFFSET)
+#define LPC54_FLEXCOMM7_PID (LPC54_FLEXCOMM7_BASE+LPC54_FLEXCOMM_PID_OFFSET)
+
+#define LPC54_FLEXCOMM8_PSELID (LPC54_FLEXCOMM8_BASE+LPC54_FLEXCOMM_PSELID_OFFSET)
+#define LPC54_FLEXCOMM8_PID (LPC54_FLEXCOMM8_BASE+LPC54_FLEXCOMM_PID_OFFSET)
+
+#define LPC54_FLEXCOMM9_PSELID (LPC54_FLEXCOMM9_BASE+LPC54_FLEXCOMM_PSELID_OFFSET)
+#define LPC54_FLEXCOMM9_PID (LPC54_FLEXCOMM9_BASE+LPC54_FLEXCOMM_PID_OFFSET)
+
+/* Register bit definitions *********************************************************/
+
+/* Peripheral Select /Flexcomm Interface ID */
+
+#define FLEXCOMM_PSELID_PERSEL_SHIFT (0) /* Bits 0-2: Peripheral Select */
+#define FLEXCOMM_PSELID_PERSEL_MASK (7 << FLEXCOMM_PSELID_PERSEL_SHIFT)
+# define FLEXCOMM_PSELID_PERSEL_NONE (0 << FLEXCOMM_PSELID_PERSEL_SHIFT) /* No peripheral selected */
+# define FLEXCOMM_PSELID_PERSEL_USART (1 << FLEXCOMM_PSELID_PERSEL_SHIFT) /* USART function selected */
+# define FLEXCOMM_PSELID_PERSEL_SPI (2 << FLEXCOMM_PSELID_PERSEL_SHIFT) /* SPI function selected */
+# define FLEXCOMM_PSELID_PERSEL_I2C (3 << FLEXCOMM_PSELID_PERSEL_SHIFT) /* I2C function selected */
+# define FLEXCOMM_PSELID_PERSEL_I2STX (4 << FLEXCOMM_PSELID_PERSEL_SHIFT) /* I2S transmit function */
+# define FLEXCOMM_PSELID_PERSEL_I2SRX (5 << FLEXCOMM_PSELID_PERSEL_SHIFT) /* I2S receive function */
+#define FLEXCOMM_PSELID_LOCK (1 << 3) /* Bit 3: Lock the peripheral select */
+#define FLEXCOMM_PSELID_USARTPRESENT (1 << 4) /* Bit 4: USART present indicator */
+#define FLEXCOMM_PSELID_SPIPRESENT (1 << 5) /* Bit 5: SPI present indicator */
+#define FLEXCOMM_PSELID_I2CPRESENT (1 << 6) /* Bit 6: I2C present indicator */
+#define FLEXCOMM_PSELID_I2SPRESENT (1 << 7) /* Bit 7: I2S present indicator */
+#define FLEXCOMM_PSELID_ID_SHIFT (12) /* Bits 12-31: Flexcomm Interface ID */
+#define FLEXCOMM_PSELID_ID_MASK (0xfffff << FLEXCOMM_PSELID_ID_SHIFT)
+
+/* Peripheral identification register */
+
+#define FLEXCOMM_PID_MINOR_SHIFT (8) /* Bits 8-11: Minor revision number */
+#define FLEXCOMM_PID_MINOR_MASK (15 << FLEXCOMM_PID_MINOR_SHIFT)
+#define FLEXCOMM_PID_MAJOR_SHIFT (12) /* Bits 12-15: Major revision number */
+#define FLEXCOMM_PID_MAJOR_MASK (15 << FLEXCOMM_PID_MAJOR_SHIFT)
+#define FLEXCOMM_PID_ID_SHIFT (16) /* Bits 15-31: Module ID for selected function */
+#define FLEXCOMM_PID_ID_MASK (0xffff << FLEXCOMM_PID_ID_SHIFT)
+
+#endif /* __ARCH_ARM_SRC_LPC54XX_CHIP_LPC54_FLEXCOMM_H */
diff --git a/arch/arm/src/lpc54xx/chip/lpc54_gint.h b/arch/arm/src/lpc54xx/chip/lpc54_gint.h
new file mode 100644
index 0000000000000000000000000000000000000000..f0eb80db55d9cfdf754dc73bee7152bcab788dcd
--- /dev/null
+++ b/arch/arm/src/lpc54xx/chip/lpc54_gint.h
@@ -0,0 +1,90 @@
+/****************************************************************************************************
+ * arch/arm/src/lpc54xx/lpc54_gint.h
+ *
+ * Copyright (C) 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.
+ *
+ ****************************************************************************************************/
+
+#ifndef __ARCH_ARM_SRC_LPC54XX_CHIP_LPC54_GINT_H
+#define __ARCH_ARM_SRC_LPC54XX_CHIP_LPC54_GINT_H
+
+/****************************************************************************************************
+ * Included Files
+ ****************************************************************************************************/
+
+#include
+#include "chip/lpc54_memorymap.h"
+
+/****************************************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************************************/
+
+/* Register offsets *********************************************************************************/
+
+#define LPC54_GINT_CTRL_OFFSET 0x0000 /* GPIO grouped interrupt control */
+#define LPC54_GINT_PORT_POL0_OFFSET 0x0020 /* GPIO grouped interrupt port 0 polarity */
+#define LPC54_GINT_PORT_POL0_OFFSET 0x0024 /* GPIO grouped interrupt port 1 polarity */
+#define LPC54_GINT_PORT_ENA0_OFFSET 0x0040 /* GPIO grouped interrupt port 0 enable */
+#define LPC54_GINT_PORT_ENA1_OFFSET 0x0044 /* GPIO grouped interrupt port 1 enable */
+
+/* Register addresses *******************************************************************************/
+
+#define LPC54_GINT0_CTRL (LPC54_GINT0_BASE + LPC54_GINT_CTRL_OFFSET)
+#define LPC54_GINT0_PORT_POL0 (LPC54_GINT0_BASE + LPC54_GINT_PORT_POL0_OFFSET)
+#define LPC54_GINT0_PORT_POL0 (LPC54_GINT0_BASE + LPC54_GINT_PORT_POL1_OFFSET)
+#define LPC54_GINT0_PORT_ENA0 (LPC54_GINT0_BASE + LPC54_GINT_PORT_ENA0_OFFSET)
+#define LPC54_GINT0_PORT_ENA1 (LPC54_GINT0_BASE + LPC54_GINT_PORT_ENA1_OFFSET)
+
+#define LPC54_GINT1_CTRL (LPC54_GINT0_BASE + LPC54_GINT_CTRL_OFFSET)
+#define LPC54_GINT1_PORT_POL0 (LPC54_GINT0_BASE + LPC54_GINT_PORT_POL0_OFFSET)
+#define LPC54_GINT1_PORT_POL0 (LPC54_GINT0_BASE + LPC54_GINT_PORT_POL1_OFFSET)
+#define LPC54_GINT1_PORT_ENA0 (LPC54_GINT0_BASE + LPC54_GINT_PORT_ENA0_OFFSET)
+#define LPC54_GINT1_PORT_ENA1 (LPC54_GINT0_BASE + LPC54_GINT_PORT_ENA1_OFFSET)
+
+/* Register bit definitions *************************************************************************/
+
+/* GPIO grouped interrupt control */
+
+#define GINT_CTRL_INT (1 << 0) /* Bit 0: Group interrupt status */
+#define GINT_CTRL_COMB (1 << 1) /* Bit 1: Combine enabled inputs for group interrupt 0 */
+#define GINT_CTRL_TRIG (1 << 2) /* Bit 2" Group interrupt trigger 0 */
+
+/* GPIO grouped interrupt port 0/1 polarity */
+
+#define GINT_PORT_POL0(n) (1 << (n)) /* Configure pin polarity of port0 pins for group interrupt */
+#define GINT_PORT_POL1(n) (1 << (n)) /* Configure pin polarity of port1 pins for group interrupt */
+
+/* GPIO grouped interrupt port 0/1 enable */
+
+#define GINT_PORT_ENA0(n) (1 << (n)) /* Enable port0 pin for group interrupt */
+#define GINT_PORT_ENA1(n) (1 << (n)) /* Enable port1 pin for group interrupt */
+
+#endif /* __ARCH_ARM_SRC_LPC54XX_CHIP_LPC54_GINT_H */
diff --git a/arch/arm/src/lpc54xx/chip/lpc54_gpio.h b/arch/arm/src/lpc54xx/chip/lpc54_gpio.h
new file mode 100644
index 0000000000000000000000000000000000000000..f9fbcc2a2bd5b883c8060ff0a2a1f6cc6ffc15f3
--- /dev/null
+++ b/arch/arm/src/lpc54xx/chip/lpc54_gpio.h
@@ -0,0 +1,108 @@
+/************************************************************************************
+ * arch/arm/src/lpc54xx/chip/lpc54_flexcomm.h
+ *
+ * Copyright (C) 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.
+ *
+ ************************************************************************************/
+
+#ifndef __ARCH_ARM_SRC_LPC54XX_CHIP_LPC54_GPIO_H
+#define __ARCH_ARM_SRC_LPC54XX_CHIP_LPC54_GPIO_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include
+#include
+#include "chip/lpc54_memorymap.h"
+
+/************************************************************************************
+ * Pre-processor Definitions
+ ************************************************************************************/
+
+#define LPC54_GPIO_PORT0 0
+#define LPC54_GPIO_PORT1 1
+#define LPC54_GPIO_PORT2 2
+#define LPC54_GPIO_PORT3 3
+#define LPC54_GPIO_PORT4 4
+#define LPC54_GPIO_PORT5 5
+#define LPC54_GPIO_NPORTS 6
+
+/* Register offsets *****************************************************************/
+/* Byte and word access to individual pins */
+
+#define LPC54_GPIO_B_OFFSET(p) (0x0000 + (p))
+#define LPC54_GPIO_W_OFFSET(p) (0x1000 + ((p) << 2))
+
+/* Word access to individual port regisers */
+
+#define LPC54_GPIO_PORT_OFFSET(n) ((n) << 2)
+#define LPC54_GPIO_DIR_OFFSET(n) (0x2000 + LPC54_GPIO_PORT_OFFSET(n))
+#define LPC54_GPIO_MASK_OFFSET(n) (0x2080 + LPC54_GPIO_PORT_OFFSET(n))
+#define LPC54_GPIO_PIN_OFFSET(n) (0x2100 + LPC54_GPIO_PORT_OFFSET(n))
+#define LPC54_GPIO_MPIN_OFFSET(n) (0x2180 + LPC54_GPIO_PORT_OFFSET(n))
+#define LPC54_GPIO_SET_OFFSET(n) (0x2200 + LPC54_GPIO_PORT_OFFSET(n))
+#define LPC54_GPIO_CLR_OFFSET(n) (0x2280 + LPC54_GPIO_PORT_OFFSET(n))
+#define LPC54_GPIO_NOT_OFFSET(n) (0x2300 + LPC54_GPIO_PORT_OFFSET(n))
+#define LPC54_GPIO_DIRSET_OFFSET(n) (0x2380 + LPC54_GPIO_PORT_OFFSET(n))
+#define LPC54_GPIO_DIRCLR_OFFSET(n) (0x2400 + LPC54_GPIO_PORT_OFFSET(n))
+#define LPC54_GPIO_DIRNOT_OFFSET(n) (0x2480 + LPC54_GPIO_PORT_OFFSET(n))
+
+/* Register addresses ***************************************************************/
+
+/* Byte and word access to individual pins */
+
+#define LPC54_GPIO_B(p) (LPC54_GPIO_BASE + LPC54_GPIO_B_OFFSET(p))
+#define LPC54_GPIO_W(p) (LPC54_GPIO_BASE + LPC54_GPIO_W_OFFSET(p))
+
+/* Word access to individual port regisers */
+
+#define LPC54_GPIO_PORT(n) (LPC54_GPIO_BASE + LPC54_GPIO_PORT_OFFSET(n))
+#define LPC54_GPIO_DIR(n) (LPC54_GPIO_BASE + LPC54_GPIO_DIR_OFFSET(n))
+#define LPC54_GPIO_MASK(n) (LPC54_GPIO_BASE + LPC54_GPIO_MASK_OFFSET(n))
+#define LPC54_GPIO_PIN(n) (LPC54_GPIO_BASE + LPC54_GPIO_PIN_OFFSET(n))
+#define LPC54_GPIO_MPIN(n) (LPC54_GPIO_BASE + LPC54_GPIO_MPIN_OFFSET(n))
+#define LPC54_GPIO_SET(n) (LPC54_GPIO_BASE + LPC54_GPIO_SET_OFFSET(n))
+#define LPC54_GPIO_CLR(n) (LPC54_GPIO_BASE + LPC54_GPIO_CLR_OFFSET(n))
+#define LPC54_GPIO_NOT(n) (LPC54_GPIO_BASE + LPC54_GPIO_NOT_OFFSET(n))
+#define LPC54_GPIO_DIRSET(n) (LPC54_GPIO_BASE + LPC54_GPIO_DIRSET_OFFSET(n))
+#define LPC54_GPIO_DIRCLR(n) (LPC54_GPIO_BASE + LPC54_GPIO_DIRCLR_OFFSET(n))
+#define LPC54_GPIO_DIRNOT(n) (LPC54_GPIO_BASE + LPC54_GPIO_DIRNOT_OFFSET(n))
+
+/* Register bit definitions *********************************************************/
+
+/* Port registers are all bit arrays with one bit corresponding each of the 32 pins
+ * of the port.
+ */
+
+#define GPIO_PORT_BIT(n) (1 << ((n) & 31))
+
+#endif /* __ARCH_ARM_SRC_LPC54XX_CHIP_LPC54_GPIO_H */
diff --git a/arch/arm/src/lpc54xx/chip/lpc54_i2c.h b/arch/arm/src/lpc54xx/chip/lpc54_i2c.h
new file mode 100644
index 0000000000000000000000000000000000000000..871f7959bc523d6840bf5d4b659eb49e03f25583
--- /dev/null
+++ b/arch/arm/src/lpc54xx/chip/lpc54_i2c.h
@@ -0,0 +1,418 @@
+/****************************************************************************************************
+ * arch/arm/src/lpc54xx/lpc54_i2c.h
+ *
+ * Copyright (C) 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.
+ *
+ ****************************************************************************************************/
+
+#ifndef __ARCH_ARM_SRC_LPC54XX_CHIP_LPC54_I2C_H
+#define __ARCH_ARM_SRC_LPC54XX_CHIP_LPC54_I2C_H
+
+/****************************************************************************************************
+ * Included Files
+ ****************************************************************************************************/
+
+#include
+#include "chip/lpc54_memorymap.h"
+
+/****************************************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************************************/
+
+/* Register offsets *********************************************************************************/
+
+/* Shared I2C registers */
+
+#define LPC54_I2C_CFG_OFFSET 0x0800 /* Configuration for shared functions */
+#define LPC54_I2C_STAT_OFFSET 0x0804 /* Status register for shared functions */
+#define LPC54_I2C_INTENSET_OFFSET 0x0808 /* Interrupt enable set and read */
+#define LPC54_I2C_INTENCLR_OFFSET 0x080c /* Interrupt enable clear */
+#define LPC54_I2C_TIMEOUT_OFFSET 0x0810 /* Time-out value */
+#define LPC54_I2C_CLKDIV_OFFSET 0x0814 /* Clock pre-divider for the entire I2C interface */
+#define LPC54_I2C_INTSTAT_OFFSET 0x0818 /* Interrupt status register for shared functions */
+
+/* Master function registers */
+
+#define LPC54_I2C_MSTCTL_OFFSET 0x0820 /* Master control */
+#define LPC54_I2C_MSTTIME_OFFSET 0x0824 /* Master timing configuration */
+#define LPC54_I2C_MSTDAT_OFFSET 0x0828 /* Combined Master receiver and transmitter data */
+
+/* Slave function registers */
+
+#define LPC54_I2C_SLVCTL_OFFSET 0x0840 /* Slave control */
+#define LPC54_I2C_SLVDAT_OFFSET 0x0844 /* Combined Slave receiver and transmitter data */
+#define LPC54_I2C_SLVADR0_OFFSET 0x0848 /* Slave address 0 */
+#define LPC54_I2C_SLVADR1_OFFSET 0x084c /* Slave address 1 */
+#define LPC54_I2C_SLVADR2_OFFSET 0x0850 /* Slave address 2 */
+#define LPC54_I2C_SLVADR3_OFFSET 0x0854 /* Slave address 3 */
+#define LPC54_I2C_SLVQUAL0_OFFSET 0x0858 /* Slave qualification for address 0 */
+
+/* Monitor function registers */
+
+#define LPC54_I2C_MONRXDAT_OFFSET 0x0880 /* Monitor receiver data */
+
+/* ID register */
+
+#define LPC54_I2C_ID_OFFSET 0x0ffc /* I2C module Identification */
+
+/* Register addresses *******************************************************************************/
+
+#define LPC54_I2C0_CFG (LPC54_FLEXCOMM0_BASE + LPC54_I2C_CFG_OFFSET)
+#define LPC54_I2C0_STAT (LPC54_FLEXCOMM0_BASE + LPC54_I2C_STAT_OFFSET)
+#define LPC54_I2C0_INTENSET (LPC54_FLEXCOMM0_BASE + LPC54_I2C_INTENSET_OFFSET)
+#define LPC54_I2C0_INTENCLR (LPC54_FLEXCOMM0_BASE + LPC54_I2C_INTENCLR_OFFSET)
+#define LPC54_I2C0_TIMEOUT (LPC54_FLEXCOMM0_BASE + LPC54_I2C_TIMEOUT_OFFSET)
+#define LPC54_I2C0_CLKDIV (LPC54_FLEXCOMM0_BASE + LPC54_I2C_CLKDIV_OFFSET)
+#define LPC54_I2C0_INTSTAT (LPC54_FLEXCOMM0_BASE + LPC54_I2C_INTSTAT_OFFSET)
+#define LPC54_I2C0_MSTCTL (LPC54_FLEXCOMM0_BASE + LPC54_I2C_MSTCTL_OFFSET)
+#define LPC54_I2C0_MSTTIME (LPC54_FLEXCOMM0_BASE + LPC54_I2C_MSTTIME_OFFSET)
+#define LPC54_I2C0_MSTDAT (LPC54_FLEXCOMM0_BASE + LPC54_I2C_MSTDAT_OFFSET)
+#define LPC54_I2C0_SLVCTL (LPC54_FLEXCOMM0_BASE + LPC54_I2C_SLVCTL_OFFSET)
+#define LPC54_I2C0_SLVDAT (LPC54_FLEXCOMM0_BASE + LPC54_I2C_SLVDAT_OFFSET)
+#define LPC54_I2C0_SLVADR0 (LPC54_FLEXCOMM0_BASE + LPC54_I2C_SLVADR0_OFFSET)
+#define LPC54_I2C0_SLVADR1 (LPC54_FLEXCOMM0_BASE + LPC54_I2C_SLVADR1_OFFSET)
+#define LPC54_I2C0_SLVADR2 (LPC54_FLEXCOMM0_BASE + LPC54_I2C_SLVADR2_OFFSET)
+#define LPC54_I2C0_SLVADR3 (LPC54_FLEXCOMM0_BASE + LPC54_I2C_SLVADR3_OFFSET)
+#define LPC54_I2C0_SLVQUAL0 (LPC54_FLEXCOMM0_BASE + LPC54_I2C_SLVQUAL0_OFFSET)
+#define LPC54_I2C0_MONRXDAT (LPC54_FLEXCOMM0_BASE + LPC54_I2C_MONRXDAT_OFFSET)
+#define LPC54_I2C0_ID (LPC54_FLEXCOMM0_BASE + LPC54_I2C_ID_OFFSET
+
+#define LPC54_I2C1_CFG (LPC54_FLEXCOMM1_BASE + LPC54_I2C_CFG_OFFSET)
+#define LPC54_I2C1_STAT (LPC54_FLEXCOMM1_BASE + LPC54_I2C_STAT_OFFSET)
+#define LPC54_I2C1_INTENSET (LPC54_FLEXCOMM1_BASE + LPC54_I2C_INTENSET_OFFSET)
+#define LPC54_I2C1_INTENCLR (LPC54_FLEXCOMM1_BASE + LPC54_I2C_INTENCLR_OFFSET)
+#define LPC54_I2C1_TIMEOUT (LPC54_FLEXCOMM1_BASE + LPC54_I2C_TIMEOUT_OFFSET)
+#define LPC54_I2C1_CLKDIV (LPC54_FLEXCOMM1_BASE + LPC54_I2C_CLKDIV_OFFSET)
+#define LPC54_I2C1_INTSTAT (LPC54_FLEXCOMM1_BASE + LPC54_I2C_INTSTAT_OFFSET)
+#define LPC54_I2C1_MSTCTL (LPC54_FLEXCOMM1_BASE + LPC54_I2C_MSTCTL_OFFSET)
+#define LPC54_I2C1_MSTTIME (LPC54_FLEXCOMM1_BASE + LPC54_I2C_MSTTIME_OFFSET)
+#define LPC54_I2C1_MSTDAT (LPC54_FLEXCOMM1_BASE + LPC54_I2C_MSTDAT_OFFSET)
+#define LPC54_I2C1_SLVCTL (LPC54_FLEXCOMM1_BASE + LPC54_I2C_SLVCTL_OFFSET)
+#define LPC54_I2C1_SLVDAT (LPC54_FLEXCOMM1_BASE + LPC54_I2C_SLVDAT_OFFSET)
+#define LPC54_I2C1_SLVADR0 (LPC54_FLEXCOMM1_BASE + LPC54_I2C_SLVADR0_OFFSET)
+#define LPC54_I2C1_SLVADR1 (LPC54_FLEXCOMM1_BASE + LPC54_I2C_SLVADR1_OFFSET)
+#define LPC54_I2C1_SLVADR2 (LPC54_FLEXCOMM1_BASE + LPC54_I2C_SLVADR2_OFFSET)
+#define LPC54_I2C1_SLVADR3 (LPC54_FLEXCOMM1_BASE + LPC54_I2C_SLVADR3_OFFSET)
+#define LPC54_I2C1_SLVQUAL0 (LPC54_FLEXCOMM1_BASE + LPC54_I2C_SLVQUAL0_OFFSET)
+#define LPC54_I2C1_MONRXDAT (LPC54_FLEXCOMM1_BASE + LPC54_I2C_MONRXDAT_OFFSET)
+#define LPC54_I2C1_ID (LPC54_FLEXCOMM1_BASE + LPC54_I2C_ID_OFFSET
+
+#define LPC54_I2C2_CFG (LPC54_FLEXCOMM2_BASE + LPC54_I2C_CFG_OFFSET)
+#define LPC54_I2C2_STAT (LPC54_FLEXCOMM2_BASE + LPC54_I2C_STAT_OFFSET)
+#define LPC54_I2C2_INTENSET (LPC54_FLEXCOMM2_BASE + LPC54_I2C_INTENSET_OFFSET)
+#define LPC54_I2C2_INTENCLR (LPC54_FLEXCOMM2_BASE + LPC54_I2C_INTENCLR_OFFSET)
+#define LPC54_I2C2_TIMEOUT (LPC54_FLEXCOMM2_BASE + LPC54_I2C_TIMEOUT_OFFSET)
+#define LPC54_I2C2_CLKDIV (LPC54_FLEXCOMM2_BASE + LPC54_I2C_CLKDIV_OFFSET)
+#define LPC54_I2C2_INTSTAT (LPC54_FLEXCOMM2_BASE + LPC54_I2C_INTSTAT_OFFSET)
+#define LPC54_I2C2_MSTCTL (LPC54_FLEXCOMM2_BASE + LPC54_I2C_MSTCTL_OFFSET)
+#define LPC54_I2C2_MSTTIME (LPC54_FLEXCOMM2_BASE + LPC54_I2C_MSTTIME_OFFSET)
+#define LPC54_I2C2_MSTDAT (LPC54_FLEXCOMM2_BASE + LPC54_I2C_MSTDAT_OFFSET)
+#define LPC54_I2C2_SLVCTL (LPC54_FLEXCOMM2_BASE + LPC54_I2C_SLVCTL_OFFSET)
+#define LPC54_I2C2_SLVDAT (LPC54_FLEXCOMM2_BASE + LPC54_I2C_SLVDAT_OFFSET)
+#define LPC54_I2C2_SLVADR0 (LPC54_FLEXCOMM2_BASE + LPC54_I2C_SLVADR0_OFFSET)
+#define LPC54_I2C2_SLVADR1 (LPC54_FLEXCOMM2_BASE + LPC54_I2C_SLVADR1_OFFSET)
+#define LPC54_I2C2_SLVADR2 (LPC54_FLEXCOMM2_BASE + LPC54_I2C_SLVADR2_OFFSET)
+#define LPC54_I2C2_SLVADR3 (LPC54_FLEXCOMM2_BASE + LPC54_I2C_SLVADR3_OFFSET)
+#define LPC54_I2C2_SLVQUAL0 (LPC54_FLEXCOMM2_BASE + LPC54_I2C_SLVQUAL0_OFFSET)
+#define LPC54_I2C2_MONRXDAT (LPC54_FLEXCOMM2_BASE + LPC54_I2C_MONRXDAT_OFFSET)
+#define LPC54_I2C2_ID (LPC54_FLEXCOMM2_BASE + LPC54_I2C_ID_OFFSET
+
+#define LPC54_I2C3_CFG (LPC54_FLEXCOMM3_BASE + LPC54_I2C_CFG_OFFSET)
+#define LPC54_I2C3_STAT (LPC54_FLEXCOMM3_BASE + LPC54_I2C_STAT_OFFSET)
+#define LPC54_I2C3_INTENSET (LPC54_FLEXCOMM3_BASE + LPC54_I2C_INTENSET_OFFSET)
+#define LPC54_I2C3_INTENCLR (LPC54_FLEXCOMM3_BASE + LPC54_I2C_INTENCLR_OFFSET)
+#define LPC54_I2C3_TIMEOUT (LPC54_FLEXCOMM3_BASE + LPC54_I2C_TIMEOUT_OFFSET)
+#define LPC54_I2C3_CLKDIV (LPC54_FLEXCOMM3_BASE + LPC54_I2C_CLKDIV_OFFSET)
+#define LPC54_I2C3_INTSTAT (LPC54_FLEXCOMM3_BASE + LPC54_I2C_INTSTAT_OFFSET)
+#define LPC54_I2C3_MSTCTL (LPC54_FLEXCOMM3_BASE + LPC54_I2C_MSTCTL_OFFSET)
+#define LPC54_I2C3_MSTTIME (LPC54_FLEXCOMM3_BASE + LPC54_I2C_MSTTIME_OFFSET)
+#define LPC54_I2C3_MSTDAT (LPC54_FLEXCOMM3_BASE + LPC54_I2C_MSTDAT_OFFSET)
+#define LPC54_I2C3_SLVCTL (LPC54_FLEXCOMM3_BASE + LPC54_I2C_SLVCTL_OFFSET)
+#define LPC54_I2C3_SLVDAT (LPC54_FLEXCOMM3_BASE + LPC54_I2C_SLVDAT_OFFSET)
+#define LPC54_I2C3_SLVADR0 (LPC54_FLEXCOMM3_BASE + LPC54_I2C_SLVADR0_OFFSET)
+#define LPC54_I2C3_SLVADR1 (LPC54_FLEXCOMM3_BASE + LPC54_I2C_SLVADR1_OFFSET)
+#define LPC54_I2C3_SLVADR2 (LPC54_FLEXCOMM3_BASE + LPC54_I2C_SLVADR2_OFFSET)
+#define LPC54_I2C3_SLVADR3 (LPC54_FLEXCOMM3_BASE + LPC54_I2C_SLVADR3_OFFSET)
+#define LPC54_I2C3_SLVQUAL0 (LPC54_FLEXCOMM3_BASE + LPC54_I2C_SLVQUAL0_OFFSET)
+#define LPC54_I2C3_MONRXDAT (LPC54_FLEXCOMM3_BASE + LPC54_I2C_MONRXDAT_OFFSET)
+#define LPC54_I2C3_ID (LPC54_FLEXCOMM3_BASE + LPC54_I2C_ID_OFFSET
+
+#define LPC54_I2C4_CFG (LPC54_FLEXCOMM4_BASE + LPC54_I2C_CFG_OFFSET)
+#define LPC54_I2C4_STAT (LPC54_FLEXCOMM4_BASE + LPC54_I2C_STAT_OFFSET)
+#define LPC54_I2C4_INTENSET (LPC54_FLEXCOMM4_BASE + LPC54_I2C_INTENSET_OFFSET)
+#define LPC54_I2C4_INTENCLR (LPC54_FLEXCOMM4_BASE + LPC54_I2C_INTENCLR_OFFSET)
+#define LPC54_I2C4_TIMEOUT (LPC54_FLEXCOMM4_BASE + LPC54_I2C_TIMEOUT_OFFSET)
+#define LPC54_I2C4_CLKDIV (LPC54_FLEXCOMM4_BASE + LPC54_I2C_CLKDIV_OFFSET)
+#define LPC54_I2C4_INTSTAT (LPC54_FLEXCOMM4_BASE + LPC54_I2C_INTSTAT_OFFSET)
+#define LPC54_I2C4_MSTCTL (LPC54_FLEXCOMM4_BASE + LPC54_I2C_MSTCTL_OFFSET)
+#define LPC54_I2C4_MSTTIME (LPC54_FLEXCOMM4_BASE + LPC54_I2C_MSTTIME_OFFSET)
+#define LPC54_I2C4_MSTDAT (LPC54_FLEXCOMM4_BASE + LPC54_I2C_MSTDAT_OFFSET)
+#define LPC54_I2C4_SLVCTL (LPC54_FLEXCOMM4_BASE + LPC54_I2C_SLVCTL_OFFSET)
+#define LPC54_I2C4_SLVDAT (LPC54_FLEXCOMM4_BASE + LPC54_I2C_SLVDAT_OFFSET)
+#define LPC54_I2C4_SLVADR0 (LPC54_FLEXCOMM4_BASE + LPC54_I2C_SLVADR0_OFFSET)
+#define LPC54_I2C4_SLVADR1 (LPC54_FLEXCOMM4_BASE + LPC54_I2C_SLVADR1_OFFSET)
+#define LPC54_I2C4_SLVADR2 (LPC54_FLEXCOMM4_BASE + LPC54_I2C_SLVADR2_OFFSET)
+#define LPC54_I2C4_SLVADR3 (LPC54_FLEXCOMM4_BASE + LPC54_I2C_SLVADR3_OFFSET)
+#define LPC54_I2C4_SLVQUAL0 (LPC54_FLEXCOMM4_BASE + LPC54_I2C_SLVQUAL0_OFFSET)
+#define LPC54_I2C4_MONRXDAT (LPC54_FLEXCOMM4_BASE + LPC54_I2C_MONRXDAT_OFFSET)
+#define LPC54_I2C4_ID (LPC54_FLEXCOMM4_BASE + LPC54_I2C_ID_OFFSET
+
+#define LPC54_I2C5_CFG (LPC54_FLEXCOMM5_BASE + LPC54_I2C_CFG_OFFSET)
+#define LPC54_I2C5_STAT (LPC54_FLEXCOMM5_BASE + LPC54_I2C_STAT_OFFSET)
+#define LPC54_I2C5_INTENSET (LPC54_FLEXCOMM5_BASE + LPC54_I2C_INTENSET_OFFSET)
+#define LPC54_I2C5_INTENCLR (LPC54_FLEXCOMM5_BASE + LPC54_I2C_INTENCLR_OFFSET)
+#define LPC54_I2C5_TIMEOUT (LPC54_FLEXCOMM5_BASE + LPC54_I2C_TIMEOUT_OFFSET)
+#define LPC54_I2C5_CLKDIV (LPC54_FLEXCOMM5_BASE + LPC54_I2C_CLKDIV_OFFSET)
+#define LPC54_I2C5_INTSTAT (LPC54_FLEXCOMM5_BASE + LPC54_I2C_INTSTAT_OFFSET)
+#define LPC54_I2C5_MSTCTL (LPC54_FLEXCOMM5_BASE + LPC54_I2C_MSTCTL_OFFSET)
+#define LPC54_I2C5_MSTTIME (LPC54_FLEXCOMM5_BASE + LPC54_I2C_MSTTIME_OFFSET)
+#define LPC54_I2C5_MSTDAT (LPC54_FLEXCOMM5_BASE + LPC54_I2C_MSTDAT_OFFSET)
+#define LPC54_I2C5_SLVCTL (LPC54_FLEXCOMM5_BASE + LPC54_I2C_SLVCTL_OFFSET)
+#define LPC54_I2C5_SLVDAT (LPC54_FLEXCOMM5_BASE + LPC54_I2C_SLVDAT_OFFSET)
+#define LPC54_I2C5_SLVADR0 (LPC54_FLEXCOMM5_BASE + LPC54_I2C_SLVADR0_OFFSET)
+#define LPC54_I2C5_SLVADR1 (LPC54_FLEXCOMM5_BASE + LPC54_I2C_SLVADR1_OFFSET)
+#define LPC54_I2C5_SLVADR2 (LPC54_FLEXCOMM5_BASE + LPC54_I2C_SLVADR2_OFFSET)
+#define LPC54_I2C5_SLVADR3 (LPC54_FLEXCOMM5_BASE + LPC54_I2C_SLVADR3_OFFSET)
+#define LPC54_I2C5_SLVQUAL0 (LPC54_FLEXCOMM5_BASE + LPC54_I2C_SLVQUAL0_OFFSET)
+#define LPC54_I2C5_MONRXDAT (LPC54_FLEXCOMM5_BASE + LPC54_I2C_MONRXDAT_OFFSET)
+#define LPC54_I2C5_ID (LPC54_FLEXCOMM5_BASE + LPC54_I2C_ID_OFFSET
+
+#define LPC54_I2C6_CFG (LPC54_FLEXCOMM6_BASE + LPC54_I2C_CFG_OFFSET)
+#define LPC54_I2C6_STAT (LPC54_FLEXCOMM6_BASE + LPC54_I2C_STAT_OFFSET)
+#define LPC54_I2C6_INTENSET (LPC54_FLEXCOMM6_BASE + LPC54_I2C_INTENSET_OFFSET)
+#define LPC54_I2C6_INTENCLR (LPC54_FLEXCOMM6_BASE + LPC54_I2C_INTENCLR_OFFSET)
+#define LPC54_I2C6_TIMEOUT (LPC54_FLEXCOMM6_BASE + LPC54_I2C_TIMEOUT_OFFSET)
+#define LPC54_I2C6_CLKDIV (LPC54_FLEXCOMM6_BASE + LPC54_I2C_CLKDIV_OFFSET)
+#define LPC54_I2C6_INTSTAT (LPC54_FLEXCOMM6_BASE + LPC54_I2C_INTSTAT_OFFSET)
+#define LPC54_I2C6_MSTCTL (LPC54_FLEXCOMM6_BASE + LPC54_I2C_MSTCTL_OFFSET)
+#define LPC54_I2C6_MSTTIME (LPC54_FLEXCOMM6_BASE + LPC54_I2C_MSTTIME_OFFSET)
+#define LPC54_I2C6_MSTDAT (LPC54_FLEXCOMM6_BASE + LPC54_I2C_MSTDAT_OFFSET)
+#define LPC54_I2C6_SLVCTL (LPC54_FLEXCOMM6_BASE + LPC54_I2C_SLVCTL_OFFSET)
+#define LPC54_I2C6_SLVDAT (LPC54_FLEXCOMM6_BASE + LPC54_I2C_SLVDAT_OFFSET)
+#define LPC54_I2C6_SLVADR0 (LPC54_FLEXCOMM6_BASE + LPC54_I2C_SLVADR0_OFFSET)
+#define LPC54_I2C6_SLVADR1 (LPC54_FLEXCOMM6_BASE + LPC54_I2C_SLVADR1_OFFSET)
+#define LPC54_I2C6_SLVADR2 (LPC54_FLEXCOMM6_BASE + LPC54_I2C_SLVADR2_OFFSET)
+#define LPC54_I2C6_SLVADR3 (LPC54_FLEXCOMM6_BASE + LPC54_I2C_SLVADR3_OFFSET)
+#define LPC54_I2C6_SLVQUAL0 (LPC54_FLEXCOMM6_BASE + LPC54_I2C_SLVQUAL0_OFFSET)
+#define LPC54_I2C6_MONRXDAT (LPC54_FLEXCOMM6_BASE + LPC54_I2C_MONRXDAT_OFFSET)
+#define LPC54_I2C6_ID (LPC54_FLEXCOMM6_BASE + LPC54_I2C_ID_OFFSET
+
+#define LPC54_I2C7_CFG (LPC54_FLEXCOMM7_BASE + LPC54_I2C_CFG_OFFSET)
+#define LPC54_I2C7_STAT (LPC54_FLEXCOMM7_BASE + LPC54_I2C_STAT_OFFSET)
+#define LPC54_I2C7_INTENSET (LPC54_FLEXCOMM7_BASE + LPC54_I2C_INTENSET_OFFSET)
+#define LPC54_I2C7_INTENCLR (LPC54_FLEXCOMM7_BASE + LPC54_I2C_INTENCLR_OFFSET)
+#define LPC54_I2C7_TIMEOUT (LPC54_FLEXCOMM7_BASE + LPC54_I2C_TIMEOUT_OFFSET)
+#define LPC54_I2C7_CLKDIV (LPC54_FLEXCOMM7_BASE + LPC54_I2C_CLKDIV_OFFSET)
+#define LPC54_I2C7_INTSTAT (LPC54_FLEXCOMM7_BASE + LPC54_I2C_INTSTAT_OFFSET)
+#define LPC54_I2C7_MSTCTL (LPC54_FLEXCOMM7_BASE + LPC54_I2C_MSTCTL_OFFSET)
+#define LPC54_I2C7_MSTTIME (LPC54_FLEXCOMM7_BASE + LPC54_I2C_MSTTIME_OFFSET)
+#define LPC54_I2C7_MSTDAT (LPC54_FLEXCOMM7_BASE + LPC54_I2C_MSTDAT_OFFSET)
+#define LPC54_I2C7_SLVCTL (LPC54_FLEXCOMM7_BASE + LPC54_I2C_SLVCTL_OFFSET)
+#define LPC54_I2C7_SLVDAT (LPC54_FLEXCOMM7_BASE + LPC54_I2C_SLVDAT_OFFSET)
+#define LPC54_I2C7_SLVADR0 (LPC54_FLEXCOMM7_BASE + LPC54_I2C_SLVADR0_OFFSET)
+#define LPC54_I2C7_SLVADR1 (LPC54_FLEXCOMM7_BASE + LPC54_I2C_SLVADR1_OFFSET)
+#define LPC54_I2C7_SLVADR2 (LPC54_FLEXCOMM7_BASE + LPC54_I2C_SLVADR2_OFFSET)
+#define LPC54_I2C7_SLVADR3 (LPC54_FLEXCOMM7_BASE + LPC54_I2C_SLVADR3_OFFSET)
+#define LPC54_I2C7_SLVQUAL0 (LPC54_FLEXCOMM7_BASE + LPC54_I2C_SLVQUAL0_OFFSET)
+#define LPC54_I2C7_MONRXDAT (LPC54_FLEXCOMM7_BASE + LPC54_I2C_MONRXDAT_OFFSET)
+#define LPC54_I2C7_ID (LPC54_FLEXCOMM7_BASE + LPC54_I2C_ID_OFFSET
+
+#define LPC54_I2C8_CFG (LPC54_FLEXCOMM8_BASE + LPC54_I2C_CFG_OFFSET)
+#define LPC54_I2C8_STAT (LPC54_FLEXCOMM8_BASE + LPC54_I2C_STAT_OFFSET)
+#define LPC54_I2C8_INTENSET (LPC54_FLEXCOMM8_BASE + LPC54_I2C_INTENSET_OFFSET)
+#define LPC54_I2C8_INTENCLR (LPC54_FLEXCOMM8_BASE + LPC54_I2C_INTENCLR_OFFSET)
+#define LPC54_I2C8_TIMEOUT (LPC54_FLEXCOMM8_BASE + LPC54_I2C_TIMEOUT_OFFSET)
+#define LPC54_I2C8_CLKDIV (LPC54_FLEXCOMM8_BASE + LPC54_I2C_CLKDIV_OFFSET)
+#define LPC54_I2C8_INTSTAT (LPC54_FLEXCOMM8_BASE + LPC54_I2C_INTSTAT_OFFSET)
+#define LPC54_I2C8_MSTCTL (LPC54_FLEXCOMM8_BASE + LPC54_I2C_MSTCTL_OFFSET)
+#define LPC54_I2C8_MSTTIME (LPC54_FLEXCOMM8_BASE + LPC54_I2C_MSTTIME_OFFSET)
+#define LPC54_I2C8_MSTDAT (LPC54_FLEXCOMM8_BASE + LPC54_I2C_MSTDAT_OFFSET)
+#define LPC54_I2C8_SLVCTL (LPC54_FLEXCOMM8_BASE + LPC54_I2C_SLVCTL_OFFSET)
+#define LPC54_I2C8_SLVDAT (LPC54_FLEXCOMM8_BASE + LPC54_I2C_SLVDAT_OFFSET)
+#define LPC54_I2C8_SLVADR0 (LPC54_FLEXCOMM8_BASE + LPC54_I2C_SLVADR0_OFFSET)
+#define LPC54_I2C8_SLVADR1 (LPC54_FLEXCOMM8_BASE + LPC54_I2C_SLVADR1_OFFSET)
+#define LPC54_I2C8_SLVADR2 (LPC54_FLEXCOMM8_BASE + LPC54_I2C_SLVADR2_OFFSET)
+#define LPC54_I2C8_SLVADR3 (LPC54_FLEXCOMM8_BASE + LPC54_I2C_SLVADR3_OFFSET)
+#define LPC54_I2C8_SLVQUAL0 (LPC54_FLEXCOMM8_BASE + LPC54_I2C_SLVQUAL0_OFFSET)
+#define LPC54_I2C8_MONRXDAT (LPC54_FLEXCOMM8_BASE + LPC54_I2C_MONRXDAT_OFFSET)
+#define LPC54_I2C8_ID (LPC54_FLEXCOMM8_BASE + LPC54_I2C_ID_OFFSET
+
+#define LPC54_I2C9_CFG (LPC54_FLEXCOMM9_BASE + LPC54_I2C_CFG_OFFSET)
+#define LPC54_I2C9_STAT (LPC54_FLEXCOMM9_BASE + LPC54_I2C_STAT_OFFSET)
+#define LPC54_I2C9_INTENSET (LPC54_FLEXCOMM9_BASE + LPC54_I2C_INTENSET_OFFSET)
+#define LPC54_I2C9_INTENCLR (LPC54_FLEXCOMM9_BASE + LPC54_I2C_INTENCLR_OFFSET)
+#define LPC54_I2C9_TIMEOUT (LPC54_FLEXCOMM9_BASE + LPC54_I2C_TIMEOUT_OFFSET)
+#define LPC54_I2C9_CLKDIV (LPC54_FLEXCOMM9_BASE + LPC54_I2C_CLKDIV_OFFSET)
+#define LPC54_I2C9_INTSTAT (LPC54_FLEXCOMM9_BASE + LPC54_I2C_INTSTAT_OFFSET)
+#define LPC54_I2C9_MSTCTL (LPC54_FLEXCOMM9_BASE + LPC54_I2C_MSTCTL_OFFSET)
+#define LPC54_I2C9_MSTTIME (LPC54_FLEXCOMM9_BASE + LPC54_I2C_MSTTIME_OFFSET)
+#define LPC54_I2C9_MSTDAT (LPC54_FLEXCOMM9_BASE + LPC54_I2C_MSTDAT_OFFSET)
+#define LPC54_I2C9_SLVCTL (LPC54_FLEXCOMM9_BASE + LPC54_I2C_SLVCTL_OFFSET)
+#define LPC54_I2C9_SLVDAT (LPC54_FLEXCOMM9_BASE + LPC54_I2C_SLVDAT_OFFSET)
+#define LPC54_I2C9_SLVADR0 (LPC54_FLEXCOMM9_BASE + LPC54_I2C_SLVADR0_OFFSET)
+#define LPC54_I2C9_SLVADR1 (LPC54_FLEXCOMM9_BASE + LPC54_I2C_SLVADR1_OFFSET)
+#define LPC54_I2C9_SLVADR2 (LPC54_FLEXCOMM9_BASE + LPC54_I2C_SLVADR2_OFFSET)
+#define LPC54_I2C9_SLVADR3 (LPC54_FLEXCOMM9_BASE + LPC54_I2C_SLVADR3_OFFSET)
+#define LPC54_I2C9_SLVQUAL0 (LPC54_FLEXCOMM9_BASE + LPC54_I2C_SLVQUAL0_OFFSET)
+#define LPC54_I2C9_MONRXDAT (LPC54_FLEXCOMM9_BASE + LPC54_I2C_MONRXDAT_OFFSET)
+#define LPC54_I2C9_ID (LPC54_FLEXCOMM9_BASE + LPC54_I2C_ID_OFFSET
+
+/* Register bit definitions *************************************************************************/
+
+/* Configuration for shared functions */
+
+#define I2C_CFG_MSTEN (1 << 0) /* Bit 0: Master enable */
+#define I2C_CFG_SLVEN (1 << 1) /* Bit 1: Slave enable */
+#define I2C_CFG_MONEN (1 << 2) /* Bit 2: Monitor enable */
+#define I2C_CFG_TIMEOUTEN (1 << 3) /* Bit 3: I2C bus time-out enable */
+#define I2C_CFG_MONCLKSTR (1 << 4) /* Bit 4: Monitor function clock stretching */
+#define I2C_CFG_HSCAPABLE (1 << 5) /* Bit 5: High-speed mode capable enable */
+
+#define I2C_CFG_ALLENABLES 0x1f
+
+/* Status, set and write, and clear register for shared functions */
+/* Master function state codes (MSTSTATE) */
+
+#define I2C_MASTER_STATE_IDLE (0) /* Idle */
+#define I2C_MASTER_STATE_RXAVAIL (1) /* Received data is available (Master Receiver mode) */
+#define I2C_MASTER_STATE_TXOK (2) /* Data can be transmitted (Master Transmitter mode) */
+#define I2C_MASTER_STATE_ADDRNAK (3) /* Slave NACKed address */
+#define I2C_MASTER_STATE_DATANAK (4) /* Slave NACKed transmitted data */
+
+/* Slave function state codes (SLVSTATE) */
+
+#define I2C_SLAVE_STATE_ADDR (0) /* Address plus R/W received */
+#define I2C_SLAVE_STATE_RXAVAIL (1) /* Received data is available (Slave Receiver mode) */
+#define I2C_SLAVE_STATE_TXOK (2) /* Data can be transmitted (Slave Transmitter mode) */
+
+/* Interrupt status, set and read, and clear registers */
+
+#define I2C_INT_MSTPENDING (1 << 0) /* Bit 0 Master Pending interrupt */
+#define I2C_STAT_MSTSTATE_SHIFT (1) /* Bits 1-3: Master State code (status only) */
+#define I2C_STAT_MSTSTATE_MASK (7 << I2C_STAT_MSTSTATE_SHIFT)
+# define I2C_STAT_MSTSTATE_IDLE (0 << I2C_STAT_MSTSTATE_SHIFT) /* Idle */
+# define I2C_STAT_MSTSTATE_RXAVAIL (1 << I2C_STAT_MSTSTATE_SHIFT) /* Receive ready */
+# define I2C_STAT_MSTSTATE_TXOK (2 << I2C_STAT_MSTSTATE_SHIFT) /* Transmit ready */
+# define I2C_STAT_MSTSTATE_ADDRNAK (3 << I2C_STAT_MSTSTATE_SHIFT) /* NACK Address */
+# define I2C_STAT_MSTSTATE_DATANAK (4 << I2C_STAT_MSTSTATE_SHIFT) /* NACK Data */
+#define I2C_INT_MSTARBLOSS (1 << 4) /* Bit 4: Master Arbitration Loss interrupt */
+#define I2C_INT_MSTSTSTPERR (1 << 6) /* Bit 6: Master Start/Stop Error interrupt */
+#define I2C_INT_SLVPENDING (1 << 8) /* Bit 8: Slave Pending interrupt */
+#define I2C_STAT_SLVSTATE_SHIFT (9) /* Bits 9-10: Slave State code (status only) */
+#define I2C_STAT_SLVSTATE_MASK (3 << I2C_STAT_SLVSTATE_SHIFT)
+# define I2C_STAT_SLVSTATE_ADDR (0 << I2C_STAT_SLVSTATE_SHIFT) /* Slave address */
+# define I2C_STAT_SLVSTATE_RXAVAIL (1 << I2C_STAT_SLVSTATE_SHIFT) /* Slave receive */
+# define I2C_STAT_SLVSTATE_TXOK (2 << I2C_STAT_SLVSTATE_SHIFT) /* Slave transmit */
+#define I2C_INT_SLVNOTSTR (1 << 11) /* Bit 11: Slave Not Stretching interrupt */
+#define I2C_STAT_SLVIDX_SHIFT (12) /* Bits 12-13: Slave address match Index (status only) */
+#define I2C_STAT_SLVIDX_MASK (3 << I2C_STAT_SLVIDX_SHIFT)
+# define I2C_STAT_SLVIDX_ADDR0 (0 << I2C_STAT_SLVIDX_SHIFT) /* Slave address 0 was matched */
+# define I2C_STAT_SLVIDX_ADDR1 (1 << I2C_STAT_SLVIDX_SHIFT) /* Slave address 1 was matched */
+# define I2C_STAT_SLVIDX_ADDR2 (2 << I2C_STAT_SLVIDX_SHIFT) /* Slave address 2 was matched */
+# define I2C_STAT_SLVIDX_ADDR3 (3 << I2C_STAT_SLVIDX_SHIFT) /* Slave address 3 was matched */
+#define I2C_STAT_SLVSEL (1 << 14) /* Bit 14: Slave selected flag (Slave only) */
+#define I2C_INT_SLVDESEL (1 << 15) /* Bit 15: Slave Deselect interrupt */
+#define I2C_INT_MONRDY (1 << 16) /* Bit 16: Monitor data Ready interrupt */
+#define I2C_INT_MONOV (1 << 17) /* Bit 17: Monitor Overrun interrupt */
+#define I2C_STAT_MONACTIVE (1 << 18) /* Bit 18: Monitor Active flag (status only) */
+#define I2C_INT_MONIDLE (1 << 19) /* Bit 19: Monitor Idle interrupt */
+#define I2C_INT_EVENTTIMEOUT (1 << 24) /* Bit 24: Event time-out interrupt */
+#define I2C_INT_SCLTIMEOUT (1 << 25) /* Bit 25: SCL time-out interrupt */
+
+#define I2C_INT_MSTPENDING (1 << 0) /* Bit 0 Master Pending interrupt */
+#define I2C_INT_MSTARBLOSS (1 << 4) /* Bit 4: Master Arbitration Loss interrupt */
+#define I2C_INT_MSTSTSTPERR (1 << 6) /* Bit 6: Master Start/Stop Error interrupt */
+#define I2C_INT_SLVPENDING (1 << 8) /* Bit 8: Slave Pending interrupt */
+#define I2C_INT_SLVNOTSTR (1 << 11) /* Bit 11: Slave Not Stretching interrupt */
+#define I2C_INT_SLVDESEL (1 << 15) /* Bit 15: Slave Deselect interrupt */
+#define I2C_INT_MONRDY (1 << 16) /* Bit 16: Monitor data Ready interrupt */
+#define I2C_INT_MONOV (1 << 17) /* Bit 17: Monitor Overrun interrupt */
+#define I2C_INT_MONIDLE (1 << 19) /* Bit 19: Monitor Idle interrupt */
+#define I2C_INT_EVENTTIMEOUT (1 << 24) /* Bit 24: Event time-out interrupt */
+#define I2C_INT_SCLTIMEOUT (1 << 25) /* Bit 25: SCL time-out interrupt */
+
+#define I2C_INT_ALL 0x030b8951
+
+/* Time-out value */
+
+#define I2C_TIMEOUT_SHIFT (0) /* Bits 0-15: Time out value
+ * Bits 0-3 hardwired to 0xff */
+#define I2C_TIMEOUT_MASK (0xffff << I2C_TIMEOUT_SHIFT)
+# define I2C_TIMEOUT(n) ((uint32_t)((n)-1) << I2C_TIMEOUT_SHIFT)
+
+/* Clock pre-divider for the entire I2C interface */
+
+#define I2C_CLKDIV_SHIFT (0) /* Bits 0-15: I2C clock divider */
+#define I2C_CLKDIV_MASK (0xffff << I2C_CLKDIV_SHIFT)
+# define I2C_CLKDIV(n) ((uint32_t)((n)-1) << I2C_CLKDIV_SHIFT)
+
+/* Master control */
+
+#define I2C_MSTCTL_MSTCONTINUE (1 << 0) /* Bit 0: Master Continue */
+#define I2C_MSTCTL_MSTSTART (1 << 1) /* Bit 1: Master Start control */
+#define I2C_MSTCTL_MSTSTOP (1 << 2) /* Bit 2: Master Stop control */
+#define I2C_MSTCTL_MSTDMA (1 << 3) /* Bit 3: Master DMA enable */
+
+/* Master timing configuration */
+
+#define I2C_MSTTIME_SCLLOW_SHIFT (0) /* Bits 0-2 Master SCL Low time */
+#define I2C_MSTTIME_SCLLOW_MASK (7 << I2C_MSTTIME_SCLLOW_SHIFT)
+# define I2C_MSTTIME_SCLLOW(n) ((uint32_t)((n)-2) << I2C_MSTTIME_SCLLOW_SHIFT)
+#define I2C_MSTTIME_SCLHIGH_SHIFT (4) /* Bits 4-6 Master SCL High time */
+#define I2C_MSTTIME_SCLHIGH_MASK (7 << I2C_MSTTIME_SCLHIGH_SHIFT)
+# define I2C_MSTTIME_SCLHIGH(n) ((uint32_t)((n)-2) << I2C_MSTTIME_SCLHIGH_SHIFT)
+
+/* Combined Master receiver and transmitter data */
+
+#define I2C_MSTDAT_SHIFT (0) /* Bits 0-7: Master function data */
+#define I2C_MSTDAT_MASK (0xff << I2C_MSTDAT_SHIFT)
+# define I2C_MSTDAT(n) ((uint32_t)(n) << I2C_MSTDAT_SHIFT)
+
+/* Slave control */
+#define I2C_SLVCTL_
+/* Combined Slave receiver and transmitter data */
+#define I2C_SLVDAT_
+/* Slave address 0 */
+#define I2C_SLVADR0_
+/* Slave address 1 */
+#define I2C_SLVADR1_
+/* Slave address 2 */
+#define I2C_SLVADR2_
+/* Slave address 3 */
+#define I2C_SLVADR3_
+/* Slave qualification for address 0 */
+#define I2C_SLVQUAL0_
+/* Monitor receiver data */
+#define I2C_MONRXDAT_
+/* I2C module Identification */
+#define I2C_ID_
+
+#endif /* __ARCH_ARM_SRC_LPC54XX_CHIP_LPC54_I2C_H */
diff --git a/arch/arm/src/lpc54xx/chip/lpc54_inputmux.h b/arch/arm/src/lpc54xx/chip/lpc54_inputmux.h
new file mode 100644
index 0000000000000000000000000000000000000000..c90250e9c53f6441dfc23082c13a5fbbbc89194e
--- /dev/null
+++ b/arch/arm/src/lpc54xx/chip/lpc54_inputmux.h
@@ -0,0 +1,298 @@
+/****************************************************************************************************
+ * arch/arm/src/lpc54xx/lpc54_inputmux.h
+ *
+ * Copyright (C) 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.
+ *
+ ****************************************************************************************************/
+
+#ifndef __ARCH_ARM_SRC_LPC54XX_CHIP_LPC54_INPUTMUX_H
+#define __ARCH_ARM_SRC_LPC54XX_CHIP_LPC54_INPUTMUX_H
+
+/****************************************************************************************************
+ * Included Files
+ ****************************************************************************************************/
+
+#include
+#include "chip/lpc54_memorymap.h"
+
+/****************************************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************************************/
+
+/* Register offsets *********************************************************************************/
+
+#define LPC54_MUX_SCT0_INMUX_OFFSET(n) (0x0000 + ((n) << 2))
+#define LPC54_MUX_SCT0_INMUX0_OFFSET 0x0000 /* Input mux register for SCT0 input 0 */
+#define LPC54_MUX_SCT0_INMUX1_OFFSET 0x0004 /* Input mux register for SCT0 input 1 */
+#define LPC54_MUX_SCT0_INMUX2_OFFSET 0x0008 /* Input mux register for SCT0 input 2 */
+#define LPC54_MUX_SCT0_INMUX3_OFFSET 0x000c /* Input mux register for SCT0 input 3 */
+#define LPC54_MUX_SCT0_INMUX4_OFFSET 0x0010 /* Input mux register for SCT0 input 4 */
+#define LPC54_MUX_SCT0_INMUX5_OFFSET 0x0014 /* Input mux register for SCT0 input 5 */
+#define LPC54_MUX_SCT0_INMUX6_OFFSET 0x0018 /* Input mux register for SCT0 input 6 */
+
+#define LPC54_MUX_PINTSEL_OFFSET(n) (0x00c0 + ((n) << 2))
+#define LPC54_MUX_PINTSEL0_OFFSET 0x00c0 /* Pin interrupt select register 0 */
+#define LPC54_MUX_PINTSEL1_OFFSET 0x00c4 /* Pin interrupt select register 1 */
+#define LPC54_MUX_PINTSEL2_OFFSET 0x00c8 /* Pin interrupt select register 2 */
+#define LPC54_MUX_PINTSEL3_OFFSET 0x00cc /* Pin interrupt select register 3 */
+#define LPC54_MUX_PINTSEL4_OFFSET 0x00d0 /* Pin interrupt select register 4 */
+#define LPC54_MUX_PINTSEL5_OFFSET 0x00d4 /* Pin interrupt select register 5 */
+#define LPC54_MUX_PINTSEL6_OFFSET 0x00d8 /* Pin interrupt select register 6 */
+#define LPC54_MUX_PINTSEL7_OFFSET 0x00dc /* Pin interrupt select register 7 */
+
+#define LPC54_MUX_DMA_ITRIG_INMUX_OFFSET(n) (0x00e0 + ((n) << 2))
+#define LPC54_MUX_DMA_ITRIG_INMUX0_OFFSET 0x00e0 /* Trigger select register for DMA channel 0 */
+#define LPC54_MUX_DMA_ITRIG_INMUX1_OFFSET 0x00e4 /* Trigger select register for DMA channel 1 */
+#define LPC54_MUX_DMA_ITRIG_INMUX2_OFFSET 0x00e8 /* Trigger select register for DMA channel 2 */
+#define LPC54_MUX_DMA_ITRIG_INMUX3_OFFSET 0x00ec /* Trigger select register for DMA channel 3 */
+#define LPC54_MUX_DMA_ITRIG_INMUX4_OFFSET 0x00f0 /* Trigger select register for DMA channel 4 */
+#define LPC54_MUX_DMA_ITRIG_INMUX5_OFFSET 0x00f4 /* Trigger select register for DMA channel 5 */
+#define LPC54_MUX_DMA_ITRIG_INMUX6_OFFSET 0x00f8 /* Trigger select register for DMA channel 6 */
+#define LPC54_MUX_DMA_ITRIG_INMUX7_OFFSET 0x00fc /* Trigger select register for DMA channel 7 */
+#define LPC54_MUX_DMA_ITRIG_INMUX8_OFFSET 0x0100 /* Trigger select register for DMA channel 8 */
+#define LPC54_MUX_DMA_ITRIG_INMUX9_OFFSET 0x0104 /* Trigger select register for DMA channel 9 */
+#define LPC54_MUX_DMA_ITRIG_INMUX10_OFFSET 0x0108 /* Trigger select register for DMA channel 10 */
+#define LPC54_MUX_DMA_ITRIG_INMUX11_OFFSET 0x010c /* Trigger select register for DMA channel 11 */
+#define LPC54_MUX_DMA_ITRIG_INMUX12_OFFSET 0x0110 /* Trigger select register for DMA channel 12 */
+#define LPC54_MUX_DMA_ITRIG_INMUX13_OFFSET 0x0114 /* Trigger select register for DMA channel 13 */
+#define LPC54_MUX_DMA_ITRIG_INMUX14_OFFSET 0x0118 /* Trigger select register for DMA channel 14 */
+#define LPC54_MUX_DMA_ITRIG_INMUX15_OFFSET 0x011c /* Trigger select register for DMA channel 15 */
+#define LPC54_MUX_DMA_ITRIG_INMUX16_OFFSET 0x0120 /* Trigger select register for DMA channel 16 */
+#define LPC54_MUX_DMA_ITRIG_INMUX17_OFFSET 0x0124 /* Trigger select register for DMA channel 17 */
+#define LPC54_MUX_DMA_ITRIG_INMUX18_OFFSET 0x0128 /* Trigger select register for DMA channel 18 */
+#define LPC54_MUX_DMA_ITRIG_INMUX19_OFFSET 0x012c /* Trigger select register for DMA channel 19 */
+#define LPC54_MUX_DMA_ITRIG_INMUX20_OFFSET 0x0130 /* Trigger select register for DMA channel 20 */
+#define LPC54_MUX_DMA_ITRIG_INMUX21_OFFSET 0x0134 /* Trigger select register for DMA channel 21 */
+#define LPC54_MUX_DMA_ITRIG_INMUX22_OFFSET 0x0138 /* Trigger select register for DMA channel 22 */
+#define LPC54_MUX_DMA_ITRIG_INMUX23_OFFSET 0x013c /* Trigger select register for DMA channel 23 */
+#define LPC54_MUX_DMA_ITRIG_INMUX24_OFFSET 0x0140 /* Trigger select register for DMA channel 24 */
+#define LPC54_MUX_DMA_ITRIG_INMUX25_OFFSET 0x0144 /* Trigger select register for DMA channel 25 */
+#define LPC54_MUX_DMA_ITRIG_INMUX26_OFFSET 0x0148 /* Trigger select register for DMA channel 26 */
+#define LPC54_MUX_DMA_ITRIG_INMUX27_OFFSET 0x014c /* Trigger select register for DMA channel 27 */
+#define LPC54_MUX_DMA_ITRIG_INMUX28_OFFSET 0x0150 /* Trigger select register for DMA channel 28 */
+#define LPC54_MUX_DMA_ITRIG_INMUX29_OFFSET 0x0154 /* Trigger select register for DMA channel 29 */
+
+#define LPC54_MUX_DMA_OTRIG_INMUX_OFFSET(n) (0x0160 + ((n) << 2))
+#define LPC54_MUX_DMA_OTRIG_INMUX0_OFFSET 0x0160 /* DMA output trigger selection to become DMA trigger 18 */
+#define LPC54_MUX_DMA_OTRIG_INMUX1_OFFSET 0x0164 /* DMA output trigger selection to become DMA trigger 19 */
+#define LPC54_MUX_DMA_OTRIG_INMUX2_OFFSET 0x0168 /* DMA output trigger selection to become DMA trigger 20 */
+#define LPC54_MUX_DMA_OTRIG_INMUX3_OFFSET 0x016c /* DMA output trigger selection to become DMA trigger 21 */
+
+#define LPC54_MUX_FREQMEAS_REF_OFFSET 0x0180 /* Selection for frequency measurement reference clock */
+#define LPC54_MUX_FREQMEAS_TARGET_OFFSET 0x0184 /* Selection for frequency measurement target clock */
+
+/* Register addresses *******************************************************************************/
+
+#define LPC54_MUX_SCT0_INMUX(n) (LPC54_MUX_BASE + LPC54_MUX_SCT0_INMUX_OFFSET(n))
+#define LPC54_MUX_SCT0_INMUX0 (LPC54_MUX_BASE + LPC54_MUX_SCT0_INMUX0_OFFSET)
+#define LPC54_MUX_SCT0_INMUX1 (LPC54_MUX_BASE + LPC54_MUX_SCT0_INMUX1_OFFSET)
+#define LPC54_MUX_SCT0_INMUX2 (LPC54_MUX_BASE + LPC54_MUX_SCT0_INMUX2_OFFSET)
+#define LPC54_MUX_SCT0_INMUX3 (LPC54_MUX_BASE + LPC54_MUX_SCT0_INMUX3_OFFSET)
+#define LPC54_MUX_SCT0_INMUX4 (LPC54_MUX_BASE + LPC54_MUX_SCT0_INMUX4_OFFSET)
+#define LPC54_MUX_SCT0_INMUX5 (LPC54_MUX_BASE + LPC54_MUX_SCT0_INMUX5_OFFSET)
+#define LPC54_MUX_SCT0_INMUX6 (LPC54_MUX_BASE + LPC54_MUX_SCT0_INMUX6_OFFSET)
+
+#define LPC54_MUX_PINTSEL(n) (LPC54_MUX_BASE + LPC54_MUX_PINTSEL_OFFSET(n))
+#define LPC54_MUX_PINTSEL0 (LPC54_MUX_BASE + LPC54_MUX_PINTSEL0_OFFSET)
+#define LPC54_MUX_PINTSEL1 (LPC54_MUX_BASE + LPC54_MUX_PINTSEL1_OFFSET)
+#define LPC54_MUX_PINTSEL2 (LPC54_MUX_BASE + LPC54_MUX_PINTSEL2_OFFSET)
+#define LPC54_MUX_PINTSEL3 (LPC54_MUX_BASE + LPC54_MUX_PINTSEL3_OFFSET)
+#define LPC54_MUX_PINTSEL4 (LPC54_MUX_BASE + LPC54_MUX_PINTSEL4_OFFSET)
+#define LPC54_MUX_PINTSEL5 (LPC54_MUX_BASE + LPC54_MUX_PINTSEL5_OFFSET)
+#define LPC54_MUX_PINTSEL6 (LPC54_MUX_BASE + LPC54_MUX_PINTSEL6_OFFSET)
+#define LPC54_MUX_PINTSEL7 (LPC54_MUX_BASE + LPC54_MUX_PINTSEL7_OFFSET)
+
+#define LPC54_MUX_DMA_ITRIG_INMUX(n) (LPC54_MUX_BASE + LPC54_MUX_DMA_ITRIG_INMUX_OFFSET(n))
+#define LPC54_MUX_DMA_ITRIG_INMUX0 (LPC54_MUX_BASE + LPC54_MUX_DMA_ITRIG_INMUX0_OFFSET)
+#define LPC54_MUX_DMA_ITRIG_INMUX1 (LPC54_MUX_BASE + LPC54_MUX_DMA_ITRIG_INMUX1_OFFSET)
+#define LPC54_MUX_DMA_ITRIG_INMUX2 (LPC54_MUX_BASE + LPC54_MUX_DMA_ITRIG_INMUX2_OFFSET)
+#define LPC54_MUX_DMA_ITRIG_INMUX3 (LPC54_MUX_BASE + LPC54_MUX_DMA_ITRIG_INMUX3_OFFSET)
+#define LPC54_MUX_DMA_ITRIG_INMUX4 (LPC54_MUX_BASE + LPC54_MUX_DMA_ITRIG_INMUX4_OFFSET)
+#define LPC54_MUX_DMA_ITRIG_INMUX5 (LPC54_MUX_BASE + LPC54_MUX_DMA_ITRIG_INMUX5_OFFSET)
+#define LPC54_MUX_DMA_ITRIG_INMUX6 (LPC54_MUX_BASE + LPC54_MUX_DMA_ITRIG_INMUX6_OFFSET)
+#define LPC54_MUX_DMA_ITRIG_INMUX7 (LPC54_MUX_BASE + LPC54_MUX_DMA_ITRIG_INMUX7_OFFSET)
+#define LPC54_MUX_DMA_ITRIG_INMUX8 (LPC54_MUX_BASE + LPC54_MUX_DMA_ITRIG_INMUX8_OFFSET)
+#define LPC54_MUX_DMA_ITRIG_INMUX9 (LPC54_MUX_BASE + LPC54_MUX_DMA_ITRIG_INMUX9_OFFSET)
+#define LPC54_MUX_DMA_ITRIG_INMUX10 (LPC54_MUX_BASE + LPC54_MUX_DMA_ITRIG_INMUX10_OFFSET)
+#define LPC54_MUX_DMA_ITRIG_INMUX11 (LPC54_MUX_BASE + LPC54_MUX_DMA_ITRIG_INMUX11_OFFSET)
+#define LPC54_MUX_DMA_ITRIG_INMUX12 (LPC54_MUX_BASE + LPC54_MUX_DMA_ITRIG_INMUX12_OFFSET)
+#define LPC54_MUX_DMA_ITRIG_INMUX13 (LPC54_MUX_BASE + LPC54_MUX_DMA_ITRIG_INMUX13_OFFSET)
+#define LPC54_MUX_DMA_ITRIG_INMUX14 (LPC54_MUX_BASE + LPC54_MUX_DMA_ITRIG_INMUX14_OFFSET)
+#define LPC54_MUX_DMA_ITRIG_INMUX15 (LPC54_MUX_BASE + LPC54_MUX_DMA_ITRIG_INMUX15_OFFSET)
+#define LPC54_MUX_DMA_ITRIG_INMUX16 (LPC54_MUX_BASE + LPC54_MUX_DMA_ITRIG_INMUX16_OFFSET)
+#define LPC54_MUX_DMA_ITRIG_INMUX17 (LPC54_MUX_BASE + LPC54_MUX_DMA_ITRIG_INMUX17_OFFSET)
+#define LPC54_MUX_DMA_ITRIG_INMUX18 (LPC54_MUX_BASE + LPC54_MUX_DMA_ITRIG_INMUX18_OFFSET)
+#define LPC54_MUX_DMA_ITRIG_INMUX19 (LPC54_MUX_BASE + LPC54_MUX_DMA_ITRIG_INMUX19_OFFSET)
+#define LPC54_MUX_DMA_ITRIG_INMUX20 (LPC54_MUX_BASE + LPC54_MUX_DMA_ITRIG_INMUX20_OFFSET)
+#define LPC54_MUX_DMA_ITRIG_INMUX21 (LPC54_MUX_BASE + LPC54_MUX_DMA_ITRIG_INMUX21_OFFSET)
+#define LPC54_MUX_DMA_ITRIG_INMUX22 (LPC54_MUX_BASE + LPC54_MUX_DMA_ITRIG_INMUX22_OFFSET)
+#define LPC54_MUX_DMA_ITRIG_INMUX23 (LPC54_MUX_BASE + LPC54_MUX_DMA_ITRIG_INMUX23_OFFSET)
+#define LPC54_MUX_DMA_ITRIG_INMUX24 (LPC54_MUX_BASE + LPC54_MUX_DMA_ITRIG_INMUX24_OFFSET)
+#define LPC54_MUX_DMA_ITRIG_INMUX25 (LPC54_MUX_BASE + LPC54_MUX_DMA_ITRIG_INMUX25_OFFSET)
+#define LPC54_MUX_DMA_ITRIG_INMUX26 (LPC54_MUX_BASE + LPC54_MUX_DMA_ITRIG_INMUX26_OFFSET)
+#define LPC54_MUX_DMA_ITRIG_INMUX27 (LPC54_MUX_BASE + LPC54_MUX_DMA_ITRIG_INMUX27_OFFSET)
+#define LPC54_MUX_DMA_ITRIG_INMUX28 (LPC54_MUX_BASE + LPC54_MUX_DMA_ITRIG_INMUX28_OFFSET)
+#define LPC54_MUX_DMA_ITRIG_INMUX29 (LPC54_MUX_BASE + LPC54_MUX_DMA_ITRIG_INMUX29_OFFSET)
+
+#define LPC54_MUX_DMA_OTRIG_INMUX(n) (LPC54_MUX_BASE + LPC54_MUX_DMA_OTRIG_INMUX_OFFSET(n))
+#define LPC54_MUX_DMA_OTRIG_INMUX0 (LPC54_MUX_BASE + LPC54_MUX_DMA_OTRIG_INMUX0_OFFSET)
+#define LPC54_MUX_DMA_OTRIG_INMUX1 (LPC54_MUX_BASE + LPC54_MUX_DMA_OTRIG_INMUX1_OFFSET)
+#define LPC54_MUX_DMA_OTRIG_INMUX2 (LPC54_MUX_BASE + LPC54_MUX_DMA_OTRIG_INMUX2_OFFSET)
+#define LPC54_MUX_DMA_OTRIG_INMUX3 (LPC54_MUX_BASE + LPC54_MUX_DMA_OTRIG_INMUX3_OFFSET)
+
+#define LPC54_MUX_FREQMEAS_REF (LPC54_MUX_BASE + LPC54_MUX_FREQMEAS_REF_OFFSET)
+#define LPC54_MUX_FREQMEAS_TARGET (LPC54_MUX_BASE + LPC54_MUX_FREQMEAS_TARGET_OFFSET)
+
+/* Register bit definitions *************************************************************************/
+
+/* Input mux register for SCT0 input 0-6 */
+
+#define MUX_SCT0_INMUX_SHIFT (0) /* Bits 0-4: Input number to SCT0 inputs 0 to 6 */
+#define MUX_SCT0_INMUX_MASK (31 << MUX_SCT0_INMUX_SHIFT)
+# define MUX_SCT0_INMUX_SCTGPI0 (0 << MUX_SCT0_INMUX_SHIFT) /* function selected from IOCON register */
+# define MUX_SCT0_INMUX_SCTGPI1 (1 << MUX_SCT0_INMUX_SHIFT) /* function selected from IOCON register */
+# define MUX_SCT0_INMUX_SCTGPI2 (2 << MUX_SCT0_INMUX_SHIFT) /* function selected from IOCON register */
+# define MUX_SCT0_INMUX_SCTGPI3 (3 << MUX_SCT0_INMUX_SHIFT) /* function selected from IOCON register */
+# define MUX_SCT0_INMUX_SCTGPI4 (4 << MUX_SCT0_INMUX_SHIFT) /* function selected from IOCON register */
+# define MUX_SCT0_INMUX_SCTGPI5 (5 << MUX_SCT0_INMUX_SHIFT) /* function selected from IOCON register */
+# define MUX_SCT0_INMUX_SCTGPI6 (6 << MUX_SCT0_INMUX_SHIFT) /* function selected from IOCON register */
+# define MUX_SCT0_INMUX_SCTGPI7 (7 << MUX_SCT0_INMUX_SHIFT) /* function selected from IOCON register */
+# define MUX_SCT0_INMUX_T0OUT0 (8 << MUX_SCT0_INMUX_SHIFT) /* T0_OUT0 */
+# define MUX_SCT0_INMUX_T1OUT0 (9 << MUX_SCT0_INMUX_SHIFT) /* T1_OUT0 */
+# define MUX_SCT0_INMUX_T2OUT0 (10 << MUX_SCT0_INMUX_SHIFT) /* T2_OUT0 */
+# define MUX_SCT0_INMUX_T3OUT0 (11 << MUX_SCT0_INMUX_SHIFT) /* T3_OUT0 */
+# define MUX_SCT0_INMUX_T4OUT0 (12 << MUX_SCT0_INMUX_SHIFT) /* T4_OUT0 */
+# define MUX_SCT0_INMUX_ADCTHCMP (13 << MUX_SCT0_INMUX_SHIFT) /* ADC_THCMP_IRQ */
+# define MUX_SCT0_INMUX_BMATCH (14 << MUX_SCT0_INMUX_SHIFT) /* GPIOINT_BMATCH */
+# define MUX_SCT0_INMUX_USB0 (15 << MUX_SCT0_INMUX_SHIFT) /* USB0_FRAME_TOGGLE */
+# define MUX_SCT0_INMUX_USB1 (16 << MUX_SCT0_INMUX_SHIFT) /* USB1_FRAME_TOGGLE */
+# define MUX_SCT0_INMUX_ARMTXEV (17 << MUX_SCT0_INMUX_SHIFT) /* ARM_TXEV */
+# define MUX_SCT0_INMUX_HALTED (18 << MUX_SCT0_INMUX_SHIFT) /* DEBUG_HALTED */
+# define MUX_SCT0_INMUX_SC0TX (19 << MUX_SCT0_INMUX_SHIFT) /* SMARTCARD0_TX_ACTIVE */
+# define MUX_SCT0_INMUX_SC0RX (20 << MUX_SCT0_INMUX_SHIFT) /* SMARTCARD0_RX_ACTIVE */
+# define MUX_SCT0_INMUX_SC1TX (21 << MUX_SCT0_INMUX_SHIFT) /* SMARTCARD1_TX_ACTIVE */
+# define MUX_SCT0_INMUX_S10RX (22 << MUX_SCT0_INMUX_SHIFT) /* SMARTCARD1_RX_ACTIVE */
+# define MUX_SCT0_INMUX_I2S6SCLK (23 << MUX_SCT0_INMUX_SHIFT) /* I2S6_SCLK */
+# define MUX_SCT0_INMUX_I2S7SCLK (24 << MUX_SCT0_INMUX_SHIFT) /* I2S7_SCLK */
+
+/* Pin interrupt select register 0-7
+ *
+ * Pin number select for pin interrupt or pattern match engine input.
+ * For PIOx_y: pin = (x * 32) + y.
+ * PIO0_0 to PIO1_31 correspond to numbers 0 to 63.
+ */
+
+#define MUX_PINTSEL(n) (1 << (n))
+
+/* Trigger select register for DMA channel 0-29 */
+
+#define ITRIG_INMUX_ADC0A (0) /* ADC0 Sequence A interrupt */
+#define ITRIG_INMUX_ADC0B (1) /* ADC0 Sequence B interrupt */
+#define ITRIG_INMUX_SCT0DMA0 (2) /* SCT0 DMA request 0 */
+#define ITRIG_INMUX_SCT0DMA1 (3) /* SCT0 DMA request 1 */
+#define ITRIG_INMUX_PININT0 (4) /* Pin interrupt 0 */
+#define ITRIG_INMUX_PININT1 (5) /* Pin interrupt 1 */
+#define ITRIG_INMUX_PININT2 (6) /* Pin interrupt 2 */
+#define ITRIG_INMUX_PININT3 (7) /* Pin interrupt 3 */
+#define ITRIG_INMUX_CTIMER0MAT0 (8) /* Timer CTIMER0 Match 0 */
+#define ITRIG_INMUX_CTIMER0MAT1 (9) /* Timer CTIMER0 Match 1 */
+#define ITRIG_INMUX_CTIMER1MAT0 (10) /* Timer CTIMER1 Match 0 */
+#define ITRIG_INMUX_CTIMER1MAT1 (11) /* Timer CTIMER1 Match 1 */
+#define ITRIG_INMUX_CTIMER2MAT0 (12) /* Timer CTIMER2 Match 0 */
+#define ITRIG_INMUX_CTIMER2MAT1 (13) /* Timer CTIMER2 Match 1 */
+#define ITRIG_INMUX_CTIMER3MAT0 (14) /* Timer CTIMER3 Match 0 */
+#define ITRIG_INMUX_CTIMER3MAT1 (15) /* Timer CTIMER3 Match 1 */
+#define ITRIG_INMUX_CTIMER4MAT0 (16) /* Timer CTIMER4 Match 0 */
+#define ITRIG_INMUX_CTIMER4MAT1 (17) /* Timer CTIMER4 Match 1 */
+#define ITRIG_INMUX_DMAMUX0 (18) /* DMA output trigger mux 0 */
+#define ITRIG_INMUX_DMAMUX1 (19) /* DMA output trigger mux 1 */
+#define ITRIG_INMUX_DMAMUX2 (20) /* DMA output trigger mux 2 */
+#define ITRIG_INMUX_DMAMUX3 (21) /* DMA output trigger mux 3 */
+
+#define MUX_DMA_ITRIG_INMUX_SHIFT (0) /* Bit 0-4: Trigger input number for DMA channel n (n = 0 to 29) */
+#define MUX_DMA_ITRIG_INMUX_MASK (31 << MUX_DMA_ITRIG_INMUX_SHIFT)
+# define MUX_DMA_ITRIG_INMUX(n) ((uint32_t)(n) << MUX_DMA_ITRIG_INMUX_SHIFT)
+# define MUX_DMA_ITRIG_INMUX_ADC0A (0 << MUX_DMA_ITRIG_INMUX_SHIFT) /* ADC0 Sequence A interrupt */
+# define MUX_DMA_ITRIG_INMUX_ADC0B (1 << MUX_DMA_ITRIG_INMUX_SHIFT) /* ADC0 Sequence B interrupt */
+# define MUX_DMA_ITRIG_INMUX_SCT0DMA0 (2 << MUX_DMA_ITRIG_INMUX_SHIFT) /* SCT0 DMA request 0 */
+# define MUX_DMA_ITRIG_INMUX_SCT0DMA1 (3 << MUX_DMA_ITRIG_INMUX_SHIFT) /* SCT0 DMA request 1 */
+# define MUX_DMA_ITRIG_INMUX_PININT0 (4 << MUX_DMA_ITRIG_INMUX_SHIFT) /* Pin interrupt 0 */
+# define MUX_DMA_ITRIG_INMUX_PININT1 (5 << MUX_DMA_ITRIG_INMUX_SHIFT) /* Pin interrupt 1 */
+# define MUX_DMA_ITRIG_INMUX_PININT2 (6 << MUX_DMA_ITRIG_INMUX_SHIFT) /* Pin interrupt 2 */
+# define MUX_DMA_ITRIG_INMUX_PININT3 (7 << MUX_DMA_ITRIG_INMUX_SHIFT) /* Pin interrupt 3 */
+# define MUX_DMA_ITRIG_INMUX_CTIMER0MAT0 (8 << MUX_DMA_ITRIG_INMUX_SHIFT) /* Timer CTIMER0 Match 0 */
+# define MUX_DMA_ITRIG_INMUX_CTIMER0MAT1 (9 << MUX_DMA_ITRIG_INMUX_SHIFT) /* Timer CTIMER0 Match 1 */
+# define MUX_DMA_ITRIG_INMUX_CTIMER1MAT0 (10 << MUX_DMA_ITRIG_INMUX_SHIFT) /* Timer CTIMER1 Match 0 */
+# define MUX_DMA_ITRIG_INMUX_CTIMER1MAT1 (11 << MUX_DMA_ITRIG_INMUX_SHIFT) /* Timer CTIMER1 Match 1 */
+# define MUX_DMA_ITRIG_INMUX_CTIMER2MAT0 (12 << MUX_DMA_ITRIG_INMUX_SHIFT) /* Timer CTIMER2 Match 0 */
+# define MUX_DMA_ITRIG_INMUX_CTIMER2MAT1 (13 << MUX_DMA_ITRIG_INMUX_SHIFT) /* Timer CTIMER2 Match 1 */
+# define MUX_DMA_ITRIG_INMUX_CTIMER3MAT0 (14 << MUX_DMA_ITRIG_INMUX_SHIFT) /* Timer CTIMER3 Match 0 */
+# define MUX_DMA_ITRIG_INMUX_CTIMER3MAT1 (15 << MUX_DMA_ITRIG_INMUX_SHIFT) /* Timer CTIMER3 Match 1 */
+# define MUX_DMA_ITRIG_INMUX_CTIMER4MAT0 (16 << MUX_DMA_ITRIG_INMUX_SHIFT) /* Timer CTIMER4 Match 0 */
+# define MUX_DMA_ITRIG_INMUX_CTIMER4MAT1 (17 << MUX_DMA_ITRIG_INMUX_SHIFT) /* Timer CTIMER4 Match 1 */
+# define MUX_DMA_ITRIG_INMUX_DMAMUX0 (18 << MUX_DMA_ITRIG_INMUX_SHIFT) /* DMA output trigger mux 0 */
+# define MUX_DMA_ITRIG_INMUX_DMAMUX1 (19 << MUX_DMA_ITRIG_INMUX_SHIFT) /* DMA output trigger mux 1 */
+# define MUX_DMA_ITRIG_INMUX_DMAMUX2 (20 << MUX_DMA_ITRIG_INMUX_SHIFT) /* DMA output trigger mux 2 */
+# define MUX_DMA_ITRIG_INMUX_DMAMUX3 (21 << MUX_DMA_ITRIG_INMUX_SHIFT) /* DMA output trigger mux 3 */
+
+/* DMA output trigger selection registers 0-3 */
+
+#define MUX_DMA_OTRIG_INMUX_SHIFT (0) /* Bits 0-4: DMA trigger output number for DMA channel n=0..29 */
+#define MUX_DMA_OTRIG_INMUX_MASK (31 << MUX_DMA_OTRIG_INMUX_SHIFT)
+# define MUX_DMA_OTRIG_INMUX(n) ((uint32_t)(n) << MUX_DMA_OTRIG_INMUX_SHIFT)
+
+/* Selection for frequency measurement reference clock */
+
+#define MUX_FREQMEAS_REF_SHIFT (0) /* Bits 0-4: Clock source for frequency measure farget clock */
+#define MUX_FREQMEAS_REF_MASK (31 << MUX_FREQMEAS_REF_SHIFT)
+# define MUX_FREQMEAS_REF_CLKIN (0 << MUX_FREQMEAS_REF_SHIFT) /* External crystal oscillator (clk_in) */
+# define MUX_FREQMEAS_REF_FRO12M (1 << MUX_FREQMEAS_REF_SHIFT) /* FRO 12 MHz oscillator (fro_12m) */
+# define MUX_FREQMEAS_REF_FROHF (2 << MUX_FREQMEAS_REF_SHIFT) /* FRO 96 or 48 MHz (fro_hf) */
+# define MUX_FREQMEAS_REF_WDTCLK (3 << MUX_FREQMEAS_REF_SHIFT) /* Watchdog oscillator (wdt_clk) */
+# define MUX_FREQMEAS_REF_32KCLK (4 << MUX_FREQMEAS_REF_SHIFT) /* 32 kHz RTC oscillator (32k_clk) */
+# define MUX_FREQMEAS_REF_MAINCLK (5 << MUX_FREQMEAS_REF_SHIFT) /* Main clock (main_clk) */
+# define MUX_FREQMEAS_REF_GPIOCLKA (6 << MUX_FREQMEAS_REF_SHIFT) /* FREQME_GPIO_CLK_A */
+# define MUX_FREQMEAS_REF_GPIOCLKB (7 << MUX_FREQMEAS_REF_SHIFT) /* FREQME_GPIO_CLK_B */
+
+/* Selection for frequency measurement target clock */
+
+#define MUX_FREQMEAS_TARGET_SHIFT (0) /* Bits 0-4: Selects target clock of the frequency measure function */
+#define MUX_FREQMEAS_TARGET_MASK (31 << MUX_FREQMEAS_TARGET_SHIFT)
+# define MUX_FREQMEAS_TARGET_CLKIN (0 << MUX_FREQMEAS_TARGET_SHIFT) /* External crystal oscillator (clk_in) */
+# define MUX_FREQMEAS_TARGET_FRO12M (1 << MUX_FREQMEAS_TARGET_SHIFT) /* FRO 12 MHz oscillator (fro_12m) */
+# define MUX_FREQMEAS_TARGET_FROHF (2 << MUX_FREQMEAS_TARGET_SHIFT) /* FRO 96 or 48 MHz (fro_hf) */
+# define MUX_FREQMEAS_TARGET_WDTCLK (3 << MUX_FREQMEAS_TARGET_SHIFT) /* Watchdog oscillator (wdt_clk) */
+# define MUX_FREQMEAS_TARGET_32KCLK (4 << MUX_FREQMEAS_TARGET_SHIFT) /* 32 kHz RTC oscillator (32k_clk) */
+# define MUX_FREQMEAS_TARGET_MAINCLK (5 << MUX_FREQMEAS_TARGET_SHIFT) /* Main clock (main_clk) */
+# define MUX_FREQMEAS_TARGET_GPIOCLKA (6 << MUX_FREQMEAS_TARGET_SHIFT) /* FREQME_GPIO_CLK_A */
+# define MUX_FREQMEAS_TARGET_ PIOCLKB (7 << MUX_FREQMEAS_TARGET_SHIFT) /* FREQME_GPIO_CLK_B */
+
+#endif /* __ARCH_ARM_SRC_LPC54XX_CHIP_LPC54_INPUTMUX_H */
diff --git a/arch/arm/src/lpc54xx/chip/lpc54_iocon.h b/arch/arm/src/lpc54xx/chip/lpc54_iocon.h
new file mode 100644
index 0000000000000000000000000000000000000000..4a04936ffa1d62250122d12fd0449e4537f4bfd2
--- /dev/null
+++ b/arch/arm/src/lpc54xx/chip/lpc54_iocon.h
@@ -0,0 +1,378 @@
+/************************************************************************************
+ * arch/arm/src/lpc54xx/chip/lpc54_iocon.h
+ *
+ * Copyright (C) 2017 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt