You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ac...@apache.org on 2023/07/12 14:31:03 UTC
[nuttx] branch master updated (062e08ea3a -> f43c7e99be)
This is an automated email from the ASF dual-hosted git repository.
acassis pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
from 062e08ea3a serial:fix driver/serial/serial.c logic error
new 8ceff0dc5a arm/stm32h7: Add STM32H745 family
new f7905512be stm32h7: add LTDC support
new f43c7e99be boards/stm32h7: Add stm32h745i-disco board
The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
arch/arm/include/stm32h7/chip.h | 6 +-
arch/arm/include/stm32h7/irq.h | 2 +
arch/arm/include/stm32h7/stm32h7x5xx_irq.h | 210 ++
arch/arm/src/stm32h7/Kconfig | 316 ++
arch/arm/src/stm32h7/Make.defs | 4 +
arch/arm/src/stm32h7/hardware/stm32_dmamux.h | 2 +
arch/arm/src/stm32h7/hardware/stm32_ethernet.h | 4 +-
arch/arm/src/stm32h7/hardware/stm32_exti.h | 5 +-
arch/arm/src/stm32h7/hardware/stm32_flash.h | 2 +
arch/arm/src/stm32h7/hardware/stm32_gpio.h | 2 +
arch/arm/src/stm32h7/hardware/stm32_i2c.h | 2 +
arch/arm/src/stm32h7/hardware/stm32_ltdc.h | 366 +++
arch/arm/src/stm32h7/hardware/stm32_memorymap.h | 2 +
arch/arm/src/stm32h7/hardware/stm32_pinmap.h | 2 +
arch/arm/src/stm32h7/hardware/stm32_pwr.h | 2 +
arch/arm/src/stm32h7/hardware/stm32_rcc.h | 2 +
arch/arm/src/stm32h7/hardware/stm32_sdmmc.h | 2 +
arch/arm/src/stm32h7/hardware/stm32_spi.h | 2 +
arch/arm/src/stm32h7/hardware/stm32_syscfg.h | 2 +
arch/arm/src/stm32h7/hardware/stm32_uart.h | 2 +
arch/arm/src/stm32h7/hardware/stm32h7x3xx_gpio.h | 5 +-
arch/arm/src/stm32h7/hardware/stm32h7x3xx_pinmap.h | 225 +-
arch/arm/src/stm32h7/hardware/stm32h7x3xx_spi.h | 5 +-
arch/arm/src/stm32h7/hardware/stm32h7x3xx_uart.h | 5 +-
arch/arm/src/stm32h7/stm32_exti_gpio.c | 5 +-
arch/arm/src/stm32h7/stm32_gpio.c | 5 +-
arch/arm/src/stm32h7/stm32_ltdc.c | 3137 ++++++++++++++++++++
arch/arm/src/stm32h7/stm32_ltdc.h | 100 +
arch/arm/src/stm32h7/stm32_rcc.c | 2 +
arch/arm/src/stm32h7/stm32h7x3xx_rcc.c | 12 +-
boards/Kconfig | 13 +
boards/arm/stm32h7/stm32h745i-disco/CMakeLists.txt | 21 +
boards/arm/stm32h7/stm32h745i-disco/Kconfig | 8 +
.../stm32h745i-disco/configs/lvgl/defconfig | 73 +
.../stm32h745i-disco/configs/netnsh/defconfig | 86 +
.../stm32h7/stm32h745i-disco/configs/nsh/defconfig | 49 +
.../stm32h745i-disco/configs/touchtest/defconfig | 59 +
.../arm/stm32h7/stm32h745i-disco/include/board.h | 504 ++++
.../arm/stm32h7/stm32h745i-disco/scripts/Make.defs | 48 +
.../arm/stm32h7/stm32h745i-disco/scripts/flash.ld | 200 ++
.../stm32h7/stm32h745i-disco/scripts/gnu-elf.ld | 126 +
.../arm/stm32h7/stm32h745i-disco/scripts/memory.ld | 47 +-
.../stm32h7/stm32h745i-disco/scripts/user-space.ld | 98 +
.../stm32h7/stm32h745i-disco/src/CMakeLists.txt | 55 +
boards/arm/stm32h7/stm32h745i-disco/src/Makefile | 55 +
.../stm32h745i-disco/src/stm32_appinitialize.c | 76 +
.../stm32h7/stm32h745i-disco/src/stm32_autoleds.c | 173 ++
.../arm/stm32h7/stm32h745i-disco/src/stm32_boot.c | 89 +
.../stm32h7/stm32h745i-disco/src/stm32_bringup.c | 230 ++
.../stm32h7/stm32h745i-disco/src/stm32_ft5x06.c | 301 ++
.../arm/stm32h7/stm32h745i-disco/src/stm32_lcd.c | 120 +
.../stm32h7/stm32h745i-disco/src/stm32_ostest.c | 95 +
.../arm/stm32h7/stm32h745i-disco/src/stm32_reset.c | 62 +
.../arm/stm32h7/stm32h745i-disco/src/stm32_usb.c | 324 ++
.../stm32h7/stm32h745i-disco/src/stm32_userleds.c | 130 +
.../stm32h745i-disco/src/stm32h745i_disco.h | 220 ++
56 files changed, 7561 insertions(+), 139 deletions(-)
create mode 100644 arch/arm/include/stm32h7/stm32h7x5xx_irq.h
create mode 100644 arch/arm/src/stm32h7/hardware/stm32_ltdc.h
create mode 100644 arch/arm/src/stm32h7/stm32_ltdc.c
create mode 100644 arch/arm/src/stm32h7/stm32_ltdc.h
create mode 100644 boards/arm/stm32h7/stm32h745i-disco/CMakeLists.txt
create mode 100644 boards/arm/stm32h7/stm32h745i-disco/Kconfig
create mode 100644 boards/arm/stm32h7/stm32h745i-disco/configs/lvgl/defconfig
create mode 100644 boards/arm/stm32h7/stm32h745i-disco/configs/netnsh/defconfig
create mode 100644 boards/arm/stm32h7/stm32h745i-disco/configs/nsh/defconfig
create mode 100644 boards/arm/stm32h7/stm32h745i-disco/configs/touchtest/defconfig
create mode 100644 boards/arm/stm32h7/stm32h745i-disco/include/board.h
create mode 100644 boards/arm/stm32h7/stm32h745i-disco/scripts/Make.defs
create mode 100644 boards/arm/stm32h7/stm32h745i-disco/scripts/flash.ld
create mode 100644 boards/arm/stm32h7/stm32h745i-disco/scripts/gnu-elf.ld
copy arch/arm/src/stm32h7/hardware/stm32_flash.h => boards/arm/stm32h7/stm32h745i-disco/scripts/memory.ld (52%)
create mode 100644 boards/arm/stm32h7/stm32h745i-disco/scripts/user-space.ld
create mode 100644 boards/arm/stm32h7/stm32h745i-disco/src/CMakeLists.txt
create mode 100644 boards/arm/stm32h7/stm32h745i-disco/src/Makefile
create mode 100644 boards/arm/stm32h7/stm32h745i-disco/src/stm32_appinitialize.c
create mode 100644 boards/arm/stm32h7/stm32h745i-disco/src/stm32_autoleds.c
create mode 100644 boards/arm/stm32h7/stm32h745i-disco/src/stm32_boot.c
create mode 100644 boards/arm/stm32h7/stm32h745i-disco/src/stm32_bringup.c
create mode 100644 boards/arm/stm32h7/stm32h745i-disco/src/stm32_ft5x06.c
create mode 100644 boards/arm/stm32h7/stm32h745i-disco/src/stm32_lcd.c
create mode 100644 boards/arm/stm32h7/stm32h745i-disco/src/stm32_ostest.c
create mode 100644 boards/arm/stm32h7/stm32h745i-disco/src/stm32_reset.c
create mode 100644 boards/arm/stm32h7/stm32h745i-disco/src/stm32_usb.c
create mode 100644 boards/arm/stm32h7/stm32h745i-disco/src/stm32_userleds.c
create mode 100644 boards/arm/stm32h7/stm32h745i-disco/src/stm32h745i_disco.h
[nuttx] 03/03: boards/stm32h7: Add stm32h745i-disco board
Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit f43c7e99bedd8ea0cc2e3e6c2c796c38dbb8f354
Author: raiden00pl <ra...@railab.me>
AuthorDate: Wed Jul 12 10:17:34 2023 +0200
boards/stm32h7: Add stm32h745i-disco board
---
boards/Kconfig | 13 +
boards/arm/stm32h7/stm32h745i-disco/CMakeLists.txt | 21 +
boards/arm/stm32h7/stm32h745i-disco/Kconfig | 8 +
.../stm32h745i-disco/configs/lvgl/defconfig | 73 +++
.../stm32h745i-disco/configs/netnsh/defconfig | 86 ++++
.../stm32h7/stm32h745i-disco/configs/nsh/defconfig | 49 ++
.../stm32h745i-disco/configs/touchtest/defconfig | 59 +++
.../arm/stm32h7/stm32h745i-disco/include/board.h | 504 +++++++++++++++++++++
.../arm/stm32h7/stm32h745i-disco/scripts/Make.defs | 48 ++
.../arm/stm32h7/stm32h745i-disco/scripts/flash.ld | 200 ++++++++
.../stm32h7/stm32h745i-disco/scripts/gnu-elf.ld | 126 ++++++
.../arm/stm32h7/stm32h745i-disco/scripts/memory.ld | 52 +++
.../stm32h7/stm32h745i-disco/scripts/user-space.ld | 98 ++++
.../stm32h7/stm32h745i-disco/src/CMakeLists.txt | 55 +++
boards/arm/stm32h7/stm32h745i-disco/src/Makefile | 55 +++
.../stm32h745i-disco/src/stm32_appinitialize.c | 76 ++++
.../stm32h7/stm32h745i-disco/src/stm32_autoleds.c | 173 +++++++
.../arm/stm32h7/stm32h745i-disco/src/stm32_boot.c | 89 ++++
.../stm32h7/stm32h745i-disco/src/stm32_bringup.c | 230 ++++++++++
.../stm32h7/stm32h745i-disco/src/stm32_ft5x06.c | 301 ++++++++++++
.../arm/stm32h7/stm32h745i-disco/src/stm32_lcd.c | 120 +++++
.../stm32h7/stm32h745i-disco/src/stm32_ostest.c | 95 ++++
.../arm/stm32h7/stm32h745i-disco/src/stm32_reset.c | 62 +++
.../arm/stm32h7/stm32h745i-disco/src/stm32_usb.c | 324 +++++++++++++
.../stm32h7/stm32h745i-disco/src/stm32_userleds.c | 130 ++++++
.../stm32h745i-disco/src/stm32h745i_disco.h | 220 +++++++++
26 files changed, 3267 insertions(+)
diff --git a/boards/Kconfig b/boards/Kconfig
index f337e59b59..9404282685 100644
--- a/boards/Kconfig
+++ b/boards/Kconfig
@@ -1608,6 +1608,15 @@ config ARCH_BOARD_NUCLEO_H743ZI2
---help---
STMicro Nucleo H743ZI2 board based on the STMicro STM32H743ZI MCU.
+config ARCH_BOARD_STM32H745I_DISCO
+ bool "STM32H745I-DISCO board"
+ depends on ARCH_CHIP_STM32H745XI
+ select ARCH_HAVE_LEDS
+ select ARCH_HAVE_BUTTONS
+ ---help---
+ STMicro STM32H745I-DISCO board based on the STMicro
+ STM32H745XI MCU.
+
config ARCH_BOARD_NUCLEO_L152RE
bool "STM32L152 Nucleo L152RE"
depends on ARCH_CHIP_STM32L152RE
@@ -2983,6 +2992,7 @@ config ARCH_BOARD
default "nucleo-g071rb" if ARCH_BOARD_NUCLEO_G071RB
default "nucleo-h743zi" if ARCH_BOARD_NUCLEO_H743ZI
default "nucleo-h743zi2" if ARCH_BOARD_NUCLEO_H743ZI2
+ default "stm32h745i-disco" if ARCH_BOARD_STM32H745I_DISCO
default "nucleo-l073rz" if ARCH_BOARD_NUCLEO_L073RZ
default "nucleo-l152re" if ARCH_BOARD_NUCLEO_L152RE
default "nucleo-l432kc" if ARCH_BOARD_NUCLEO_L432KC
@@ -3551,6 +3561,9 @@ endif
if ARCH_BOARD_NUCLEO_H743ZI2
source "boards/arm/stm32h7/nucleo-h743zi2/Kconfig"
endif
+if ARCH_BOARD_STM32H745I_DISCO
+source "boards/arm/stm32h7/stm32h745i-disco/Kconfig"
+endif
if ARCH_BOARD_B_L475E_IOT01A
source "boards/arm/stm32l4/b-l475e-iot01a/Kconfig"
endif
diff --git a/boards/arm/stm32h7/stm32h745i-disco/CMakeLists.txt b/boards/arm/stm32h7/stm32h745i-disco/CMakeLists.txt
new file mode 100644
index 0000000000..9a11a7f4c8
--- /dev/null
+++ b/boards/arm/stm32h7/stm32h745i-disco/CMakeLists.txt
@@ -0,0 +1,21 @@
+# ##############################################################################
+# boards/arm/stm32h7/stm32h745i-disco/CMakeLists.txt
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more contributor
+# license agreements. See the NOTICE file distributed with this work for
+# additional information regarding copyright ownership. The ASF licenses this
+# file to you under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+#
+# ##############################################################################
+
+add_subdirectory(src)
diff --git a/boards/arm/stm32h7/stm32h745i-disco/Kconfig b/boards/arm/stm32h7/stm32h745i-disco/Kconfig
new file mode 100644
index 0000000000..d850d66e8c
--- /dev/null
+++ b/boards/arm/stm32h7/stm32h745i-disco/Kconfig
@@ -0,0 +1,8 @@
+#
+# For a description of the syntax of this configuration file,
+# see the file kconfig-language.txt in the NuttX tools repository.
+#
+
+if ARCH_BOARD_STM32H745I_DISCO
+
+endif # ARCH_BOARD_STM32H745I_DISCO
diff --git a/boards/arm/stm32h7/stm32h745i-disco/configs/lvgl/defconfig b/boards/arm/stm32h7/stm32h745i-disco/configs/lvgl/defconfig
new file mode 100644
index 0000000000..002ea81a6d
--- /dev/null
+++ b/boards/arm/stm32h7/stm32h745i-disco/configs/lvgl/defconfig
@@ -0,0 +1,73 @@
+#
+# This file is autogenerated: PLEASE DO NOT EDIT IT.
+#
+# You can use "make menuconfig" to make any modifications to the installed .config file.
+# You can then do "make savedefconfig" to generate a new defconfig file that includes your
+# modifications.
+#
+# CONFIG_STANDARD_SERIAL is not set
+# CONFIG_STM32H7_FB_CMAP is not set
+# CONFIG_STM32H7_LTDC_L1_CHROMAKEYEN is not set
+# CONFIG_STM32H7_LTDC_L2 is not set
+# CONFIG_STM32H7_USE_LEGACY_PINMAP is not set
+CONFIG_ARCH="arm"
+CONFIG_ARCH_BOARD="stm32h745i-disco"
+CONFIG_ARCH_BOARD_STM32H745I_DISCO=y
+CONFIG_ARCH_CHIP="stm32h7"
+CONFIG_ARCH_CHIP_STM32H745XI=y
+CONFIG_ARCH_CHIP_STM32H7=y
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARMV7M_DCACHE=y
+CONFIG_ARMV7M_DCACHE_WRITETHROUGH=y
+CONFIG_ARMV7M_DTCM=y
+CONFIG_ARMV7M_ICACHE=y
+CONFIG_BOARD_LOOPSPERMSEC=43103
+CONFIG_BUILTIN=y
+CONFIG_DEV_URANDOM=y
+CONFIG_DEV_ZERO=y
+CONFIG_DRIVERS_VIDEO=y
+CONFIG_EXAMPLES_FB=y
+CONFIG_EXAMPLES_LVGLDEMO=y
+CONFIG_EXAMPLES_TOUCHSCREEN=y
+CONFIG_FS_PROCFS=y
+CONFIG_FT5X06_NPOLLWAITERS=8
+CONFIG_FT5X06_POLLMODE=y
+CONFIG_FT5X06_SINGLEPOINT=y
+CONFIG_FT5X06_SWAPXY=y
+CONFIG_FT5X06_THRESHX=9
+CONFIG_FT5X06_THRESHY=15
+CONFIG_GRAPHICS_LVGL=y
+CONFIG_INIT_ENTRYPOINT="nsh_main"
+CONFIG_INPUT=y
+CONFIG_INPUT_FT5X06=y
+CONFIG_INTELHEX_BINARY=y
+CONFIG_MQ_MAXMSGSIZE=256
+CONFIG_NSH_ARCHINIT=y
+CONFIG_NSH_BUILTIN_APPS=y
+CONFIG_NSH_DISABLE_IFUPDOWN=y
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_READLINE=y
+CONFIG_PREALLOC_TIMERS=4
+CONFIG_RAM_SIZE=245760
+CONFIG_RAM_START=0x20010000
+CONFIG_RAW_BINARY=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_HPWORK=y
+CONFIG_SCHED_WAITPID=y
+CONFIG_SERIAL_TERMIOS=y
+CONFIG_SIG_DEFAULT=y
+CONFIG_START_DAY=6
+CONFIG_START_MONTH=12
+CONFIG_START_YEAR=2011
+CONFIG_STM32H7_DMA1=y
+CONFIG_STM32H7_DMA2=y
+CONFIG_STM32H7_I2C4=y
+CONFIG_STM32H7_LTDC=y
+CONFIG_STM32H7_LTDC_FB_BASE=0x24020000
+CONFIG_STM32H7_LTDC_FB_SIZE=261120
+CONFIG_STM32H7_USART3=y
+CONFIG_SYSTEM_NSH=y
+CONFIG_TTY_SIGINT=y
+CONFIG_USART3_SERIAL_CONSOLE=y
+CONFIG_VIDEO_FB=y
diff --git a/boards/arm/stm32h7/stm32h745i-disco/configs/netnsh/defconfig b/boards/arm/stm32h7/stm32h745i-disco/configs/netnsh/defconfig
new file mode 100644
index 0000000000..58186cad51
--- /dev/null
+++ b/boards/arm/stm32h7/stm32h745i-disco/configs/netnsh/defconfig
@@ -0,0 +1,86 @@
+#
+# This file is autogenerated: PLEASE DO NOT EDIT IT.
+#
+# You can use "make menuconfig" to make any modifications to the installed .config file.
+# You can then do "make savedefconfig" to generate a new defconfig file that includes your
+# modifications.
+#
+# CONFIG_STANDARD_SERIAL is not set
+# CONFIG_STM32H7_USE_LEGACY_PINMAP is not set
+CONFIG_ARCH="arm"
+CONFIG_ARCH_BOARD="stm32h745i-disco"
+CONFIG_ARCH_BOARD_STM32H745I_DISCO=y
+CONFIG_ARCH_CHIP="stm32h7"
+CONFIG_ARCH_CHIP_STM32H745XI=y
+CONFIG_ARCH_CHIP_STM32H7=y
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARMV7M_DCACHE=y
+CONFIG_ARMV7M_DCACHE_WRITETHROUGH=y
+CONFIG_ARMV7M_DTCM=y
+CONFIG_ARMV7M_ICACHE=y
+CONFIG_BOARD_LOOPSPERMSEC=43103
+CONFIG_BUILTIN=y
+CONFIG_DEBUG_ERROR=y
+CONFIG_DEBUG_FEATURES=y
+CONFIG_DEBUG_INFO=y
+CONFIG_DEBUG_NET=y
+CONFIG_DEBUG_NET_ERROR=y
+CONFIG_DEBUG_SYMBOLS=y
+CONFIG_DEBUG_WARN=y
+CONFIG_ETH0_PHY_LAN8740A=y
+CONFIG_FS_PROCFS=y
+CONFIG_INIT_ENTRYPOINT="nsh_main"
+CONFIG_INTELHEX_BINARY=y
+CONFIG_MM_REGIONS=4
+CONFIG_NET=y
+CONFIG_NETDB_DNSCLIENT=y
+CONFIG_NETDB_DNSSERVER_IPv4ADDR=0x08080808
+CONFIG_NETINIT_DHCPC=y
+CONFIG_NETINIT_DRIPADDR=0x08080808
+CONFIG_NETINIT_NOMAC=y
+CONFIG_NETUTILS_DISCOVER=y
+CONFIG_NETUTILS_TELNETD=y
+CONFIG_NET_ARP_IPIN=y
+CONFIG_NET_ARP_SEND=y
+CONFIG_NET_BROADCAST=y
+CONFIG_NET_ETH_PKTSIZE=1500
+CONFIG_NET_ICMP=y
+CONFIG_NET_ICMP_SOCKET=y
+CONFIG_NET_IGMP=y
+CONFIG_NET_ROUTE=y
+CONFIG_NET_STATISTICS=y
+CONFIG_NET_TCP=y
+CONFIG_NET_UDP=y
+CONFIG_NET_UDP_CHECKSUMS=y
+CONFIG_NSH_ARCHINIT=y
+CONFIG_NSH_BUILTIN_APPS=y
+CONFIG_NSH_DISABLE_IFUPDOWN=y
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_READLINE=y
+CONFIG_PREALLOC_TIMERS=4
+CONFIG_RAM_SIZE=245760
+CONFIG_RAM_START=0x20010000
+CONFIG_RAW_BINARY=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_LPWORK=y
+CONFIG_SCHED_WAITPID=y
+CONFIG_START_DAY=6
+CONFIG_START_MONTH=12
+CONFIG_START_YEAR=2011
+CONFIG_STM32H7_ETHMAC=y
+CONFIG_STM32H7_MII=y
+CONFIG_STM32H7_PHYADDR=1
+CONFIG_STM32H7_PHYSR=31
+CONFIG_STM32H7_PHYSR_100FD=0x0018
+CONFIG_STM32H7_PHYSR_100HD=0x0008
+CONFIG_STM32H7_PHYSR_10FD=0x0014
+CONFIG_STM32H7_PHYSR_10HD=0x0004
+CONFIG_STM32H7_PHYSR_ALTCONFIG=y
+CONFIG_STM32H7_PHYSR_ALTMODE=0x001c
+CONFIG_STM32H7_USART3=y
+CONFIG_SYSTEM_DHCPC_RENEW=y
+CONFIG_SYSTEM_NSH=y
+CONFIG_SYSTEM_PING=y
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_USART3_SERIAL_CONSOLE=y
diff --git a/boards/arm/stm32h7/stm32h745i-disco/configs/nsh/defconfig b/boards/arm/stm32h7/stm32h745i-disco/configs/nsh/defconfig
new file mode 100644
index 0000000000..7f3b80bd46
--- /dev/null
+++ b/boards/arm/stm32h7/stm32h745i-disco/configs/nsh/defconfig
@@ -0,0 +1,49 @@
+#
+# This file is autogenerated: PLEASE DO NOT EDIT IT.
+#
+# You can use "make menuconfig" to make any modifications to the installed .config file.
+# You can then do "make savedefconfig" to generate a new defconfig file that includes your
+# modifications.
+#
+# CONFIG_NSH_DISABLE_IFCONFIG is not set
+# CONFIG_NSH_DISABLE_PS is not set
+# CONFIG_STANDARD_SERIAL is not set
+# CONFIG_STM32H7_USE_LEGACY_PINMAP is not set
+CONFIG_ARCH="arm"
+CONFIG_ARCH_BOARD="stm32h745i-disco"
+CONFIG_ARCH_BOARD_STM32H745I_DISCO=y
+CONFIG_ARCH_CHIP="stm32h7"
+CONFIG_ARCH_CHIP_STM32H745XI=y
+CONFIG_ARCH_CHIP_STM32H7=y
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARMV7M_DCACHE=y
+CONFIG_ARMV7M_DCACHE_WRITETHROUGH=y
+CONFIG_ARMV7M_DTCM=y
+CONFIG_ARMV7M_ICACHE=y
+CONFIG_BOARD_LOOPSPERMSEC=43103
+CONFIG_BUILTIN=y
+CONFIG_DEBUG_ERROR=y
+CONFIG_DEBUG_FEATURES=y
+CONFIG_DEBUG_INFO=y
+CONFIG_DEBUG_SYMBOLS=y
+CONFIG_DEBUG_WARN=y
+CONFIG_INIT_ENTRYPOINT="nsh_main"
+CONFIG_INTELHEX_BINARY=y
+CONFIG_MM_REGIONS=4
+CONFIG_NSH_BUILTIN_APPS=y
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_READLINE=y
+CONFIG_PREALLOC_TIMERS=4
+CONFIG_RAM_SIZE=245760
+CONFIG_RAM_START=0x20010000
+CONFIG_RAW_BINARY=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_WAITPID=y
+CONFIG_START_DAY=6
+CONFIG_START_MONTH=12
+CONFIG_START_YEAR=2011
+CONFIG_STM32H7_USART3=y
+CONFIG_SYSTEM_NSH=y
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_USART3_SERIAL_CONSOLE=y
diff --git a/boards/arm/stm32h7/stm32h745i-disco/configs/touchtest/defconfig b/boards/arm/stm32h7/stm32h745i-disco/configs/touchtest/defconfig
new file mode 100644
index 0000000000..067abf1f36
--- /dev/null
+++ b/boards/arm/stm32h7/stm32h745i-disco/configs/touchtest/defconfig
@@ -0,0 +1,59 @@
+#
+# This file is autogenerated: PLEASE DO NOT EDIT IT.
+#
+# You can use "make menuconfig" to make any modifications to the installed .config file.
+# You can then do "make savedefconfig" to generate a new defconfig file that includes your
+# modifications.
+#
+# CONFIG_STANDARD_SERIAL is not set
+# CONFIG_STM32H7_USE_LEGACY_PINMAP is not set
+CONFIG_ARCH="arm"
+CONFIG_ARCH_BOARD="stm32h745i-disco"
+CONFIG_ARCH_BOARD_STM32H745I_DISCO=y
+CONFIG_ARCH_CHIP="stm32h7"
+CONFIG_ARCH_CHIP_STM32H745XI=y
+CONFIG_ARCH_CHIP_STM32H7=y
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARMV7M_DCACHE=y
+CONFIG_ARMV7M_DCACHE_WRITETHROUGH=y
+CONFIG_ARMV7M_DTCM=y
+CONFIG_ARMV7M_ICACHE=y
+CONFIG_BOARD_LOOPSPERMSEC=43103
+CONFIG_BUILTIN=y
+CONFIG_EXAMPLES_TOUCHSCREEN=y
+CONFIG_FS_PROCFS=y
+CONFIG_FT5X06_NPOLLWAITERS=8
+CONFIG_FT5X06_POLLMODE=y
+CONFIG_FT5X06_SINGLEPOINT=y
+CONFIG_FT5X06_SWAPXY=y
+CONFIG_FT5X06_THRESHX=9
+CONFIG_FT5X06_THRESHY=15
+CONFIG_INIT_ENTRYPOINT="nsh_main"
+CONFIG_INPUT=y
+CONFIG_INPUT_FT5X06=y
+CONFIG_INTELHEX_BINARY=y
+CONFIG_IOB_NBUFFERS=24
+CONFIG_IOB_NCHAINS=24
+CONFIG_MM_IOB=y
+CONFIG_MM_REGIONS=4
+CONFIG_NSH_ARCHINIT=y
+CONFIG_NSH_BUILTIN_APPS=y
+CONFIG_NSH_DISABLE_IFUPDOWN=y
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_READLINE=y
+CONFIG_PREALLOC_TIMERS=4
+CONFIG_RAM_SIZE=245760
+CONFIG_RAM_START=0x20010000
+CONFIG_RAW_BINARY=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_LPWORK=y
+CONFIG_SCHED_WAITPID=y
+CONFIG_START_DAY=6
+CONFIG_START_MONTH=12
+CONFIG_START_YEAR=2011
+CONFIG_STM32H7_I2C4=y
+CONFIG_STM32H7_USART3=y
+CONFIG_SYSTEM_NSH=y
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_USART3_SERIAL_CONSOLE=y
diff --git a/boards/arm/stm32h7/stm32h745i-disco/include/board.h b/boards/arm/stm32h7/stm32h745i-disco/include/board.h
new file mode 100644
index 0000000000..948e632583
--- /dev/null
+++ b/boards/arm/stm32h7/stm32h745i-disco/include/board.h
@@ -0,0 +1,504 @@
+/****************************************************************************
+ * boards/arm/stm32h7/stm32h745i-disco/include/board.h
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+#ifndef __BOARDS_ARM_STM32H7_STM32H745I_DISCO_INCLUDE_BOARD_H
+#define __BOARDS_ARM_STM32H7_STM32H745I_DISCO_INCLUDE_BOARD_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#ifndef __ASSEMBLY__
+# include <stdint.h>
+#endif
+
+/* Do not include STM32 H7 header files here */
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/* Clocking *****************************************************************/
+
+/* The STM32H745I-DISCO board provides the following clock sources:
+ *
+ * X3: 32.768 KHz crystal for LSE
+ * X2: 25 MHz HSE crystal oscillator
+ *
+ * So we have these clock source available within the STM32
+ *
+ * HSI: 16 MHz RC factory-trimmed
+ * LSI: 32 KHz RC
+ * HSE: 25 MHz oscillator X2
+ * LSE: 32.768 kHz
+ */
+
+#define STM32_HSI_FREQUENCY 16000000ul
+#define STM32_LSI_FREQUENCY 32000
+#define STM32_HSE_FREQUENCY 25000000ul
+#define STM32_LSE_FREQUENCY 32768
+
+/* Main PLL Configuration.
+ *
+ * PLL source is HSE = 25,000,000
+ *
+ * When STM32_HSE_FREQUENCY / PLLM <= 2MHz VCOL must be selected.
+ * VCOH otherwise.
+ *
+ * PLL_VCOx = (STM32_HSE_FREQUENCY / PLLM) * PLLN
+ * Subject to:
+ *
+ * 1 <= PLLM <= 63
+ * 4 <= PLLN <= 512
+ * 150 MHz <= PLL_VCOL <= 420MHz
+ * 192 MHz <= PLL_VCOH <= 836MHz
+ *
+ * SYSCLK = PLL_VCO / PLLP
+ * CPUCLK = SYSCLK / D1CPRE
+ * Subject to
+ *
+ * PLLP1 = {2, 4, 6, 8, ..., 128}
+ * PLLP2,3 = {2, 3, 4, ..., 128}
+ * CPUCLK <= 400 MHz
+ */
+
+#define STM32_BOARD_USEHSE
+#define STM32_HSEBYP_ENABLE
+
+#define STM32_PLLCFG_PLLSRC RCC_PLLCKSELR_PLLSRC_HSE
+
+/* PLL1, wide 4 - 8 MHz input, enable DIVP, DIVQ, DIVR
+ *
+ * PLL1_VCO = (25,000,000 / 5) * 160 = 800 MHz
+ *
+ * PLL1P = PLL1_VCO/2 = 800 MHz / 2 = 400 MHz
+ * PLL1Q = PLL1_VCO/4 = 800 MHz / 4 = 200 MHz
+ * PLL1R = PLL1_VCO/8 = 800 MHz / 8 = 100 MHz
+ */
+
+#define STM32_PLLCFG_PLL1CFG (RCC_PLLCFGR_PLL1VCOSEL_WIDE | \
+ RCC_PLLCFGR_PLL1RGE_4_8_MHZ | \
+ RCC_PLLCFGR_DIVP1EN | \
+ RCC_PLLCFGR_DIVQ1EN | \
+ RCC_PLLCFGR_DIVR1EN)
+#define STM32_PLLCFG_PLL1M RCC_PLLCKSELR_DIVM1(5)
+#define STM32_PLLCFG_PLL1N RCC_PLL1DIVR_N1(160)
+#define STM32_PLLCFG_PLL1P RCC_PLL1DIVR_P1(2)
+#define STM32_PLLCFG_PLL1Q RCC_PLL1DIVR_Q1(4)
+#define STM32_PLLCFG_PLL1R RCC_PLL1DIVR_R1(8)
+
+#define STM32_VCO1_FREQUENCY ((STM32_HSE_FREQUENCY / 5) * 160)
+#define STM32_PLL1P_FREQUENCY (STM32_VCO1_FREQUENCY / 2)
+#define STM32_PLL1Q_FREQUENCY (STM32_VCO1_FREQUENCY / 4)
+#define STM32_PLL1R_FREQUENCY (STM32_VCO1_FREQUENCY / 8)
+
+/* PLL2 */
+
+#define STM32_PLLCFG_PLL2CFG (RCC_PLLCFGR_PLL2VCOSEL_WIDE | \
+ RCC_PLLCFGR_PLL2RGE_4_8_MHZ | \
+ RCC_PLLCFGR_DIVP2EN)
+#define STM32_PLLCFG_PLL2M RCC_PLLCKSELR_DIVM2(5)
+#define STM32_PLLCFG_PLL2N RCC_PLL2DIVR_N2(160)
+#define STM32_PLLCFG_PLL2P RCC_PLL2DIVR_P2(2)
+#define STM32_PLLCFG_PLL2Q 4
+#define STM32_PLLCFG_PLL2R 4
+
+#define STM32_VCO2_FREQUENCY ((STM32_HSE_FREQUENCY / 5) * 160)
+#define STM32_PLL2P_FREQUENCY (STM32_VCO2_FREQUENCY / 2)
+#define STM32_PLL2Q_FREQUENCY
+#define STM32_PLL2R_FREQUENCY
+
+/* PLL3 is defined to 9 MHz to use with LCD */
+
+#define STM32_PLLCFG_PLL3CFG (RCC_PLLCFGR_PLL3VCOSEL_WIDE | \
+ RCC_PLLCFGR_PLL3RGE_4_8_MHZ | \
+ RCC_PLLCFGR_DIVP3EN | \
+ RCC_PLLCFGR_DIVQ3EN | \
+ RCC_PLLCFGR_DIVR3EN)
+#define STM32_PLLCFG_PLL3M RCC_PLLCKSELR_DIVM3(5)
+#define STM32_PLLCFG_PLL3N RCC_PLL3DIVR_N3(160)
+#define STM32_PLLCFG_PLL3P RCC_PLL3DIVR_P3(2)
+#define STM32_PLLCFG_PLL3Q RCC_PLL3DIVR_Q3(2)
+#define STM32_PLLCFG_PLL3R RCC_PLL3DIVR_R3(88)
+
+#define STM32_VCO3_FREQUENCY ((STM32_HSE_FREQUENCY / 1) * 6)
+#define STM32_PLL3P_FREQUENCY (STM32_VCO3_FREQUENCY / 2)
+#define STM32_PLL3Q_FREQUENCY (STM32_VCO3_FREQUENCY / 2)
+#define STM32_PLL3R_FREQUENCY (STM32_VCO3_FREQUENCY / 3)
+
+/* SYSCLK = PLL1P = 400 MHz
+ * CPUCLK = SYSCLK / 1 = 400 MHz
+ */
+
+#define STM32_RCC_D1CFGR_D1CPRE (RCC_D1CFGR_D1CPRE_SYSCLK)
+#define STM32_SYSCLK_FREQUENCY (STM32_PLL1P_FREQUENCY)
+#define STM32_CPUCLK_FREQUENCY (STM32_SYSCLK_FREQUENCY / 1)
+
+/* Configure Clock Assignments */
+
+/* AHB clock (HCLK) is SYSCLK/2 (200 MHz max)
+ * HCLK1 = HCLK2 = HCLK3 = HCLK4
+ */
+
+#define STM32_RCC_D1CFGR_HPRE RCC_D1CFGR_HPRE_SYSCLKd2 /* HCLK = SYSCLK / 2 */
+#define STM32_ACLK_FREQUENCY (STM32_CPUCLK_FREQUENCY / 2) /* ACLK in D1, HCLK3 in D1 */
+#define STM32_HCLK_FREQUENCY (STM32_CPUCLK_FREQUENCY / 2) /* HCLK in D2, HCLK4 in D3 */
+
+/* APB1 clock (PCLK1) is HCLK/4 (54 MHz) */
+
+#define STM32_RCC_D2CFGR_D2PPRE1 RCC_D2CFGR_D2PPRE1_HCLKd2 /* PCLK1 = HCLK / 4 */
+#define STM32_PCLK1_FREQUENCY (STM32_HCLK_FREQUENCY/2)
+
+/* APB2 clock (PCLK2) is HCLK/4 (54 MHz) */
+
+#define STM32_RCC_D2CFGR_D2PPRE2 RCC_D2CFGR_D2PPRE2_HCLKd2 /* PCLK2 = HCLK / 4 */
+#define STM32_PCLK2_FREQUENCY (STM32_HCLK_FREQUENCY/2)
+
+/* APB3 clock (PCLK3) is HCLK/4 (54 MHz) */
+
+#define STM32_RCC_D1CFGR_D1PPRE RCC_D1CFGR_D1PPRE_HCLKd2 /* PCLK3 = HCLK / 4 */
+#define STM32_PCLK3_FREQUENCY (STM32_HCLK_FREQUENCY/2)
+
+/* APB4 clock (PCLK4) is HCLK/4 (54 MHz) */
+
+#define STM32_RCC_D3CFGR_D3PPRE RCC_D3CFGR_D3PPRE_HCLKd2 /* PCLK4 = HCLK / 4 */
+#define STM32_PCLK4_FREQUENCY (STM32_HCLK_FREQUENCY/4)
+
+/* Timer clock frequencies */
+
+/* Timers driven from APB1 will be twice PCLK1 */
+
+#define STM32_APB1_TIM2_CLKIN (2*STM32_PCLK1_FREQUENCY)
+#define STM32_APB1_TIM3_CLKIN (2*STM32_PCLK1_FREQUENCY)
+#define STM32_APB1_TIM4_CLKIN (2*STM32_PCLK1_FREQUENCY)
+#define STM32_APB1_TIM5_CLKIN (2*STM32_PCLK1_FREQUENCY)
+#define STM32_APB1_TIM6_CLKIN (2*STM32_PCLK1_FREQUENCY)
+#define STM32_APB1_TIM7_CLKIN (2*STM32_PCLK1_FREQUENCY)
+#define STM32_APB1_TIM12_CLKIN (2*STM32_PCLK1_FREQUENCY)
+#define STM32_APB1_TIM13_CLKIN (2*STM32_PCLK1_FREQUENCY)
+#define STM32_APB1_TIM14_CLKIN (2*STM32_PCLK1_FREQUENCY)
+
+/* Timers driven from APB2 will be twice PCLK2 */
+
+#define STM32_APB2_TIM1_CLKIN (2*STM32_PCLK2_FREQUENCY)
+#define STM32_APB2_TIM8_CLKIN (2*STM32_PCLK2_FREQUENCY)
+#define STM32_APB2_TIM15_CLKIN (2*STM32_PCLK2_FREQUENCY)
+#define STM32_APB2_TIM16_CLKIN (2*STM32_PCLK2_FREQUENCY)
+#define STM32_APB2_TIM17_CLKIN (2*STM32_PCLK2_FREQUENCY)
+
+/* Kernel Clock Configuration
+ *
+ * Note: look at Table 54 in ST Manual
+ */
+
+/* I2C123 clock source - HSI */
+
+#define STM32_RCC_D2CCIP2R_I2C123SRC RCC_D2CCIP2R_I2C123SEL_HSI
+
+/* I2C4 clock source - HSI */
+
+#define STM32_RCC_D3CCIPR_I2C4SRC RCC_D3CCIPR_I2C4SEL_HSI
+
+/* SPI123 clock source - PLL1Q */
+
+#define STM32_RCC_D2CCIP1R_SPI123SRC RCC_D2CCIP1R_SPI123SEL_PLL1
+
+/* SPI45 clock source - APB (PCLK2?) */
+
+#define STM32_RCC_D2CCIP1R_SPI45SRC RCC_D2CCIP1R_SPI45SEL_APB
+
+/* SPI6 clock source - APB (PCLK4) */
+
+#define STM32_RCC_D3CCIPR_SPI6SRC RCC_D3CCIPR_SPI6SEL_PCLK4
+
+/* USB 1 and 2 clock source - HSI48 */
+
+#define STM32_RCC_D2CCIP2R_USBSRC RCC_D2CCIP2R_USBSEL_HSI48
+
+/* ADC 1 2 3 clock source - pll2_pclk */
+
+#define STM32_RCC_D3CCIPR_ADCSEL RCC_D3CCIPR_ADCSEL_PLL2
+
+/* FLASH wait states
+ *
+ * ------------ ---------- -----------
+ * Vcore MAX ACLK WAIT STATES
+ * ------------ ---------- -----------
+ * 1.15-1.26 V 70 MHz 0
+ * (VOS1 level) 140 MHz 1
+ * 210 MHz 2
+ * 1.05-1.15 V 55 MHz 0
+ * (VOS2 level) 110 MHz 1
+ * 165 MHz 2
+ * 220 MHz 3
+ * 0.95-1.05 V 45 MHz 0
+ * (VOS3 level) 90 MHz 1
+ * 135 MHz 2
+ * 180 MHz 3
+ * 225 MHz 4
+ * ------------ ---------- -----------
+ */
+
+#define BOARD_FLASH_WAITSTATES 4
+
+/* SDMMC definitions ********************************************************/
+
+/* Init 400kHz, PLL1Q/(2*250) */
+
+#define STM32_SDMMC_INIT_CLKDIV (250 << STM32_SDMMC_CLKCR_CLKDIV_SHIFT)
+
+/* Just set these to 25 MHz for now, PLL1Q/(2*4), default speed 12.5MB/s */
+
+#define STM32_SDMMC_MMCXFR_CLKDIV (4 << STM32_SDMMC_CLKCR_CLKDIV_SHIFT)
+#define STM32_SDMMC_SDXFR_CLKDIV (4 << STM32_SDMMC_CLKCR_CLKDIV_SHIFT)
+
+#define STM32_SDMMC_CLKCR_EDGE STM32_SDMMC_CLKCR_NEGEDGE
+
+/* Ethernet definitions *****************************************************/
+
+/* The STM32H7 connects to a LAN8740A PHY using these pins:
+ *
+ * STM32H7 BOARD LAN8740A
+ * GPIO SIGNAL PIN NAME
+ * -------- ------------ -------------
+ * - PA2 MII_MDIO MDIO
+ * - PC1 MII_MDC MDC
+ * - PH2 MII_CRS CRS
+ * - PH3 MII_COL COL/CRS_DV/MODE2
+ * - PI10 MII_RX_ER RXER/RXD4/PHYAD0
+ * - PA1 MII_RX_CLK RXCLK/PHYAD1
+ * - PC4 MII_RXD0 RXD0/MODE0
+ * - PC5 MII_RXD1 RXD1/MODE1
+ * - PB0 MII_RXD2 RXD2/nPME/RMIISE
+ * - PB1 MII_RXD3 RXD3/PHYAD2
+ * - PC3 MII_TX_CLK TXCLK
+ * - PG13 MII_TXD0 TXD0
+ * - PG12 MII_TXD1 TXD1
+ * - PC2 MII_TXD2 TXD2
+ * - PE2 MII_TXD3 TXD3
+ * - PA7 MII_RX_DV RXDV
+ * - PG11 MII_TX_EN TXEN
+ * - PB2 nINT nINT/TXER/TXD4
+ */
+
+#define GPIO_ETH_MII_CRS GPIO_ETH_MII_CRS_2
+#define GPIO_ETH_MII_COL GPIO_ETH_MII_COL_2
+#define GPIO_ETH_MII_RX_ER GPIO_ETH_MII_RX_ER_2
+#define GPIO_ETH_MII_RXD2 GPIO_ETH_MII_RXD2_1
+#define GPIO_ETH_MII_RXD3 GPIO_ETH_MII_RXD3_1
+#define GPIO_ETH_MII_TX_EN GPIO_ETH_MII_TX_EN_2
+#define GPIO_ETH_MII_TXD0 GPIO_ETH_MII_TXD0_2
+#define GPIO_ETH_MII_TXD1 GPIO_ETH_MII_TXD1_2
+#define GPIO_ETH_MII_TXD3 GPIO_ETH_MII_TXD3_2
+#define GPIO_ETH_RMII_TX_EN GPIO_ETH_RMII_TX_EN_2
+
+#define GPIO_ETH_MDC (GPIO_ETH_MDC_0 | GPIO_SPEED_100MHz)
+#define GPIO_ETH_MDIO (GPIO_ETH_MDIO_0 | GPIO_SPEED_100MHz)
+#define GPIO_ETH_MII_RXD0 (GPIO_ETH_MII_RXD0_0 | GPIO_SPEED_100MHz)
+#define GPIO_ETH_MII_RXD1 (GPIO_ETH_MII_RXD1_0 | GPIO_SPEED_100MHz)
+#define GPIO_ETH_MII_RX_CLK (GPIO_ETH_MII_RX_CLK_0 | GPIO_SPEED_100MHz)
+#define GPIO_ETH_MII_RX_DV (GPIO_ETH_MII_RX_DV_0 | GPIO_SPEED_100MHz)
+#define GPIO_ETH_MII_TXD2 (GPIO_ETH_MII_TXD2_0 | GPIO_SPEED_100MHz)
+#define GPIO_ETH_MII_TX_CLK (GPIO_ETH_MII_TX_CLK_0 | GPIO_SPEED_100MHz)
+#define GPIO_ETH_RMII_TXD0 (GPIO_ETH_RMII_TXD0_2 | GPIO_SPEED_100MHz)
+#define GPIO_ETH_RMII_TXD1 (GPIO_ETH_RMII_TXD1_1 | GPIO_SPEED_100MHz)
+#define GPIO_ETH_RMII_TX_EN (GPIO_ETH_RMII_TX_EN_2 | GPIO_SPEED_100MHz)
+
+/* LED definitions **********************************************************/
+
+/* The board has 4 user LEDs.
+ * LD1 Green PI12
+ * LD2 Orange PI13
+ * LD3 Red PI14
+ * LD4 Blue PI15
+ *
+ * If CONFIG_ARCH_LEDS is not defined, then the user can control the LEDs
+ * in any way. The following definitions are used to access individual LEDs.
+ */
+
+/* LED index values for use with board_userled() */
+
+#define BOARD_LED1 0
+#define BOARD_LED2 1
+#define BOARD_LED3 2
+#define BOARD_NLEDS 3
+
+#define BOARD_LED_GREEN BOARD_LED1
+#define BOARD_LED_BLUE BOARD_LED2
+#define BOARD_LED_RED BOARD_LED3
+
+/* LED bits for use with board_userled_all() */
+
+#define BOARD_LED1_BIT (1 << BOARD_LED1)
+#define BOARD_LED2_BIT (1 << BOARD_LED2)
+#define BOARD_LED3_BIT (1 << BOARD_LED3)
+
+/* If CONFIG_ARCH_LEDS is defined, the usage by the board port is defined in
+ * include/board.h and src/stm32_leds.c. The LEDs are used to encode
+ * OS-related events as follows:
+ *
+ *
+ * SYMBOL Meaning LED state
+ * Red Green Blue
+ * ---------------------- -------------------------- ------ ------ ----
+ */
+
+#define LED_STARTED 0 /* NuttX has been started OFF OFF OFF */
+#define LED_HEAPALLOCATE 1 /* Heap has been allocated OFF OFF ON */
+#define LED_IRQSENABLED 2 /* Interrupts enabled OFF ON OFF */
+#define LED_STACKCREATED 3 /* Idle stack created OFF ON ON */
+#define LED_INIRQ 4 /* In an interrupt N/C N/C GLOW */
+#define LED_SIGNAL 5 /* In a signal handler N/C GLOW N/C */
+#define LED_ASSERTION 6 /* An assertion failed GLOW N/C GLOW */
+#define LED_PANIC 7 /* The system has crashed Blink OFF N/C */
+#define LED_IDLE 8 /* MCU is is sleep mode ON OFF OFF */
+
+/* Thus if the Green LED is statically on, NuttX has successfully booted and
+ * is, apparently, running normally. If the Red LED is flashing at
+ * approximately 2Hz, then a fatal error has been detected and the system
+ * has halted.
+ */
+
+/* Button definitions *******************************************************/
+
+/* The NUCLEO board supports one button: Pushbutton B1, labeled "User", is
+ * connected to GPIO PI11.
+ * A high value will be sensed when the button is depressed.
+ */
+
+#define BUTTON_USER 0
+#define NUM_BUTTONS 1
+#define BUTTON_USER_BIT (1 << BUTTON_USER)
+
+/* Alternate function pin selections ****************************************/
+
+/* USART3 (Nucleo Virtual Console) */
+
+#define GPIO_USART3_RX (GPIO_USART3_RX_1 | GPIO_SPEED_100MHz) /* PB11 */
+#define GPIO_USART3_TX (GPIO_USART3_TX_1 | GPIO_SPEED_100MHz) /* PB10 */
+
+/* I2C4 - Used by Touchscreen and Audio Codec */
+
+#define GPIO_I2C4_SCL (GPIO_I2C4_SCL_1 | GPIO_SPEED_50MHz) /* PD12 */
+#define GPIO_I2C4_SDA (GPIO_I2C4_SDA_1 | GPIO_SPEED_50MHz) /* PD13 */
+
+/* LTDC */
+
+#define GPIO_LTDC_R0 (GPIO_LTDC_R0_3 | GPIO_SPEED_100MHz)
+#define GPIO_LTDC_R1 (GPIO_LTDC_R1_3 | GPIO_SPEED_100MHz)
+#define GPIO_LTDC_R2 (GPIO_LTDC_R2_4 | GPIO_SPEED_100MHz)
+#define GPIO_LTDC_R3 (GPIO_LTDC_R3_3 | GPIO_SPEED_100MHz)
+#define GPIO_LTDC_R4 (GPIO_LTDC_R4_4 | GPIO_SPEED_100MHz)
+#define GPIO_LTDC_R5 (GPIO_LTDC_R5_4 | GPIO_SPEED_100MHz)
+#define GPIO_LTDC_R6 (GPIO_LTDC_R6_4 | GPIO_SPEED_100MHz)
+#define GPIO_LTDC_R7 (GPIO_LTDC_R7_3 | GPIO_SPEED_100MHz)
+
+#define GPIO_LTDC_G0 (GPIO_LTDC_G0_2 | GPIO_SPEED_100MHz)
+#define GPIO_LTDC_G1 (GPIO_LTDC_G1_2 | GPIO_SPEED_100MHz)
+#define GPIO_LTDC_G2 (GPIO_LTDC_G2_3 | GPIO_SPEED_100MHz)
+#define GPIO_LTDC_G3 (GPIO_LTDC_G3_4 | GPIO_SPEED_100MHz)
+#define GPIO_LTDC_G4 (GPIO_LTDC_G4_3 | GPIO_SPEED_100MHz)
+#define GPIO_LTDC_G5 (GPIO_LTDC_G5_3 | GPIO_SPEED_100MHz)
+#define GPIO_LTDC_G6 (GPIO_LTDC_G6_3 | GPIO_SPEED_100MHz)
+#define GPIO_LTDC_G7 (GPIO_LTDC_G7_3 | GPIO_SPEED_100MHz)
+
+#define GPIO_LTDC_B0 (GPIO_LTDC_B0_1 | GPIO_SPEED_100MHz)
+#define GPIO_LTDC_B1 (GPIO_LTDC_B1_2 | GPIO_SPEED_100MHz)
+#define GPIO_LTDC_B2 (GPIO_LTDC_B2_3 | GPIO_SPEED_100MHz)
+#define GPIO_LTDC_B3 (GPIO_LTDC_B3_3 | GPIO_SPEED_100MHz)
+#define GPIO_LTDC_B4 (GPIO_LTDC_B4_4 | GPIO_SPEED_100MHz)
+#define GPIO_LTDC_B5 (GPIO_LTDC_B5_3 | GPIO_SPEED_100MHz)
+#define GPIO_LTDC_B6 (GPIO_LTDC_B6_3 | GPIO_SPEED_100MHz)
+#define GPIO_LTDC_B7 (GPIO_LTDC_B7_3 | GPIO_SPEED_100MHz)
+
+#define GPIO_LTDC_VSYNC (GPIO_LTDC_VSYNC_3 | GPIO_SPEED_100MHz)
+#define GPIO_LTDC_HSYNC (GPIO_LTDC_HSYNC_3 | GPIO_SPEED_100MHz)
+#define GPIO_LTDC_DE (GPIO_LTDC_DE_3 | GPIO_SPEED_100MHz)
+#define GPIO_LTDC_CLK (GPIO_LTDC_CLK_3 | GPIO_SPEED_100MHz)
+
+/* DMA **********************************************************************/
+
+#define DMAMAP_SPI3_RX DMAMAP_DMA12_SPI3RX_0 /* DMA1 */
+#define DMAMAP_SPI3_TX DMAMAP_DMA12_SPI3TX_0 /* DMA1 */
+
+/* LCD definitions */
+
+#define BOARD_LTDC_WIDTH 480
+#define BOARD_LTDC_HEIGHT 272
+
+#define BOARD_LTDC_OUTPUT_BPP 24
+#define BOARD_LTDC_HFP 32
+#define BOARD_LTDC_HBP 13
+#define BOARD_LTDC_VFP 2
+#define BOARD_LTDC_VBP 2
+#define BOARD_LTDC_HSYNC 41
+#define BOARD_LTDC_VSYNC 10
+
+#define BOARD_LTDC_PLLSAIN 192
+#define BOARD_LTDC_PLLSAIR 5
+
+/* Pixel Clock Polarity */
+
+#define BOARD_LTDC_GCR_PCPOL 0 /* !LTDC_GCR_PCPOL */
+
+/* Data Enable Polarity */
+
+#define BOARD_LTDC_GCR_DEPOL 0 /* !LTDC_GCR_DEPOL */
+
+/* Vertical Sync Polarity */
+
+#define BOARD_LTDC_GCR_VSPOL 0 /* !LTDC_GCR_VSPOL */
+
+/* Horizontal Sync Polarity */
+
+#define BOARD_LTDC_GCR_HSPOL 0 /* !LTDC_GCR_HSPOL */
+
+/* GPIO pinset */
+
+#define GPIO_LTDC_PINS 24 /* 24-bit display */
+
+/****************************************************************************
+ * Public Data
+ ****************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+#undef EXTERN
+#if defined(__cplusplus)
+#define EXTERN extern "C"
+extern "C"
+{
+#else
+#define EXTERN extern
+#endif
+
+/****************************************************************************
+ * Public Function Prototypes
+ ****************************************************************************/
+
+#undef EXTERN
+#if defined(__cplusplus)
+}
+#endif
+
+#endif /* __ASSEMBLY__ */
+#endif /* __BOARDS_ARM_STM32H7_STM32H745I_DISCO_INCLUDE_BOARD_H */
diff --git a/boards/arm/stm32h7/stm32h745i-disco/scripts/Make.defs b/boards/arm/stm32h7/stm32h745i-disco/scripts/Make.defs
new file mode 100644
index 0000000000..53f84d9234
--- /dev/null
+++ b/boards/arm/stm32h7/stm32h745i-disco/scripts/Make.defs
@@ -0,0 +1,48 @@
+############################################################################
+# boards/arm/stm32h7/stm32h745i-disco/scripts/Make.defs
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership. The
+# ASF licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the
+# License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+#
+############################################################################
+
+include $(TOPDIR)/.config
+include $(TOPDIR)/tools/Config.mk
+include $(TOPDIR)/arch/arm/src/armv7-m/Toolchain.defs
+
+LDSCRIPT = flash.ld
+
+ARCHSCRIPT += $(BOARD_DIR)$(DELIM)scripts$(DELIM)$(LDSCRIPT)
+
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS := $(ARCHCFLAGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS := $(ARCHCXXFLAGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe
+CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
+CPPFLAGS := $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS)
+AFLAGS := $(CFLAGS) -D__ASSEMBLY__
+
+NXFLATLDFLAGS1 = -r -d -warn-common
+NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat-pcrel.ld -no-check-sections
+LDNXFLATFLAGS = -e main -s 2048
+
+# ELF module definitions
+
+CELFFLAGS = $(CFLAGS) -mlong-calls # --target1-abs
+CXXELFFLAGS = $(CXXFLAGS) -mlong-calls # --target1-abs
+
+LDELFFLAGS = -r -e main
+LDELFFLAGS += -T $(call CONVERT_PATH,$(TOPDIR)/binfmt/libelf/gnu-elf.ld)
diff --git a/boards/arm/stm32h7/stm32h745i-disco/scripts/flash.ld b/boards/arm/stm32h7/stm32h745i-disco/scripts/flash.ld
new file mode 100644
index 0000000000..958e111c19
--- /dev/null
+++ b/boards/arm/stm32h7/stm32h745i-disco/scripts/flash.ld
@@ -0,0 +1,200 @@
+/****************************************************************************
+ * boards/arm/stm32h7/stm32h745i-disco/scripts/flash.ld
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/* The STM32H745ZI has 2048Kb of main FLASH memory. The flash memory is
+ * partitioned into a User Flash memory and a System Flash memory. Each
+ * of these memories has two banks:
+ *
+ * 1) User Flash memory:
+ *
+ * Bank 1: Start address 0x0800:0000 to 0x080F:FFFF with 8 sectors, 128Kb each
+ * Bank 2: Start address 0x0810:0000 to 0x081F:FFFF with 8 sectors, 128Kb each
+ *
+ * 2) System Flash memory:
+ *
+ * Bank 1: Start address 0x1FF0:0000 to 0x1FF1:FFFF with 1 x 128Kb sector
+ * Bank 1: Start address 0x1FF4:0000 to 0x1FF5:FFFF with 1 x 128Kb sector
+ *
+ * 3) User option bytes for user configuration, only in Bank 1.
+ *
+ * In the STM32H745ZI, two different boot spaces can be selected through
+ * the BOOT pin and the boot base address programmed in the BOOT_ADD0 and
+ * BOOT_ADD1 option bytes:
+ *
+ * 1) BOOT=0: Boot address defined by user option byte BOOT_ADD0[15:0].
+ * ST programmed value: Flash memory at 0x0800:0000
+ * 2) BOOT=1: Boot address defined by user option byte BOOT_ADD1[15:0].
+ * ST programmed value: System bootloader at 0x1FF0:0000
+ *
+ * TODO: Check next paragraph with nucleo schematics
+ *
+ * NuttX does not modify these option bytes. On the unmodified
+ * STM32H745I-DISCO board, the BOOT0 pin is at ground so by default, the
+ * STM32 will boot to address 0x0800:0000 in FLASH.
+ *
+ * The STM32H745ZI also has 1024Kb of data SRAM.
+ * SRAM is split up into several blocks and into three power domains:
+ *
+ * 1) TCM SRAMs are dedicated to the Cortex-M7 and are accessible with
+ * 0 wait states by the Cortex-M7 and by MDMA through AHBS slave bus
+ *
+ * 1.1) 128Kb of DTCM-RAM beginning at address 0x2000:0000
+ *
+ * The DTCM-RAM is organized as 2 x 64Kb DTCM-RAMs on 2 x 32 bit
+ * DTCM ports. The DTCM-RAM could be used for critical real-time
+ * data, such as interrupt service routines or stack / heap memory.
+ * Both DTCM-RAMs can be used in parallel (for load/store operations)
+ * thanks to the Cortex-M7 dual issue capability.
+ *
+ * 1.2) 64Kb of ITCM-RAM beginning at address 0x0000:0000
+ *
+ * This RAM is connected to ITCM 64-bit interface designed for
+ * execution of critical real-times routines by the CPU.
+ *
+ * 2) AXI SRAM (D1 domain) accessible by all system masters except BDMA
+ * through D1 domain AXI bus matrix
+ *
+ * 2.1) 512Kb of SRAM beginning at address 0x2400:0000
+ *
+ * 3) AHB SRAM (D2 domain) accessible by all system masters except BDMA
+ * through D2 domain AHB bus matrix
+ *
+ * 3.1) 128Kb of SRAM1 beginning at address 0x3000:0000
+ * 3.2) 128Kb of SRAM2 beginning at address 0x3002:0000
+ * 3.3) 32Kb of SRAM3 beginning at address 0x3004:0000
+ *
+ * SRAM1 - SRAM3 are one contiguous block: 288Kb at address 0x3000:0000
+ *
+ * 4) AHB SRAM (D3 domain) accessible by most of system masters
+ * through D3 domain AHB bus matrix
+ *
+ * 4.1) 64Kb of SRAM4 beginning at address 0x3800:0000
+ * 4.1) 4Kb of backup RAM beginning at address 0x3880:0000
+ *
+ * When booting from FLASH, FLASH memory is aliased to address 0x0000:0000
+ * where the code expects to begin execution by jumping to the entry point in
+ * the 0x0800:0000 address range.
+ */
+
+MEMORY
+{
+ itcm (rwx) : ORIGIN = 0x00000000, LENGTH = 64K
+ flash (rx) : ORIGIN = 0x08000000, LENGTH = 2048K
+ dtcm1 (rwx) : ORIGIN = 0x20000000, LENGTH = 64K
+ dtcm2 (rwx) : ORIGIN = 0x20010000, LENGTH = 64K
+ sram (rwx) : ORIGIN = 0x24000000, LENGTH = 512K
+ sram1 (rwx) : ORIGIN = 0x30000000, LENGTH = 128K
+ sram2 (rwx) : ORIGIN = 0x30020000, LENGTH = 128K
+ sram3 (rwx) : ORIGIN = 0x30040000, LENGTH = 32K
+ sram4 (rwx) : ORIGIN = 0x38000000, LENGTH = 64K
+ bbram (rwx) : ORIGIN = 0x38800000, LENGTH = 4K
+}
+
+OUTPUT_ARCH(arm)
+EXTERN(_vectors)
+ENTRY(_stext)
+SECTIONS
+{
+ .text :
+ {
+ _stext = ABSOLUTE(.);
+ *(.vectors)
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > flash
+
+ .init_section :
+ {
+ _sinit = ABSOLUTE(.);
+ *(.init_array .init_array.*)
+ _einit = ABSOLUTE(.);
+ } > flash
+
+ .ARM.extab :
+ {
+ *(.ARM.extab*)
+ } > flash
+
+ __exidx_start = ABSOLUTE(.);
+ .ARM.exidx :
+ {
+ *(.ARM.exidx*)
+ } > flash
+ __exidx_end = ABSOLUTE(.);
+
+ _eronly = ABSOLUTE(.);
+
+ .data :
+ {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ . = ALIGN(4);
+ _edata = ABSOLUTE(.);
+ } > sram AT > flash
+
+ .bss :
+ {
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ . = ALIGN(4);
+ _ebss = ABSOLUTE(.);
+ } > sram
+
+ /* Emit the the D3 power domain section for locating BDMA data
+ *
+ * Static data with locate_data(".sram4") will be located
+ * at start of SRAM4; the rest of SRAM4 will be added to the heap.
+ */
+
+ .sram4_reserve (NOLOAD) :
+ {
+ *(.sram4)
+ . = ALIGN(4);
+ _sram4_heap_start = ABSOLUTE(.);
+ } > sram4
+
+ /* Stabs debugging sections. */
+
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/boards/arm/stm32h7/stm32h745i-disco/scripts/gnu-elf.ld b/boards/arm/stm32h7/stm32h745i-disco/scripts/gnu-elf.ld
new file mode 100644
index 0000000000..7521ec8c8e
--- /dev/null
+++ b/boards/arm/stm32h7/stm32h745i-disco/scripts/gnu-elf.ld
@@ -0,0 +1,126 @@
+/****************************************************************************
+ * boards/arm/stm32h7/stm32h745i-disco/scripts/gnu-elf.ld
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+SECTIONS
+{
+ .text 0x00000000 :
+ {
+ _stext = . ;
+ *(.text)
+ *(.text.*)
+ *(.gnu.warning)
+ *(.stub)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.jcr)
+
+ /* C++ support: The .init and .fini sections contain specific logic
+ * to manage static constructors and destructors.
+ */
+
+ *(.gnu.linkonce.t.*)
+ *(.init) /* Old ABI */
+ *(.fini) /* Old ABI */
+ _etext = . ;
+ }
+
+ .ARM.extab :
+ {
+ *(.ARM.extab*)
+ }
+
+ .ARM.exidx :
+ {
+ *(.ARM.exidx*)
+ }
+
+ .rodata :
+ {
+ _srodata = . ;
+ *(.rodata)
+ *(.rodata1)
+ *(.rodata.*)
+ *(.gnu.linkonce.r*)
+ _erodata = . ;
+ }
+
+ .data :
+ {
+ _sdata = . ;
+ *(.data)
+ *(.data1)
+ *(.data.*)
+ *(.gnu.linkonce.d*)
+ . = ALIGN(4);
+ _edata = . ;
+ }
+
+ /* C++ support. For each global and static local C++ object,
+ * GCC creates a small subroutine to construct the object. Pointers
+ * to these routines (not the routines themselves) are stored as
+ * simple, linear arrays in the .ctors section of the object file.
+ * Similarly, pointers to global/static destructor routines are
+ * stored in .dtors.
+ */
+
+ .ctors :
+ {
+ _sctors = . ;
+ *(.ctors) /* Old ABI: Unallocated */
+ *(.init_array) /* New ABI: Allocated */
+ _edtors = . ;
+ }
+
+ .dtors :
+ {
+ _sdtors = . ;
+ *(.dtors) /* Old ABI: Unallocated */
+ *(.fini_array) /* New ABI: Allocated */
+ _edtors = . ;
+ }
+
+ .bss :
+ {
+ _sbss = . ;
+ *(.bss)
+ *(.bss.*)
+ *(.sbss)
+ *(.sbss.*)
+ *(.gnu.linkonce.b*)
+ *(COMMON)
+ . = ALIGN(4);
+ _ebss = . ;
+ }
+
+ /* Stabs debugging sections. */
+
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/boards/arm/stm32h7/stm32h745i-disco/scripts/memory.ld b/boards/arm/stm32h7/stm32h745i-disco/scripts/memory.ld
new file mode 100644
index 0000000000..12b0c0fe21
--- /dev/null
+++ b/boards/arm/stm32h7/stm32h745i-disco/scripts/memory.ld
@@ -0,0 +1,52 @@
+/****************************************************************************
+ * boards/arm/stm32h7/stm32h745i-disco/scripts/memory.ld
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/* TODO: Add description for memory organisation */
+
+MEMORY
+{
+ /* ITCM boot address */
+
+ itcm (rwx) : ORIGIN = 0x00000000, LENGTH = 64K
+
+ /* 2048Kb FLASH */
+
+ kflash (rx) : ORIGIN = 0x08000000, LENGTH = 128K
+ uflash (rx) : ORIGIN = 0x08020000, LENGTH = 128K
+ xflash (rx) : ORIGIN = 0x08040000, LENGTH = 1792K
+
+ /* 288Kb SRAM123 */
+
+ ksram (rwx) : ORIGIN = 0x30000000, LENGTH = 16K
+ usram (rwx) : ORIGIN = 0x30004000, LENGTH = 16K
+ xsram (rwx) : ORIGIN = 0x30008000, LENGTH = 288K - 32K
+
+ /* 512Kb of contiguous AXI SRAM */
+
+ sram (rwx) : ORIGIN = 0x24000000, LENGTH = 512K
+
+ /* DTCM SRAM */
+
+ dtcm1 (rwx) : ORIGIN = 0x20000000, LENGTH = 64K
+ dtcm2 (rwx) : ORIGIN = 0x20010000, LENGTH = 64K
+
+ sram4 (rwx) : ORIGIN = 0x38000000, LENGTH = 64K
+ bbram (rwx) : ORIGIN = 0x38800000, LENGTH = 4K
+}
diff --git a/boards/arm/stm32h7/stm32h745i-disco/scripts/user-space.ld b/boards/arm/stm32h7/stm32h745i-disco/scripts/user-space.ld
new file mode 100644
index 0000000000..a02cc5e67e
--- /dev/null
+++ b/boards/arm/stm32h7/stm32h745i-disco/scripts/user-space.ld
@@ -0,0 +1,98 @@
+/****************************************************************************
+ * boards/arm/stm32h7/stm32h745i-disco/scripts/user-space.ld
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/* NOTE: This depends on the memory.ld script having been included prior to
+ * this script.
+ */
+
+OUTPUT_ARCH(arm)
+SECTIONS
+{
+ .userspace : {
+ *(.userspace)
+ } > uflash
+
+ .text : {
+ _stext = ABSOLUTE(.);
+ *(.text .text.*)
+ *(.fixup)
+ *(.gnu.warning)
+ *(.rodata .rodata.*)
+ *(.gnu.linkonce.t.*)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.got)
+ *(.gcc_except_table)
+ *(.gnu.linkonce.r.*)
+ _etext = ABSOLUTE(.);
+ } > uflash
+
+ .init_section : {
+ _sinit = ABSOLUTE(.);
+ *(.init_array .init_array.*)
+ _einit = ABSOLUTE(.);
+ } > uflash
+
+ .ARM.extab : {
+ *(.ARM.extab*)
+ } > uflash
+
+ __exidx_start = ABSOLUTE(.);
+ .ARM.exidx : {
+ *(.ARM.exidx*)
+ } > uflash
+
+ __exidx_end = ABSOLUTE(.);
+
+ _eronly = ABSOLUTE(.);
+
+ .data : {
+ _sdata = ABSOLUTE(.);
+ *(.data .data.*)
+ *(.gnu.linkonce.d.*)
+ CONSTRUCTORS
+ . = ALIGN(4);
+ _edata = ABSOLUTE(.);
+ } > usram AT > uflash
+
+ .bss : {
+ _sbss = ABSOLUTE(.);
+ *(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
+ *(COMMON)
+ . = ALIGN(4);
+ _ebss = ABSOLUTE(.);
+ } > usram
+
+ /* Stabs debugging sections */
+
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}
diff --git a/boards/arm/stm32h7/stm32h745i-disco/src/CMakeLists.txt b/boards/arm/stm32h7/stm32h745i-disco/src/CMakeLists.txt
new file mode 100644
index 0000000000..b70b7a4cb9
--- /dev/null
+++ b/boards/arm/stm32h7/stm32h745i-disco/src/CMakeLists.txt
@@ -0,0 +1,55 @@
+############################################################################
+# boards/arm/stm32h7/stm32h745i-disco/src/CMakeLists.txt
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership. The
+# ASF licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the
+# License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+#
+############################################################################
+
+set(SRCS stm32_boot.c stm32_bringup.c)
+
+if(CONFIG_ARCH_LEDS)
+ list(APPEND SRCS stm32_autoleds.c)
+else()
+ list(APPEND SRCS stm32_userleds.c)
+endif()
+
+if(CONFIG_STM32H7_OTGFS)
+ list(APPEND SRCS stm32_usb.c)
+endif()
+
+if(CONFIG_BOARDCTL)
+ list(APPEND SRCS stm32_appinitialize.c)
+endif()
+
+if(CONFIG_TESTING_OSTEST)
+ list(APPEND SRCS stm32_ostest.c)
+endif()
+
+if(CONFIG_BOARDCTL_RESET)
+ list(APPEND SRCS stm32_reset.c)
+endif()
+
+if(CONFIG_INPUT_FT5X06)
+ list(APPEND SRCS stm32_ft5x06.c)
+endif()
+
+if(CONFIG_STM32H7_LTDC)
+ list(APPEND SRCS stm32_lcd.c)
+endif()
+
+target_sources(board PRIVATE ${SRCS})
+
+set_property(GLOBAL PROPERTY LD_SCRIPT "${NUTTX_BOARD_DIR}/scripts/flash.ld")
diff --git a/boards/arm/stm32h7/stm32h745i-disco/src/Makefile b/boards/arm/stm32h7/stm32h745i-disco/src/Makefile
new file mode 100644
index 0000000000..ad49e0ba19
--- /dev/null
+++ b/boards/arm/stm32h7/stm32h745i-disco/src/Makefile
@@ -0,0 +1,55 @@
+############################################################################
+# boards/arm/stm32h7/stm32h745i-disco/src/Makefile
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership. The
+# ASF licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the
+# License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+#
+############################################################################
+
+include $(TOPDIR)/Make.defs
+
+CSRCS = stm32_boot.c stm32_bringup.c
+
+ifeq ($(CONFIG_ARCH_LEDS),y)
+CSRCS += stm32_autoleds.c
+else
+CSRCS += stm32_userleds.c
+endif
+
+ifeq ($(CONFIG_STM32H7_OTGFS),y)
+CSRCS += stm32_usb.c
+endif
+
+ifeq ($(CONFIG_BOARDCTL),y)
+CSRCS += stm32_appinitialize.c
+endif
+
+ifeq ($(CONFIG_TESTING_OSTEST),y)
+CSRCS += stm32_ostest.c
+endif
+
+ifeq ($(CONFIG_BOARDCTL_RESET),y)
+CSRCS += stm32_reset.c
+endif
+
+ifeq ($(CONFIG_INPUT_FT5X06),y)
+CSRCS += stm32_ft5x06.c
+endif
+
+ifeq ($(CONFIG_STM32H7_LTDC),y)
+CSRCS += stm32_lcd.c
+endif
+
+include $(TOPDIR)/boards/Board.mk
diff --git a/boards/arm/stm32h7/stm32h745i-disco/src/stm32_appinitialize.c b/boards/arm/stm32h7/stm32h745i-disco/src/stm32_appinitialize.c
new file mode 100644
index 0000000000..d7b24a4e55
--- /dev/null
+++ b/boards/arm/stm32h7/stm32h745i-disco/src/stm32_appinitialize.c
@@ -0,0 +1,76 @@
+/****************************************************************************
+ * boards/arm/stm32h7/stm32h745i-disco/src/stm32_appinitialize.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <nuttx/board.h>
+#include <sys/types.h>
+
+#include "stm32h745i_disco.h"
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: board_app_initialize
+ *
+ * Description:
+ * Perform application specific initialization. This function is never
+ * called directly from application code, but only indirectly via the
+ * (non-standard) boardctl() interface using the command BOARDIOC_INIT.
+ *
+ * Input Parameters:
+ * arg - The boardctl() argument is passed to the board_app_initialize()
+ * implementation without modification. The argument has no
+ * meaning to NuttX; the meaning of the argument is a contract
+ * between the board-specific initialization logic and the
+ * matching application logic. The value could be such things as a
+ * mode enumeration value, a set of DIP switch switch settings, a
+ * pointer to configuration data read from a file or serial FLASH,
+ * or whatever you would like to do with it. Every implementation
+ * should accept zero/NULL as a default configuration.
+ *
+ * Returned Value:
+ * Zero (OK) is returned on success; a negated errno value is returned on
+ * any failure to indicate the nature of the failure.
+ *
+ ****************************************************************************/
+
+int board_app_initialize(uintptr_t arg)
+{
+#ifdef CONFIG_BOARD_LATE_INITIALIZE
+ /* Board initialization already performed by board_late_initialize() */
+
+ return OK;
+#else
+ /* Perform board-specific initialization */
+
+ return stm32_bringup();
+#endif
+}
diff --git a/boards/arm/stm32h7/stm32h745i-disco/src/stm32_autoleds.c b/boards/arm/stm32h7/stm32h745i-disco/src/stm32_autoleds.c
new file mode 100644
index 0000000000..9801f49d7c
--- /dev/null
+++ b/boards/arm/stm32h7/stm32h745i-disco/src/stm32_autoleds.c
@@ -0,0 +1,173 @@
+/****************************************************************************
+ * boards/arm/stm32h7/stm32h745i-disco/src/stm32_autoleds.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdbool.h>
+#include <debug.h>
+
+#include <nuttx/board.h>
+#include <arch/board/board.h>
+
+#include "stm32_gpio.h"
+#include "stm32h745i_disco.h"
+
+#ifdef CONFIG_ARCH_LEDS
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+#define ARRAYSIZE(x) (sizeof((x)) / sizeof((x)[0]))
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/* Indexed by BOARD_LED_<color> */
+
+static const uint32_t g_ledmap[BOARD_NLEDS] =
+{
+ GPIO_LED_GREEN,
+ GPIO_LED_ORANGE,
+ GPIO_LED_RED,
+};
+
+static bool g_initialized;
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+static void phy_set_led(int led, bool state)
+{
+ /* Active High */
+
+ stm32_gpiowrite(g_ledmap[led], state);
+}
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: board_autoled_initialize
+ ****************************************************************************/
+
+void board_autoled_initialize(void)
+{
+ int i;
+
+ /* Configure the LD1 GPIO for output. Initial state is OFF */
+
+ for (i = 0; i < ARRAYSIZE(g_ledmap); i++)
+ {
+ stm32_configgpio(g_ledmap[i]);
+ }
+}
+
+/****************************************************************************
+ * Name: board_autoled_on
+ ****************************************************************************/
+
+void board_autoled_on(int led)
+{
+ switch (led)
+ {
+ default:
+ break;
+
+ case LED_HEAPALLOCATE:
+ phy_set_led(BOARD_LED_BLUE, true);
+ break;
+
+ case LED_IRQSENABLED:
+ phy_set_led(BOARD_LED_BLUE, false);
+ phy_set_led(BOARD_LED_GREEN, true);
+ break;
+
+ case LED_STACKCREATED:
+ phy_set_led(BOARD_LED_GREEN, true);
+ phy_set_led(BOARD_LED_BLUE, true);
+ g_initialized = true;
+ break;
+
+ case LED_INIRQ:
+ phy_set_led(BOARD_LED_BLUE, true);
+ break;
+
+ case LED_SIGNAL:
+ phy_set_led(BOARD_LED_GREEN, true);
+ break;
+
+ case LED_ASSERTION:
+ phy_set_led(BOARD_LED_RED, true);
+ phy_set_led(BOARD_LED_BLUE, true);
+ break;
+
+ case LED_PANIC:
+ phy_set_led(BOARD_LED_RED, true);
+ break;
+
+ case LED_IDLE : /* IDLE */
+ phy_set_led(BOARD_LED_RED, true);
+ break;
+ }
+}
+
+/****************************************************************************
+ * Name: board_autoled_off
+ ****************************************************************************/
+
+void board_autoled_off(int led)
+{
+ switch (led)
+ {
+ default:
+ break;
+
+ case LED_SIGNAL:
+ phy_set_led(BOARD_LED_GREEN, false);
+ break;
+
+ case LED_INIRQ:
+ phy_set_led(BOARD_LED_BLUE, false);
+ break;
+
+ case LED_ASSERTION:
+ phy_set_led(BOARD_LED_RED, false);
+ phy_set_led(BOARD_LED_BLUE, false);
+ break;
+
+ case LED_PANIC:
+ phy_set_led(BOARD_LED_RED, false);
+ break;
+
+ case LED_IDLE : /* IDLE */
+ phy_set_led(BOARD_LED_RED, false);
+ break;
+ }
+}
+
+#endif /* CONFIG_ARCH_LEDS */
diff --git a/boards/arm/stm32h7/stm32h745i-disco/src/stm32_boot.c b/boards/arm/stm32h7/stm32h745i-disco/src/stm32_boot.c
new file mode 100644
index 0000000000..41d8125f05
--- /dev/null
+++ b/boards/arm/stm32h7/stm32h745i-disco/src/stm32_boot.c
@@ -0,0 +1,89 @@
+/****************************************************************************
+ * boards/arm/stm32h7/stm32h745i-disco/src/stm32_boot.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <debug.h>
+
+#include <nuttx/board.h>
+#include <arch/board/board.h>
+
+#include "stm32h745i_disco.h"
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: stm32_boardinitialize
+ *
+ * Description:
+ * All STM32 architectures must provide the following entry point.
+ * This entry point is called early in the initialization -- after all
+ * memory has been configured and mapped but before any devices have been
+ * initialized.
+ *
+ ****************************************************************************/
+
+void stm32_boardinitialize(void)
+{
+#ifdef CONFIG_ARCH_LEDS
+ /* Configure on-board LEDs if LED support has been selected. */
+
+ board_autoled_initialize();
+#endif
+
+#if defined(CONFIG_STM32H7_OTGFS) || defined(CONFIG_STM32H7_HOST)
+ /* Initialize USB */
+
+ stm32_usbinitialize();
+#endif
+}
+
+/****************************************************************************
+ * Name: board_late_initialize
+ *
+ * Description:
+ * If CONFIG_BOARD_LATE_INITIALIZE is selected, then an additional
+ * initialization call will be performed in the boot-up sequence to a
+ * function called board_late_initialize(). board_late_initialize()
+ * will be called immediately after up_initialize() is called and just
+ * before the initial application is started. This additional
+ * initialization phase may be used, for example, to initialize board-
+ * specific device drivers.
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_BOARD_LATE_INITIALIZE
+void board_late_initialize(void)
+{
+#if defined(CONFIG_NSH_LIBRARY) && !defined(CONFIG_BOARDCTL)
+ /* Perform board bring-up here instead of from the
+ * board_app_initialize().
+ */
+
+ stm32_bringup();
+#endif
+}
+#endif
diff --git a/boards/arm/stm32h7/stm32h745i-disco/src/stm32_bringup.c b/boards/arm/stm32h7/stm32h745i-disco/src/stm32_bringup.c
new file mode 100644
index 0000000000..9d2047ca6c
--- /dev/null
+++ b/boards/arm/stm32h7/stm32h745i-disco/src/stm32_bringup.c
@@ -0,0 +1,230 @@
+/****************************************************************************
+ * boards/arm/stm32h7/stm32h745i-disco/src/stm32_bringup.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+#include <syslog.h>
+#include <errno.h>
+
+#include <nuttx/fs/fs.h>
+#include <nuttx/mtd/mtd.h>
+#include <nuttx/kmalloc.h>
+#include <nuttx/usb/usbmonitor.h>
+
+#ifdef CONFIG_STM32H7_OTGFS
+#include "stm32_usbhost.h"
+#endif
+
+#ifdef CONFIG_VIDEO_FB
+# include <nuttx/video/fb.h>
+#endif
+
+#include "stm32_gpio.h"
+
+#include "stm32h745i_disco.h"
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+static void convert_lcd_rgb565(void)
+{
+ /* Put LCD_{R0,R1,R2,G0,G1,B0,B1,B2} in low level */
+
+ stm32_configgpio(GPIO_LCD_R0);
+ stm32_gpiowrite(GPIO_LCD_R0, 0);
+ stm32_configgpio(GPIO_LCD_R1);
+ stm32_gpiowrite(GPIO_LCD_R1, 0);
+ stm32_configgpio(GPIO_LCD_R2);
+ stm32_gpiowrite(GPIO_LCD_R2, 0);
+ stm32_configgpio(GPIO_LCD_G0);
+ stm32_gpiowrite(GPIO_LCD_G0, 0);
+ stm32_configgpio(GPIO_LCD_G1);
+ stm32_gpiowrite(GPIO_LCD_G1, 0);
+ stm32_configgpio(GPIO_LCD_B0);
+ stm32_gpiowrite(GPIO_LCD_B0, 0);
+ stm32_configgpio(GPIO_LCD_B1);
+ stm32_gpiowrite(GPIO_LCD_B1, 0);
+ stm32_configgpio(GPIO_LCD_B2);
+ stm32_gpiowrite(GPIO_LCD_B2, 0);
+}
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: stm32_bringup
+ *
+ * Description:
+ * Perform architecture-specific initialization
+ *
+ * CONFIG_BOARD_LATE_INITIALIZE=y :
+ * Called from board_late_initialize().
+ *
+ * CONFIG_BOARD_LATE_INITIALIZE=n && CONFIG_BOARDCTL=y &&
+ * CONFIG_NSH_ARCHINIT:
+ * Called from the NSH library
+ *
+ ****************************************************************************/
+
+int stm32_bringup(void)
+{
+ int ret;
+#ifdef CONFIG_RAMMTD
+ FAR uint8_t *ramstart;
+#endif
+
+ UNUSED(ret);
+
+ convert_lcd_rgb565();
+
+#ifdef CONFIG_FS_PROCFS
+ /* Mount the procfs file system */
+
+ ret = nx_mount(NULL, "/proc", "procfs", 0, NULL);
+ if (ret < 0)
+ {
+ syslog(LOG_ERR,
+ "ERROR: Failed to mount the PROC filesystem: %d\n", ret);
+ }
+#endif /* CONFIG_FS_PROCFS */
+
+#ifdef CONFIG_INPUT_FT5X06
+ /* Initialize the touchscreen.
+ * WARNING: stm32_tsc_setup() cannot be called from the IDLE thread.
+ */
+
+ ret = stm32_tsc_setup(0);
+ if (ret < 0)
+ {
+ syslog(LOG_ERR, "ERROR: stm32_tsc_setup failed: %d\n", ret);
+ }
+#endif
+
+#ifdef CONFIG_VIDEO_FB
+ /* Initialize and register the framebuffer driver */
+
+ ret = fb_register(0, 0);
+ if (ret < 0)
+ {
+ syslog(LOG_ERR, "ERROR: fb_register() failed: %d\n", ret);
+ }
+#endif
+
+#if !defined(CONFIG_ARCH_LEDS) && defined(CONFIG_USERLED_LOWER)
+ /* Register the LED driver */
+
+ ret = userled_lower_initialize("/dev/userleds");
+ if (ret < 0)
+ {
+ syslog(LOG_ERR, "ERROR: userled_lower_initialize() failed: %d\n", ret);
+ }
+#endif
+
+#ifdef CONFIG_RAMMTD
+ /* Create a RAM MTD device if configured */
+
+ ramstart = (FAR uint8_t *)kmm_malloc(128 * 1024);
+ if (ramstart == NULL)
+ {
+ syslog(LOG_ERR, "ERROR: Allocation for RAM MTD failed\n");
+ }
+ else
+ {
+ /* Initialized the RAM MTD */
+
+ FAR struct mtd_dev_s *mtd = rammtd_initialize(ramstart, 128 * 1024);
+ if (mtd == NULL)
+ {
+ syslog(LOG_ERR, "ERROR: rammtd_initialize failed\n");
+ kmm_free(ramstart);
+ }
+ else
+ {
+ /* Erase the RAM MTD */
+
+ ret = mtd->ioctl(mtd, MTDIOC_BULKERASE, 0);
+ if (ret < 0)
+ {
+ syslog(LOG_ERR, "ERROR: IOCTL MTDIOC_BULKERASE failed\n");
+ }
+
+#ifdef CONFIG_FS_LITTLEFS
+ /* Register the MTD driver so that it can be accessed from the
+ * VFS.
+ */
+
+ ret = register_mtddriver("/dev/rammtd", mtd, 0755, NULL);
+ if (ret < 0)
+ {
+ syslog(LOG_ERR, "ERROR: Failed to register MTD driver: %d\n",
+ ret);
+ }
+
+ /* Mount the LittleFS file system */
+
+ ret = nx_mount("/dev/rammtd", "/mnt/lfs", "littlefs", 0,
+ "forceformat");
+ if (ret < 0)
+ {
+ syslog(LOG_ERR,
+ "ERROR: Failed to mount LittleFS at /mnt/lfs: %d\n",
+ ret);
+ }
+#endif
+ }
+ }
+#endif
+
+#ifdef HAVE_USBHOST
+ /* Initialize USB host operation. stm32_usbhost_initialize()
+ * starts a thread will monitor for USB connection and
+ * disconnection events.
+ */
+
+ ret = stm32_usbhost_initialize();
+ if (ret != OK)
+ {
+ syslog(LOG_ERR,
+ "ERROR: Failed to initialize USB host: %d\n",
+ ret);
+ }
+#endif
+
+#ifdef HAVE_USBMONITOR
+ /* Start the USB Monitor */
+
+ ret = usbmonitor_start();
+ if (ret != OK)
+ {
+ syslog(LOG_ERR,
+ "ERROR: Failed to start USB monitor: %d\n",
+ ret);
+ }
+#endif
+
+ return OK;
+}
diff --git a/boards/arm/stm32h7/stm32h745i-disco/src/stm32_ft5x06.c b/boards/arm/stm32h7/stm32h745i-disco/src/stm32_ft5x06.c
new file mode 100644
index 0000000000..fd3865f6fb
--- /dev/null
+++ b/boards/arm/stm32h7/stm32h745i-disco/src/stm32_ft5x06.c
@@ -0,0 +1,301 @@
+/****************************************************************************
+ * boards/arm/stm32h7/stm32h745i-disco/src/stm32_ft5x06.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <assert.h>
+#include <debug.h>
+#include <errno.h>
+
+#include <nuttx/input/ft5x06.h>
+#include <arch/board/board.h>
+
+#include "stm32_gpio.h"
+#include "stm32_i2c.h"
+
+#include "stm32h745i_disco.h"
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+#define FT5X06_FREQUENCY 100000 /* For now, will boost later */
+
+#ifdef CONFIG_INPUT_FT5X06
+#ifndef CONFIG_INPUT
+# error "FT5x06 support requires CONFIG_INPUT"
+#endif
+
+#ifndef CONFIG_STM32H7_I2C4
+# error "FT5x06 support requires CONFIG_STM32H7_I2C4"
+#endif
+
+#ifndef CONFIG_FT5X06_I2CDEV
+# define CONFIG_FT5X06_I2CDEV 4
+#endif
+
+#if CONFIG_FT5X06_I2CDEV != 4
+# error "CONFIG_FT5X06_I2CDEV must be four"
+#endif
+
+#ifndef CONFIG_FT5X06_DEVMINOR
+# define CONFIG_FT5X06_DEVMINOR 0
+#endif
+
+/****************************************************************************
+ * Private Types
+ ****************************************************************************/
+
+struct stm32_ft5x06_config_s
+{
+ xcpt_t handler; /* The FT5x06 interrupt handler */
+ FAR void *arg; /* Interrupt handler argument */
+};
+
+/****************************************************************************
+ * Private Function Ptototypes
+ ****************************************************************************/
+
+#ifndef CONFIG_FT5X06_POLLMODE
+static int stm32_ft5x06_attach(FAR const struct ft5x06_config_s *config,
+ xcpt_t isr, FAR void *arg);
+static void stm32_ft5x06_enable(FAR const struct ft5x06_config_s *config,
+ bool enable);
+static void stm32_ft5x06_clear(FAR const struct ft5x06_config_s *config);
+#endif
+static void stm32_ft5x06_wakeup(FAR const struct ft5x06_config_s *config);
+static void stm32_ft5x06_nreset(FAR const struct ft5x06_config_s *config,
+ bool state);
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+static const struct ft5x06_config_s g_ft5x06_config =
+{
+ .address = FT5X06_I2C_ADDRESS,
+ .frequency = FT5X06_FREQUENCY,
+#ifndef CONFIG_FT5X06_POLLMODE
+ .attach = stm32_ft5x06_attach,
+ .enable = stm32_ft5x06_enable,
+ .clear = stm32_ft5x06_clear,
+#endif
+ .wakeup = stm32_ft5x06_wakeup,
+ .nreset = stm32_ft5x06_nreset
+};
+
+#ifndef CONFIG_FT5X06_POLLMODE
+static struct stm32_ft5x06_config_s g_priv_config =
+{
+ .handler = NULL,
+ .arg = NULL,
+};
+#endif
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: stm32_ft5x06_attach
+ *
+ * Description:
+ * Attach an FT5x06 interrupt handler to a GPIO interrupt
+ *
+ ****************************************************************************/
+
+#ifndef CONFIG_FT5X06_POLLMODE
+static int stm32_ft5x06_attach(FAR const struct ft5x06_config_s *config,
+ xcpt_t isr, FAR void *arg)
+{
+ iinfo("Saving handler %p\n", isr);
+
+ /* Just save the handler. We will use it when EXTI interruptsare enabled */
+
+ if (isr)
+ {
+ /* Just save the address of the handler for now. The new handler will
+ * be attached when the interrupt is next enabled.
+ */
+
+ iinfo("Attaching %p\n", isr);
+ g_priv_config.handler = isr;
+ g_priv_config.arg = arg;
+ }
+ else
+ {
+ iinfo("Detaching %p\n", g_priv_config.handler);
+ stm32_ft5x06_enable(config, false);
+ g_priv_config.handler = NULL;
+ g_priv_config.arg = NULL;
+ }
+
+ return OK;
+}
+#endif
+
+/****************************************************************************
+ * Name: stm32_ft5x06_enable
+ *
+ * Description:
+ * Enable or disable a GPIO interrupt
+ *
+ ****************************************************************************/
+
+#ifndef CONFIG_FT5X06_POLLMODE
+static void stm32_ft5x06_enable(FAR const struct ft5x06_config_s *config,
+ bool enable)
+{
+ irqstate_t flags;
+
+ /* Attach and enable, or detach and disable. Enabling and disabling GPIO
+ * interrupts is a multi-step process so the safest thing is to keep
+ * interrupts disabled during the reconfiguration.
+ */
+
+ flags = enter_critical_section();
+ if (enable)
+ {
+ /* Configure the EXTI interrupt using the SAVED handler */
+
+ stm32_gpiosetevent(GPIO_FT5X06_INT, true, false, true,
+ g_priv_config.handler, g_priv_config.arg);
+ }
+ else
+ {
+ /* Configure the EXTI interrupt with a NULL handler to disable it */
+
+ stm32_gpiosetevent(GPIO_FT5X06_INT, false, false, false,
+ NULL, NULL);
+ }
+
+ leave_critical_section(flags);
+}
+#endif
+
+/****************************************************************************
+ * Name: stm32_ft5x06_clear
+ *
+ * Description:
+ * Acknowledge/clear any pending GPIO interrupt
+ *
+ ****************************************************************************/
+
+#ifndef CONFIG_FT5X06_POLLMODE
+static void stm32_ft5x06_clear(FAR const struct ft5x06_config_s *config)
+{
+ /* Does nothing */
+}
+#endif
+
+/****************************************************************************
+ * Name: stm32_ft5x06_wakeup
+ *
+ * Description:
+ * Issue WAKE interrupt to FT5x06 to change the FT5x06 from Hibernate to
+ * Active mode.
+ *
+ ****************************************************************************/
+
+static void stm32_ft5x06_wakeup(FAR const struct ft5x06_config_s *config)
+{
+ /* We do not have access to the WAKE pin in the implementation */
+}
+
+/****************************************************************************
+ * Name: stm32_ft5x06_nreset
+ *
+ * Description:
+ * Control the chip reset pin
+ *
+ ****************************************************************************/
+
+static void stm32_ft5x06_nreset(FAR const struct ft5x06_config_s *config,
+ bool nstate)
+{
+ /* We do not have access to the RESET pin in the implementation */
+}
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: stm32_tsc_setup
+ *
+ * Description:
+ * This function is called by board-bringup logic to configure the
+ * touchscreen device. This function will register the driver as
+ * /dev/inputN where N is the minor device number.
+ *
+ * Input Parameters:
+ * minor - The input device minor number
+ *
+ * Returned Value:
+ * Zero is returned on success. Otherwise, a negated errno value is
+ * returned to indicate the nature of the failure.
+ *
+ ****************************************************************************/
+
+int stm32_tsc_setup(int minor)
+{
+ FAR struct i2c_master_s *dev;
+ int ret;
+
+ iinfo("minor %d\n", minor);
+ DEBUGASSERT(minor == CONFIG_FT5X06_DEVMINOR);
+
+ /* Check if we are already initialized */
+
+ iinfo("Initializing\n");
+
+ /* Configure the FT5X06 interrupt pin as an input */
+
+ stm32_configgpio(GPIO_FT5X06_INT);
+
+ /* Get an instance of the I2C interface */
+
+ dev = stm32_i2cbus_initialize(CONFIG_FT5X06_I2CDEV);
+ if (!dev)
+ {
+ ierr("ERROR: Failed to initialize I2C bus %d\n", CONFIG_FT5X06_I2CDEV);
+ return -ENODEV;
+ }
+
+ /* Initialize and register the I2C touchscreen device */
+
+ ret = ft5x06_register(dev, &g_ft5x06_config, CONFIG_FT5X06_DEVMINOR);
+ if (ret < 0)
+ {
+ ierr("ERROR: Failed to register FT5x06 driver: %d\n", ret);
+ stm32_i2cbus_uninitialize(dev);
+ return ret;
+ }
+
+ iinfo("ft5x06_register Ok\n");
+
+ return OK;
+}
+
+#endif /* CONFIG_INPUT_FT5X06 */
diff --git a/boards/arm/stm32h7/stm32h745i-disco/src/stm32_lcd.c b/boards/arm/stm32h7/stm32h745i-disco/src/stm32_lcd.c
new file mode 100644
index 0000000000..6acc451599
--- /dev/null
+++ b/boards/arm/stm32h7/stm32h745i-disco/src/stm32_lcd.c
@@ -0,0 +1,120 @@
+/****************************************************************************
+ * boards/arm/stm32h7/stm32h745i-disco/src/stm32_lcd.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <errno.h>
+#include <debug.h>
+
+#include <nuttx/arch.h>
+#include <nuttx/board.h>
+#include <nuttx/video/fb.h>
+#include <arch/board/board.h>
+
+#include "stm32_gpio.h"
+#include "stm32_ltdc.h"
+
+#include "stm32h745i_disco.h"
+
+#ifdef CONFIG_STM32H7_LTDC
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_fbinitialize
+ *
+ * Description:
+ * Initialize the framebuffer video hardware associated with the display.
+ *
+ * Input Parameters:
+ * display - In the case of hardware with multiple displays, this
+ * specifies the display. Normally this is zero.
+ *
+ * Returned Value:
+ * Zero is returned on success; a negated errno value is returned on any
+ * failure.
+ *
+ ****************************************************************************/
+
+int up_fbinitialize(int display)
+{
+ /* Custom LCD display with RGB interface */
+
+ stm32_configgpio(GPIO_LCD_DISP);
+ stm32_configgpio(GPIO_LCD_BL);
+
+ stm32_gpiowrite(GPIO_LCD_DISP, true);
+ stm32_gpiowrite(GPIO_LCD_BL, true);
+
+ return stm32_ltdcinitialize();
+}
+
+/****************************************************************************
+ * Name: up_fbgetvplane
+ *
+ * Description:
+ * Return a a reference to the framebuffer object for the specified video
+ * plane of the specified plane.
+ * Many OSDs support multiple planes of video.
+ *
+ * Input Parameters:
+ * display - In the case of hardware with multiple displays, this
+ * specifies the display. Normally this is zero.
+ * vplane - Identifies the plane being queried.
+ *
+ * Returned Value:
+ * A non-NULL pointer to the frame buffer access structure is returned on
+ * success; NULL is returned on any failure.
+ *
+ ****************************************************************************/
+
+FAR struct fb_vtable_s *up_fbgetvplane(int display, int vplane)
+{
+ return stm32_ltdcgetvplane(vplane);
+}
+
+/****************************************************************************
+ * Name: up_fbuninitialize
+ *
+ * Description:
+ * Uninitialize the framebuffer support for the specified display.
+ *
+ * Input Parameters:
+ * display - In the case of hardware with multiple displays, this
+ * specifies the display. Normally this is zero.
+ *
+ * Returned Value:
+ * None
+ *
+ ****************************************************************************/
+
+void up_fbuninitialize(int display)
+{
+ stm32_gpiowrite(GPIO_LCD_DISP, false);
+ stm32_gpiowrite(GPIO_LCD_BL, false);
+
+ stm32_ltdcuninitialize();
+}
+#endif /* CONFIG_STM32_LTDC */
diff --git a/boards/arm/stm32h7/stm32h745i-disco/src/stm32_ostest.c b/boards/arm/stm32h7/stm32h745i-disco/src/stm32_ostest.c
new file mode 100644
index 0000000000..b60cd0c620
--- /dev/null
+++ b/boards/arm/stm32h7/stm32h745i-disco/src/stm32_ostest.c
@@ -0,0 +1,95 @@
+/****************************************************************************
+ * boards/arm/stm32h7/stm32h745i-disco/src/stm32_ostest.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <string.h>
+#include <debug.h>
+
+#include <nuttx/irq.h>
+#include <arch/board/board.h>
+
+#include "arm_arch.h"
+#include "arm_internal.h"
+#include "stm32h745i_disco.h"
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/* Configuration ************************************************************/
+
+#undef HAVE_FPU
+#if defined(CONFIG_ARCH_FPU) && !defined(CONFIG_TESTING_OSTEST_FPUTESTDISABLE) && \
+ defined(CONFIG_TESTING_OSTEST_FPUSIZE) && defined(CONFIG_SCHED_WAITPID)
+# define HAVE_FPU 1
+#endif
+
+#ifdef HAVE_FPU
+
+#if CONFIG_TESTING_OSTEST_FPUSIZE != (4*SW_FPU_REGS)
+# error "CONFIG_TESTING_OSTEST_FPUSIZE has the wrong size"
+#endif
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+static uint32_t g_saveregs[XCPTCONTEXT_REGS];
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/* Given an array of size CONFIG_TESTING_OSTEST_FPUSIZE, this function will
+ * return the current FPU registers.
+ */
+
+void arch_getfpu(FAR uint32_t *fpusave)
+{
+ irqstate_t flags;
+
+ /* Take a snapshot of the thread context right now */
+
+ flags = enter_critical_section();
+ arm_saveusercontext(g_saveregs);
+
+ /* Return only the floating register values */
+
+ memcpy(fpusave, &g_saveregs[REG_S0], (4*SW_FPU_REGS));
+ leave_critical_section(flags);
+}
+
+/* Given two arrays of size CONFIG_TESTING_OSTEST_FPUSIZE this function
+ * will compare them and return true if they are identical.
+ */
+
+bool arch_cmpfpu(FAR const uint32_t *fpusave1, FAR const uint32_t *fpusave2)
+{
+ return memcmp(fpusave1, fpusave2, (4*SW_FPU_REGS)) == 0;
+}
+
+#endif /* HAVE_FPU */
diff --git a/boards/arm/stm32h7/stm32h745i-disco/src/stm32_reset.c b/boards/arm/stm32h7/stm32h745i-disco/src/stm32_reset.c
new file mode 100644
index 0000000000..d77453f461
--- /dev/null
+++ b/boards/arm/stm32h7/stm32h745i-disco/src/stm32_reset.c
@@ -0,0 +1,62 @@
+/****************************************************************************
+ * boards/arm/stm32h7/stm32h745i-disco/src/stm32_reset.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <nuttx/arch.h>
+#include <nuttx/board.h>
+
+#ifdef CONFIG_BOARDCTL_RESET
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: board_reset
+ *
+ * Description:
+ * Reset board. Support for this function is required by board-level
+ * logic if CONFIG_BOARDCTL_RESET is selected.
+ *
+ * Input Parameters:
+ * status - Status information provided with the reset event. This
+ * meaning of this status information is board-specific. If not
+ * used by a board, the value zero may be provided in calls to
+ * board_reset().
+ *
+ * Returned Value:
+ * If this function returns, then it was not possible to power-off the
+ * board due to some constraints. The return value int this case is a
+ * board-specific reason for the failure to shutdown.
+ *
+ ****************************************************************************/
+
+int board_reset(int status)
+{
+ up_systemreset();
+ return 0;
+}
+
+#endif /* CONFIG_BOARDCTL_RESET */
diff --git a/boards/arm/stm32h7/stm32h745i-disco/src/stm32_usb.c b/boards/arm/stm32h7/stm32h745i-disco/src/stm32_usb.c
new file mode 100644
index 0000000000..f904945d60
--- /dev/null
+++ b/boards/arm/stm32h7/stm32h745i-disco/src/stm32_usb.c
@@ -0,0 +1,324 @@
+/****************************************************************************
+ * boards/arm/stm32h7/stm32h745i-disco/src/stm32_usb.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+#include <stdint.h>
+#include <stdbool.h>
+#include <sched.h>
+#include <errno.h>
+#include <assert.h>
+#include <debug.h>
+
+#include <nuttx/kthread.h>
+#include <nuttx/usb/usbdev.h>
+#include <nuttx/usb/usbhost.h>
+#include <nuttx/usb/usbdev_trace.h>
+
+#include "chip.h"
+#include "stm32_gpio.h"
+#include "stm32_otg.h"
+
+#include "stm32h745i_disco.h"
+
+#ifdef CONFIG_STM32H7_OTGFS
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+#if defined(CONFIG_USBDEV) || defined(CONFIG_USBHOST)
+# define HAVE_USB 1
+#else
+# warning "CONFIG_STM32_OTGFS is enabled but neither CONFIG_USBDEV nor CONFIG_USBHOST"
+# undef HAVE_USB
+#endif
+
+#ifndef CONFIG_USBHOST_DEFPRIO
+# define CONFIG_USBHOST_DEFPRIO 100
+#endif
+
+#ifndef CONFIG_USBHOST_STACKSIZE
+# define CONFIG_USBHOST_STACKSIZE 2048
+#endif
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+#ifdef CONFIG_USBHOST
+static struct usbhost_connection_s *g_usbconn;
+#endif
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: usbhost_waiter
+ *
+ * Description:
+ * Wait for USB devices to be connected.
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_USBHOST
+static int usbhost_waiter(int argc, char *argv[])
+{
+ struct usbhost_hubport_s *hport;
+
+ uinfo("Running\n");
+ for (; ; )
+ {
+ /* Wait for the device to change state */
+
+ DEBUGVERIFY(CONN_WAIT(g_usbconn, &hport));
+ uinfo("%s\n", hport->connected ? "connected" : "disconnected");
+
+ /* Did we just become connected? */
+
+ if (hport->connected)
+ {
+ /* Yes.. enumerate the newly connected device */
+
+ CONN_ENUMERATE(g_usbconn, hport);
+ }
+ }
+
+ /* Keep the compiler from complaining */
+
+ return 0;
+}
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: stm32_usbinitialize
+ *
+ * Description:
+ * Called from stm32_usbinitialize very early in inialization to setup
+ * USB-related GPIO pins for the nucleo-144 board.
+ *
+ ****************************************************************************/
+
+void stm32_usbinitialize(void)
+{
+ /* The OTG FS has an internal soft pull-up.
+ * No GPIO configuration is required
+ */
+
+ /* Configure the OTG FS VBUS sensing GPIO,
+ * Power On, and Overcurrent GPIOs
+ */
+
+#ifdef CONFIG_STM32H7_OTGFS
+ stm32_configgpio(GPIO_OTGFS_VBUS);
+ stm32_configgpio(GPIO_OTGFS_PWRON);
+ stm32_configgpio(GPIO_OTGFS_OVER);
+#endif
+}
+
+/****************************************************************************
+ * Name: stm32_usbhost_initialize
+ *
+ * Description:
+ * Called at application startup time to initialize the USB host
+ * functionality.
+ * This function will start a thread that will monitor for device
+ * connection/disconnection events.
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_USBHOST
+int stm32_usbhost_initialize(void)
+{
+ int pid;
+#if defined(CONFIG_USBHOST_HUB) || defined(CONFIG_USBHOST_MSC) || \
+ defined(CONFIG_USBHOST_HIDKBD) || defined(CONFIG_USBHOST_HIDMOUSE)
+ int ret;
+#endif
+
+ /* First, register all of the class drivers needed to support the drivers
+ * that we care about:
+ */
+
+ uinfo("Register class drivers\n");
+
+#ifdef CONFIG_USBHOST_HUB
+ /* Initialize USB hub class support */
+
+ ret = usbhost_hub_initialize();
+ if (ret < 0)
+ {
+ uerr("ERROR: usbhost_hub_initialize failed: %d\n", ret);
+ }
+#endif
+
+#ifdef CONFIG_USBHOST_MSC
+ /* Register the USB mass storage class class */
+
+ ret = usbhost_msc_initialize();
+ if (ret != OK)
+ {
+ uerr("ERROR: Failed to register the mass storage class: %d\n", ret);
+ }
+#endif
+
+#ifdef CONFIG_USBHOST_CDCACM
+ /* Register the CDC/ACM serial class */
+
+ ret = usbhost_cdcacm_initialize();
+ if (ret != OK)
+ {
+ uerr("ERROR: Failed to register the CDC/ACM serial class: %d\n", ret);
+ }
+#endif
+
+#ifdef CONFIG_USBHOST_HIDKBD
+ /* Initialize the HID keyboard class */
+
+ ret = usbhost_kbdinit();
+ if (ret != OK)
+ {
+ uerr("ERROR: Failed to register the HID keyboard class\n");
+ }
+#endif
+
+#ifdef CONFIG_USBHOST_HIDMOUSE
+ /* Initialize the HID mouse class */
+
+ ret = usbhost_mouse_init();
+ if (ret != OK)
+ {
+ uerr("ERROR: Failed to register the HID mouse class\n");
+ }
+#endif
+
+ /* Then get an instance of the USB host interface */
+
+ uinfo("Initialize USB host\n");
+ g_usbconn = stm32_otgfshost_initialize(0);
+ if (g_usbconn)
+ {
+ /* Start a thread to handle device connection. */
+
+ uinfo("Start usbhost_waiter\n");
+
+ pid = kthread_create("usbhost", CONFIG_USBHOST_DEFPRIO,
+ CONFIG_USBHOST_STACKSIZE,
+ (main_t)usbhost_waiter, (FAR char * const *)NULL);
+ return pid < 0 ? -ENOEXEC : OK;
+ }
+
+ return -ENODEV;
+}
+#endif
+
+/****************************************************************************
+ * Name: stm32_usbhost_vbusdrive
+ *
+ * Description:
+ * Enable/disable driving of VBUS 5V output. This function must be
+ * provided be each platform that implements the STM32 OTG FS host
+ * interface
+ *
+ * "On-chip 5 V VBUS generation is not supported. For this reason, a
+ * charge pump or, if 5 V are available on the application board, a
+ * basic power switch, must be added externally to drive the 5 V VBUS
+ * line. The external charge pump can be driven by any GPIO output.
+ * When the application decides to power on VBUS using the chosen GPIO,
+ * it must also set the port power bit in the host port control and status
+ * register (PPWR bit in OTG_FS_HPRT).
+ *
+ * "The application uses this field to control power to this port, and
+ * the core clears this bit on an overcurrent condition."
+ *
+ * Input Parameters:
+ * iface - For future growth to handle multiple USB host interface.
+ * Should be zero.
+ * enable - true: enable VBUS power; false: disable VBUS power
+ *
+ * Returned Value:
+ * None
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_USBHOST
+void stm32_usbhost_vbusdrive(int iface, bool enable)
+{
+ DEBUGASSERT(iface == 0);
+
+ /* Set the Power Switch by driving the active low enable pin */
+
+ stm32_gpiowrite(GPIO_OTGFS_PWRON, !enable);
+}
+#endif
+
+/****************************************************************************
+ * Name: stm32_setup_overcurrent
+ *
+ * Description:
+ * Setup to receive an interrupt-level callback if an overcurrent
+ * condition is detected.
+ *
+ * Input Parameters:
+ * handler - New overcurrent interrupt handler
+ * arg - The argument provided for the interrupt handler
+ *
+ * Returned Value:
+ * Zero (OK) is returned on success. Otherwise, a negated errno value
+ * is returned to indicate the nature of the failure.
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_USBHOST
+int stm32_setup_overcurrent(xcpt_t handler, void *arg)
+{
+ return stm32_gpiosetevent(GPIO_OTGFS_OVER, true, true, true, handler, arg);
+}
+#endif
+
+/****************************************************************************
+ * Name: stm32_usbsuspend
+ *
+ * Description:
+ * Board logic must provide the stm32_usbsuspend logic if the USBDEV
+ * driver is used. This function is called whenever the USB enters or
+ * leaves suspend mode. This is an opportunity for the board logic to
+ * shutdown clocks, power, etc. while the USB is suspended.
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_USBDEV
+void stm32_usbsuspend(FAR struct usbdev_s *dev, bool resume)
+{
+ uinfo("resume: %d\n", resume);
+}
+#endif
+
+#endif /* CONFIG_STM32_OTGFS */
diff --git a/boards/arm/stm32h7/stm32h745i-disco/src/stm32_userleds.c b/boards/arm/stm32h7/stm32h745i-disco/src/stm32_userleds.c
new file mode 100644
index 0000000000..9f15fd0eb5
--- /dev/null
+++ b/boards/arm/stm32h7/stm32h745i-disco/src/stm32_userleds.c
@@ -0,0 +1,130 @@
+/****************************************************************************
+ * boards/arm/stm32h7/stm32h745i-disco/src/stm32_userleds.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdbool.h>
+#include <debug.h>
+
+#include <nuttx/board.h>
+#include <arch/board/board.h>
+
+#include "stm32_gpio.h"
+
+#include "stm32h745i_disco.h"
+
+#ifndef CONFIG_ARCH_LEDS
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+#define ARRAYSIZE(x) (sizeof((x)) / sizeof((x)[0]))
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/* This array maps an LED number to GPIO pin configuration and is indexed by
+ * BOARD_LED_<color>
+ */
+
+static const uint32_t g_ledcfg[BOARD_NLEDS] =
+{
+ GPIO_LED_GREEN,
+ GPIO_LED_BLUE,
+ GPIO_LED_RED,
+};
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: board_userled_initialize
+ *
+ * Description:
+ * If CONFIG_ARCH_LEDS is defined, then NuttX will control the on-board
+ * LEDs. If CONFIG_ARCH_LEDS is not defined, then the
+ * board_userled_initialize() is available to initialize the LED from user
+ * application logic.
+ *
+ ****************************************************************************/
+
+uint32_t board_userled_initialize(void)
+{
+ int i;
+
+ /* Configure LED1-3 GPIOs for output */
+
+ for (i = 0; i < ARRAYSIZE(g_ledcfg); i++)
+ {
+ stm32_configgpio(g_ledcfg[i]);
+ }
+
+ return BOARD_NLEDS;
+}
+
+/****************************************************************************
+ * Name: board_userled
+ *
+ * Description:
+ * If CONFIG_ARCH_LEDS is defined, then NuttX will control the on-board
+ * LEDs. If CONFIG_ARCH_LEDS is not defined, then the board_userled() is
+ * available to control the LED from user application logic.
+ *
+ ****************************************************************************/
+
+void board_userled(int led, bool ledon)
+{
+ if ((unsigned)led < ARRAYSIZE(g_ledcfg))
+ {
+ stm32_gpiowrite(g_ledcfg[led], ledon);
+ }
+}
+
+/****************************************************************************
+ * Name: board_userled_all
+ *
+ * Description:
+ * If CONFIG_ARCH_LEDS is defined, then NuttX will control the on-board
+ * LEDs. If CONFIG_ARCH_LEDS is not defined, then the board_userled_all()
+ * is available to control the LED from user application logic. NOTE: since
+ * there is only a single LED on-board, this is function is not very useful.
+ *
+ ****************************************************************************/
+
+void board_userled_all(uint32_t ledset)
+{
+ int i;
+
+ /* Configure LED1-3 GPIOs for output */
+
+ for (i = 0; i < ARRAYSIZE(g_ledcfg); i++)
+ {
+ stm32_gpiowrite(g_ledcfg[i], (ledset & (1 << i)) != 0);
+ }
+}
+
+#endif /* !CONFIG_ARCH_LEDS */
diff --git a/boards/arm/stm32h7/stm32h745i-disco/src/stm32h745i_disco.h b/boards/arm/stm32h7/stm32h745i-disco/src/stm32h745i_disco.h
new file mode 100644
index 0000000000..819e1cb750
--- /dev/null
+++ b/boards/arm/stm32h7/stm32h745i-disco/src/stm32h745i_disco.h
@@ -0,0 +1,220 @@
+/****************************************************************************
+ * boards/arm/stm32h7/stm32h745i-disco/src/stm32h745i_disco.h
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+#ifndef __BOARDS_ARM_STM32H7_STM32H745I_DISCO_SRC_STM32H745I_DISCO_H
+#define __BOARDS_ARM_STM32H7_STM32H745I_DISCO_SRC_STM32H745I_DISCO_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+#include <nuttx/compiler.h>
+
+#include <stdint.h>
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/* Configuration ************************************************************/
+
+#define HAVE_USBDEV 1
+#define HAVE_USBHOST 1
+#define HAVE_USBMONITOR 1
+
+/* Can't support USB host or device features if USB OTG FS is not enabled */
+
+#ifndef CONFIG_STM32H7_OTGFS
+# undef HAVE_USBDEV
+# undef HAVE_USBHOST
+#endif
+
+/* Can't support USB device if USB device is not enabled */
+
+#ifndef CONFIG_USBDEV
+# undef HAVE_USBDEV
+#endif
+
+/* Can't support USB host is USB host is not enabled */
+
+#ifndef CONFIG_USBHOST
+# undef HAVE_USBHOST
+#endif
+
+/* Check if we should enable the USB monitor before starting NSH */
+
+#ifndef CONFIG_USBMONITOR
+# undef HAVE_USBMONITOR
+#endif
+
+#ifndef HAVE_USBDEV
+# undef CONFIG_USBDEV_TRACE
+#endif
+
+#if !defined(CONFIG_USBDEV_TRACE) && !defined(CONFIG_USBHOST_TRACE)
+# undef HAVE_USBMONITOR
+#endif
+
+/* LED */
+
+#define GPIO_LD1 (GPIO_OUTPUT | GPIO_PUSHPULL | GPIO_SPEED_50MHz | \
+ GPIO_OUTPUT_CLEAR | GPIO_PORTI | GPIO_PIN13)
+#define GPIO_LD2 (GPIO_OUTPUT | GPIO_PUSHPULL | GPIO_SPEED_50MHz | \
+ GPIO_OUTPUT_CLEAR | GPIO_PORTJ | GPIO_PIN2)
+#define GPIO_LD3 (GPIO_OUTPUT | GPIO_PUSHPULL | GPIO_SPEED_50MHz | \
+ GPIO_OUTPUT_CLEAR | GPIO_PORTD | GPIO_PIN3)
+
+#define GPIO_LED_GREEN GPIO_LD1
+#define GPIO_LED_ORANGE GPIO_LD2
+#define GPIO_LED_RED GPIO_LD3
+
+#define GPIO_OTGFS_VBUS (GPIO_INPUT|GPIO_FLOAT|GPIO_SPEED_100MHz| \
+ GPIO_OPENDRAIN|GPIO_PORTA|GPIO_PIN9)
+
+# define GPIO_OTGFS_PWRON (GPIO_OUTPUT|GPIO_FLOAT|GPIO_SPEED_100MHz| \
+ GPIO_PUSHPULL|GPIO_PORTD|GPIO_PIN10)
+
+#ifdef CONFIG_USBHOST
+# define GPIO_OTGFS_OVER (GPIO_INPUT|GPIO_EXTI|GPIO_FLOAT| \
+ GPIO_SPEED_100MHz|GPIO_PUSHPULL| \
+ GPIO_PORTG|GPIO_PIN7)
+#else
+# define GPIO_OTGFS_OVER (GPIO_INPUT|GPIO_FLOAT|GPIO_SPEED_100MHz| \
+ GPIO_PUSHPULL|GPIO_PORTG|GPIO_PIN7)
+#endif
+
+/* Touchscreen definitions **************************************************/
+
+/* The STM32H743I-DISCO have connectors for the LCD model RK043FN48H-CT672B.
+ * It comes with the FT5336GQQ (FT5X06) touchscreen chip integrated.
+ * FT5X06 is connected to the I2C4 bus.
+ */
+
+/* I2C4 address of the FT5336GQQ touchscreen chip */
+
+#define FT5X06_I2C_ADDRESS 0x38
+
+/* Touchscreen Interrupt line: PG2 */
+
+#define GPIO_FT5X06_INT (GPIO_INPUT|GPIO_FLOAT|GPIO_SPEED_100MHz| \
+ GPIO_PUSHPULL|GPIO_PORTG|GPIO_PIN2)
+
+/* The reset line is active low: PB12 */
+
+#define GPIO_FT5X06_RST (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_50MHz|\
+ GPIO_OUTPUT_SET|GPIO_PORTB|GPIO_PIN12)
+
+/* LCD */
+
+#define GPIO_LCD_DISP (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_50MHz|\
+ GPIO_OUTPUT_SET|GPIO_PORTD|GPIO_PIN7)
+
+#define GPIO_LCD_BL (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_50MHz|\
+ GPIO_OUTPUT_SET|GPIO_PORTK|GPIO_PIN0)
+
+/* Convert 24-bit LCD to 16-bit */
+
+#define GPIO_LCD_R0 (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_50MHz|\
+ GPIO_OUTPUT_CLEAR|GPIO_PORTI|GPIO_PIN15)
+
+#define GPIO_LCD_R1 (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_50MHz|\
+ GPIO_OUTPUT_CLEAR|GPIO_PORTJ|GPIO_PIN0)
+
+#define GPIO_LCD_R2 (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_50MHz|\
+ GPIO_OUTPUT_CLEAR|GPIO_PORTJ|GPIO_PIN1)
+
+#define GPIO_LCD_G0 (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_50MHz|\
+ GPIO_OUTPUT_CLEAR|GPIO_PORTG|GPIO_PIN0)
+
+#define GPIO_LCD_G1 (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_50MHz|\
+ GPIO_OUTPUT_CLEAR|GPIO_PORTG|GPIO_PIN1)
+
+#define GPIO_LCD_B0 (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_50MHz|\
+ GPIO_OUTPUT_CLEAR|GPIO_PORTJ|GPIO_PIN12)
+
+#define GPIO_LCD_B1 (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_50MHz|\
+ GPIO_OUTPUT_CLEAR|GPIO_PORTJ|GPIO_PIN13)
+
+#define GPIO_LCD_B2 (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_50MHz|\
+ GPIO_OUTPUT_CLEAR|GPIO_PORTJ|GPIO_PIN14)
+
+/****************************************************************************
+ * Public Function Prototypes
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: stm32_bringup
+ *
+ * Description:
+ * Perform architecture-specific initialization
+ *
+ * CONFIG_BOARD_LATE_INITIALIZE=y :
+ * Called from board_late_initialize().
+ *
+ * CONFIG_BOARD_LATE_INITIALIZE=y && CONFIG_BOARDCTL=y :
+ * Called from the NSH library
+ *
+ ****************************************************************************/
+
+int stm32_bringup(void);
+
+/****************************************************************************
+ * Name: stm32_usbinitialize
+ *
+ * Description:
+ * Called from stm32_usbinitialize very early in inialization to setup
+ * USB-related GPIO pins for the STM32H745I-DISCO board.
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_STM32H7_OTGFS
+void weak_function stm32_usbinitialize(void);
+#endif
+
+/****************************************************************************
+ * Name: stm32_usbhost_initialize
+ *
+ * Description:
+ * Called at application startup time to initialize the USB host
+ * functionality. This function will start a thread that will monitor for
+ * device connection/disconnection events.
+ *
+ ****************************************************************************/
+
+#if defined(CONFIG_STM32H7_OTGFS) && defined(CONFIG_USBHOST)
+int stm32_usbhost_initialize(void);
+#endif
+
+/****************************************************************************
+ * Name: stm32_tsc_setup
+ *
+ * Description:
+ * This function is called by board-bringup logic to configure the
+ * touchscreen device. This function will register the driver as
+ * /dev/inputN where N is the minor device number.
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_INPUT_FT5X06
+int stm32_tsc_setup(int minor);
+#endif
+
+#endif /* __BOARDS_ARM_STM32H7_STM32H745I_DISCO_SRC_STM32H745I_DISCO_H */
[nuttx] 02/03: stm32h7: add LTDC support
Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit f7905512be0a2fdf3fe435d0bce015c8b2020db3
Author: raiden00pl <ra...@railab.me>
AuthorDate: Wed Jul 12 10:09:35 2023 +0200
stm32h7: add LTDC support
---
arch/arm/src/stm32h7/Kconfig | 227 ++
arch/arm/src/stm32h7/Make.defs | 4 +
arch/arm/src/stm32h7/hardware/stm32_ltdc.h | 366 +++
arch/arm/src/stm32h7/hardware/stm32h7x3xx_pinmap.h | 220 +-
arch/arm/src/stm32h7/stm32_ltdc.c | 3137 ++++++++++++++++++++
arch/arm/src/stm32h7/stm32_ltdc.h | 100 +
arch/arm/src/stm32h7/stm32h7x3xx_rcc.c | 12 +-
7 files changed, 3955 insertions(+), 111 deletions(-)
diff --git a/arch/arm/src/stm32h7/Kconfig b/arch/arm/src/stm32h7/Kconfig
index 7177fcb2ee..fc0a3b599d 100644
--- a/arch/arm/src/stm32h7/Kconfig
+++ b/arch/arm/src/stm32h7/Kconfig
@@ -348,6 +348,7 @@ config STM32H7_STM32H7X3XX
select ARMV7M_HAVE_DCACHE
select ARMV7M_HAVE_ITCM
select ARMV7M_HAVE_DTCM
+ select STM32H7_HAVE_LTDC
select STM32H7_HAVE_ETHERNET
select STM32H7_HAVE_FMC
select STM32H7_HAVE_GPIOF if !STM32H7_IO_CONFIG_V
@@ -382,6 +383,7 @@ config STM32H7_STM32H7X5XX
select ARMV7M_HAVE_DCACHE
select ARMV7M_HAVE_ITCM
select ARMV7M_HAVE_DTCM
+ select STM32H7_HAVE_LTDC
select STM32H7_HAVE_ETHERNET
select STM32H7_HAVE_FMC
select STM32H7_HAVE_GPIOF if !STM32H7_IO_CONFIG_V
@@ -399,6 +401,7 @@ config STM32H7_STM32H7X7XX
select ARMV7M_HAVE_DCACHE
select ARMV7M_HAVE_ITCM
select ARMV7M_HAVE_DTCM
+ select STM32H7_HAVE_LTDC
select STM32H7_HAVE_ETHERNET
select STM32H7_HAVE_FMC
select STM32H7_HAVE_GPIOF
@@ -535,6 +538,10 @@ menu "STM32H7 Peripheral Selection"
# These "hidden" settings determine whether a peripheral option is available
# for the selected MCU
+config STM32H7_HAVE_LTDC
+ bool
+ default n
+
config STM32H7_HAVE_ETHERNET
bool
default n
@@ -822,6 +829,20 @@ config STM32H7_I2C4
endmenu # STM32H7 I2C Selection
+config STM32H7_LTDC
+ bool "LTDC"
+ default n
+ select FB
+ depends on STM32H7_HAVE_LTDC
+ ---help---
+ The STM32 LTDC is an LCD-TFT Display Controller available on
+ the STM32H7 devices.
+ It features a standard RGB888 parallel video interface (along
+ with HSYNC, VSYNC, etc.) for controlling TFT LCD displays.
+ In some STM32H7 devices the graphics signals can optionally
+ be output via DSI instead of the parallel interface:
+ See config options STM32H7_DSIHOST and STM32H7_LTDC_USE_DSI.
+
menu "STM32H7 SPI Selection"
config STM32H7_SPI1
@@ -5433,6 +5454,212 @@ config STM32H7_ETHMAC_REGDEBUG
endmenu # Ethernet MAC configuration
+if STM32H7_LTDC
+
+menu "LTDC Configuration"
+
+config STM32H7_LTDC_USE_DSI
+ bool "Use DSI as display connection"
+ default n
+ depends on STM32H7_DSIHOST
+ ---help---
+ Select this if your display is connected via DSI.
+ Deselect option if your display is connected via digital
+ RGB+HSYNC+VSYNC
+
+config STM32H7_LTDC_BACKLIGHT
+ bool "Backlight support"
+ default y
+
+config STM32H7_LTDC_DEFBACKLIGHT
+ hex "Default backlight level"
+ default 0xf0
+
+config STM32H7_LTDC_BACKCOLOR
+ hex "Background color"
+ default 0x0
+ ---help---
+ This is the background color that will be used as the LTDC
+ background layer color. It is an RGB888 format value,
+ which gets written unmodified to register LTDC_BCCR.
+
+config STM32H7_LTDC_DITHER
+ bool "Dither support"
+ default n
+
+config STM32H7_LTDC_DITHER_RED
+ depends on STM32H7_LTDC_DITHER
+ int "Dither red width"
+ range 0 7
+ default 2
+ ---help---
+ This is the dither red width.
+
+config STM32H7_LTDC_DITHER_GREEN
+ depends on STM32H7_LTDC_DITHER
+ int "Dither green width"
+ range 0 7
+ default 2
+ ---help---
+ This is the dither green width.
+
+config STM32H7_LTDC_DITHER_BLUE
+ depends on STM32H7_LTDC_DITHER
+ int "Dither blue width"
+ range 0 7
+ default 2
+ ---help---
+ This is the dither blue width.
+
+config STM32H7_LTDC_FB_BASE
+ hex "Framebuffer memory start address"
+ default 0
+ ---help---
+ If you are using the LTDC, then you must provide the address
+ of the start of the framebuffer. This address will typically
+ be in the SRAM or SDRAM memory region of the FMC.
+
+config STM32H7_LTDC_FB_SIZE
+ int "Framebuffer memory size (bytes)"
+ default 0
+ ---help---
+ Must be the whole size of the active LTDC layer.
+
+config STM32H7_LTDC_L1_CHROMAKEYEN
+ bool "Enable chromakey support for layer 1"
+ default y
+
+config STM32H7_LTDC_L1_CHROMAKEY
+ hex "Layer L1 initial chroma key"
+ default 0x00000000
+
+config STM32H7_LTDC_L1_COLOR
+ hex "Layer L1 default color"
+ default 0x00000000
+
+choice
+ prompt "Layer 1 color format"
+ default STM32H7_LTDC_L1_RGB565
+
+config STM32H7_LTDC_L1_L8
+ bool "8 bpp L8 (8-bit CLUT)"
+ depends on STM32H7_FB_CMAP
+
+config STM32H7_LTDC_L1_AL44
+ bool "8 bpp AL44 (4-bit alpha + 4-bit CLUT)"
+ depends on STM32H7_FB_CMAP
+
+config STM32H7_LTDC_L1_AL88
+ bool "16 bpp AL88 (8-bit alpha + 8-bit CLUT)"
+ depends on STM32H7_FB_CMAP
+
+config STM32H7_LTDC_L1_RGB565
+ bool "16 bpp RGB 565"
+ depends on !STM32H7_FB_CMAP
+
+config STM32H7_LTDC_L1_ARGB4444
+ bool "16 bpp ARGB 4444"
+ depends on !STM32H7_FB_CMAP
+
+config STM32H7_LTDC_L1_ARGB1555
+ bool "16 bpp ARGB 1555"
+ depends on !STM32H7_FB_CMAP
+
+config STM32H7_LTDC_L1_RGB888
+ bool "24 bpp RGB 888"
+ depends on !STM32H7_FB_CMAP
+
+config STM32H7_LTDC_L1_ARGB8888
+ bool "32 bpp ARGB 8888"
+ depends on !STM32H7_FB_CMAP
+
+endchoice # Layer 1 color format
+
+config STM32H7_LTDC_L2
+ bool "Enable Layer 2 support"
+ default y
+
+if STM32H7_LTDC_L2
+
+config STM32H7_LTDC_L2_COLOR
+ hex "Layer L2 default color"
+ default 0x00000000
+
+config STM32H7_LTDC_L2_CHROMAKEYEN
+ bool "Enable chromakey support for layer 2"
+ default y
+
+config STM32H7_LTDC_L2_CHROMAKEY
+ hex "Layer L2 initial chroma key"
+ default 0x00000000
+
+choice
+ prompt "Layer 2 (top layer) color format"
+ default STM32H7_LTDC_L2_RGB565
+
+config STM32H7_LTDC_L2_L8
+ depends on STM32H7_LTDC_L1_L8
+ bool "8 bpp L8 (8-bit CLUT)"
+
+config STM32H7_LTDC_L2_AL44
+ depends on STM32H7_LTDC_L1_AL44
+ bool "8 bpp AL44 (4-bit alpha + 4-bit CLUT)"
+
+config STM32H7_LTDC_L2_AL88
+ depends on STM32H7_LTDC_L1_AL88
+ bool "16 bpp AL88 (8-bit alpha + 8-bit CLUT)"
+
+config STM32H7_LTDC_L2_RGB565
+ depends on STM32H7_LTDC_L1_RGB565
+ bool "16 bpp RGB 565"
+
+config STM32H7_LTDC_L2_ARGB4444
+ depends on STM32H7_LTDC_L1_ARGB4444
+ bool "16 bpp ARGB 4444"
+
+config STM32H7_LTDC_L2_ARGB1555
+ depends on STM32H7_LTDC_L1_ARGB1555
+ bool "16 bpp ARGB 1555"
+
+config STM32H7_LTDC_L2_RGB888
+ depends on STM32H7_LTDC_L1_RGB888
+ bool "24 bpp RGB 888"
+
+config STM32H7_LTDC_L2_ARGB8888
+ depends on STM32H7_LTDC_L1_ARGB8888
+ bool "32 bpp ARGB 8888"
+
+endchoice # Layer 2 color format
+
+endif # STM32H7_LTDC_L2
+
+config STM32H7_FB_CMAP
+ bool "Color map support"
+ default y
+ select FB_CMAP
+ ---help---
+ EnablingEnablescolor map support is necessary for ltdc L8 format.
+
+config STM32H7_FB_TRANSPARENCY
+ bool "Transparency color map support"
+ default y
+ depends on STM32H7_FB_CMAP
+ select FB_TRANSPARENCY
+ ---help---
+ Enables transparency color map support is necessary for ltdc L8 format.
+
+config STM32H7_LTDC_REGDEBUG
+ bool "Enable LTDC register value debug messages"
+ default n
+ ---help---
+ This gives additional messages for LTDC related register values.
+ Additionally, you have to select "Low-level LCD Debug Features"
+ to enable the debug messages.
+
+endmenu
+
+endif # STM32H7_LTDC
+
menu "QEncoder Driver"
depends on SENSORS_QENCODER
depends on STM32H7_TIM1 || STM32H7_TIM2 || STM32H7_TIM3 || STM32H7_TIM4 || STM32H7_TIM5 || STM32H7_TIM8
diff --git a/arch/arm/src/stm32h7/Make.defs b/arch/arm/src/stm32h7/Make.defs
index 5b38888238..8d1433e69f 100644
--- a/arch/arm/src/stm32h7/Make.defs
+++ b/arch/arm/src/stm32h7/Make.defs
@@ -122,6 +122,10 @@ ifeq ($(CONFIG_TIMER),y)
CHIP_CSRCS += stm32_tim_lowerhalf.c
endif
+ifeq ($(CONFIG_STM32H7_LTDC),y)
+CHIP_CSRCS += stm32_ltdc.c
+endif
+
ifeq ($(CONFIG_USBDEV),y)
CHIP_CSRCS += stm32_otgdev.c
endif
diff --git a/arch/arm/src/stm32h7/hardware/stm32_ltdc.h b/arch/arm/src/stm32h7/hardware/stm32_ltdc.h
new file mode 100644
index 0000000000..190f63e947
--- /dev/null
+++ b/arch/arm/src/stm32h7/hardware/stm32_ltdc.h
@@ -0,0 +1,366 @@
+/****************************************************************************
+ * arch/arm/src/stm32h7/hardware/stm32_ltdc.h
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+#ifndef __ARCH_ARM_SRC_STM32H7_HARDWARE_STM32_LTDC_H
+#define __ARCH_ARM_SRC_STM32H7_HARDWARE_STM32_LTDC_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+#include "hardware/stm32_memorymap.h"
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+#define STM32_LTDC_NCLUT 256 /* Number of entries in the CLUTs */
+
+/* LCDC Register Offsets ****************************************************/
+
+#define STM32_LTDC_SSCR_OFFSET 0x0008 /* LTDC Synchronization Size Config Register */
+#define STM32_LTDC_BPCR_OFFSET 0x000c /* LTDC Back Porch Configuration Register */
+#define STM32_LTDC_AWCR_OFFSET 0x0010 /* LTDC Active Width Configuration Register */
+#define STM32_LTDC_TWCR_OFFSET 0x0014 /* LTDC Total Width Configuration Register */
+#define STM32_LTDC_GCR_OFFSET 0x0018 /* LTDC Global Control Register */
+ /* 0x0020 Reserved */
+#define STM32_LTDC_SRCR_OFFSET 0x0024 /* LTDC Shadow Reload Configuration Register */
+ /* 0x0028 Reserved */
+#define STM32_LTDC_BCCR_OFFSET 0x002c /* LTDC Background Color Configuration Register */
+ /* 0x0030 Reserved */
+#define STM32_LTDC_IER_OFFSET 0x0034 /* LTDC Interrupt Enable Register */
+#define STM32_LTDC_ISR_OFFSET 0x0038 /* LTDC Interrupt Status Register */
+#define STM32_LTDC_ICR_OFFSET 0x003c /* LTDC Interrupt Clear Register */
+#define STM32_LTDC_LIPCR_OFFSET 0x0040 /* LTDC Line Interrupt Position Config Register */
+#define STM32_LTDC_CPSR_OFFSET 0x0044 /* LTDC Current Position Status Register */
+#define STM32_LTDC_CDSR_OFFSET 0x0048 /* LTDC Current Display Status Register */
+ /* 0x004c-0x0080 Reserved */
+
+#define STM32_LTDC_L1CR_OFFSET 0x0084 /* LTDC Layer 1 Control Register */
+#define STM32_LTDC_L1WHPCR_OFFSET 0x0088 /* LTDC Layer 1 Window Horiz Pos Config Register */
+#define STM32_LTDC_L1WVPCR_OFFSET 0x008c /* LTDC Layer 1 Window Vert Pos Config Register */
+#define STM32_LTDC_L1CKCR_OFFSET 0x0090 /* LTDC Layer 1 Color Keying Config Register */
+#define STM32_LTDC_L1PFCR_OFFSET 0x0094 /* LTDC Layer 1 Pixel Format Configuration Register */
+#define STM32_LTDC_L1CACR_OFFSET 0x0098 /* LTDC Layer 1 Constant Alpha Config Register */
+#define STM32_LTDC_L1DCCR_OFFSET 0x009c /* LTDC Layer 1 Default Color Config Register */
+#define STM32_LTDC_L1BFCR_OFFSET 0x00a0 /* LTDC Layer 1 Blending Factors Config Register */
+ /* 0x00A4-0x00A8 Reserved */
+#define STM32_LTDC_L1CFBAR_OFFSET 0x00ac /* LTDC Layer 1 Color Frame Buffer Address Register */
+#define STM32_LTDC_L1CFBLR_OFFSET 0x00b0 /* LTDC Layer 1 Color Frame Buffer Length Register */
+#define STM32_LTDC_L1CFBLNR_OFFSET 0x00b4 /* LTDC Layer 1 Color Frame Buffer Line Number Register */
+ /* 0x00B8-0x00C0 Reserved */
+#define STM32_LTDC_L1CLUTWR_OFFSET 0x00c4 /* LTDC Layer 1 CLUT Write Register */
+ /* 0x00C8-0x0100 Reserved */
+#define STM32_LTDC_L2CR_OFFSET 0x0104 /* LTDC Layer 2 Control Register */
+#define STM32_LTDC_L2WHPCR_OFFSET 0x0108 /* LTDC Layer 2 Window Horiz Pos Config Register */
+#define STM32_LTDC_L2WVPCR_OFFSET 0x010c /* LTDC Layer 2 Window Vert Pos Config Register */
+#define STM32_LTDC_L2CKCR_OFFSET 0x0110 /* LTDC Layer 2 Color Keying Config Register */
+#define STM32_LTDC_L2PFCR_OFFSET 0x0114 /* LTDC Layer 2 Pixel Format Configuration Register */
+#define STM32_LTDC_L2CACR_OFFSET 0x0118 /* LTDC Layer 2 Constant Alpha Config Register */
+#define STM32_LTDC_L2DCCR_OFFSET 0x011c /* LTDC Layer 2 Default Color Config Register */
+#define STM32_LTDC_L2BFCR_OFFSET 0x0120 /* LTDC Layer 2 Blending Factors Config Register */
+ /* 0x0124-0x0128 Reserved */
+#define STM32_LTDC_L2CFBAR_OFFSET 0x012c /* LTDC Layer 2 Color Frame Buffer Address Register */
+#define STM32_LTDC_L2CFBLR_OFFSET 0x0130 /* LTDC Layer 2 Color Frame Buffer Length Register */
+#define STM32_LTDC_L2CFBLNR_OFFSET 0x0134 /* LTDC Layer 2 Color Frame Buffer Line Number Register */
+ /* 0x0138-0x0130 Reserved */
+#define STM32_LTDC_L2CLUTWR_OFFSET 0x0144 /* LTDC Layer 2 CLUT Write Register */
+ /* 0x0148-0x03ff Reserved */
+
+/* LTDC Register Addresses **************************************************/
+
+#define STM32_LTDC_SSCR (STM32_LTDC_BASE + STM32_LTDC_SSCR_OFFSET)
+#define STM32_LTDC_BPCR (STM32_LTDC_BASE + STM32_LTDC_BPCR_OFFSET)
+#define STM32_LTDC_AWCR (STM32_LTDC_BASE + STM32_LTDC_AWCR_OFFSET)
+#define STM32_LTDC_TWCR (STM32_LTDC_BASE + STM32_LTDC_TWCR_OFFSET)
+#define STM32_LTDC_GCR (STM32_LTDC_BASE + STM32_LTDC_GCR_OFFSET)
+#define STM32_LTDC_SRCR (STM32_LTDC_BASE + STM32_LTDC_SRCR_OFFSET)
+#define STM32_LTDC_BCCR (STM32_LTDC_BASE + STM32_LTDC_BCCR_OFFSET)
+#define STM32_LTDC_IER (STM32_LTDC_BASE + STM32_LTDC_IER_OFFSET)
+#define STM32_LTDC_ISR (STM32_LTDC_BASE + STM32_LTDC_ISR_OFFSET)
+#define STM32_LTDC_ICR (STM32_LTDC_BASE + STM32_LTDC_ICR_OFFSET)
+#define STM32_LTDC_LIPCR (STM32_LTDC_BASE + STM32_LTDC_LIPCR_OFFSET)
+#define STM32_LTDC_CPSR (STM32_LTDC_BASE + STM32_LTDC_CPSR_OFFSET)
+#define STM32_LTDC_CDSR (STM32_LTDC_BASE + STM32_LTDC_CDSR_OFFSET)
+
+#define STM32_LTDC_L1CR (STM32_LTDC_BASE + STM32_LTDC_L1CR_OFFSET)
+#define STM32_LTDC_L1WHPCR (STM32_LTDC_BASE + STM32_LTDC_L1WHPCR_OFFSET)
+#define STM32_LTDC_L1WVPCR (STM32_LTDC_BASE + STM32_LTDC_L1WVPCR_OFFSET)
+#define STM32_LTDC_L1CKCR (STM32_LTDC_BASE + STM32_LTDC_L1CKCR_OFFSET)
+#define STM32_LTDC_L1PFCR (STM32_LTDC_BASE + STM32_LTDC_L1PFCR_OFFSET)
+#define STM32_LTDC_L1CACR (STM32_LTDC_BASE + STM32_LTDC_L1CACR_OFFSET)
+#define STM32_LTDC_L1DCCR (STM32_LTDC_BASE + STM32_LTDC_L1DCCR_OFFSET)
+#define STM32_LTDC_L1BFCR (STM32_LTDC_BASE + STM32_LTDC_L1BFCR_OFFSET)
+#define STM32_LTDC_L1CFBAR (STM32_LTDC_BASE + STM32_LTDC_L1CFBAR_OFFSET)
+#define STM32_LTDC_L1CFBLR (STM32_LTDC_BASE + STM32_LTDC_L1CFBLR_OFFSET)
+#define STM32_LTDC_L1CFBLNR (STM32_LTDC_BASE + STM32_LTDC_L1CFBLNR_OFFSET)
+#define STM32_LTDC_L1CLUTWR (STM32_LTDC_BASE + STM32_LTDC_L1CLUTWR_OFFSET)
+
+#define STM32_LTDC_L2CR (STM32_LTDC_BASE + STM32_LTDC_L2CR_OFFSET)
+#define STM32_LTDC_L2WHPCR (STM32_LTDC_BASE + STM32_LTDC_L2WHPCR_OFFSET)
+#define STM32_LTDC_L2WVPCR (STM32_LTDC_BASE + STM32_LTDC_L2WVPCR_OFFSET)
+#define STM32_LTDC_L2CKCR (STM32_LTDC_BASE + STM32_LTDC_L2CKCR_OFFSET)
+#define STM32_LTDC_L2PFCR (STM32_LTDC_BASE + STM32_LTDC_L2PFCR_OFFSET)
+#define STM32_LTDC_L2CACR (STM32_LTDC_BASE + STM32_LTDC_L2CACR_OFFSET)
+#define STM32_LTDC_L2DCCR (STM32_LTDC_BASE + STM32_LTDC_L2DCCR_OFFSET)
+#define STM32_LTDC_L2BFCR (STM32_LTDC_BASE + STM32_LTDC_L2BFCR_OFFSET)
+#define STM32_LTDC_L2CFBAR (STM32_LTDC_BASE + STM32_LTDC_L2CFBAR_OFFSET)
+#define STM32_LTDC_L2CFBLR (STM32_LTDC_BASE + STM32_LTDC_L2CFBLR_OFFSET)
+#define STM32_LTDC_L2CFBLNR (STM32_LTDC_BASE + STM32_LTDC_L2CFBLNR_OFFSET)
+#define STM32_LTDC_L2CLUTWR (STM32_LTDC_BASE + STM32_LTDC_L2CLUTWR_OFFSET)
+
+/* LTDC Register Bit Definitions ********************************************/
+
+/* LTDC Synchronization Size Configuration Register */
+
+#define LTDC_SSCR_VSH_SHIFT (0) /* Bits 0-10: Vertical Sync Height (scan lines) */
+#define LTDC_SSCR_VSH_MASK (0x7ff << LTDC_SSCR_VSH_SHIFT)
+# define LTDC_SSCR_VSH(n) ((uint32_t)(n) << LTDC_SSCR_VSH_SHIFT)
+#define LTDC_SSCR_HSW_SHIFT (16) /* Bits 16-27: Horizontal Sync Width (pixel clocks) */
+#define LTDC_SSCR_HSW_MASK (0xfff << LTDC_SSCR_HSW_SHIFT)
+# define LTDC_SSCR_HSW(n) ((uint32_t)(n) << LTDC_SSCR_HSW_SHIFT)
+
+/* LTDC Back Porch Configuration Register */
+
+#define LTDC_BPCR_AVBP_SHIFT (0) /* Bits 0-10: Accumulated Vertical back porch (scan lines) */
+#define LTDC_BPCR_AVBP_MASK (0x7ff << LTDC_BPCR_AVBP_SHIFT)
+# define LTDC_BPCR_AVBP(n) ((uint32_t)(n) << LTDC_BPCR_AVBP_SHIFT)
+#define LTDC_BPCR_AHBP_SHIFT (16) /* Bits 16-27: Accumulated Horizontal back porch (pixel clocks) */
+#define LTDC_BPCR_AHBP_MASK (0xfff << LTDC_BPCR_AVBP_SHIFT)
+# define LTDC_BPCR_AHBP(n) ((uint32_t)(n) << LTDC_BPCR_AHBP_SHIFT)
+
+/* LTDC Active Width Configuration Register */
+
+#define LTDC_AWCR_AAH_SHIFT (0) /* Bits 0-10: Accumulated Active Height (scan lines) */
+#define LTDC_AWCR_AAH_MASK (0x7ff << LTDC_AWCR_AAH_SHIFT)
+# define LTDC_AWCR_AAH(n) ((uint32_t)(n) << LTDC_AWCR_AAH_SHIFT)
+#define LTDC_AWCR_AAW_SHIFT (16) /* Bits 16-27: Accumulated Active Width (pixel clocks) */
+#define LTDC_AWCR_AAW_MASK (0xfff << LTDC_AWCR_AAW_SHIFT)
+# define LTDC_AWCR_AAW(n) ((uint32_t)(n) << LTDC_AWCR_AAW_SHIFT)
+
+/* LTDC Total Width Configuration Register */
+
+#define LTDC_TWCR_TOTALH_SHIFT (0) /* Bits 0-10: Total Height (scan lines) */
+#define LTDC_TWCR_TOTALH_MASK (0x7ff << LTDC_TWCR_TOTALH_SHIFT)
+# define LTDC_TWCR_TOTALH(n) ((uint32_t)(n) << LTDC_TWCR_TOTALH_SHIFT)
+#define LTDC_TWCR_TOTALW_SHIFT (16) /* Bits 16-27: Total Width (pixel clocks) */
+#define LTDC_TWCR_TOTALW_MASK (0xfff << LTDC_TWCR_TOTALW_SHIFT)
+# define LTDC_TWCR_TOTALW(n) ((uint32_t)(n) << LTDC_TWCR_TOTALW_SHIFT)
+
+/* LTDC Global Control Register */
+
+#define LTDC_GCR_LTDCEN (1 << 0) /* Bit 0: LCD-TFT Controller Enable Bit */
+#define LTDC_GCR_DBW_SHIFT (4) /* Bits 4-6: Dither Blue Width */
+#define LTDC_GCR_DBW_MASK (0x7 << LTDC_GCR_DBW_SHIFT)
+# define LTDC_GCR_DBW(n) ((uint32_t)(n) << LTDC_GCR_DBW_SHIFT)
+#define LTDC_GCR_DGW_SHIFT (8) /* Bits 8-10: Dither Green Width */
+#define LTDC_GCR_DGW_MASK (0x7 << LTDC_GCR_DGW_SHIFT)
+# define LTDC_GCR_DGW(n) ((uint32_t)(n) << LTDC_GCR_DGW_SHIFT)
+#define LTDC_GCR_DRW_SHIFT (12) /* Bits 12-14: Dither Red Width */
+#define LTDC_GCR_DRW_MASK (0x7 << LTDC_GCR_DRW_SHIFT)
+# define LTDC_GCR_DRW(n) ((uint32_t)(n) << LTDC_GCR_DRW_SHIFT)
+#define LTDC_GCR_DEN (1 << 16) /* Bit 16: Dither Enable */
+#define LTDC_GCR_PCPOL (1 << 28) /* Bit 28: Pixel Clock Polarity */
+#define LTDC_GCR_DEPOL (1 << 29) /* Bit 29: Not(Data Enable) Polarity */
+#define LTDC_GCR_VSPOL (1 << 30) /* Bit 30: Vertical Sync Polarity */
+#define LTDC_GCR_HSPOL (1 << 31) /* Bit 31: Horizontal Sync Polarity */
+
+/* LTDC Shadow Reload Configuration Register */
+
+#define LTDC_SRCR_IMR (1 << 0) /* Bit 0: Immediate Reload */
+#define LTDC_SRCR_VBR (1 << 1) /* Bit 1: Vertical Blanking Reload */
+
+/* LTDC Background Color Configuration Register */
+
+#define LTDC_BCCR_BCBLUE_SHIFT (0) /* Bits 0-7: Background Color Blue Value */
+#define LTDC_BCCR_BCBLUE_MASK (0xff << LTDC_BCCR_BCBLUE_SHIFT)
+# define LTDC_BCCR_BCBLUE(n) ((uint32_t)(n) << LTDC_BCCR_BCBLUE_SHIFT)
+#define LTDC_BCCR_BCGREEN_SHIFT (8) /* Bits 8-15: Background Color Green Value */
+#define LTDC_BCCR_BCGREEN_MASK (0xff << LTDC_BCCR_BCGREEN_SHIFT)
+# define LTDC_BCCR_BCGREEN(n) ((uint32_t)(n) << LTDC_BCCR_BCGREEN_SHIFT)
+#define LTDC_BCCR_BCRED_SHIFT (16) /* Bits 16-23: Background Color Red Value */
+#define LTDC_BCCR_BCRED_MASK (0xff << LTDC_BCCR_BCRED_SHIFT)
+# define LTDC_BCCR_BCRED(n) ((uint32_t)(n) << LTDC_BCCR_BCRED_SHIFT)
+
+/* LTDC Interrupt Enable Register */
+
+#define LTDC_IER_LIE (1 << 0) /* Bit 0: Line Interrupt Enable */
+#define LTDC_IER_FUIE (1 << 1) /* Bit 1: FIFO Underrun Interrupt Enable */
+#define LTDC_IER_TERRIE (1 << 2) /* Bit 2: Transfer Error Interrupt Enable */
+#define LTDC_IER_RRIE (1 << 3) /* Bit 3: Register Reload Interrupt Enable */
+
+/* LTDC Interrupt Status Register */
+
+#define LTDC_ISR_LIF (1 << 0) /* Bit 0: Line Interrupt Flag */
+#define LTDC_ISR_FUIF (1 << 1) /* Bit 1: FIFO Underrun Interrupt Flag */
+#define LTDC_IER_TERRIF (1 << 2) /* Bit 2: Transfer Error Interrupt Flag */
+#define LTDC_ISR_RRIF (1 << 3) /* Bit 3: Register Reload Interrupt Flag */
+
+/* LTDC Interrupt Clear Register */
+
+#define LTDC_ICR_CLIF (1 << 0) /* Bit 0: Clear Line Interrupt Flag */
+#define LTDC_ICR_CFUIF (1 << 1) /* Bit 1: Clear FIFO Underrun Interrupt Flag */
+#define LTDC_ICR_CTERRIF (1 << 2) /* Bit 2: Clear Transfer Error Interrupt Flag */
+#define LTDC_ICR_CRRIF (1 << 3) /* Bit 3: Clear Register Reload Interrupt Flag */
+
+/* LTDC Line Interrupt Posittion Configuration Register */
+
+#define LTDC_LIPCR_LIPOS_SHIFT (0) /* Bits 0-10: Line Interrupt Position */
+#define LTDC_LIPCR_LIPOS_MASK (0x7ff << LTDC_LIPCR_LIPOS_SHIFT)
+# define LTDC_LIPCR_LIPOS(n) ((uint32_t)(n) << LTDC_LIPCR_LIPOS_SHIFT)
+
+/* LTDC Current Position Status Register */
+
+#define LTDC_CPSR_CYPOS_SHIFT (0) /* Bits 0-15: Current Y Position */
+#define LTDC_CPSR_CYPOS_MASK (0xFFFF << LTDC_CPSR_CYPOS_SHIFT)
+# define LTDC_CPSR_CYPOS(n) ((uint32_t)(n) << LTDC_CPSR_CYPOS_SHIFT)
+#define LTDC_CPSR_CXPOS_SHIFT (16) /* Bits 15-31: Current X Position */
+#define LTDC_CPSR_CXPOS_MASK (0xFFFF << LTDC_CPSR_CXPOS_SHIFT)
+# define LTDC_CPSR_CXPOS(n) ((uint32_t)(n) << LTDC_CPSR_CXPOS_SHIFT)
+
+/* LTDC Current Display Status Register */
+
+#define LTDC_CDSR_VDES (1 << 0) /* Bit 0: Vertical Data Enable display Status */
+#define LTDC_CDSR_HDES (1 << 1) /* Bit 1: Horizontal Data Enable display Status */
+#define LTDC_CDSR_VSYNCS (1 << 2) /* Bit 2: Vertical Sync display Status */
+#define LTDC_CDSR_HSYNCS (1 << 3) /* Bit 3: Horizontal Sync display Status */
+
+/* LTDC Layer x Control Register */
+
+#define LTDC_LXCR_LEN (1 << 0) /* Bit 0: Layer Enable */
+#define LTDC_LXCR_COLKEN (1 << 1) /* Bit 1: Color Keying Enable */
+#define LTDC_LXCR_CLUTEN (1 << 4) /* Bit 4: Color Look-Up Table Enable */
+
+/* LTDC Layer x Window Horizontal Position Configuration Register */
+
+#define LTDC_LXWHPCR_WHSTPOS_SHIFT (0) /* Bits 0-11: Window Horizontal Start Position */
+#define LTDC_LXWHPCR_WHSTPOS_MASK (0xfff << LTDC_LXWHPCR_WHSTPOS_SHIFT)
+# define LTDC_LXWHPCR_WHSTPOS(n) ((uint32_t)(n) << LTDC_LXWHPCR_WHSTPOS_SHIFT)
+#define LTDC_LXWHPCR_WHSPPOS_SHIFT (16) /* Bits 16-27: Window Horizontal Stop Position */
+#define LTDC_LXWHPCR_WHSPPOS_MASK (0xfff << LTDC_LXWHPCR_WHSPPOS_SHIFT)
+# define LTDC_LXWHPCR_WHSPPOS(n) ((uint32_t)(n) << LTDC_LXWHPCR_WHSPPOS_SHIFT)
+
+/* LTDC Layer x Window Vertical Position Configuration Register */
+
+#define LTDC_LXWVPCR_WVSTPOS_SHIFT (0) /* Bits 0-10: Window Vertical Start Position */
+#define LTDC_LXWVPCR_WVSTPOS_MASK (0x7ff << LTDC_LXWVPCR_WVSTPOS_SHIFT)
+# define LTDC_LXWVPCR_WVSTPOS(n) ((uint32_t)(n) << LTDC_LXWVPCR_WVSTPOS_SHIFT)
+#define LTDC_LXWVPCR_WVSPPOS_SHIFT (16) /* Bits 16-26: Window Vertical Stop Position */
+#define LTDC_LXWVPCR_WVSPPOS_MASK (0x7ff << LTDC_LXWVPCR_WVSPPOS_SHIFT)
+# define LTDC_LXWVPCR_WVSPPOS(n) ((uint32_t)(n) << LTDC_LXWVPCR_WVSPPOS_SHIFT)
+
+/* LTDC Layer x Color Keying Configuration Register */
+
+#define LTDC_LXCKCR_CKBLUE_SHIFT (0) /* Bits 0-7: Color Key Blue Value */
+#define LTDC_LXCKCR_CKBLUE_MASK (0xff << LTDC_LXCKCR_CKBLUE_SHIFT)
+# define LTDC_LXCKCR_CKBLUE(n) ((uint32_t)(n) << LTDC_LXCKCR_CKBLUE_SHIFT)
+#define LTDC_LXCKCR_CKGREEN_SHIFT (8) /* Bits 8-15: Color Key Green Value */
+#define LTDC_LXCKCR_CKGREEN_MASK (0xff << LTDC_LXCKCR_CKGREEN_SHIFT)
+# define LTDC_LXCKCR_CKGREEN(n) ((uint32_t)(n) << LTDC_LXCKCR_CKGREEN_SHIFT)
+#define LTDC_LXCKCR_CKRED_SHIFT (16) /* Bits 16-23: Color Key Red Value */
+#define LTDC_LXCKCR_CKRED_MASK (0xff << LTDC_LXCKCR_CKRED_SHIFT)
+# define LTDC_LXCKCR_CKRED(n) ((uint32_t)(n) << LTDC_LXCKCR_CKRED_SHIFT)
+
+/* LTDC Layer x Pixel Format Configuration Register */
+
+#define LTDC_LXPFCR_PF_SHIFT (0) /* Bits 0-2: Pixel Format */
+#define LTDC_LXPFCR_PF_MASK (0x7 << LTDC_LXPFCR_PF_SHIFT)
+# define LTDC_LXPFCR_PF(n) ((uint32_t)(n) << LTDC_LXPFCR_PF_SHIFT)
+
+#define LTDC_PF_ARGB8888 0
+#define LTDC_PF_RGB888 1
+#define LTDC_PF_RGB565 2
+#define LTDC_PF_ARGB1555 3
+#define LTDC_PF_ARGB4444 4
+#define LTDC_PF_L8 5 /* 8-bit Luninance (CLUT lookup) */
+#define LTDC_PF_AL44 6 /* 4-bit Alpha, 4-bit Luminance */
+#define LTDC_PF_AL88 7 /* 8-bit Alpha, 8-bit Luminance */
+
+/* LTDC Layer x Constant Alpha Configuration Register */
+
+#define LTDC_LXCACR_CONSTA_SHIFT (0) /* Bits 0-7: Constant Alpha */
+#define LTDC_LXCACR_CONSTA_MASK (0x7 << LTDC_LXCACR_CONSTA_SHIFT)
+# define LTDC_LXCACR_CONSTA(n) ((uint32_t)(n) << LTDC_LXCACR_CONSTA_SHIFT)
+
+/* LTDC Layer x Default Color Configuration Register */
+
+#define LTDC_LXDCCR_DCBLUE_SHIFT (0) /* Bits 0-7: Default Color Blue Value */
+#define LTDC_LXDCCR_DCBLUE_MASK (0xff << LTDC_LXDCCR_DCBLUE_SHIFT)
+# define LTDC_LXDCCR_DCBLUE(n) ((uint32_t)(n) << LTDC_LXDCCR_DCBLUE_SHIFT)
+#define LTDC_LXDCCR_DCGREEN_SHIFT (8) /* Bits 8-15: Default Color Green Value */
+#define LTDC_LXDCCR_DCGREEN_MASK (0xff << LTDC_LXDCCR_DCGREEN_SHIFT)
+# define LTDC_LXDCCR_DCGREEN(n) ((uint32_t)(n) << LTDC_LXDCCR_DCGREEN_SHIFT)
+#define LTDC_LXDCCR_DCRED_SHIFT (16) /* Bits 16-23: Default Color Red Value */
+#define LTDC_LXDCCR_DCRED_MASK (0xff << LTDC_LXDCCR_DCRED_SHIFT)
+# define LTDC_LXDCCR_DCRED(n) ((uint32_t)(n) << LTDC_LXDCCR_DCRED_SHIFT)
+#define LTDC_LXDCCR_DCALPHA_SHIFT (24) /* Bits 24-31: Default Color Alpha Value */
+#define LTDC_LXDCCR_DCALPHA_MASK (0xff << LTDC_LXDCCR_DCALPHA_SHIFT)
+# define LTDC_LXDCCR_DCALPHA(n) ((uint32_t)(n) << LTDC_LXDCCR_DCALPHA_SHIFT)
+
+/* LTDC Layer x Blending Factors Configuration Register */
+
+#define LTDC_LXBFCR_BF2_SHIFT (0) /* Bits 0-2: Blending Factor 2 */
+#define LTDC_LXBFCR_BF2_MASK (0x7 << LTDC_LXBFCR_BF2_SHIFT)
+# define LTDC_LXBFCR_BF2(n) ((uint32_t)(n) << LTDC_LXBFCR_BF2_SHIFT)
+#define LTDC_LXBFCR_BF1_SHIFT (8) /* Bits 8-10: Blending Factor 1 */
+#define LTDC_LXBFCR_BF1_MASK (0x7 << LTDC_LXBFCR_BF1_SHIFT)
+# define LTDC_LXBFCR_BF1(n) ((uint32_t)(n) << LTDC_LXBFCR_BF1_SHIFT)
+
+#define LTDC_BF1_CONST_ALPHA 0x04 /* Constant Alpha */
+#define LTDC_BF1_PIXEL_ALPHA 0x06 /* Pixel Alpha x Constant Alpha */
+#define LTDC_BF2_CONST_ALPHA 0x05 /* Constant Alpha */
+#define LTDC_BF2_PIXEL_ALPHA 0x07 /* Pixel Alpha x Constant Alpha */
+
+/* LTDC Layer x Color Frame Buffer Length Configuration Register */
+
+#define LTDC_LXCFBLR_CFBLL_SHIFT (0) /* Bits 0-12: Color Frame Buffer Line Length */
+#define LTDC_LXCFBLR_CFBLL_MASK (0x1fff << LTDC_LXCFBLR_CFBLL_SHIFT)
+# define LTDC_LXCFBLR_CFBLL(n) ((uint32_t)(n) << LTDC_LXCFBLR_CFBLL_SHIFT)
+#define LTDC_LXCFBLR_CFBP_SHIFT (16) /* Bits 16-28: Color Frame Buffer Pitch */
+#define LTDC_LXCFBLR_CFBP_MASK (0x1fff << LTDC_LXCFBLR_CFBP_SHIFT)
+# define LTDC_LXCFBLR_CFBP(n) ((uint32_t)(n) << LTDC_LXCFBLR_CFBP_SHIFT)
+
+/* LTDC Layer x Color Frame Buffer Line Number Register */
+
+#define LTDC_LXCFBLNR_LN_SHIFT (0) /* Bits 0-10: Color Frame Buffer Line Number */
+#define LTDC_LXCFBLNR_LN_MASK (0x7ff << LTDC_LXCFBLNR_LN_SHIFT)
+# define LTDC_LXCFBLNR_LN(n) ((uint32_t)(n) << LTDC_LXCFBLNR_LN_SHIFT)
+
+/* LTDC Layer x CLUT Write Register */
+
+#define LTDC_LXCLUTWR_BLUE_SHIFT (0) /* Bits 0-7: Default Color Blue Value */
+#define LTDC_LXCLUTWR_BLUE_MASK (0xff << LTDC_LXCLUTWR_BLUE_SHIFT)
+# define LTDC_LXCLUTWR_BLUE(n) ((uint32_t)(n) << LTDC_LXCLUTWR_BLUE_SHIFT)
+#define LTDC_LXCLUTWR_GREEN_SHIFT (8) /* Bits 8-15: Default Color Green Value */
+#define LTDC_LXCLUTWR_GREEN_MASK (0xff << LTDC_LXCLUTWR_GREEN_SHIFT)
+# define LTDC_LXCLUTWR_GREEN(n) ((uint32_t)(n) << LTDC_LXCLUTWR_GREEN_SHIFT)
+#define LTDC_LXCLUTWR_RED_SHIFT (16) /* Bits 16-23: Default Color Red Value */
+#define LTDC_LXCLUTWR_RED_MASK (0xff << LTDC_LXCLUTWR_RED_SHIFT)
+# define LTDC_LXCLUTWR_RED(n) ((uint32_t)(n) << LTDC_LXCLUTWR_RED_SHIFT)
+#define LTDC_LXCLUTWR_CLUTADD_SHIFT (24) /* Bits 24-31: CLUT Address */
+#define LTDC_LXCLUTWR_CLUTADD_MASK (0xff << LTDC_LXCLUTWR_CLUTADD_SHIFT)
+# define LTDC_LXCLUTWR_CLUTADD(n) ((uint32_t)(n) << LTDC_LXCLUTWR_CLUTADD_SHIFT)
+
+/****************************************************************************
+ * Public Types
+ ****************************************************************************/
+
+#endif /* __ARCH_ARM_SRC_STM32H7_HARDWARE_STM32_LTDC_H */
diff --git a/arch/arm/src/stm32h7/hardware/stm32h7x3xx_pinmap.h b/arch/arm/src/stm32h7/hardware/stm32h7x3xx_pinmap.h
index a483a2157d..ae0c89d9d0 100644
--- a/arch/arm/src/stm32h7/hardware/stm32h7x3xx_pinmap.h
+++ b/arch/arm/src/stm32h7/hardware/stm32h7x3xx_pinmap.h
@@ -570,116 +570,116 @@
/* LCD-TFT Display Controller (LTDC) */
-#define GPIO_LCD_B0_1 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTE|GPIO_PIN4)
-#define GPIO_LCD_B0_2 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTG|GPIO_PIN14)
-#define GPIO_LCD_B0_3 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTJ|GPIO_PIN12)
-#define GPIO_LCD_B1_1 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTA|GPIO_PIN10)
-#define GPIO_LCD_B1_2 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTG|GPIO_PIN12)
-#define GPIO_LCD_B1_3 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTJ|GPIO_PIN13)
-#define GPIO_LCD_B2_1 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTC|GPIO_PIN9)
-#define GPIO_LCD_B2_2 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTD|GPIO_PIN6)
-#define GPIO_LCD_B2_3 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTG|GPIO_PIN10)
-#define GPIO_LCD_B2_4 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTJ|GPIO_PIN14)
-#define GPIO_LCD_B2_5 (GPIO_ALT|GPIO_AF9|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTA|GPIO_PIN3)
-#define GPIO_LCD_B3_1 (GPIO_ALT|GPIO_AF13|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTA|GPIO_PIN8)
-#define GPIO_LCD_B3_2 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTD|GPIO_PIN10)
-#define GPIO_LCD_B3_3 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTG|GPIO_PIN11)
-#define GPIO_LCD_B3_4 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTJ|GPIO_PIN15)
-#define GPIO_LCD_B4_1 (GPIO_ALT|GPIO_AF12|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTA|GPIO_PIN10)
-#define GPIO_LCD_B4_2 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTE|GPIO_PIN12)
-#define GPIO_LCD_B4_3 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTI|GPIO_PIN4)
-#define GPIO_LCD_B4_4 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTK|GPIO_PIN3)
-#define GPIO_LCD_B4_5 (GPIO_ALT|GPIO_AF9|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTG|GPIO_PIN12)
-#define GPIO_LCD_B4_6 (GPIO_ALT|GPIO_AF9|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTJ|GPIO_PIN13)
-#define GPIO_LCD_B5_1 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTA|GPIO_PIN3)
-#define GPIO_LCD_B5_2 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTI|GPIO_PIN5)
-#define GPIO_LCD_B5_3 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTK|GPIO_PIN4)
-#define GPIO_LCD_B6_1 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTB|GPIO_PIN8)
-#define GPIO_LCD_B6_2 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTI|GPIO_PIN6)
-#define GPIO_LCD_B6_3 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTK|GPIO_PIN5)
-#define GPIO_LCD_B7_1 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTB|GPIO_PIN9)
-#define GPIO_LCD_B7_2 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTI|GPIO_PIN7)
-#define GPIO_LCD_B7_3 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTK|GPIO_PIN6)
-
-#define GPIO_LCD_CLK_1 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTE|GPIO_PIN14)
-#define GPIO_LCD_CLK_2 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTG|GPIO_PIN7)
-#define GPIO_LCD_CLK_3 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTI|GPIO_PIN14)
-
-#define GPIO_LCD_DE_1 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTE|GPIO_PIN13)
-#define GPIO_LCD_DE_2 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTF|GPIO_PIN10)
-#define GPIO_LCD_DE_3 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTK|GPIO_PIN7)
-
-#define GPIO_LCD_G0_1 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTB|GPIO_PIN1)
-#define GPIO_LCD_G0_2 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTE|GPIO_PIN5)
-#define GPIO_LCD_G0_3 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTJ|GPIO_PIN7)
-#define GPIO_LCD_G1_1 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTB|GPIO_PIN0)
-#define GPIO_LCD_G1_2 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTE|GPIO_PIN6)
-#define GPIO_LCD_G1_3 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTJ|GPIO_PIN8)
-#define GPIO_LCD_G2_1 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTA|GPIO_PIN6)
-#define GPIO_LCD_G2_2 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTH|GPIO_PIN13)
-#define GPIO_LCD_G2_3 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTJ|GPIO_PIN9)
-#define GPIO_LCD_G2_4 (GPIO_ALT|GPIO_AF9|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTI|GPIO_PIN15)
-#define GPIO_LCD_G3_1 (GPIO_ALT|GPIO_AF10|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTC|GPIO_PIN9)
-#define GPIO_LCD_G3_2 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTE|GPIO_PIN11)
-#define GPIO_LCD_G3_3 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTH|GPIO_PIN14)
-#define GPIO_LCD_G3_4 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTJ|GPIO_PIN10)
-#define GPIO_LCD_G3_5 (GPIO_ALT|GPIO_AF9|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTG|GPIO_PIN10)
-#define GPIO_LCD_G3_6 (GPIO_ALT|GPIO_AF9|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTJ|GPIO_PIN12)
-#define GPIO_LCD_G4_1 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTB|GPIO_PIN10)
-#define GPIO_LCD_G4_2 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTH|GPIO_PIN15)
-#define GPIO_LCD_G4_3 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTH|GPIO_PIN4)
-#define GPIO_LCD_G4_4 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTJ|GPIO_PIN11)
-#define GPIO_LCD_G5_1 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTB|GPIO_PIN11)
-#define GPIO_LCD_G5_2 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTI|GPIO_PIN0)
-#define GPIO_LCD_G5_3 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTK|GPIO_PIN0)
-#define GPIO_LCD_G5_4 (GPIO_ALT|GPIO_AF9|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTH|GPIO_PIN4)
-#define GPIO_LCD_G6_1 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTC|GPIO_PIN7)
-#define GPIO_LCD_G6_2 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTI|GPIO_PIN1)
-#define GPIO_LCD_G6_3 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTK|GPIO_PIN1)
-#define GPIO_LCD_G6_4 (GPIO_ALT|GPIO_AF9|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTI|GPIO_PIN11)
-#define GPIO_LCD_G7_1 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTD|GPIO_PIN3)
-#define GPIO_LCD_G7_2 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTG|GPIO_PIN8)
-#define GPIO_LCD_G7_3 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTI|GPIO_PIN2)
-#define GPIO_LCD_G7_4 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTK|GPIO_PIN2)
-
-#define GPIO_LCD_HSYNC_1 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTC|GPIO_PIN6)
-#define GPIO_LCD_HSYNC_2 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTI|GPIO_PIN10)
-#define GPIO_LCD_HSYNC_3 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTI|GPIO_PIN12)
-
-#define GPIO_LCD_R0_1 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTG|GPIO_PIN13)
-#define GPIO_LCD_R0_2 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTH|GPIO_PIN2)
-#define GPIO_LCD_R0_3 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTI|GPIO_PIN15)
-#define GPIO_LCD_R1_1 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTA|GPIO_PIN2)
-#define GPIO_LCD_R1_2 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTH|GPIO_PIN3)
-#define GPIO_LCD_R1_3 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTJ|GPIO_PIN0)
-#define GPIO_LCD_R2_1 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTA|GPIO_PIN1)
-#define GPIO_LCD_R2_2 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTC|GPIO_PIN10)
-#define GPIO_LCD_R2_3 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTH|GPIO_PIN8)
-#define GPIO_LCD_R2_4 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTJ|GPIO_PIN1)
-#define GPIO_LCD_R3_1 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTH|GPIO_PIN9)
-#define GPIO_LCD_R3_2 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTJ|GPIO_PIN2)
-#define GPIO_LCD_R3_3 (GPIO_ALT|GPIO_AF9|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTB|GPIO_PIN0)
-#define GPIO_LCD_R4_1 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTA|GPIO_PIN11)
-#define GPIO_LCD_R4_2 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTA|GPIO_PIN5)
-#define GPIO_LCD_R4_3 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTH|GPIO_PIN10)
-#define GPIO_LCD_R4_4 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTJ|GPIO_PIN3)
-#define GPIO_LCD_R5_1 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTA|GPIO_PIN12)
-#define GPIO_LCD_R5_2 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTA|GPIO_PIN9)
-#define GPIO_LCD_R5_3 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTC|GPIO_PIN0)
-#define GPIO_LCD_R5_4 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTH|GPIO_PIN11)
-#define GPIO_LCD_R5_5 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTJ|GPIO_PIN4)
-#define GPIO_LCD_R6_1 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTA|GPIO_PIN8)
-#define GPIO_LCD_R6_2 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTH|GPIO_PIN12)
-#define GPIO_LCD_R6_3 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTJ|GPIO_PIN5)
-#define GPIO_LCD_R6_4 (GPIO_ALT|GPIO_AF9|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTB|GPIO_PIN1)
-#define GPIO_LCD_R7_1 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTE|GPIO_PIN15)
-#define GPIO_LCD_R7_2 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTG|GPIO_PIN6)
-#define GPIO_LCD_R7_3 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTJ|GPIO_PIN6)
-#define GPIO_LCD_R7_4 (GPIO_ALT|GPIO_AF9|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTJ|GPIO_PIN0)
-
-#define GPIO_LCD_VSYNC_1 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTA|GPIO_PIN4)
-#define GPIO_LCD_VSYNC_2 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTI|GPIO_PIN13)
-#define GPIO_LCD_VSYNC_3 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTI|GPIO_PIN9)
+#define GPIO_LTDC_B0_1 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTE|GPIO_PIN4)
+#define GPIO_LTDC_B0_2 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTG|GPIO_PIN14)
+#define GPIO_LTDC_B0_3 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTJ|GPIO_PIN12)
+#define GPIO_LTDC_B1_1 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTA|GPIO_PIN10)
+#define GPIO_LTDC_B1_2 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTG|GPIO_PIN12)
+#define GPIO_LTDC_B1_3 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTJ|GPIO_PIN13)
+#define GPIO_LTDC_B2_1 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTC|GPIO_PIN9)
+#define GPIO_LTDC_B2_2 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTD|GPIO_PIN6)
+#define GPIO_LTDC_B2_3 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTG|GPIO_PIN10)
+#define GPIO_LTDC_B2_4 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTJ|GPIO_PIN14)
+#define GPIO_LTDC_B2_5 (GPIO_ALT|GPIO_AF9|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTA|GPIO_PIN3)
+#define GPIO_LTDC_B3_1 (GPIO_ALT|GPIO_AF13|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTA|GPIO_PIN8)
+#define GPIO_LTDC_B3_2 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTD|GPIO_PIN10)
+#define GPIO_LTDC_B3_3 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTG|GPIO_PIN11)
+#define GPIO_LTDC_B3_4 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTJ|GPIO_PIN15)
+#define GPIO_LTDC_B4_1 (GPIO_ALT|GPIO_AF12|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTA|GPIO_PIN10)
+#define GPIO_LTDC_B4_2 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTE|GPIO_PIN12)
+#define GPIO_LTDC_B4_3 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTI|GPIO_PIN4)
+#define GPIO_LTDC_B4_4 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTK|GPIO_PIN3)
+#define GPIO_LTDC_B4_5 (GPIO_ALT|GPIO_AF9|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTG|GPIO_PIN12)
+#define GPIO_LTDC_B4_6 (GPIO_ALT|GPIO_AF9|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTJ|GPIO_PIN13)
+#define GPIO_LTDC_B5_1 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTA|GPIO_PIN3)
+#define GPIO_LTDC_B5_2 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTI|GPIO_PIN5)
+#define GPIO_LTDC_B5_3 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTK|GPIO_PIN4)
+#define GPIO_LTDC_B6_1 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTB|GPIO_PIN8)
+#define GPIO_LTDC_B6_2 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTI|GPIO_PIN6)
+#define GPIO_LTDC_B6_3 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTK|GPIO_PIN5)
+#define GPIO_LTDC_B7_1 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTB|GPIO_PIN9)
+#define GPIO_LTDC_B7_2 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTI|GPIO_PIN7)
+#define GPIO_LTDC_B7_3 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTK|GPIO_PIN6)
+
+#define GPIO_LTDC_CLK_1 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTE|GPIO_PIN14)
+#define GPIO_LTDC_CLK_2 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTG|GPIO_PIN7)
+#define GPIO_LTDC_CLK_3 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTI|GPIO_PIN14)
+
+#define GPIO_LTDC_DE_1 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTE|GPIO_PIN13)
+#define GPIO_LTDC_DE_2 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTF|GPIO_PIN10)
+#define GPIO_LTDC_DE_3 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTK|GPIO_PIN7)
+
+#define GPIO_LTDC_G0_1 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTB|GPIO_PIN1)
+#define GPIO_LTDC_G0_2 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTE|GPIO_PIN5)
+#define GPIO_LTDC_G0_3 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTJ|GPIO_PIN7)
+#define GPIO_LTDC_G1_1 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTB|GPIO_PIN0)
+#define GPIO_LTDC_G1_2 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTE|GPIO_PIN6)
+#define GPIO_LTDC_G1_3 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTJ|GPIO_PIN8)
+#define GPIO_LTDC_G2_1 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTA|GPIO_PIN6)
+#define GPIO_LTDC_G2_2 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTH|GPIO_PIN13)
+#define GPIO_LTDC_G2_3 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTJ|GPIO_PIN9)
+#define GPIO_LTDC_G2_4 (GPIO_ALT|GPIO_AF9|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTI|GPIO_PIN15)
+#define GPIO_LTDC_G3_1 (GPIO_ALT|GPIO_AF10|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTC|GPIO_PIN9)
+#define GPIO_LTDC_G3_2 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTE|GPIO_PIN11)
+#define GPIO_LTDC_G3_3 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTH|GPIO_PIN14)
+#define GPIO_LTDC_G3_4 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTJ|GPIO_PIN10)
+#define GPIO_LTDC_G3_5 (GPIO_ALT|GPIO_AF9|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTG|GPIO_PIN10)
+#define GPIO_LTDC_G3_6 (GPIO_ALT|GPIO_AF9|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTJ|GPIO_PIN12)
+#define GPIO_LTDC_G4_1 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTB|GPIO_PIN10)
+#define GPIO_LTDC_G4_2 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTH|GPIO_PIN15)
+#define GPIO_LTDC_G4_3 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTH|GPIO_PIN4)
+#define GPIO_LTDC_G4_4 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTJ|GPIO_PIN11)
+#define GPIO_LTDC_G5_1 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTB|GPIO_PIN11)
+#define GPIO_LTDC_G5_2 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTI|GPIO_PIN0)
+#define GPIO_LTDC_G5_3 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTK|GPIO_PIN0)
+#define GPIO_LTDC_G5_4 (GPIO_ALT|GPIO_AF9|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTH|GPIO_PIN4)
+#define GPIO_LTDC_G6_1 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTC|GPIO_PIN7)
+#define GPIO_LTDC_G6_2 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTI|GPIO_PIN1)
+#define GPIO_LTDC_G6_3 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTK|GPIO_PIN1)
+#define GPIO_LTDC_G6_4 (GPIO_ALT|GPIO_AF9|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTI|GPIO_PIN11)
+#define GPIO_LTDC_G7_1 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTD|GPIO_PIN3)
+#define GPIO_LTDC_G7_2 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTG|GPIO_PIN8)
+#define GPIO_LTDC_G7_3 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTI|GPIO_PIN2)
+#define GPIO_LTDC_G7_4 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTK|GPIO_PIN2)
+
+#define GPIO_LTDC_HSYNC_1 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTC|GPIO_PIN6)
+#define GPIO_LTDC_HSYNC_2 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTI|GPIO_PIN10)
+#define GPIO_LTDC_HSYNC_3 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTI|GPIO_PIN12)
+
+#define GPIO_LTDC_R0_1 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTG|GPIO_PIN13)
+#define GPIO_LTDC_R0_2 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTH|GPIO_PIN2)
+#define GPIO_LTDC_R0_3 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTI|GPIO_PIN15)
+#define GPIO_LTDC_R1_1 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTA|GPIO_PIN2)
+#define GPIO_LTDC_R1_2 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTH|GPIO_PIN3)
+#define GPIO_LTDC_R1_3 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTJ|GPIO_PIN0)
+#define GPIO_LTDC_R2_1 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTA|GPIO_PIN1)
+#define GPIO_LTDC_R2_2 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTC|GPIO_PIN10)
+#define GPIO_LTDC_R2_3 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTH|GPIO_PIN8)
+#define GPIO_LTDC_R2_4 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTJ|GPIO_PIN1)
+#define GPIO_LTDC_R3_1 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTH|GPIO_PIN9)
+#define GPIO_LTDC_R3_2 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTJ|GPIO_PIN2)
+#define GPIO_LTDC_R3_3 (GPIO_ALT|GPIO_AF9|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTB|GPIO_PIN0)
+#define GPIO_LTDC_R4_1 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTA|GPIO_PIN11)
+#define GPIO_LTDC_R4_2 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTA|GPIO_PIN5)
+#define GPIO_LTDC_R4_3 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTH|GPIO_PIN10)
+#define GPIO_LTDC_R4_4 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTJ|GPIO_PIN3)
+#define GPIO_LTDC_R5_1 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTA|GPIO_PIN12)
+#define GPIO_LTDC_R5_2 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTA|GPIO_PIN9)
+#define GPIO_LTDC_R5_3 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTC|GPIO_PIN0)
+#define GPIO_LTDC_R5_4 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTH|GPIO_PIN11)
+#define GPIO_LTDC_R5_5 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTJ|GPIO_PIN4)
+#define GPIO_LTDC_R6_1 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTA|GPIO_PIN8)
+#define GPIO_LTDC_R6_2 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTH|GPIO_PIN12)
+#define GPIO_LTDC_R6_3 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTJ|GPIO_PIN5)
+#define GPIO_LTDC_R6_4 (GPIO_ALT|GPIO_AF9|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTB|GPIO_PIN1)
+#define GPIO_LTDC_R7_1 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTE|GPIO_PIN15)
+#define GPIO_LTDC_R7_2 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTG|GPIO_PIN6)
+#define GPIO_LTDC_R7_3 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTJ|GPIO_PIN6)
+#define GPIO_LTDC_R7_4 (GPIO_ALT|GPIO_AF9|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTJ|GPIO_PIN0)
+
+#define GPIO_LTDC_VSYNC_1 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTA|GPIO_PIN4)
+#define GPIO_LTDC_VSYNC_2 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTI|GPIO_PIN13)
+#define GPIO_LTDC_VSYNC_3 (GPIO_ALT|GPIO_AF14|GPIO_PULLUP|GPIO_PUSHPULL|GPIO_PORTI|GPIO_PIN9)
/* Low Power Timer */
diff --git a/arch/arm/src/stm32h7/stm32_ltdc.c b/arch/arm/src/stm32h7/stm32_ltdc.c
new file mode 100644
index 0000000000..62082c3495
--- /dev/null
+++ b/arch/arm/src/stm32h7/stm32_ltdc.c
@@ -0,0 +1,3137 @@
+/****************************************************************************
+ * arch/arm/src/stm32h7/stm32_ltdc.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/* References:
+ * STM32F429 Technical Reference Manual and Data Sheet
+ */
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <string.h>
+#include <assert.h>
+#include <errno.h>
+#include <debug.h>
+
+#include <nuttx/irq.h>
+#include <nuttx/kmalloc.h>
+#include <nuttx/semaphore.h>
+#include <nuttx/video/fb.h>
+
+#include <arch/board/board.h>
+
+#include "arm_internal.h"
+
+#include "hardware/stm32_ltdc.h"
+#include "stm32_rcc.h"
+#include "stm32_gpio.h"
+#include "stm32_ltdc.h"
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/* Register definition ******************************************************/
+
+#ifndef BOARD_LTDC_WIDTH
+# error BOARD_LTDC_WIDTH must be defined in the board.h header file
+#endif
+
+#ifndef BOARD_LTDC_HEIGHT
+# error BOARD_LTDC_HEIGHT must be defined in the board.h header file
+#endif
+
+#define STM32_LTDC_HEIGHT BOARD_LTDC_HEIGHT
+#define STM32_LTDC_WIDTH BOARD_LTDC_WIDTH
+
+/* Configure LTDC register */
+
+/* LTDC_LxWHPCR register */
+
+#define STM32_LTDC_LXWHPCR_WHSTPOS (BOARD_LTDC_HSYNC + BOARD_LTDC_HBP - 1)
+#define STM32_LTDC_LxWHPCR_WHSPPOS (BOARD_LTDC_HSYNC + BOARD_LTDC_HBP + \
+ STM32_LTDC_WIDTH - 1)
+
+/* LTDC_LxWVPCR register */
+
+#define STM32_LTDC_LXWVPCR_WVSTPOS (BOARD_LTDC_VSYNC + BOARD_LTDC_VBP - 1)
+#define STM32_LTDC_LxWVPCR_WVSPPOS (BOARD_LTDC_VSYNC + BOARD_LTDC_VBP + \
+ STM32_LTDC_HEIGHT - 1)
+
+/* LTDC_SSCR register */
+
+#define STM32_LTDC_SSCR_VSH LTDC_SSCR_VSH(BOARD_LTDC_VSYNC - 1)
+#define STM32_LTDC_SSCR_HSW LTDC_SSCR_HSW(BOARD_LTDC_HSYNC - 1)
+
+/* LTDC_BPCR register */
+
+#define STM32_LTDC_BPCR_AVBP LTDC_BPCR_AVBP(STM32_LTDC_LXWVPCR_WVSTPOS)
+#define STM32_LTDC_BPCR_AHBP LTDC_BPCR_AHBP(STM32_LTDC_LXWHPCR_WHSTPOS)
+
+/* LTDC_AWCR register */
+
+#define STM32_LTDC_AWCR_AAH LTDC_AWCR_AAH(STM32_LTDC_LxWVPCR_WVSPPOS)
+#define STM32_LTDC_AWCR_AAW LTDC_AWCR_AAW(STM32_LTDC_LxWHPCR_WHSPPOS)
+
+/* LTDC_TWCR register */
+
+#define STM32_LTDC_TWCR_TOTALH LTDC_TWCR_TOTALH(BOARD_LTDC_VSYNC + \
+ BOARD_LTDC_VBP + \
+ STM32_LTDC_HEIGHT + BOARD_LTDC_VFP - 1)
+#define STM32_LTDC_TWCR_TOTALW LTDC_TWCR_TOTALW(BOARD_LTDC_HSYNC + \
+ BOARD_LTDC_HBP + \
+ STM32_LTDC_WIDTH + BOARD_LTDC_HFP - 1)
+
+/* Global GCR register */
+
+/* Synchronisation and Polarity */
+
+#define STM32_LTDC_GCR_PCPOL BOARD_LTDC_GCR_PCPOL
+#define STM32_LTDC_GCR_DEPOL BOARD_LTDC_GCR_DEPOL
+#define STM32_LTDC_GCR_VSPOL BOARD_LTDC_GCR_VSPOL
+#define STM32_LTDC_GCR_HSPOL BOARD_LTDC_GCR_HSPOL
+
+/* Dither */
+
+#define STM32_LTDC_GCR_DEN BOARD_LTDC_GCR_DEN
+#define STM32_LTDC_GCR_DBW LTDC_GCR_GBW(BOARD_LTDC_GCR_DBW)
+#define STM32_LTDC_GCR_DGW LTDC_GCR_DGW(BOARD_LTDC_GCR_DGW)
+#define STN32_LTDC_GCR_DRW LTDC_GCR_DBW(BOARD_LTDC_GCR_DRW)
+
+/* LIPCR register */
+
+#define STM32_LTDC_LIPCR_LIPOS LTDC_LIPCR_LIPOS(STM32_LTDC_TWCR_TOTALW)
+
+/* Configuration ************************************************************/
+
+#ifndef CONFIG_STM32H7_LTDC_DEFBACKLIGHT
+# define CONFIG_STM32H7_LTDC_DEFBACKLIGHT 0xf0
+#endif
+#define STM32_LTDC_BACKLIGHT_OFF 0x00
+
+/* Color/video formats */
+
+/* Layer 1 format */
+
+#if defined(CONFIG_STM32H7_LTDC_L1_L8)
+# define STM32_LTDC_L1_BPP 8
+# define STM32_LTDC_L1_COLOR_FMT FB_FMT_RGB8
+# define STM32_LTDC_L1PFCR_PF LTDC_LXPFCR_PF(LTDC_PF_L8)
+# define STM32_LTDC_L1_DMA2D_PF DMA2D_PF_L8
+# define STM32_LTDC_L1CMAP
+#elif defined(CONFIG_STM32H7_LTDC_L1_RGB565)
+# define STM32_LTDC_L1_BPP 16
+# define STM32_LTDC_L1_COLOR_FMT FB_FMT_RGB16_565
+# define STM32_LTDC_L1PFCR_PF LTDC_LXPFCR_PF(LTDC_PF_RGB565)
+# define STM32_LTDC_L1_DMA2D_PF DMA2D_PF_RGB565
+#elif defined(CONFIG_STM32H7_LTDC_L1_RGB888)
+# define STM32_LTDC_L1_BPP 24
+# define STM32_LTDC_L1_COLOR_FMT FB_FMT_RGB24
+# define STM32_LTDC_L1PFCR_PF LTDC_LXPFCR_PF(LTDC_PF_RGB888)
+# define STM32_LTDC_L1_DMA2D_PF DMA2D_PF_RGB888
+#elif defined(CONFIG_STM32H7_LTDC_L1_ARGB8888)
+# define STM32_LTDC_L1_BPP 32
+# define STM32_LTDC_L1_COLOR_FMT FB_FMT_RGB32
+# define STM32_LTDC_L1PFCR_PF LTDC_LXPFCR_PF(LTDC_PF_ARGB8888)
+# define STM32_LTDC_L1_DMA2D_PF DMA2D_PF_ARGB8888
+#else
+# error "LTDC pixel format not supported"
+#endif
+
+/* Layer 2 format */
+
+#ifdef CONFIG_STM32H7_LTDC_L2
+# if defined(CONFIG_STM32H7_LTDC_L2_L8)
+# define STM32_LTDC_L2_BPP 8
+# define STM32_LTDC_L2_COLOR_FMT FB_FMT_RGB8
+# define STM32_LTDC_L2PFCR_PF LTDC_LXPFCR_PF(LTDC_PF_L8)
+# define STM32_LTDC_L2_DMA2D_PF DMA2D_PF_L8
+# define STM32_LTDC_L2CMAP
+# elif defined(CONFIG_STM32H7_LTDC_L2_RGB565)
+# define STM32_LTDC_L2_BPP 16
+# define STM32_LTDC_L2_COLOR_FMT FB_FMT_RGB16_565
+# define STM32_LTDC_L2PFCR_PF LTDC_LXPFCR_PF(LTDC_PF_RGB565)
+# define STM32_LTDC_L2_DMA2D_PF DMA2D_PF_RGB565
+# elif defined(CONFIG_STM32H7_LTDC_L2_RGB888)
+# define STM32_LTDC_L2_BPP 24
+# define STM32_LTDC_L2_COLOR_FMT FB_FMT_RGB24
+# define STM32_LTDC_L2PFCR_PF LTDC_LXPFCR_PF(LTDC_PF_RGB888)
+# define STM32_LTDC_L2_DMA2D_PF DMA2D_PF_RGB888
+# elif defined(CONFIG_STM32H7_LTDC_L2_ARGB8888)
+# define STM32_LTDC_L2_BPP 32
+# define STM32_LTDC_L2_COLOR_FMT FB_FMT_RGB32
+# define STM32_LTDC_L2PFCR_PF LTDC_LXPFCR_PF(LTDC_PF_ARGB8888)
+# define STM32_LTDC_L2_DMA2D_PF DMA2D_PF_ARGB8888
+# else
+# error "LTDC pixel format not supported"
+# endif
+#endif /* CONFIG_STM32H7_LTDC_L2 */
+
+/* Framebuffer sizes in bytes */
+
+#if STM32_LTDC_L1_BPP == 8
+# define STM32_LTDC_L1_STRIDE (STM32_LTDC_WIDTH)
+#elif STM32_LTDC_L1_BPP == 16
+# define STM32_LTDC_L1_STRIDE ((STM32_LTDC_WIDTH * 16 + 7) / 8)
+#elif STM32_LTDC_L1_BPP == 24
+# define STM32_LTDC_L1_STRIDE ((STM32_LTDC_WIDTH * 24 + 7) / 8)
+#elif STM32_LTDC_L1_BPP == 32
+# define STM32_LTDC_L1_STRIDE ((STM32_LTDC_WIDTH * 32 + 7) / 8)
+#else
+# error Undefined or unrecognized base resolution
+#endif
+
+/* LTDC only supports 8 bit per pixel overal */
+
+#define STM32_LTDC_LX_BYPP(n) ((n) / 8)
+
+#define STM32_LTDC_L1_FBSIZE (STM32_LTDC_L1_STRIDE * STM32_LTDC_HEIGHT)
+
+#ifdef CONFIG_STM32H7_LTDC_L2
+# ifndef CONFIG_STM32H7_LTDC_L2_WIDTH
+# define CONFIG_STM32H7_LTDC_L2_WIDTH STM32_LTDC_WIDTH
+# endif
+
+# if CONFIG_STM32H7_LTDC_L2_WIDTH > STM32_LTDC_WIDTH
+# error Width of Layer 2 exceeds the width of the display
+# endif
+
+# ifndef CONFIG_STM32H7_LTDC_L2_HEIGHT
+# define CONFIG_STM32H7_LTDC_L2_HEIGHT STM32_LTDC_HEIGHT
+# endif
+
+# if CONFIG_STM32H7_LTDC_L2_HEIGHT > STM32_LTDC_HEIGHT
+# error Height of Layer 2 exceeds the height of the display
+# endif
+
+# if STM32_LTDC_L2_BPP == 8
+# define STM32_LTDC_L2_STRIDE (CONFIG_STM32H7_LTDC_L2_WIDTH)
+# elif STM32_LTDC_L2_BPP == 16
+# define STM32_LTDC_L2_STRIDE ((CONFIG_STM32H7_LTDC_L2_WIDTH * 16 + 7) / 8)
+# elif STM32_LTDC_L2_BPP == 24
+# define STM32_LTDC_L2_STRIDE ((CONFIG_STM32H7_LTDC_L2_WIDTH * 24 + 7) / 8)
+# elif STM32_LTDC_L2_BPP == 32
+# define STM32_LTDC_L2_STRIDE ((CONFIG_STM32H7_LTDC_L2_WIDTH * 32 + 7) / 8)
+# else
+# error Undefined or unrecognized base resolution
+# endif
+
+# define STM32_LTDC_L2_FBSIZE (STM32_LTDC_L2_STRIDE * \
+ CONFIG_STM32H7_LTDC_L2_HEIGHT)
+
+#else
+# define STM32_LTDC_L2_FBSIZE (0)
+# define STM32_LTDC_L2_BPP 0
+#endif
+
+/* Total memory used for framebuffers */
+
+#define STM32_LTDC_TOTAL_FBSIZE (STM32_LTDC_L1_FBSIZE + \
+ STM32_LTDC_L2_FBSIZE)
+
+/* Debug option */
+
+#ifdef CONFIG_STM32H7_LTDC_REGDEBUG
+# define regerr lcderr
+# define reginfo lcdinfo
+#else
+# define regerr(x...)
+# define reginfo(x...)
+#endif
+
+/* Preallocated LTDC framebuffers */
+
+/* Position the framebuffer memory in the center of the memory set aside.
+ * We will use any skirts before or after the framebuffer memory as a guard
+ * against wild framebuffer writes.
+ */
+
+#define STM32_LTDC_BUFFER_SIZE CONFIG_STM32H7_LTDC_FB_SIZE
+#define STM32_LTDC_BUFFER_FREE (STM32_LTDC_BUFFER_SIZE - \
+ STM32_LTDC_TOTAL_FBSIZE)
+#define STM32_LTDC_BUFFER_START (CONFIG_STM32H7_LTDC_FB_BASE + \
+ STM32_LTDC_BUFFER_FREE/2)
+
+#if STM32_LTDC_BUFFER_FREE < 0
+# error "STM32_LTDC_BUFFER_SIZE not large enough for frame buffers"
+#endif
+
+/* Layer frame buffer */
+
+#define STM32_LTDC_BUFFER_L1 STM32_LTDC_BUFFER_START
+#define STM32_LTDC_ENDBUF_L1 (STM32_LTDC_BUFFER_L1 + \
+ STM32_LTDC_L1_FBSIZE)
+
+#ifdef CONFIG_STM32H7_LTDC_L2
+# define STM32_LTDC_BUFFER_L2 STM32_LTDC_ENDBUF_L1
+# define STM32_LTDC_ENDBUF_L2 (STM32_LTDC_BUFFER_L2 + \
+ STM32_LTDC_L2_FBSIZE)
+#else
+# define STM32_LTDC_ENDBUF_L2 STM32_LTDC_ENDBUF_L1
+#endif
+
+/* LTDC layer */
+
+#ifdef CONFIG_STM32H7_LTDC_L2
+# define LTDC_NLAYERS 2
+#else
+# define LTDC_NLAYERS 1
+#endif
+
+/* DMA2D layer */
+
+#ifdef CONFIG_STM32H7_DMA2D
+# define DMA2D_NLAYERS CONFIG_STM32H7_DMA2D_NLAYERS
+# if DMA2D_NLAYERS < 1
+# error "DMA2D must at least support 1 overlay"
+# endif
+
+#define STM32_DMA2D_WIDTH CONFIG_STM32H7_DMA2D_LAYER_PPLINE
+
+# if defined(CONFIG_STM32H7_DMA2D_L8)
+# define STM32_DMA2D_STRIDE (STM32_DMA2D_WIDTH)
+# define STM32_DMA2D_BPP 8
+# define STM32_DMA2D_COLOR_FMT DMA2D_PF_L8
+# elif defined(CONFIG_STM32H7_DMA2D_RGB565)
+# define STM32_DMA2D_STRIDE ((STM32_DMA2D_WIDTH * 16 + 7) / 8)
+# define STM32_DMA2D_BPP 16
+# define STM32_DMA2D_COLOR_FMT DMA2D_PF_RGB565
+# elif defined(CONFIG_STM32H7_DMA2D_RGB888)
+# define STM32_DMA2D_STRIDE ((STM32_DMA2D_WIDTH * 24 + 7) / 8)
+# define STM32_DMA2D_BPP 24
+# define STM32_DMA2D_COLOR_FMT DMA2D_PF_RGB888
+# elif defined(CONFIG_STM32H7_DMA2D_ARGB8888)
+# define STM32_DMA2D_STRIDE ((STM32_DMA2D_WIDTH * 32 + 7) / 8)
+# define STM32_DMA2D_BPP 32
+# define STM32_DMA2D_COLOR_FMT DMA2D_PF_ARGB8888
+# else
+# error "DMA2D pixel format not supported"
+# endif
+
+# ifdef CONFIG_STM32H7_DMA2D_LAYER_SHARED
+# define STM32_DMA2D_FBSIZE CONFIG_STM32H7_DMA2D_FB_SIZE
+# define STM32_DMA2D_LAYER_SIZE 0
+# else
+# define STM32_DMA2D_FBSIZE CONFIG_STM32H7_DMA2D_FB_SIZE / DMA2D_NLAYERS
+# define STM32_DMA2D_LAYER_SIZE STM32_DMA2D_FBSIZE
+# if STM32_DMA2D_FBSIZE * DMA2D_NLAYERS > CONFIG_STM32H7_DMA2D_FB_SIZE
+# error "DMA2D framebuffer size to small for configured number of overlays"
+# endif
+# endif /* CONFIG_STM32H7_DMA2D_LAYER_SHARED */
+
+# define STM32_DMA2D_HEIGHT STM32_DMA2D_FBSIZE / STM32_DMA2D_STRIDE
+
+# define STM32_DMA2D_BUFFER_START CONFIG_STM32H7_DMA2D_FB_BASE
+#else
+# define DMA2D_NLAYERS 0
+#endif /* CONFIG_STM32H7_DMA2D */
+
+#define LTDC_NOVERLAYS LTDC_NLAYERS + DMA2D_NLAYERS
+
+/* Dithering */
+
+#ifndef CONFIG_STM32H7_LTDC_DITHER_RED
+# define STM32_LTDC_DITHER_RED 0
+#else
+# define STM32_LTDC_DITHER_RED CONFIG_STM32H7_LTDC_DITHER_RED
+#endif
+#ifndef CONFIG_STM32H7_LTDC_DITHER_GREEN
+# define STM32_LTDC_DITHER_GREEN 0
+#else
+# define STM32_LTDC_DITHER_GREEN CONFIG_STM32H7_LTDC_DITHER_GREEN
+#endif
+#ifndef CONFIG_STM32H7_LTDC_DITHER_BLUE
+# define STM32_LTDC_DITHER_BLUE 0
+#else
+# define STM32_LTDC_DITHER_BLUE CONFIG_STM32H7_LTDC_DITHER_BLUE
+#endif
+
+/* Background color */
+
+#ifndef CONFIG_STM32H7_LTDC_BACKCOLOR
+# define STM32_LTDC_BACKCOLOR 0
+#else
+# define STM32_LTDC_BACKCOLOR CONFIG_STM32H7_LTDC_BACKCOLOR
+#endif
+
+/* Layer default color */
+
+#ifdef CONFIG_STM32H7_LTDC_L1_COLOR
+# define STM32_LTDC_L1_COLOR CONFIG_STM32H7_LTDC_L1_COLOR
+#else
+# define STM32_LTDC_L1_COLOR 0x000000
+#endif
+
+#ifdef CONFIG_STM32H7_LTDC_L2
+# ifdef CONFIG_STM32H7_LTDC_L2_COLOR
+# define STM32_LTDC_L2_COLOR CONFIG_STM32H7_LTDC_L2_COLOR
+# else
+# define STM32_LTDC_L2_COLOR 0x000000
+# endif
+#endif
+
+/* Internal operation flags */
+
+#define LTDC_LAYER_SETAREA (1 << 0) /* Change visible area */
+#define LTDC_LAYER_SETALPHAVALUE (1 << 1) /* Change constant alpha value */
+#define LTDC_LAYER_SETBLENDMODE (1 << 2) /* Change blendmode */
+#define LTDC_LAYER_SETCOLORKEY (1 << 3) /* Change color key */
+#define LTDC_LAYER_ENABLECOLORKEY (1 << 4) /* Enable colorkey */
+#define LTDC_LAYER_SETCOLOR (1 << 5) /* Change default color */
+#define LTDC_LAYER_SETENABLE (1 << 6) /* Change enabled state */
+#define LTDC_LAYER_ENABLE (1 << 7) /* Enable the layer */
+
+/* Layer initializing state */
+
+#define LTDC_LAYER_INIT LTDC_LAYER_SETAREA | \
+ LTDC_LAYER_SETALPHAVALUE | \
+ LTDC_LAYER_SETBLENDMODE | \
+ LTDC_LAYER_SETCOLORKEY | \
+ LTDC_LAYER_SETCOLOR | \
+ LTDC_LAYER_SETENABLE | \
+ LTDC_LAYER_ENABLE
+
+/* Blendfactor reset values for flip operation */
+
+#define STM32_LTDC_BF1_RESET 6
+#define STM32_LTDC_BF2_RESET 7
+
+/* Check pixel format support by DMA2D driver */
+
+#ifdef CONFIG_STM32H7_DMA2D
+# if defined(CONFIG_STM32H7_LTDC_L1_L8) || \
+ defined(CONFIG_STM32H7_LTDC_L2_L8)
+# if !defined(CONFIG_STM32H7_DMA2D_L8)
+# error "DMA2D must support FB_FMT_RGB8 pixel format"
+# endif
+# endif
+# if defined(CONFIG_STM32H7_LTDC_L1_RGB565) || \
+ defined(CONFIG_STM32H7_LTDC_L2_RGB565)
+# if !defined(CONFIG_STM32H7_DMA2D_RGB565)
+# error "DMA2D must support FB_FMT_RGB16_565 pixel format"
+# endif
+# endif
+# if defined(CONFIG_STM32H7_LTDC_L1_RGB888) || \
+ defined(CONFIG_STM32H7_LTDC_L2_RGB888)
+# if !defined(CONFIG_STM32H7_DMA2D_RGB888)
+# error "DMA2D must support FB_FMT_RGB24 pixel format"
+# endif
+# endif
+# if defined(CONFIG_STM32H7_LTDC_L1_ARGB8888) || \
+ defined(CONFIG_STM32H7_LTDC_L2_ARGB8888)
+# if !defined(CONFIG_STM32H7_DMA2D_ARGB8888)
+# error "DMA2D must support FB_FMT_RGB32 pixel format"
+# endif
+# endif
+#endif
+
+/* Calculate the size of the layers clut table */
+
+#ifdef CONFIG_STM32H7_FB_CMAP
+# if defined(CONFIG_STM32H7_DMA2D) && !defined(CONFIG_STM32H7_DMA2D_L8)
+# error "DMA2D must also support L8 CLUT pixel format if supported by LTDC"
+# endif
+# ifdef STM32_LTDC_L1CMAP
+# ifdef CONFIG_STM32H7_FB_TRANSPARENCY
+# define STM32_LAYER_CLUT_SIZE STM32_LTDC_NCLUT * sizeof(uint32_t)
+# else
+# define STM32_LAYER_CLUT_SIZE STM32_LTDC_NCLUT * 3 * sizeof(uint8_t)
+# endif
+# endif
+# ifdef STM32_LTDC_L2CMAP
+# undef STM32_LAYER_CLUT_SIZE
+# ifdef CONFIG_STM32H7_FB_TRANSPARENCY
+# define STM32_LAYER_CLUT_SIZE STM32_LTDC_NCLUT * sizeof(uint32_t) * 2
+# else
+# define STM32_LAYER_CLUT_SIZE STM32_LTDC_NCLUT * 3 * sizeof(uint8_t) * 2
+# endif
+# endif
+#endif
+
+#ifndef CONFIG_STM32H7_FB_CMAP
+# if defined(STM32_LTDC_L1CMAP) || defined(STM32_LTDC_L2CMAP)
+# undef STM32_LTDC_L1CMAP
+# undef STM32_LTDC_L2CMAP
+# error "Enable cmap to support the configured layer format!"
+# endif
+#endif
+
+/* Layer clut rgb value positioning */
+
+#define LTDC_L1CLUT_REDOFFSET 0
+#define LTDC_L1CLUT_GREENOFFSET 256
+#define LTDC_L1CLUT_BLUEOFFSET 512
+#define LTDC_L2CLUT_REDOFFSET 768
+#define LTDC_L2CLUT_GREENOFFSET 1024
+#define LTDC_L2CLUT_BLUEOFFSET 1280
+
+/* Layer argb clut register position */
+
+#define LTDC_CLUT_ADD(n) ((uint32_t)(n) << 24)
+#define LTDC_CLUT_ALPHA(n) LTDC_CLUT_ADD(n)
+#define LTDC_CLUT_RED(n) ((uint32_t)(n) << 16)
+#define LTDC_CLUT_GREEN(n) ((uint32_t)(n) << 8)
+#define LTDC_CLUT_BLUE(n) ((uint32_t)(n) << 0)
+#define LTDC_CLUT_RGB888_MASK 0xffffff
+
+/* Layer argb cmap conversion */
+
+#define LTDC_CMAP_ALPHA(n) ((uint32_t)(n) >> 24)
+#define LTDC_CMAP_RED(n) ((uint32_t)(n) >> 16)
+#define LTDC_CMAP_GREEN(n) ((uint32_t)(n) >> 8)
+#define LTDC_CMAP_BLUE(n) ((uint32_t)(n) >> 0)
+
+/* Hardware acceleration support */
+
+/* Acceleration support for LTDC overlays */
+
+#ifdef CONFIG_STM32H7_LTDC_L1_CHROMAKEYEN
+# define STM32_LTDC_L1_CHROMAEN true
+# define STM32_LTDC_L1_CHROMAKEY CONFIG_STM32H7_LTDC_L1_CHROMAKEY
+# define LTDC_LTDC_ACCL_L1 FB_ACCL_TRANSP | FB_ACCL_CHROMA
+#else
+# define STM32_LTDC_L1_CHROMAEN false
+# define STM32_LTDC_L1_CHROMAKEY 0
+# define LTDC_LTDC_ACCL_L1 FB_ACCL_TRANSP
+#endif
+
+#ifdef CONFIG_STM32H7_LTDC_L2_CHROMAKEYEN
+# define STM32_LTDC_L2_CHROMAEN true
+# define STM32_LTDC_L2_CHROMAKEY CONFIG_STM32H7_LTDC_L2_CHROMAKEY
+# define LTDC_LTDC_ACCL_L2 FB_ACCL_TRANSP | FB_ACCL_CHROMA
+#else
+# define STM32_LTDC_L2_CHROMAEN false
+# define STM32_LTDC_L2_CHROMAKEY 0
+# define LTDC_LTDC_ACCL_L2 FB_ACCL_TRANSP
+#endif
+
+#ifdef CONFIG_STM32H7_DMA2D
+# ifdef CONFIG_FB_OVERLAY_BLIT
+# ifdef CONFIG_STM32H7_FB_CMAP
+# define LTDC_BLIT_ACCL FB_ACCL_BLIT
+# else
+# define LTDC_BLIT_ACCL FB_ACCL_BLIT | FB_ACCL_BLEND
+# endif /* CONFIG_STM32H7_FB_CMAP */
+# else
+# define LTDC_BLIT_ACCL 0
+# endif /* CONFIG_FB_OVERLAY_BLIT */
+
+# ifdef CONFIG_STM32H7_FB_CMAP
+# define LTDC_DMA2D_ACCL LTDC_BLIT_ACCL
+# else
+# define LTDC_DMA2D_ACCL FB_ACCL_COLOR | LTDC_BLIT_ACCL
+# endif /* CONFIG_STM32H7_FB_CMAP */
+#else
+# define LTDC_DMA2D_ACCL 0
+#endif /* CONFIG_STM32H7_DMA2D */
+
+#define LTDC_L1_ACCL LTDC_LTDC_ACCL_L1 | LTDC_DMA2D_ACCL
+#ifdef CONFIG_STM32H7_LTDC_L2
+# define LTDC_L2_ACCL LTDC_LTDC_ACCL_L2 | LTDC_DMA2D_ACCL
+#endif
+
+/* Acceleration support for DMA2D overlays */
+
+#ifdef CONFIG_STM32H7_FB_CMAP
+# ifdef CONFIG_FB_OVERLAY_BLIT
+# define DMA2D_ACCL FB_ACCL_BLIT | FB_ACCL_AREA
+# else
+# define DMA2D_ACCL FB_ACCL_AREA
+# endif
+#else
+# ifdef CONFIG_FB_OVERLAY_BLIT
+# define DMA2D_ACCL FB_ACCL_AREA | \
+ FB_ACCL_TRANSP | \
+ FB_ACCL_COLOR | \
+ FB_ACCL_BLIT | \
+ FB_ACCL_BLEND
+# else
+# define DMA2D_ACCL FB_ACCL_AREA | \
+ FB_ACCL_TRANSP | \
+ FB_ACCL_COLOR
+# endif
+#endif
+
+/* Helper */
+
+#define MIN(x,y) ((x) < (y) ? (x) : (y))
+
+/* Color normalization */
+
+#if defined(CONFIG_STM32H7_LTDC_L1_RGB565)
+# define RGB888_R(x) (((((x) >> 11) & 0x1f) * 527 + 23) >> 6)
+# define RGB888_G(x) (((((x) >> 5) & 0x3f) * 259 + 33) >> 6)
+# define RGB888_B(x) ((((x) & 0x1f) * 527 + 23) >> 6)
+# define ARGB8888(x) ((RGB888_R(x) << 16) | \
+ (RGB888_G(x) << 8) | \
+ RGB888_B(x))
+#else
+# define ARGB8888(x) (x)
+#endif
+
+/****************************************************************************
+ * Private Types
+ ****************************************************************************/
+
+/* This enumeration names each layer supported by the hardware */
+
+enum stm32_layer_e
+{
+ LTDC_LAYER_L1 = 0, /* LCD Layer 1 */
+ LTDC_LAYER_L2, /* LCD Layer 2 */
+};
+
+/* LTDC General layer information */
+
+struct stm32_ltdc_s
+{
+ int layerno; /* layer number */
+
+#ifdef CONFIG_FB_OVERLAY
+ struct fb_overlayinfo_s oinfo; /* Overlay info */
+#endif
+
+#ifdef CONFIG_STM32H7_DMA2D
+ struct stm32_dma2d_overlay_s dma2dinfo; /* Overlay info for DMA2D */
+#endif
+
+ sem_t *lock; /* Layer exclusive access */
+};
+
+/* This structure provides the overall state of the LTDC layer */
+
+struct stm32_ltdcdev_s
+{
+ /* Framebuffer interface */
+
+ struct fb_vtable_s vtable;
+
+ /* Framebuffer video information */
+
+ struct fb_videoinfo_s vinfo;
+
+ /* Framebuffer plane information */
+
+ struct fb_planeinfo_s pinfo;
+
+ /* Cmap information */
+
+#ifdef CONFIG_STM32H7_FB_CMAP
+ struct fb_cmap_s cmap;
+#endif
+
+ /* Layer information */
+
+ struct stm32_ltdc_s layer[LTDC_NOVERLAYS];
+
+#ifdef CONFIG_STM32H7_DMA2D
+ /* Interface to the dma2d controller */
+
+ FAR struct dma2d_layer_s *dma2d;
+#endif
+};
+
+/* Interrupt handling */
+
+struct stm32_interrupt_s
+{
+ int irq; /* irq number */
+ int error; /* Interrupt error */
+ sem_t *sem; /* Semaphore for waiting for irq */
+};
+
+/****************************************************************************
+ * Private Function Prototypes
+ ****************************************************************************/
+
+/* Overal LTDC helper */
+
+static void stm32_ltdc_enable(bool enable);
+static void stm32_ltdc_gpioconfig(void);
+static void stm32_ltdc_periphconfig(void);
+static void stm32_ltdc_bgcolor(uint32_t rgb);
+static void stm32_ltdc_dither(bool enable, uint8_t red,
+ uint8_t green, uint8_t blue);
+static int stm32_ltdcirq(int irq, void *context, FAR void *arg);
+static int stm32_ltdc_waitforirq(void);
+static int stm32_ltdc_reload(uint8_t value, bool waitvblank);
+
+/* Helper for layer register configuration */
+
+static void stm32_ltdc_lpixelformat(FAR struct stm32_ltdc_s *layer);
+static void stm32_ltdc_lframebuffer(FAR struct stm32_ltdc_s *layer);
+static void stm32_ltdc_lenable(FAR struct stm32_ltdc_s *layer, bool enable);
+static void stm32_ltdc_ldefaultcolor(FAR struct stm32_ltdc_s * layer,
+ uint32_t rgb);
+static void stm32_ltdc_ltransp(FAR struct stm32_ltdc_s *layer,
+ uint8_t transp,
+ uint32_t mode);
+static void stm32_ltdc_lchromakey(FAR struct stm32_ltdc_s *layer,
+ uint32_t chromakey);
+static void stm32_ltdc_lchromakeyenable(FAR struct stm32_ltdc_s *layer,
+ bool enable);
+static void stm32_ltdc_linit(uint8_t lid);
+
+#ifdef CONFIG_STM32H7_DMA2D
+static void stm32_ltdc_dma2dlinit(void);
+
+# ifdef CONFIG_FB_OVERLAY_BLIT
+static bool stm32_ltdc_lvalidate(FAR const struct stm32_ltdc_s *layer,
+ FAR const struct fb_area_s *area);
+# endif
+#endif
+
+#ifdef CONFIG_STM32H7_FB_CMAP
+static void stm32_ltdc_lputclut(FAR struct stm32_ltdc_s * layer,
+ FAR const struct fb_cmap_s *cmap);
+static void stm32_ltdc_lgetclut(FAR struct stm32_ltdc_s * layer,
+ FAR struct fb_cmap_s *cmap);
+static void stm32_ltdc_lclutenable(FAR struct stm32_ltdc_s *layer,
+ bool enable);
+#endif
+
+static void stm32_ltdc_lclear(uint8_t overlayno);
+
+/* Framebuffer interface */
+
+static int stm32_getvideoinfo(FAR struct fb_vtable_s *vtable,
+ FAR struct fb_videoinfo_s *vinfo);
+static int stm32_getplaneinfo(FAR struct fb_vtable_s *vtable,
+ int planeno,
+ FAR struct fb_planeinfo_s *pinfo);
+
+/* The following is provided only if the video hardware supports RGB color
+ * mapping
+ */
+
+#ifdef CONFIG_STM32H7_FB_CMAP
+static int stm32_getcmap(FAR struct fb_vtable_s *vtable,
+ FAR struct fb_cmap_s *cmap);
+static int stm32_putcmap(FAR struct fb_vtable_s *vtable,
+ FAR const struct fb_cmap_s *cmap);
+#endif
+
+/* The following is provided only if the video hardware signals vertical
+ * synchronisation
+ */
+
+#ifdef CONFIG_FB_SYNC
+static int stm32_waitforvsync(FAR struct fb_vtable_s *vtable);
+#endif
+
+/* The following is provided only if the video hardware supports overlays */
+
+#ifdef CONFIG_FB_OVERLAY
+static int stm32_getoverlayinfo(FAR struct fb_vtable_s *vtable,
+ int overlayno,
+ FAR struct fb_overlayinfo_s *oinfo);
+static int stm32_settransp(FAR struct fb_vtable_s *vtable,
+ FAR const struct fb_overlayinfo_s *oinfo);
+static int stm32_setchromakey(FAR struct fb_vtable_s *vtable,
+ FAR const struct fb_overlayinfo_s *oinfo);
+static int stm32_setcolor(FAR struct fb_vtable_s *vtable,
+ FAR const struct fb_overlayinfo_s *oinfo);
+static int stm32_setblank(FAR struct fb_vtable_s *vtable,
+ FAR const struct fb_overlayinfo_s *oinfo);
+static int stm32_setarea(FAR struct fb_vtable_s *vtable,
+ FAR const struct fb_overlayinfo_s *oinfo);
+
+/* The following is provided only if the video hardware supports blit and
+ * blend operation
+ */
+
+# ifdef CONFIG_FB_OVERLAY_BLIT
+static int stm32_blit(FAR struct fb_vtable_s *vtable,
+ FAR const struct fb_overlayblit_s *blit);
+static int stm32_blend(FAR struct fb_vtable_s *vtable,
+ FAR const struct fb_overlayblend_s *blend);
+# endif /* CONFIG_FB_OVERLAY_BLIT */
+#endif /* CONFIG_FB_OVERLAY */
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/* PIO pin configurations */
+
+static const uint32_t g_ltdcpins[] =
+{
+ GPIO_LTDC_R4, GPIO_LTDC_R5, GPIO_LTDC_R6, GPIO_LTDC_R7,
+ GPIO_LTDC_G4, GPIO_LTDC_G5, GPIO_LTDC_G6, GPIO_LTDC_G7,
+ GPIO_LTDC_B4, GPIO_LTDC_B5, GPIO_LTDC_B6, GPIO_LTDC_B7,
+#if BOARD_LTDC_OUTPUT_BPP > 12
+ GPIO_LTDC_R3, GPIO_LTDC_G2, GPIO_LTDC_G3, GPIO_LTDC_B3,
+# if BOARD_LTDC_OUTPUT_BPP > 16
+ GPIO_LTDC_R2, GPIO_LTDC_B2,
+# if BOARD_LTDC_OUTPUT_BPP > 18
+ GPIO_LTDC_R0, GPIO_LTDC_R1, GPIO_LTDC_G0, GPIO_LTDC_G1,
+ GPIO_LTDC_B0, GPIO_LTDC_B1,
+# endif
+# endif
+#endif
+ GPIO_LTDC_VSYNC, GPIO_LTDC_HSYNC, GPIO_LTDC_DE, GPIO_LTDC_CLK
+};
+
+#define STM32_LTDC_NPINCONFIGS (sizeof(g_ltdcpins) / sizeof(uint32_t))
+
+#ifdef CONFIG_STM32H7_FB_CMAP
+/* The layers clut table entries */
+
+static uint8_t g_redclut[STM32_LTDC_NCLUT];
+static uint8_t g_greenclut[STM32_LTDC_NCLUT];
+static uint8_t g_blueclut[STM32_LTDC_NCLUT];
+# ifdef CONFIG_STM32H7_FB_TRANSPARENCY
+static uint8_t g_transpclut[STM32_LTDC_NCLUT];
+# endif
+#endif /* CONFIG_STM32H7_FB_CMAP */
+
+/* The LTDC semaphore that enforces mutually exclusive access */
+
+static sem_t g_lock;
+
+/* The semaphore for interrupt handling */
+
+static sem_t g_semirq;
+
+/* This structure provides irq handling */
+
+static struct stm32_interrupt_s g_interrupt =
+{
+ .irq = STM32_IRQ_LTDC,
+ .error = OK,
+ .sem = &g_semirq
+};
+
+/* This structure provides the internal interface */
+
+static struct stm32_ltdcdev_s g_vtable =
+{
+ .vtable =
+ {
+ .getvideoinfo = stm32_getvideoinfo,
+ .getplaneinfo = stm32_getplaneinfo
+#ifdef CONFIG_FB_SYNC
+ ,
+ .waitforvsync = stm32_waitforvsync
+#endif
+
+#ifdef CONFIG_STM32H7_FB_CMAP
+ ,
+ .getcmap = stm32_getcmap,
+ .putcmap = stm32_putcmap
+#endif
+
+#ifdef CONFIG_FB_OVERLAY
+ ,
+ .getoverlayinfo = stm32_getoverlayinfo,
+ .settransp = stm32_settransp,
+ .setchromakey = stm32_setchromakey,
+ .setcolor = stm32_setcolor,
+ .setblank = stm32_setblank,
+ .setarea = stm32_setarea
+# ifdef CONFIG_FB_OVERLAY_BLIT
+ ,
+ .blit = stm32_blit,
+ .blend = stm32_blend
+# endif
+#endif /* CONFIG_FB_OVERLAY */
+ },
+#ifdef CONFIG_STM32H7_LTDC_L2
+ .pinfo =
+ {
+ .fbmem = (uint8_t *)STM32_LTDC_BUFFER_L2,
+ .fblen = STM32_LTDC_L2_FBSIZE,
+ .stride = STM32_LTDC_L2_STRIDE,
+ .display = 0,
+ .bpp = STM32_LTDC_L2_BPP
+ },
+ .vinfo =
+ {
+ .fmt = STM32_LTDC_L2_COLOR_FMT,
+ .xres = STM32_LTDC_WIDTH,
+ .yres = STM32_LTDC_HEIGHT,
+ .nplanes = 1,
+# ifdef CONFIG_FB_OVERLAY
+ .noverlays = LTDC_NOVERLAYS
+# endif
+ }
+#else
+ .pinfo =
+ {
+ .fbmem = (uint8_t *)STM32_LTDC_BUFFER_L1,
+ .fblen = STM32_LTDC_L1_FBSIZE,
+ .stride = STM32_LTDC_L1_STRIDE,
+ .display = 0,
+ .bpp = STM32_LTDC_L1_BPP
+ },
+ .vinfo =
+ {
+ .fmt = STM32_LTDC_L1_COLOR_FMT,
+ .xres = STM32_LTDC_WIDTH,
+ .yres = STM32_LTDC_HEIGHT,
+ .nplanes = 1,
+# ifdef CONFIG_FB_OVERLAY
+ .noverlays = LTDC_NOVERLAYS
+# endif
+ }
+#endif /* CONFIG_STM32H7_LTDC_L2 */
+ ,
+#ifdef CONFIG_STM32H7_FB_CMAP
+ .cmap =
+ {
+ .first = 0,
+ .len = STM32_LTDC_NCLUT,
+ .red = g_redclut,
+ .green = g_greenclut,
+ .blue = g_blueclut,
+# ifdef CONFIG_STM32H7_FB_TRANSPARENCY
+ .transp = g_transpclut
+# endif
+ }
+ ,
+#endif
+ .layer[LTDC_LAYER_L1] =
+ {
+ .layerno = LTDC_LAYER_L1,
+#ifdef CONFIG_FB_OVERLAY
+ .oinfo =
+ {
+ .fbmem = (uint8_t *)STM32_LTDC_BUFFER_L1,
+ .fblen = STM32_LTDC_L1_FBSIZE,
+ .stride = STM32_LTDC_L1_STRIDE,
+ .overlay = LTDC_LAYER_L1,
+ .bpp = STM32_LTDC_L1_BPP,
+ .blank = 0,
+ .chromakey = 0,
+ .color = 0,
+ .transp =
+ {
+ .transp = 0xff,
+ .transp_mode = FB_CONST_ALPHA
+ },
+ .sarea =
+ {
+ .x = 0,
+ .y = 0,
+ .w = STM32_LTDC_WIDTH,
+ .h = STM32_LTDC_HEIGHT
+ },
+ .accl = LTDC_L1_ACCL
+ },
+#endif
+
+#ifdef CONFIG_STM32H7_DMA2D
+ .dma2dinfo =
+ {
+ .fmt = STM32_LTDC_L1_DMA2D_PF,
+ .transp_mode = STM32_DMA2D_PFCCR_AM_NONE,
+ .xres = STM32_LTDC_WIDTH,
+ .yres = STM32_LTDC_HEIGHT,
+ .oinfo = &g_vtable.layer[LTDC_LAYER_L1].oinfo
+ },
+#endif
+ .lock = &g_lock
+ }
+#ifdef CONFIG_STM32H7_LTDC_L2
+ ,
+ .layer[LTDC_LAYER_L2] =
+ {
+ .layerno = LTDC_LAYER_L2,
+#ifdef CONFIG_FB_OVERLAY
+ .oinfo =
+ {
+ .overlay = LTDC_LAYER_L2,
+ .fbmem = (uint8_t *)STM32_LTDC_BUFFER_L2,
+ .fblen = STM32_LTDC_L2_FBSIZE,
+ .stride = STM32_LTDC_L2_STRIDE,
+ .bpp = STM32_LTDC_L2_BPP,
+ .blank = 0,
+ .chromakey = 0,
+ .color = 0,
+ .transp =
+ {
+ .transp = 0xff,
+ .transp_mode = FB_CONST_ALPHA
+ },
+ .sarea =
+ {
+ .x = 0,
+ .y = 0,
+ .w = STM32_LTDC_WIDTH,
+ .h = STM32_LTDC_HEIGHT
+ },
+ .accl = LTDC_L2_ACCL
+ },
+#endif
+
+#ifdef CONFIG_STM32H7_DMA2D
+ .dma2dinfo =
+ {
+ .fmt = STM32_LTDC_L2_DMA2D_PF,
+ .transp_mode = STM32_DMA2D_PFCCR_AM_NONE,
+ .xres = STM32_LTDC_WIDTH,
+ .yres = STM32_LTDC_HEIGHT,
+ .oinfo = &g_vtable.layer[LTDC_LAYER_L2].oinfo
+ },
+#endif
+ .lock = &g_lock
+ }
+#endif
+};
+
+/* Configuration lookup tables */
+
+/* LTDC width */
+
+static const uint32_t stm32_width_layer_t[LTDC_NLAYERS] =
+{
+ STM32_LTDC_WIDTH
+#ifdef CONFIG_STM32H7_LTDC_L2
+ , STM32_LTDC_WIDTH
+#endif
+};
+
+/* LTDC height */
+
+static const uint32_t stm32_height_layer_t[LTDC_NLAYERS] =
+{
+ STM32_LTDC_HEIGHT
+#ifdef CONFIG_STM32H7_LTDC_L2
+ , STM32_LTDC_HEIGHT
+#endif
+};
+
+/* LTDC stride */
+
+static const uint32_t stm32_stride_layer_t[LTDC_NLAYERS] =
+{
+ STM32_LTDC_L1_STRIDE
+#ifdef CONFIG_STM32H7_LTDC_L2
+ , STM32_LTDC_L2_STRIDE
+#endif
+};
+
+/* LTDC bpp */
+
+static const uint32_t stm32_bpp_layer_t[LTDC_NLAYERS] =
+{
+ STM32_LTDC_L1_BPP
+#ifdef CONFIG_STM32H7_LTDC_L2
+ , STM32_LTDC_L2_BPP
+#endif
+};
+
+/* LTDC framebuffer len */
+
+static const uint32_t stm32_fblen_layer_t[LTDC_NLAYERS] =
+{
+ STM32_LTDC_L1_FBSIZE
+#ifdef CONFIG_STM32H7_LTDC_L2
+ , STM32_LTDC_L2_FBSIZE
+#endif
+};
+
+/* LTDC framebuffer */
+
+static const uint32_t stm32_fbmem_layer_t[LTDC_NLAYERS] =
+{
+ STM32_LTDC_BUFFER_L1
+#ifdef CONFIG_STM32H7_LTDC_L2
+ , STM32_LTDC_BUFFER_L2
+#endif
+};
+
+/* LTDC default color lookup table */
+
+static const uint32_t stm32_defaultcolor_layer_t[LTDC_NLAYERS] =
+{
+ STM32_LTDC_L1_COLOR
+#ifdef CONFIG_STM32H7_LTDC_L2
+ , STM32_LTDC_L2_COLOR
+#endif
+};
+
+/* LTDC default chromakey */
+
+static const uint32_t stm32_chromakey_layer_t[LTDC_NLAYERS] =
+{
+ STM32_LTDC_L1_CHROMAKEY
+#ifdef CONFIG_STM32H7_LTDC_L2
+ , STM32_LTDC_L2_CHROMAKEY
+#endif
+};
+
+/* LTDC chromakey enabled state */
+
+static const bool stm32_chromakeyen_layer_t[LTDC_NLAYERS] =
+{
+ STM32_LTDC_L1_CHROMAEN
+#ifdef CONFIG_STM32H7_LTDC_L2
+ , STM32_LTDC_L2_CHROMAEN
+#endif
+};
+
+/* LTDC pixel format lookup table */
+
+static const uint32_t stm32_fmt_layer_t[LTDC_NLAYERS] =
+{
+ STM32_LTDC_L1PFCR_PF
+#ifdef CONFIG_STM32H7_LTDC_L2
+ , STM32_LTDC_L2PFCR_PF
+#endif
+};
+
+/* Register lookup tables */
+
+/* LTDC_LxCR */
+
+static const uintptr_t stm32_cr_layer_t[LTDC_NLAYERS] =
+{
+ STM32_LTDC_L1CR
+#ifdef CONFIG_STM32H7_LTDC_L2
+ , STM32_LTDC_L2CR
+#endif
+};
+
+/* LTDC_LxWHPCR */
+
+static const uintptr_t stm32_whpcr_layer_t[LTDC_NLAYERS] =
+{
+ STM32_LTDC_L1WHPCR
+#ifdef CONFIG_STM32H7_LTDC_L2
+ , STM32_LTDC_L2WHPCR
+#endif
+};
+
+/* LTDC_LxWVPCR */
+
+static const uintptr_t stm32_wvpcr_layer_t[LTDC_NLAYERS] =
+{
+ STM32_LTDC_L1WVPCR
+#ifdef CONFIG_STM32H7_LTDC_L2
+ , STM32_LTDC_L2WVPCR
+#endif
+};
+
+/* LTDC_LxPFCR */
+
+static const uintptr_t stm32_pfcr_layer_t[LTDC_NLAYERS] =
+{
+ STM32_LTDC_L1PFCR
+#ifdef CONFIG_STM32H7_LTDC_L2
+ , STM32_LTDC_L2PFCR
+#endif
+};
+
+/* LTDC_LxDCCR */
+
+static const uintptr_t stm32_dccr_layer_t[LTDC_NLAYERS] =
+{
+ STM32_LTDC_L1DCCR
+#ifdef CONFIG_STM32H7_LTDC_L2
+ , STM32_LTDC_L2DCCR
+#endif
+};
+
+/* LTDC_LxCKCR */
+
+static const uintptr_t stm32_ckcr_layer_t[LTDC_NLAYERS] =
+{
+ STM32_LTDC_L1CKCR
+#ifdef CONFIG_STM32H7_LTDC_L2
+ , STM32_LTDC_L2CKCR
+#endif
+};
+
+/* LTDC_LxCACR */
+
+static const uintptr_t stm32_cacr_layer_t[LTDC_NLAYERS] =
+{
+ STM32_LTDC_L1CACR
+#ifdef CONFIG_STM32H7_LTDC_L2
+ , STM32_LTDC_L2CACR
+#endif
+};
+
+/* LTDC_LxBFCR */
+
+static const uintptr_t stm32_bfcr_layer_t[LTDC_NLAYERS] =
+{
+ STM32_LTDC_L1BFCR
+#ifdef CONFIG_STM32H7_LTDC_L2
+ , STM32_LTDC_L2BFCR
+#endif
+};
+
+/* LTDC_LxCFBAR */
+
+static const uintptr_t stm32_cfbar_layer_t[LTDC_NLAYERS] =
+{
+ STM32_LTDC_L1CFBAR
+#ifdef CONFIG_STM32H7_LTDC_L2
+ , STM32_LTDC_L2CFBAR
+#endif
+};
+
+/* LTDC_LxCFBLR */
+
+static const uintptr_t stm32_cfblr_layer_t[LTDC_NLAYERS] =
+{
+ STM32_LTDC_L1CFBLR
+#ifdef CONFIG_STM32H7_LTDC_L2
+ , STM32_LTDC_L2CFBLR
+#endif
+};
+
+/* LTDC_LxCFBLNR */
+
+static const uintptr_t stm32_cfblnr_layer_t[LTDC_NLAYERS] =
+{
+ STM32_LTDC_L1CFBLNR
+#ifdef CONFIG_STM32H7_LTDC_L2
+ , STM32_LTDC_L2CFBLNR
+#endif
+};
+
+/* LTDC_LxCLUTWR */
+
+#ifdef CONFIG_STM32H7_FB_CMAP
+static const uintptr_t stm32_clutwr_layer_t[LTDC_NLAYERS] =
+{
+ STM32_LTDC_L1CLUTWR
+# ifdef CONFIG_STM32H7_LTDC_L2
+ , STM32_LTDC_L2CLUTWR
+# endif
+};
+#endif /* CONFIG_STM32H7_FB_CMAP */
+
+/* The initialized state of the driver */
+
+static bool g_initialized;
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: stm32_ltdc_gpioconfig
+ *
+ * Description:
+ * Configure GPIO pins for use with the LTDC
+ *
+ ****************************************************************************/
+
+static void stm32_ltdc_gpioconfig(void)
+{
+ int i;
+
+ lcdinfo("Configuring pins\n");
+
+ /* Configure each pin */
+
+ for (i = 0; i < STM32_LTDC_NPINCONFIGS; i++)
+ {
+ reginfo("set gpio%d = %08x\n", i, g_ltdcpins[i]);
+ stm32_configgpio(g_ltdcpins[i]);
+ }
+}
+
+/****************************************************************************
+ * Name: stm32_ltdc_periphconfig
+ *
+ * Description:
+ * Configures the synchronous timings
+ * Configures the synchronous signals and clock polarity
+ *
+ ****************************************************************************/
+
+static void stm32_ltdc_periphconfig(void)
+{
+ uint32_t regval;
+
+ /* Configure GPIO's */
+
+ stm32_ltdc_gpioconfig();
+
+ /* Configure APB3 LTDC clock external */
+
+ reginfo("configured RCC_APB3ENR=%08x\n", getreg32(STM32_RCC_APB3ENR));
+
+ /* Configure LTDC_SSCR */
+
+ regval = (STM32_LTDC_SSCR_VSH | STM32_LTDC_SSCR_HSW);
+ reginfo("set LTDC_SSCR=%08x\n", regval);
+ putreg32(regval, STM32_LTDC_SSCR);
+ reginfo("configured LTDC_SSCR=%08x\n", getreg32(STM32_LTDC_SSCR));
+
+ /* Configure LTDC_BPCR */
+
+ regval = (STM32_LTDC_BPCR_AVBP | STM32_LTDC_BPCR_AHBP);
+ reginfo("set LTDC_BPCR=%08x\n", regval);
+ putreg32(regval, STM32_LTDC_BPCR);
+ reginfo("configured LTDC_BPCR=%08x\n", getreg32(STM32_LTDC_BPCR));
+
+ /* Configure LTDC_AWCR */
+
+ regval = (STM32_LTDC_AWCR_AAH | STM32_LTDC_AWCR_AAW);
+ reginfo("set LTDC_AWCR=%08x\n", regval);
+ putreg32(regval, STM32_LTDC_AWCR);
+ reginfo("configured LTDC_AWCR=%08x\n", getreg32(STM32_LTDC_AWCR));
+
+ /* Configure LTDC_TWCR */
+
+ regval = (STM32_LTDC_TWCR_TOTALH | STM32_LTDC_TWCR_TOTALW);
+ reginfo("set LTDC_TWCR=%08x\n", regval);
+ putreg32(regval, STM32_LTDC_TWCR);
+ reginfo("configured LTDC_TWCR=%08x\n", getreg32(STM32_LTDC_TWCR));
+
+ /* Configure LTDC_GCR */
+
+ regval = getreg32(STM32_LTDC_GCR);
+ regval &= ~(LTDC_GCR_PCPOL | LTDC_GCR_DEPOL | LTDC_GCR_VSPOL |
+ LTDC_GCR_HSPOL);
+ regval |= (STM32_LTDC_GCR_PCPOL | STM32_LTDC_GCR_DEPOL |
+ STM32_LTDC_GCR_VSPOL | STM32_LTDC_GCR_HSPOL);
+
+ reginfo("set LTDC_GCR=%08x\n", regval);
+ putreg32(regval, STM32_LTDC_GCR);
+ reginfo("configured LTDC_GCR=%08x\n", getreg32(STM32_LTDC_GCR));
+}
+
+/****************************************************************************
+ * Name: stm32_ltdc_ldefaultcolor
+ *
+ * Description:
+ * Configures layer default color.
+ *
+ * Input Parameters:
+ * layer - Reference to the layer control structure
+ * rgb - RGB888 background color
+ *
+ ****************************************************************************/
+
+static void stm32_ltdc_ldefaultcolor(FAR struct stm32_ltdc_s * layer,
+ uint32_t rgb)
+{
+ DEBUGASSERT(layer->layerno < LTDC_NLAYERS);
+ reginfo("set LTDC_L%dDCCR=%08x\n", layer->layerno + 1, rgb);
+
+ putreg32(rgb, stm32_dccr_layer_t[layer->layerno]);
+
+ /* Reload shadow register */
+
+ stm32_ltdc_reload(LTDC_SRCR_IMR, false);
+
+ reginfo("configured LTDC_L%dDCCR=%08x\n", layer->layerno + 1,
+ getreg32(STM32_LTDC_BCCR));
+}
+
+/****************************************************************************
+ * Name: stm32_ltdc_bgcolor
+ *
+ * Description:
+ * Configures background color of the LCD controller.
+ *
+ * Input Parameters:
+ * rgb - RGB888 background color
+ *
+ ****************************************************************************/
+
+static void stm32_ltdc_bgcolor(uint32_t rgb)
+{
+ reginfo("set LTDC_BCCR=%08x\n", rgb);
+ putreg32(rgb, STM32_LTDC_BCCR);
+ reginfo("configured LTDC_BCCR=%08x\n", getreg32(STM32_LTDC_BCCR));
+}
+
+/****************************************************************************
+ * Name: stm32_ltdc_dither
+ *
+ * Description:
+ * Configures dither settings of the LCD controller.
+ *
+ * Input Parameters:
+ * enable - Enable dithering
+ * red - Red dither width
+ * green - Green dither width
+ * blue - Blue dither width
+ *
+ ****************************************************************************/
+
+static void stm32_ltdc_dither(bool enable, uint8_t red,
+ uint8_t green, uint8_t blue)
+{
+ uint32_t regval;
+
+ regval = getreg32(STM32_LTDC_GCR);
+
+ if (enable == true)
+ {
+ regval |= LTDC_GCR_DEN;
+ }
+ else
+ {
+ regval &= ~LTDC_GCR_DEN;
+ }
+
+ regval &= ~(LTDC_GCR_DBW_MASK | LTDC_GCR_DGW_MASK | LTDC_GCR_DRW_MASK);
+ regval |= (LTDC_GCR_DRW(red) | LTDC_GCR_DGW(green) | LTDC_GCR_DBW(blue));
+
+ reginfo("set LTDC_GCR=%08x\n", regval);
+ putreg32(regval, STM32_LTDC_GCR);
+ reginfo("configured LTDC_GCR=%08x\n", getreg32(STM32_LTDC_GCR));
+}
+
+/****************************************************************************
+ * Name: stm32_ltdc_linepos
+ *
+ * Description:
+ * Configures line position register
+ *
+ ****************************************************************************/
+
+static void stm32_ltdc_linepos(void)
+{
+ /* Configure LTDC_LIPCR */
+
+ reginfo("set LTDC_LIPCR=%08x\n", STM32_LTDC_LIPCR_LIPOS);
+ putreg32(STM32_LTDC_LIPCR_LIPOS, STM32_LTDC_LIPCR);
+ reginfo("configured LTDC_LIPCR=%08x\n", getreg32(STM32_LTDC_LIPCR));
+}
+
+/****************************************************************************
+ * Name: stm32_ltdc_irqctrl
+ *
+ * Description:
+ * Control interrupts generated by the ltdc controller
+ *
+ * Input Parameters:
+ * setirqs - set interrupt mask
+ * clrirqs - clear interrupt mask
+ *
+ ****************************************************************************/
+
+static void stm32_ltdc_irqctrl(uint32_t setirqs, uint32_t clrirqs)
+{
+ uint32_t regval;
+
+ regval = getreg32(STM32_LTDC_IER);
+ regval &= ~clrirqs;
+ regval |= setirqs;
+ reginfo("set LTDC_IER=%08x\n", regval);
+ putreg32(regval, STM32_LTDC_IER);
+ reginfo("configured LTDC_IER=%08x\n", getreg32(STM32_LTDC_IER));
+}
+
+/****************************************************************************
+ * Name: stm32_ltdcirq
+ *
+ * Description:
+ * LTDC interrupt handler
+ *
+ ****************************************************************************/
+
+static int stm32_ltdcirq(int irq, void *context, FAR void *arg)
+{
+ int ret;
+ FAR struct stm32_interrupt_s *priv = &g_interrupt;
+ uint32_t regval = getreg32(STM32_LTDC_ISR);
+
+ reginfo("irq = %d, regval = %08x\n", irq, regval);
+
+ if (regval & LTDC_ISR_RRIF)
+ {
+ /* Register reload interrupt */
+
+ /* Clear the interrupt status register */
+
+ reginfo("Register reloaded\n");
+ putreg32(LTDC_ICR_CRRIF, STM32_LTDC_ICR);
+ priv->error = OK;
+ }
+ else if (regval & LTDC_IER_LIE)
+ {
+ /* Line interrupt */
+
+ /* Clear the interrupt status register */
+
+ reginfo("Line interrupt\n");
+ putreg32(LTDC_ICR_CLIF, STM32_LTDC_ICR);
+ priv->error = OK;
+ }
+ else if (regval & LTDC_IER_TERRIE)
+ {
+ /* Transfer error interrupt */
+
+ /* Clear the interrupt status register */
+
+ reginfo("Error transfer\n");
+ putreg32(LTDC_ICR_CTERRIF, STM32_LTDC_ICR);
+ priv->error = -ECANCELED;
+ }
+ else if (regval & LTDC_IER_FUIE)
+ {
+ /* Fifo underrun error interrupt */
+
+ /* Clear the interrupt status register */
+
+ reginfo("Error fifo underrun\n");
+ putreg32(LTDC_ICR_CFUIF, STM32_LTDC_ICR);
+ priv->error = -ECANCELED;
+ }
+ else
+ {
+ DEBUGASSERT("Unknown interrupt");
+ }
+
+ /* Unlock the semaphore if locked */
+
+ ret = nxsem_post(priv->sem);
+
+ if (ret < 0)
+ {
+ lcderr("ERROR: nxsem_post() failed\n");
+ }
+
+ return OK;
+}
+
+/****************************************************************************
+ * Name: stm32_ltdc_waitforirq
+ *
+ * Description:
+ * Helper waits until the ltdc irq occurs. In the current design That means
+ * that a register reload was been completed.
+ * Note! The caller must use this function within a critical section.
+ *
+ * Returned Value:
+ * OK - On success otherwise ERROR
+ *
+ ****************************************************************************/
+
+static int stm32_ltdc_waitforirq(void)
+{
+ int ret = OK;
+ FAR struct stm32_interrupt_s *priv = &g_interrupt;
+
+ ret = nxsem_wait(priv->sem);
+
+ if (ret < 0)
+ {
+ lcderr("ERROR: nxsem_wait() failed\n");
+ }
+
+ ret = priv->error;
+
+ return ret;
+}
+
+/****************************************************************************
+ * Name: stm32_ltdc_reload
+ *
+ * Description:
+ * Reload the layer shadow register and make layer changes visible.
+ * Note! The caller must ensure that a previous register reloading has been
+ * completed.
+ *
+ * Input Parameters:
+ * value - Reload flag (e.g. upon vertical blank or immediately)
+ * waitvblank - Wait until register reload is finished
+ *
+ ****************************************************************************/
+
+static int stm32_ltdc_reload(uint8_t value, bool waitvblank)
+{
+ int ret = OK;
+
+ /* Reloads the shadow register.
+ * Note! This will not trigger an register reload interrupt if
+ * immediately reload is set.
+ */
+
+ reginfo("set LTDC_SRCR=%08x\n", value);
+ putreg32(value, STM32_LTDC_SRCR);
+ reginfo("configured LTDC_SRCR=%08x\n", getreg32(STM32_LTDC_SRCR));
+
+ if (value == LTDC_SRCR_VBR && waitvblank)
+ {
+ /* Wait upon vertical blanking period */
+
+ ret = stm32_ltdc_waitforirq();
+ }
+ else
+ {
+ /* Wait until register reload hase been done */
+
+ while (getreg32(STM32_LTDC_SRCR) & value);
+ }
+
+ return ret;
+}
+
+/****************************************************************************
+ * Name: stm32_ltdc_irqconfig
+ *
+ * Description:
+ * Configure interrupts
+ *
+ ****************************************************************************/
+
+static void stm32_ltdc_irqconfig(void)
+{
+ /* Initialize the LTDC semaphore that enforces mutually exclusive access */
+
+ nxsem_init(&g_lock, 0, 1);
+
+ /* Initialize the semaphore for interrupt handling. This waitsem
+ * semaphore is used for signaling and, hence, should not have priority
+ * inheritance enabled.
+ */
+
+ nxsem_init(g_interrupt.sem, 0, 0);
+ nxsem_set_protocol(g_interrupt.sem, SEM_PRIO_NONE);
+
+ /* Attach LTDC interrupt vector */
+
+ irq_attach(g_interrupt.irq, stm32_ltdcirq, NULL);
+
+ /* Enable the IRQ at the NVIC */
+
+ up_enable_irq(g_interrupt.irq);
+
+ /* Enable interrupts expect line interrupt */
+
+ stm32_ltdc_irqctrl(LTDC_IER_RRIE |
+ LTDC_IER_TERRIE |
+ LTDC_IER_FUIE,
+ LTDC_IER_LIE);
+
+ /* Configure line interrupt */
+
+ stm32_ltdc_linepos();
+}
+
+/****************************************************************************
+ * Name: stm32_ltdc_globalconfig
+ *
+ * Description:
+ * Configure background color
+ * Configure dithering
+ *
+ ****************************************************************************/
+
+static void stm32_ltdc_globalconfig(void)
+{
+ /* Configure dither */
+
+ stm32_ltdc_dither(
+#ifdef CONFIG_STM32H7_LTDC_DITHER
+ true,
+#else
+ false,
+#endif
+ STM32_LTDC_DITHER_RED,
+ STM32_LTDC_DITHER_GREEN,
+ STM32_LTDC_DITHER_BLUE);
+
+ /* Configure background color */
+
+ stm32_ltdc_bgcolor(STM32_LTDC_BACKCOLOR);
+}
+
+/****************************************************************************
+ * Name: stm32_ltdc_enable
+ *
+ * Description:
+ * Disable the LCD peripheral
+ *
+ * Input Parameters:
+ * enable - Enable or disable
+ *
+ ****************************************************************************/
+
+static void stm32_ltdc_enable(bool enable)
+{
+ uint32_t regval;
+
+ regval = getreg32(STM32_LTDC_GCR);
+ reginfo("get LTDC_GCR=%08x\n", regval);
+
+ if (enable == true)
+ {
+ regval |= LTDC_GCR_LTDCEN;
+ }
+ else
+ {
+ regval &= ~LTDC_GCR_LTDCEN;
+ }
+
+ reginfo("set LTDC_GCR=%08x\n", regval);
+ putreg32(regval, STM32_LTDC_GCR);
+ reginfo("configured LTDC_GCR=%08x\n", getreg32(STM32_LTDC_GCR));
+}
+
+/****************************************************************************
+ * Name: stm32_ltdc_lpixelformat
+ *
+ * Description:
+ * Set the layer pixel format.
+ * Note! This changes have no effect until the shadow register reload has
+ * been done.
+ *
+ * Input Parameters:
+ * Reference to the layer control structure
+ *
+ ****************************************************************************/
+
+static void stm32_ltdc_lpixelformat(FAR struct stm32_ltdc_s *layer)
+{
+ uint8_t overlay = layer->layerno;
+ DEBUGASSERT(layer->layerno < LTDC_NLAYERS);
+
+ /* Configure PFCR register */
+
+ reginfo("set LTDC_L%dPFCR=%08x\n", overlay + 1,
+ stm32_fmt_layer_t[overlay]);
+ putreg32(stm32_fmt_layer_t[overlay], stm32_pfcr_layer_t[overlay]);
+
+ /* Reload shadow register */
+
+ stm32_ltdc_reload(LTDC_SRCR_IMR, false);
+}
+
+/****************************************************************************
+ * Name: stm32_ltdc_lframebuffer
+ *
+ * Description:
+ * Configure layer framebuffer of the entire window.
+ * Note! This changes have no effect until the shadow register reload has
+ * been done.
+ *
+ * Input Parameters:
+ * Reference to the layer control structure
+ *
+ ****************************************************************************/
+
+static void stm32_ltdc_lframebuffer(FAR struct stm32_ltdc_s *layer)
+{
+ uint32_t cfblr;
+ uint32_t rxpos;
+ uint32_t rypos;
+ uint32_t whpcr;
+ uint32_t wvpcr;
+ uint8_t layerno = layer->layerno;
+
+ DEBUGASSERT(layer->layerno < LTDC_NLAYERS);
+ reginfo("xpos = %d, ypos = %d, xres = %d, yres = %d\n", 0, 0,
+ stm32_width_layer_t[layerno], stm32_height_layer_t[layerno]);
+
+ /* Calculate register position */
+
+ rxpos = STM32_LTDC_LXWHPCR_WHSTPOS + 1;
+ rypos = STM32_LTDC_LXWVPCR_WVSTPOS + 1;
+
+ /* Accumulate horizontal position */
+
+ whpcr = LTDC_LXWHPCR_WHSTPOS(rxpos);
+ whpcr |= LTDC_LXWHPCR_WHSPPOS(rxpos + stm32_width_layer_t[layerno] - 1);
+
+ /* Accumulate vertical position */
+
+ wvpcr = LTDC_LXWVPCR_WVSTPOS(rypos);
+ wvpcr |= LTDC_LXWVPCR_WVSPPOS(rypos + stm32_height_layer_t[layerno] - 1);
+
+ /* Configure LxWHPCR / LxWVPCR register */
+
+ reginfo("set LTDC_L%dWHPCR=%08x\n", layerno + 1, whpcr);
+ putreg32(whpcr, stm32_whpcr_layer_t[layerno]);
+ reginfo("set LTDC_L%dWVPCR=%08x\n", layerno + 1, wvpcr);
+ putreg32(wvpcr, stm32_wvpcr_layer_t[layerno]);
+
+ /* Configure LxCFBAR register */
+
+ reginfo("set LTDC_L%dCFBAR=%08x\n", layerno + 1,
+ stm32_fbmem_layer_t[layerno]);
+ putreg32(stm32_fbmem_layer_t[layerno], stm32_cfbar_layer_t[layerno]);
+
+ /* Configure LxCFBLR register */
+
+ /* Calculate line length */
+
+ cfblr = LTDC_LXCFBLR_CFBP(stm32_stride_layer_t[layerno]) |
+ LTDC_LXCFBLR_CFBLL(stm32_width_layer_t[layerno] *
+ STM32_LTDC_LX_BYPP(stm32_bpp_layer_t[layerno]) + 3);
+
+ reginfo("set LTDC_L%dCFBLR=%08x\n", layerno + 1, cfblr);
+ putreg32(cfblr, stm32_cfblr_layer_t[layerno]);
+
+ /* Configure LxCFBLNR register */
+
+ reginfo("set LTDC_L%dCFBLNR=%08x\n", layerno + 1,
+ stm32_height_layer_t[layerno]);
+ putreg32(stm32_height_layer_t[layerno], stm32_cfblnr_layer_t[layerno]);
+
+ /* Reload shadow register */
+
+ stm32_ltdc_reload(LTDC_SRCR_IMR, false);
+}
+
+/****************************************************************************
+ * Name: stm32_ltdc_lenable
+ *
+ * Description:
+ * Enable or disable layer.
+ * Note! This changes have no effect until the shadow register reload has
+ * been done.
+ *
+ * Input Parameters:
+ * layer - Reference to the layer control structure
+ * enable - Enable or disable layer
+ *
+ ****************************************************************************/
+
+static void stm32_ltdc_lenable(FAR struct stm32_ltdc_s *layer, bool enable)
+{
+ uint32_t regval;
+ DEBUGASSERT(layer->layerno < LTDC_NLAYERS);
+
+ regval = getreg32(stm32_cr_layer_t[layer->layerno]);
+
+ if (enable == true)
+ {
+ regval |= LTDC_LXCR_LEN;
+ }
+ else
+ {
+ regval &= ~LTDC_LXCR_LEN;
+ }
+
+ /* Enable/Disable layer */
+
+ reginfo("set LTDC_L%dCR=%08x\n", layer->layerno + 1, regval);
+ putreg32(regval, stm32_cr_layer_t[layer->layerno]);
+
+ /* Reload shadow register */
+
+ stm32_ltdc_reload(LTDC_SRCR_IMR, false);
+}
+
+/****************************************************************************
+ * Name: stm32_ltdc_ltransp
+ *
+ * Description:
+ * Change layer transparency.
+ * Note! This changes have no effect until the shadow register reload has
+ * been done.
+ *
+ * Input Parameters:
+ * layer - Reference to the layer control structure
+ * transp - Transparency
+ * mode - Transparency mode
+ *
+ ****************************************************************************/
+
+static void stm32_ltdc_ltransp(FAR struct stm32_ltdc_s *layer,
+ uint8_t transp, uint32_t mode)
+{
+ uint32_t bf1;
+ uint32_t bf2;
+
+ DEBUGASSERT(layer->layerno < LTDC_NLAYERS);
+
+#ifdef CONFIG_FB_OVERLAY
+ if (mode == FB_CONST_ALPHA)
+ {
+ bf1 = LTDC_BF1_CONST_ALPHA;
+ bf2 = LTDC_BF2_CONST_ALPHA;
+ }
+ else
+ {
+ bf1 = LTDC_BF1_PIXEL_ALPHA;
+ bf2 = LTDC_BF2_PIXEL_ALPHA;
+ }
+#else
+ bf1 = LTDC_BF1_CONST_ALPHA;
+ bf2 = LTDC_BF2_CONST_ALPHA;
+#endif
+
+ reginfo("set LTDC_L%dBFCR=%08x\n", layer->layerno + 1,
+ (LTDC_LXBFCR_BF1(bf1) | LTDC_LXBFCR_BF2(bf2)));
+
+ /* Set blendmode */
+
+ putreg32((LTDC_LXBFCR_BF1(bf1) | LTDC_LXBFCR_BF2(bf2)),
+ stm32_bfcr_layer_t[layer->layerno]);
+
+ /* Set alpha */
+
+ reginfo("set LTDC_L%dCACR=%02x\n", layer->layerno + 1, transp);
+ putreg32(transp, stm32_cacr_layer_t[layer->layerno]);
+
+ /* Reload shadow register */
+
+ stm32_ltdc_reload(LTDC_SRCR_IMR, false);
+}
+
+/****************************************************************************
+ * Name: stm32_ltdc_lchromakey
+ *
+ * Description:
+ * Change layer chromakey.
+ * Note! This changes have no effect until the shadow register reload has
+ * been done.
+ *
+ * Input Parameters:
+ * layer - Reference to the layer control structure
+ * chroma - chromakey
+ *
+ ****************************************************************************/
+
+static void stm32_ltdc_lchromakey(FAR struct stm32_ltdc_s *layer,
+ uint32_t chroma)
+{
+ uint32_t rgb;
+ DEBUGASSERT(layer->layerno < LTDC_NLAYERS);
+
+ reginfo("%08x\n", getreg32(stm32_cr_layer_t[layer->layerno]));
+
+ /* Set chromakey */
+
+#ifdef CONFIG_STM32H7_FB_CMAP
+ uint8_t r = g_vtable.cmap.red[chroma];
+ uint8_t g = g_vtable.cmap.green[chroma];
+ uint8_t b = g_vtable.cmap.blue[chroma];
+ rgb = ((r << 16) | (g << 8) | b);
+#else
+ rgb = ARGB8888(chroma);
+#endif
+
+ reginfo("set LTDC_L%dCKCR=%08x\n", layer->layerno + 1, rgb);
+ putreg32(rgb, stm32_ckcr_layer_t[layer->layerno]);
+
+ /* Reload shadow register */
+
+ stm32_ltdc_reload(LTDC_SRCR_IMR, false);
+}
+
+/****************************************************************************
+ * Name: stm32_ltdc_lchromakeyenable
+ *
+ * Description:
+ * Enable or disable layer chromakey support.
+ * Note! This changes have no effect until the shadow register reload has
+ * been done.
+ *
+ * Input Parameters:
+ * layer - Reference to the layer control structure
+ * enable - Enable or disable chromakey
+ *
+ ****************************************************************************/
+
+static void stm32_ltdc_lchromakeyenable(FAR struct stm32_ltdc_s *layer,
+ bool enable)
+{
+ uint32_t regval;
+ DEBUGASSERT(layer->layerno < LTDC_NLAYERS);
+
+ regval = getreg32(stm32_cr_layer_t[layer->layerno]);
+
+ /* Enable/Disable colorkey */
+
+ if (enable == true)
+ {
+ regval |= LTDC_LXCR_COLKEN;
+ }
+ else
+ {
+ regval &= ~LTDC_LXCR_COLKEN;
+ }
+
+ reginfo("set LTDC_L%dCR=%08x\n", layer->layerno + 1, regval);
+ putreg32(regval, stm32_cr_layer_t[layer->layerno]);
+
+ /* Reload shadow register */
+
+ stm32_ltdc_reload(LTDC_SRCR_IMR, false);
+}
+
+/****************************************************************************
+ * Name: stm32_ltdc_lclutenable
+ *
+ * Description:
+ * Disable or enable the layer clut support
+ *
+ * Input Parameters:
+ * layer - Reference to the layer control structure
+ * enable - Enable or disable
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_STM32H7_FB_CMAP
+static void stm32_ltdc_lclutenable(FAR struct stm32_ltdc_s *layer,
+ bool enable)
+{
+ uint32_t regval;
+
+ regval = getreg32(stm32_cr_layer_t[layer->oinfo.overlay]);
+ reginfo("get LTDC_L%dCR=%08x\n", layer->oinfo.overlay + 1, regval);
+
+ /* Disable the clut support during update the color table */
+
+ if (enable == true)
+ {
+ regval |= LTDC_LXCR_CLUTEN;
+ }
+ else
+ {
+ regval &= ~LTDC_LXCR_CLUTEN;
+ }
+
+ reginfo("set LTDC_L%dCR=%08x\n", layer->oinfo.overlay, regval);
+ putreg32(regval, stm32_cr_layer_t[layer->oinfo.overlay]);
+
+ /* Reload shadow register */
+
+ stm32_ltdc_reload(LTDC_SRCR_IMR, false);
+}
+
+/****************************************************************************
+ * Name: stm32_ltdc_lputclut
+ *
+ * Description:
+ * Update the clut layer register during blank period.
+ * Note! The clut register is no shadow register.
+ *
+ * Input Parameters:
+ * layer - Reference to the layer control structure
+ * cmap - Color map
+ *
+ ****************************************************************************/
+
+static void stm32_ltdc_lputclut(FAR struct stm32_ltdc_s *layer,
+ FAR const struct fb_cmap_s *cmap)
+{
+ int n;
+ irqstate_t flags;
+
+ /* Disable clut during register update */
+
+ stm32_ltdc_lclutenable(layer, false);
+
+ /* Update the clut registers. Ensure operation is atomic or in interrupt
+ * protected context.
+ */
+
+ flags = enter_critical_section();
+
+ for (n = cmap->first; n < cmap->len && n < STM32_LTDC_NCLUT; n++)
+ {
+ uint32_t regval;
+
+ regval = (uint32_t)LTDC_CLUT_ADD(n) |
+ (uint32_t)LTDC_CLUT_RED(cmap->red[n]) |
+ (uint32_t)LTDC_CLUT_GREEN(cmap->green[n]) |
+ (uint32_t)LTDC_CLUT_BLUE(cmap->blue[n]);
+
+ reginfo("set LTDC_L%dCLUTWR = %08x, first = %d, len = %d\n",
+ layer->oinfo.overlay + 1, regval, cmap->first, cmap->len);
+ putreg32(regval, stm32_clutwr_layer_t[layer->oinfo.overlay]);
+ }
+
+ leave_critical_section(flags);
+
+ /* Enable clut after register update */
+
+ stm32_ltdc_lclutenable(layer, true);
+
+ /* Reload shadow control register */
+
+ stm32_ltdc_reload(LTDC_SRCR_IMR, false);
+}
+
+/****************************************************************************
+ * Name: stm32_ltdc_lgetclut
+ *
+ * Description:
+ * Copy the layers color lookup table.
+ *
+ * Input Parameters:
+ * layer - Reference to the layer control structure
+ * cmap - Color map
+ *
+ ****************************************************************************/
+
+static void stm32_ltdc_lgetclut(FAR struct stm32_ltdc_s * layer,
+ FAR struct fb_cmap_s * cmap)
+{
+ int n;
+ FAR struct fb_cmap_s *priv_cmap = &g_vtable.cmap;
+
+ /* Copy from internal cmap */
+
+ for (n = cmap->first; n < cmap->len && n < STM32_LTDC_NCLUT; n++)
+ {
+# ifdef CONFIG_STM32H7_FB_TRANSPARENCY
+ cmap->transp[n] = priv_cmap->transp[n];
+# endif
+ cmap->red[n] = priv_cmap->red[n];
+ cmap->green[n] = priv_cmap->green[n];
+ cmap->blue[n] = priv_cmap->blue[n];
+
+ reginfo("color = %d, transp=%02x, red=%02x, green=%02x, blue=%02x\n",
+ n,
+# ifdef CONFIG_STM32H7_FB_TRANSPARENCY
+ cmap->transp[n],
+# endif
+ cmap->red[n],
+ cmap->green[n],
+ cmap->blue[n]);
+ }
+}
+#endif /* CONFIG_STM32H7_FB_CMAP */
+
+/****************************************************************************
+ * Name: stm32_ltdc_lclear
+ *
+ * Description:
+ * Clear the whole layer
+ *
+ * Input Parameters:
+ * overlayno - Number overlay
+ *
+ ****************************************************************************/
+
+static void stm32_ltdc_lclear(uint8_t overlayno)
+{
+ memset((uint8_t *)stm32_fbmem_layer_t[overlayno], 0,
+ stm32_fblen_layer_t[overlayno]);
+}
+
+/****************************************************************************
+ * Name: stm32_ltdc_lvalidate
+ *
+ * Description:
+ * Validates if the given area is within the overlay framebuffer memory
+ * region
+ *
+ * Input Parameters:
+ * layer - Reference to the layer control structure
+ * area - Reference to the overlay area
+ *
+ ****************************************************************************/
+
+#if defined(CONFIG_STM32H7_DMA2D) && defined(CONFIG_FB_OVERLAY_BLIT)
+static bool stm32_ltdc_lvalidate(FAR const struct stm32_ltdc_s *layer,
+ FAR const struct fb_area_s *area)
+{
+ uint32_t offset;
+
+ offset = (area->y + area->h - 1) * layer->oinfo.stride +
+ (area->x + area->w) * layer->oinfo.bpp / 8;
+
+ return (offset <= layer->oinfo.fblen && area->w > 0 && area->h > 0);
+}
+#endif /* defined(CONFIG_STM32H7_DMA2D) && defined(CONFIG_FB_OVERLAY_BLIT) */
+
+/****************************************************************************
+ * Name: stm32_ltdc_linit
+ *
+ * Description:
+ * Initialize layer to their default states.
+ *
+ * Initialize:
+ * - layer framebuffer
+ * - layer pixelformat
+ * - layer defaultcolor
+ * - layer chromakey
+ * - layer transparency
+ * - layer clut
+ *
+ * Input Parameters:
+ * layer - Reference to the layer control structure
+ *
+ ****************************************************************************/
+
+static void stm32_ltdc_linit(uint8_t overlay)
+{
+ DEBUGASSERT(overlay < LTDC_NLAYERS);
+
+ FAR struct stm32_ltdcdev_s *dev = &g_vtable;
+ FAR struct stm32_ltdc_s *layer = &dev->layer[overlay];
+
+ /* Disable layer */
+
+ stm32_ltdc_lenable(layer, false);
+
+ /* Clear the layer framebuffer */
+
+ stm32_ltdc_lclear(overlay);
+
+ /* Set layers framebuffer */
+
+ stm32_ltdc_lframebuffer(layer);
+
+ /* Set layers pixel input format */
+
+ stm32_ltdc_lpixelformat(layer);
+
+ /* Configure layer default color */
+
+ stm32_ltdc_ldefaultcolor(layer, stm32_defaultcolor_layer_t[overlay]);
+
+ /* Layers default transparency */
+
+ stm32_ltdc_ltransp(layer, 0xff, 0);
+
+ /* Layers chromakey */
+
+ stm32_ltdc_lchromakey(layer, stm32_chromakey_layer_t[overlay]);
+
+ /* Enable chromakey */
+
+ stm32_ltdc_lchromakeyenable(layer, stm32_chromakeyen_layer_t[overlay]);
+
+#ifdef CONFIG_STM32H7_FB_CMAP
+ /* Disable clut by default */
+
+ if (dev->vinfo.fmt == FB_FMT_RGB8)
+ {
+ /* Initialize LTDC clut register */
+
+ stm32_ltdc_lputclut(layer, &g_vtable.cmap);
+
+ /* Configure the clut register */
+
+ stm32_ltdc_lclutenable(layer, true);
+ }
+#endif
+
+ /* Finally enable the layer */
+
+ stm32_ltdc_lenable(layer, true);
+}
+
+/****************************************************************************
+ * Name: stm32_ltdc_dma2dlinit
+ *
+ * Description:
+ * Initialize dma2d layer to their default states.
+ *
+ * Initialize:
+ * - layer framebuffer
+ * - layer pixelformat
+ * - layer size
+ * - layer color
+ * - layer chromakey
+ * - layer transparency
+ * - layer clut
+ *
+ * Input Parameters:
+ * layer - Reference to the layer control structure
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_STM32H7_DMA2D
+static void stm32_ltdc_dma2dlinit(void)
+{
+ int n;
+ FAR struct stm32_ltdcdev_s *dev = &g_vtable;
+
+ for (n = 0; n < DMA2D_NLAYERS; n++)
+ {
+ uint32_t overlay = n + LTDC_NLAYERS;
+ FAR struct stm32_ltdc_s *layer = &dev->layer[overlay];
+ uint8_t * fbmem = (uint8_t *)STM32_DMA2D_BUFFER_START;
+
+ layer->layerno = overlay;
+ layer->oinfo.fbmem = fbmem + STM32_DMA2D_LAYER_SIZE * n;
+ layer->oinfo.fblen = STM32_DMA2D_FBSIZE;
+ layer->oinfo.stride = STM32_DMA2D_STRIDE;
+ layer->oinfo.overlay = overlay;
+ layer->oinfo.bpp = STM32_DMA2D_BPP;
+ layer->oinfo.blank = 0;
+ layer->oinfo.chromakey = 0;
+ layer->oinfo.color = 0;
+ layer->oinfo.transp.transp = 0xff;
+ layer->oinfo.transp.transp_mode = 0;
+ layer->oinfo.sarea.x = 0;
+ layer->oinfo.sarea.y = 0;
+ layer->oinfo.sarea.w = STM32_DMA2D_WIDTH;
+ layer->oinfo.sarea.h = STM32_DMA2D_HEIGHT;
+ layer->oinfo.accl = DMA2D_ACCL;
+ layer->lock = &g_lock;
+ layer->dma2dinfo.fmt = STM32_DMA2D_COLOR_FMT;
+ layer->dma2dinfo.transp_mode = STM32_DMA2D_PFCCR_AM_NONE;
+ layer->dma2dinfo.xres = layer->oinfo.sarea.w;
+ layer->dma2dinfo.yres = layer->oinfo.sarea.h;
+ layer->dma2dinfo.oinfo = &layer->oinfo;
+ }
+}
+#endif /* CONFIG_STM32H7_DMA2D */
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: stm32_getvideoinfo
+ *
+ * Description:
+ * Entrypoint ioctl FBIOGET_VIDEOINFO
+ * Get the videoinfo for the framebuffer
+ *
+ * Input Parameters:
+ * vtable - The framebuffer driver object
+ * vinfo - the videoinfo object
+ *
+ * Returned Value:
+ * On success - OK
+ * On error - -EINVAL
+ *
+ ****************************************************************************/
+
+static int stm32_getvideoinfo(struct fb_vtable_s *vtable,
+ struct fb_videoinfo_s *vinfo)
+{
+ FAR struct stm32_ltdcdev_s *priv = (FAR struct stm32_ltdcdev_s *)vtable;
+
+ lcdinfo("vtable=%p vinfo=%p\n", vtable, vinfo);
+ DEBUGASSERT(vtable != NULL && priv == &g_vtable && vinfo != NULL);
+
+ memcpy(vinfo, &priv->vinfo, sizeof(struct fb_videoinfo_s));
+ return OK;
+}
+
+/****************************************************************************
+ * Name: stm32_getplaneinfo
+ *
+ * Description:
+ * Entrypoint ioctl FBIOGET_PLANEINFO
+ * Get the planeinfo for the framebuffer
+ *
+ * Input Parameters:
+ * vtable - The framebuffer driver object
+ * pinfo - the planeinfo object
+ *
+ * Returned Value:
+ * On success - OK
+ * On error - -EINVAL
+ *
+ ****************************************************************************/
+
+static int stm32_getplaneinfo(struct fb_vtable_s *vtable, int planeno,
+ struct fb_planeinfo_s *pinfo)
+{
+ FAR struct stm32_ltdcdev_s *priv = (FAR struct stm32_ltdcdev_s *)vtable;
+
+ DEBUGASSERT(vtable != NULL && priv == &g_vtable);
+ lcdinfo("vtable=%p planeno=%d pinfo=%p\n", vtable, planeno, pinfo);
+
+ if (planeno == 0)
+ {
+ memcpy(pinfo, &priv->pinfo, sizeof(struct fb_planeinfo_s));
+ return OK;
+ }
+
+ lcderr("ERROR: Returning EINVAL\n");
+ return -EINVAL;
+}
+
+/****************************************************************************
+ * Name: stm32_getcmap
+ *
+ * Description:
+ * Entrypoint ioctl FBIOGET_CMAP
+ * Get a range of CLUT values for the LCD
+ *
+ * Input Parameters:
+ * vtable - The framebuffer driver object
+ * cmap - the color table
+ *
+ * Returned Value:
+ * On success - OK
+ * On error - -EINVAL
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_STM32H7_FB_CMAP
+static int stm32_getcmap(struct fb_vtable_s *vtable,
+ struct fb_cmap_s *cmap)
+{
+ int ret;
+ FAR struct stm32_ltdcdev_s *priv = (FAR struct stm32_ltdcdev_s *)vtable;
+
+ DEBUGASSERT(vtable != NULL && priv == &g_vtable && cmap != NULL);
+ lcdinfo("vtable=%p cmap=%p\n", vtable, cmap);
+
+ if (priv->vinfo.fmt != FB_FMT_RGB8)
+ {
+ lcderr("ERROR: CLUT is not supported for the pixel format: %d\n",
+ priv->vinfo.fmt);
+ ret = -EINVAL;
+ }
+ else if (cmap->first >= STM32_LTDC_NCLUT)
+ {
+ lcderr("ERROR: only %d color table entries supported\n",
+ STM32_LTDC_NCLUT);
+ ret = -EINVAL;
+ }
+ else
+ {
+ /* Currently, there is no api to set color map for each overlay
+ * separately. LTDC layers can have different color maps. Get the cmap
+ * from the main overlay.
+ */
+
+ FAR struct stm32_ltdc_s * layer;
+# ifdef CONFIG_STM32H7_LTDC_L2
+ layer = &priv->layer[LTDC_LAYER_L2];
+# else
+ layer = &priv->layer[LTDC_LAYER_L1];
+# endif
+ nxsem_wait(layer->lock);
+ stm32_ltdc_lgetclut(layer, cmap);
+ nxsem_post(layer->lock);
+
+ ret = OK;
+ }
+
+ return ret;
+}
+
+/****************************************************************************
+ * Name: stm32_putcmap
+ *
+ * Description:
+ * Entrypoint ioctl FBIOPUT_CMAP
+ * Set a range of the CLUT values for the LCD
+ *
+ * Input Parameters:
+ * vtable - The framebuffer driver object
+ * cmap - the color table
+ *
+ * Returned Value:
+ * On success - OK
+ * On error - -EINVAL
+ *
+ ****************************************************************************/
+
+static int stm32_putcmap(struct fb_vtable_s *vtable,
+ const struct fb_cmap_s *cmap)
+{
+ int ret;
+ FAR struct stm32_ltdcdev_s *priv = (FAR struct stm32_ltdcdev_s *)vtable;
+
+ DEBUGASSERT(vtable != NULL && priv == &g_vtable && cmap != NULL);
+ lcdinfo("vtable=%p cmap=%p\n", vtable, cmap);
+
+ if (priv->vinfo.fmt != FB_FMT_RGB8)
+ {
+ lcderr("ERROR: CLUT is not supported for the pixel format: %d\n",
+ priv->vinfo.fmt);
+ ret = -EINVAL;
+ }
+ else if (cmap->first >= STM32_LTDC_NCLUT)
+ {
+ lcderr("ERROR: only %d color table entries supported\n",
+ STM32_LTDC_NCLUT);
+ ret = -EINVAL;
+ }
+ else
+ {
+ /* Currently, there is no api to set color map for each overlay
+ * separately. LTDC layers can have different color maps, but is shared
+ * for now.
+ */
+
+ int n;
+ FAR struct fb_cmap_s *priv_cmap = &g_vtable.cmap;
+
+ /* First copy to internal cmap */
+
+ for (n = cmap->first; n < cmap->len && n < STM32_LTDC_NCLUT; n++)
+ {
+ priv_cmap->red[n] = cmap->red[n];
+ priv_cmap->green[n] = cmap->green[n];
+ priv_cmap->blue[n] = cmap->blue[n];
+# ifdef CONFIG_STM32H7_FB_TRANSPARENCY
+ /* Not supported by LTDC */
+
+ priv_cmap->transp[n] = cmap->transp[n];
+# endif
+ }
+
+ priv_cmap->first = cmap->first;
+ priv_cmap->len = cmap->len;
+
+ /* Update the layer clut register */
+
+ nxsem_wait(&g_lock);
+
+ for (n = 0; n < LTDC_NLAYERS; n++)
+ {
+ FAR struct stm32_ltdc_s * layer = &priv->layer[n];
+ stm32_ltdc_lputclut(layer, priv_cmap);
+ }
+
+# ifdef CONFIG_STM32H7_DMA2D
+ /* Update dma2d cmap */
+
+ priv->dma2d->setclut(cmap);
+# endif
+ nxsem_post(&g_lock);
+
+ ret = OK;
+ }
+
+ return ret;
+}
+#endif /* CONFIG_STM32H7_FB_CMAP */
+
+/****************************************************************************
+ * Name: stm32_ioctl_waitforvsync
+ * Description:
+ * Entrypoint ioctl FBIO_WAITFORSYNC
+ ****************************************************************************/
+
+#ifdef CONFIG_FB_SYNC
+static int stm32_waitforvsync(FAR struct fb_vtable_s *vtable)
+{
+ int ret;
+
+ DEBUGASSERT(vtable != NULL && vtable == &g_vtable.vtable);
+
+ /* Wait upon vertical synchronization. */
+
+ ret = stm32_ltdc_reload(LTDC_SRCR_VBR, true);
+
+ return ret;
+}
+#endif /* CONFIG_FB_SYNC */
+
+/****************************************************************************
+ * Name: stm32_getoverlayinfo
+ * Description:
+ * Entrypoint ioctl FBIOGET_OVERLAYINFO
+ ****************************************************************************/
+
+#ifdef CONFIG_FB_OVERLAY
+static int stm32_getoverlayinfo(FAR struct fb_vtable_s *vtable,
+ int overlayno,
+ FAR struct fb_overlayinfo_s *oinfo)
+{
+ FAR struct stm32_ltdcdev_s *priv = (FAR struct stm32_ltdcdev_s *)vtable;
+
+ lcdinfo("vtable=%p overlay=%d oinfo=%p\n", vtable, overlayno, oinfo);
+ DEBUGASSERT(vtable != NULL && priv == &g_vtable);
+
+ if (overlayno < LTDC_NOVERLAYS)
+ {
+ FAR struct stm32_ltdc_s * layer = &priv->layer[overlayno];
+ memcpy(oinfo, &layer->oinfo, sizeof(struct fb_overlayinfo_s));
+ return OK;
+ }
+
+ lcderr("ERROR: Returning EINVAL\n");
+ return -EINVAL;
+}
+
+/****************************************************************************
+ * Name: stm32_settransp
+ * Description:
+ * Entrypoint ioctl FBIOSET_TRANSP
+ ****************************************************************************/
+
+static int stm32_settransp(FAR struct fb_vtable_s *vtable,
+ FAR const struct fb_overlayinfo_s *oinfo)
+{
+ FAR struct stm32_ltdcdev_s *priv = (FAR struct stm32_ltdcdev_s *)vtable;
+
+ DEBUGASSERT(vtable != NULL && priv == &g_vtable);
+ lcdinfo("vtable=%p, overlay=%d, transp=%02x, transp_mode=%02x\n", vtable,
+ oinfo->overlay, oinfo->transp.transp, oinfo->transp.transp_mode);
+
+ if (oinfo->transp.transp_mode > 1)
+ {
+ lcderr("ERROR: Returning ENOSYS, transparency mode not supported\n");
+ return -ENOSYS;
+ }
+
+ if (oinfo->overlay < LTDC_NOVERLAYS)
+ {
+ FAR struct stm32_ltdc_s * layer = &priv->layer[oinfo->overlay];
+
+ nxsem_wait(layer->lock);
+ layer->oinfo.transp.transp = oinfo->transp.transp;
+ layer->oinfo.transp.transp_mode = oinfo->transp.transp_mode;
+
+# ifdef CONFIG_STM32H7_DMA2D
+ if (layer->oinfo.transp.transp_mode == 0)
+ {
+ layer->dma2dinfo.transp_mode = STM32_DMA2D_PFCCR_AM_CONST;
+ }
+ else if (layer->oinfo.transp.transp_mode == 1)
+ {
+ layer->dma2dinfo.transp_mode = STM32_DMA2D_PFCCR_AM_PIXEL;
+ }
+
+ if (oinfo->overlay < LTDC_NLAYERS)
+# endif
+ {
+ /* Set LTDC blendmode and alpha value */
+
+ stm32_ltdc_ltransp(layer, layer->oinfo.transp.transp,
+ layer->oinfo.transp.transp_mode);
+ }
+
+ nxsem_post(layer->lock);
+ return OK;
+ }
+
+ lcderr("ERROR: Returning EINVAL\n");
+ return -EINVAL;
+}
+
+/****************************************************************************
+ * Name: stm32_setchromakey
+ * Description:
+ * Entrypoint ioctl FBIOSET_CHROMAKEY
+ ****************************************************************************/
+
+static int stm32_setchromakey(FAR struct fb_vtable_s *vtable,
+ FAR const struct fb_overlayinfo_s *oinfo)
+{
+ FAR struct stm32_ltdcdev_s *priv = (FAR struct stm32_ltdcdev_s *)vtable;
+
+ DEBUGASSERT(vtable != NULL && priv == &g_vtable && oinfo != NULL);
+ lcdinfo("vtable=%p, overlay=%d, chromakey=%08x\n", vtable,
+ oinfo->overlay, oinfo->chromakey);
+
+ if (oinfo->overlay < LTDC_NLAYERS)
+ {
+ int ret;
+ FAR struct stm32_ltdc_s * layer = &priv->layer[oinfo->overlay];
+
+# ifndef CONFIG_STM32H7_LTDC_L1_CHROMAKEY
+ if (oinfo->overlay == LTDC_LAYER_L1)
+ {
+ return -ENOSYS;
+ }
+# endif
+
+# ifndef CONFIG_STM32H7_LTDC_L2_CHROMAKEY
+ if (oinfo->overlay == LTDC_LAYER_L2)
+ {
+ return -ENOSYS;
+ }
+# endif
+
+ nxsem_wait(layer->lock);
+# ifdef CONFIG_STM32H7_FB_CMAP
+ if (oinfo->chromakey >= g_vtable.cmap.len)
+ {
+ lcderr("ERROR: Clut index %d is out of range\n", oinfo->chromakey);
+ ret = -EINVAL;
+ }
+ else
+# endif
+ {
+ layer->oinfo.chromakey = oinfo->chromakey;
+
+ /* Set chromakey */
+
+ stm32_ltdc_lchromakey(layer, layer->oinfo.chromakey);
+ ret = OK;
+ }
+
+ nxsem_post(layer->lock);
+ return ret;
+ }
+# ifdef CONFIG_STM32H7_DMA2D
+ else if (oinfo->overlay < LTDC_NOVERLAYS)
+ {
+ /* Chromakey not supported by DMA2D */
+
+ return -ENOSYS;
+ }
+# endif
+
+ lcderr("ERROR: Returning EINVAL\n");
+ return -EINVAL;
+}
+
+/****************************************************************************
+ * Name: stm32_setcolor
+ * Description:
+ * Entrypoint ioctl FBIOSET_COLOR
+ ****************************************************************************/
+
+static int stm32_setcolor(FAR struct fb_vtable_s *vtable,
+ FAR const struct fb_overlayinfo_s *oinfo)
+{
+ DEBUGASSERT(vtable != NULL && vtable == &g_vtable.vtable && oinfo != NULL);
+ lcdinfo("vtable=%p, overlay=%d, color=%08x\n", vtable, oinfo->color);
+
+ if (oinfo->overlay < LTDC_NOVERLAYS)
+ {
+# ifdef CONFIG_STM32H7_DMA2D
+
+ /* Set color within the active overlay is not supported by LTDC. So use
+ * DMA2D controller instead when configured.
+ */
+
+ int ret;
+ FAR struct stm32_ltdcdev_s *priv =
+ (FAR struct stm32_ltdcdev_s *)vtable;
+ FAR struct stm32_ltdc_s * layer = &priv->layer[oinfo->overlay];
+ FAR struct fb_overlayinfo_s * poverlay = layer->dma2dinfo.oinfo;
+
+ DEBUGASSERT(&layer->oinfo == poverlay);
+
+ nxsem_wait(layer->lock);
+ poverlay->color = oinfo->color;
+ ret = priv->dma2d->fillcolor(&layer->dma2dinfo, &poverlay->sarea,
+ poverlay->color);
+ nxsem_post(layer->lock);
+
+ return ret;
+# else
+ /* Coloring not supported by LTDC */
+
+ return -ENOSYS;
+# endif
+ }
+
+ lcderr("ERROR: Returning EINVAL\n");
+ return -EINVAL;
+}
+
+/****************************************************************************
+ * Name: stm32_setblank
+ * Description:
+ * Entrypoint ioctl FBIOSET_BLANK
+ ****************************************************************************/
+
+static int stm32_setblank(FAR struct fb_vtable_s *vtable,
+ FAR const struct fb_overlayinfo_s *oinfo)
+{
+ FAR struct stm32_ltdcdev_s *priv = (FAR struct stm32_ltdcdev_s *)vtable;
+
+ DEBUGASSERT(vtable != NULL && priv == &g_vtable && oinfo != NULL);
+ lcdinfo("vtable=%p, overlay=%d, blank=%02x\n", vtable, oinfo->blank);
+
+ if (oinfo->overlay < LTDC_NLAYERS)
+ {
+ FAR struct stm32_ltdc_s * layer = &priv->layer[oinfo->overlay];
+
+ nxsem_wait(layer->lock);
+ layer->oinfo.blank = oinfo->blank;
+
+ /* Enable or disable layer */
+
+ stm32_ltdc_lenable(layer, (layer->oinfo.blank == 0));
+ nxsem_post(layer->lock);
+
+ return OK;
+ }
+# ifdef CONFIG_STM32H7_DMA2D
+ else if (oinfo->overlay < LTDC_NOVERLAYS)
+ {
+ /* DMA2D overlays are non visible */
+
+ return OK;
+ }
+# endif
+
+ lcderr("ERROR: Returning EINVAL\n");
+ return -EINVAL;
+}
+
+/****************************************************************************
+ * Name: stm32_setarea
+ * Description:
+ * Entrypoint ioctl FBIOSET_AREA
+ ****************************************************************************/
+
+static int stm32_setarea(FAR struct fb_vtable_s *vtable,
+ FAR const struct fb_overlayinfo_s *oinfo)
+{
+ DEBUGASSERT(vtable != NULL && vtable == &g_vtable.vtable && oinfo != NULL);
+ lcdinfo("vtable=%p, overlay=%d, x=%d, y=%d, w=%d, h=%d\n", vtable,
+ oinfo->overlay, oinfo->sarea.x, oinfo->sarea.y, oinfo->sarea.w,
+ oinfo->sarea.h);
+
+ if (oinfo->overlay < LTDC_NLAYERS)
+ {
+ /* LTDC area is defined by the overlay size (display resolution) only */
+
+ return -ENOSYS;
+ }
+
+# ifdef CONFIG_STM32H7_DMA2D
+ if (oinfo->overlay < LTDC_NOVERLAYS)
+ {
+ FAR struct stm32_ltdcdev_s *priv =
+ (FAR struct stm32_ltdcdev_s *)vtable;
+ FAR struct stm32_ltdc_s * layer =
+ &priv->layer[oinfo->overlay];
+
+ nxsem_wait(layer->lock);
+ memcpy(&layer->oinfo.sarea, &oinfo->sarea, sizeof(struct fb_area_s));
+ nxsem_post(layer->lock);
+
+ return OK;
+ }
+# endif
+
+ lcderr("ERROR: Returning EINVAL\n");
+ return -EINVAL;
+}
+
+/****************************************************************************
+ * Name: stm32_blit
+ * Description:
+ * Entrypoint ioctl FBIOSET_BLIT
+ ****************************************************************************/
+
+# ifdef CONFIG_FB_OVERLAY_BLIT
+static int stm32_blit(FAR struct fb_vtable_s *vtable,
+ FAR const struct fb_overlayblit_s *blit)
+{
+ DEBUGASSERT(vtable != NULL && vtable == &g_vtable.vtable && blit != NULL);
+ lcdinfo("vtable = %p, blit = %p\n", vtable, blit);
+
+ if (blit->dest.overlay < LTDC_NOVERLAYS &&
+ blit->src.overlay < LTDC_NOVERLAYS)
+ {
+# ifdef CONFIG_STM32H7_DMA2D
+ int ret;
+ struct fb_area_s sarea;
+ FAR const struct fb_area_s *darea = &blit->dest.area;
+ FAR struct stm32_ltdcdev_s *priv =
+ (FAR struct stm32_ltdcdev_s *)vtable;
+ FAR struct stm32_ltdc_s *dlayer =
+ &priv->layer[blit->dest.overlay];
+ FAR struct stm32_ltdc_s *slayer =
+ &priv->layer[blit->src.overlay];
+
+ DEBUGASSERT(&dlayer->oinfo == dlayer->dma2dinfo.oinfo &&
+ &slayer->oinfo == slayer->dma2dinfo.oinfo);
+
+ /* DMA2D doesn't support image scale, so set to the smallest area */
+
+ memcpy(&sarea, &blit->src.area, sizeof(struct fb_area_s));
+
+ /* Check if area is within the entire overlay */
+
+ if (!stm32_ltdc_lvalidate(dlayer, darea) ||
+ !stm32_ltdc_lvalidate(slayer, &sarea))
+ {
+ return -EINVAL;
+ }
+
+ sarea.w = MIN(darea->w, sarea.w);
+ sarea.h = MIN(darea->h, sarea.h);
+
+ nxsem_wait(dlayer->lock);
+ ret = priv->dma2d->blit(&dlayer->dma2dinfo, darea->x, darea->y,
+ &slayer->dma2dinfo, &sarea);
+ nxsem_post(dlayer->lock);
+
+ return ret;
+# else
+ /* LTDC doesn't support blit transfer */
+
+ return -ENOSYS;
+# endif
+ }
+
+ lcderr("ERROR: Returning EINVAL\n");
+ return -EINVAL;
+}
+
+/****************************************************************************
+ * Name: stm32_blend
+ * Description:
+ * Entrypoint ioctl FBIOSET_BLEND
+ ****************************************************************************/
+
+static int stm32_blend(FAR struct fb_vtable_s *vtable,
+ FAR const struct fb_overlayblend_s *blend)
+{
+ DEBUGASSERT(vtable != NULL && vtable == &g_vtable.vtable && blend != NULL);
+ lcdinfo("vtable = %p, blend = %p\n", vtable, blend);
+
+ if (blend->dest.overlay < LTDC_NOVERLAYS &&
+ blend->foreground.overlay < LTDC_NOVERLAYS &&
+ blend->background.overlay < LTDC_NOVERLAYS)
+ {
+# ifdef CONFIG_STM32H7_DMA2D
+ int ret;
+ struct fb_area_s barea;
+ FAR const struct fb_area_s *darea = &blend->dest.area;
+ FAR const struct fb_area_s *farea = &blend->foreground.area;
+ FAR struct stm32_ltdcdev_s *priv =
+ (FAR struct stm32_ltdcdev_s *)vtable;
+ FAR struct stm32_ltdc_s *dlayer = &priv->layer[blend->dest.overlay];
+ FAR struct stm32_ltdc_s *flayer =
+ &priv->layer[blend->foreground.overlay];
+ FAR struct stm32_ltdc_s *blayer =
+ &priv->layer[blend->background.overlay];
+
+ DEBUGASSERT(&dlayer->oinfo == dlayer->dma2dinfo.oinfo &&
+ &flayer->oinfo == flayer->dma2dinfo.oinfo &&
+ &blayer->oinfo == blayer->dma2dinfo.oinfo);
+
+ /* DMA2D doesn't support image scale, so set to the smallest area */
+
+ memcpy(&barea, &blend->background.area, sizeof(struct fb_area_s));
+
+ /* Check if area is within the entire overlay */
+
+ if (!stm32_ltdc_lvalidate(dlayer, darea) ||
+ !stm32_ltdc_lvalidate(flayer, farea) ||
+ !stm32_ltdc_lvalidate(blayer, &barea))
+ {
+ lcderr("ERROR: Returning EINVAL\n");
+ return -EINVAL;
+ }
+
+ barea.w = MIN(darea->w, barea.w);
+ barea.h = MIN(darea->h, barea.h);
+ barea.w = MIN(farea->w, barea.w);
+ barea.h = MIN(farea->h, barea.h);
+
+ nxsem_wait(dlayer->lock);
+ ret = priv->dma2d->blend(&dlayer->dma2dinfo, darea->x, darea->y,
+ &flayer->dma2dinfo, farea->x, farea->y,
+ &blayer->dma2dinfo, &barea);
+ nxsem_post(dlayer->lock);
+
+ return ret;
+# else
+ /* LTDC doesn't support blend transfer */
+
+ return -ENOSYS;
+# endif
+ }
+
+ lcderr("ERROR: Returning EINVAL\n");
+ return -EINVAL;
+}
+# endif /* CONFIG_FB_OVERLAY_BLIT */
+#endif /* CONFIG_FB_OVERLAY */
+
+/****************************************************************************
+ * Name: stm32_ltdcreset
+ *
+ * Description:
+ * Reset LTDC via APB2RSTR
+ *
+ ****************************************************************************/
+
+void stm32_ltdcreset(void)
+{
+ uint32_t regval = getreg32(STM32_RCC_APB3RSTR);
+ putreg32(regval | RCC_APB3RSTR_LTDCRST, STM32_RCC_APB3RSTR);
+ putreg32(regval & ~RCC_APB3RSTR_LTDCRST, STM32_RCC_APB3RSTR);
+}
+
+/****************************************************************************
+ * Name: stm32_ltdcinitialize
+ *
+ * Description:
+ * Initialize the ltdc controller
+ *
+ * Returned Value:
+ * OK
+ *
+ ****************************************************************************/
+
+int stm32_ltdcinitialize(void)
+{
+ int ret = OK;
+
+ lcdinfo("Initialize LTDC driver\n");
+
+ if (g_initialized == true)
+ {
+ return ret;
+ }
+
+ /* Disable the LCD */
+
+ stm32_ltdc_enable(false);
+
+ lcdinfo("Configuring the LCD controller\n");
+
+ /* Configure LCD periphery */
+
+ lcdinfo("Configure lcd periphery\n");
+ stm32_ltdc_periphconfig();
+
+ /* Configure interrupts */
+
+ lcdinfo("Configure interrupts\n");
+ stm32_ltdc_irqconfig();
+
+ /* Configure global ltdc register */
+
+ lcdinfo("Configure global register\n");
+ stm32_ltdc_globalconfig();
+
+#ifdef CONFIG_STM32H7_DMA2D
+ /* Initialize the dma2d controller */
+
+ ret = stm32_dma2dinitialize();
+
+ if (ret != OK)
+ {
+ return ret;
+ }
+
+ /* Bind the dma2d interface */
+
+ g_vtable.dma2d = stm32_dma2ddev();
+ DEBUGASSERT(g_vtable.dma2d != NULL);
+#endif
+
+#ifdef CONFIG_STM32H7_FB_CMAP
+ /* Cleanup clut */
+
+ memset(&g_redclut, 0, STM32_LTDC_NCLUT);
+ memset(&g_blueclut, 0, STM32_LTDC_NCLUT);
+ memset(&g_greenclut, 0, STM32_LTDC_NCLUT);
+# ifdef CONFIG_STM32H7_FB_TRANSPARENCY
+ memset(&g_transpclut, 0, STM32_LTDC_NCLUT);
+# endif
+#endif /* CONFIG_STM32H7_FB_CMAP */
+
+ /* Initialize ltdc layer */
+
+ lcdinfo("Initialize ltdc layer\n");
+ stm32_ltdc_linit(LTDC_LAYER_L1);
+#ifdef CONFIG_STM32H7_LTDC_L2
+ stm32_ltdc_linit(LTDC_LAYER_L2);
+#endif
+
+#ifdef CONFIG_STM32H7_DMA2D
+ stm32_ltdc_dma2dlinit();
+#endif
+ /* Enable the backlight */
+
+#ifdef CONFIG_STM32H7_LCD_BACKLIGHT
+ stm32_backlight(true);
+#endif
+
+ /* Reload shadow register */
+
+ lcdinfo("Reload shadow register\n");
+ stm32_ltdc_reload(LTDC_SRCR_IMR, false);
+
+ /* Turn the LCD on */
+
+ lcdinfo("Enabling the display\n");
+ stm32_ltdc_enable(true);
+
+ /* Set initialized state */
+
+ g_initialized = true;
+ return ret;
+}
+
+/****************************************************************************
+ * Name: stm32_ltdcgetvplane
+ *
+ * Description:
+ * Return a a reference to the framebuffer object for the specified video
+ * plane.
+ *
+ * Input Parameters:
+ * None
+ *
+ * Returned Value:
+ * Reference to the framebuffer object (NULL on failure)
+ *
+ ****************************************************************************/
+
+struct fb_vtable_s *stm32_ltdcgetvplane(int vplane)
+{
+ lcdinfo("vplane: %d\n", vplane);
+
+ if (vplane == 0)
+ {
+ return &g_vtable.vtable;
+ }
+
+ return NULL;
+}
+
+/****************************************************************************
+ * Name: stm32_ltdcuninitialize
+ *
+ * Description:
+ * Uninitialize the framebuffer driver. Bad things will happen if you
+ * call this without first calling fb_initialize()!
+ *
+ ****************************************************************************/
+
+void stm32_ltdcuninitialize(void)
+{
+ /* Disable all ltdc interrupts */
+
+ stm32_ltdc_irqctrl(0, LTDC_IER_RRIE | LTDC_IER_TERRIE |
+ LTDC_IER_FUIE | LTDC_IER_LIE);
+
+ up_disable_irq(g_interrupt.irq);
+ irq_detach(g_interrupt.irq);
+
+ /* Disable the LCD controller */
+
+ stm32_ltdc_enable(false);
+
+ /* Set initialized state */
+
+ g_initialized = false;
+}
+
+/****************************************************************************
+ * Name: stm32_lcd_backlight
+ *
+ * Description:
+ * Provide this interface to turn the backlight on and off.
+ *
+ * Input Parameters:
+ * blon - Enable or disable the lcd backlight
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_STM32H7_LCD_BACKLIGHT
+void stm32_backlight(bool blon)
+{
+ /* Set default backlight level CONFIG_STM32H7_LTDC_DEFBACKLIGHT */
+
+ lcderr("ERROR: Not supported\n");
+}
+#endif
diff --git a/arch/arm/src/stm32h7/stm32_ltdc.h b/arch/arm/src/stm32h7/stm32_ltdc.h
new file mode 100644
index 0000000000..72dae60c48
--- /dev/null
+++ b/arch/arm/src/stm32h7/stm32_ltdc.h
@@ -0,0 +1,100 @@
+/****************************************************************************
+ * arch/arm/src/stm32h7/stm32_ltdc.h
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+#ifndef __ARCH_ARM_SRC_STM32F7_STM32_LTDC_H
+#define __ARCH_ARM_SRC_STM32F7_STM32_LTDC_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdbool.h>
+
+#include <nuttx/video/fb.h>
+#include <nuttx/nx/nxglib.h>
+
+/****************************************************************************
+ * Public Function Prototypes
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: stm32_ltdcreset
+ *
+ * Description:
+ * Reset LTDC via APB2RSTR
+ *
+ ****************************************************************************/
+
+void stm32_ltdcreset(void);
+
+/****************************************************************************
+ * Name: stm32_ltdcinitialize
+ *
+ * Description:
+ * Initialize the ltdc controller
+ *
+ * Returned Value:
+ * OK
+ *
+ ****************************************************************************/
+
+int stm32_ltdcinitialize(void);
+
+/****************************************************************************
+ * Name: stm32_ltdcuninitialize
+ *
+ * Description:
+ * Uninitialize the ltdc controller
+ *
+ ****************************************************************************/
+
+void stm32_ltdcuninitialize(void);
+
+/****************************************************************************
+ * Name: stm32_ltdcgetvplane
+ *
+ * Description:
+ * Get video plane reference used by framebuffer interface
+ *
+ * Parameter:
+ * vplane - Video plane
+ *
+ * Returned Value:
+ * Video plane reference
+ *
+ ****************************************************************************/
+
+FAR struct fb_vtable_s *stm32_ltdcgetvplane(int vplane);
+
+/****************************************************************************
+ * Name: stm32_lcd_backlight
+ *
+ * Description:
+ * If CONFIG_STM32F7_LCD_BACKLIGHT is defined, then the board-specific
+ * logic must provide this interface to turn the backlight on and off.
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_STM32F7_LCD_BACKLIGHT
+void stm32_backlight(bool blon);
+#endif
+#endif /* __ARCH_ARM_SRC_STM32F7_STM32_LTDC_H */
diff --git a/arch/arm/src/stm32h7/stm32h7x3xx_rcc.c b/arch/arm/src/stm32h7/stm32h7x3xx_rcc.c
index 40692f7971..ca9b629ec2 100644
--- a/arch/arm/src/stm32h7/stm32h7x3xx_rcc.c
+++ b/arch/arm/src/stm32h7/stm32h7x3xx_rcc.c
@@ -326,6 +326,12 @@ static inline void rcc_enableahb3(void)
regval |= RCC_AHB3ENR_FMCEN;
#endif
+#if defined(CONFIG_STM32H7_LTDC) && defined(CONFIG_STM32H7_DMA2D)
+ /* Enable DMA2D */
+
+ regval |= RCC_AHB3ENR_DMA2DEN;
+#endif
+
/* TODO: ... */
putreg32(regval, STM32_RCC_AHB3ENR); /* Enable peripherals */
@@ -543,7 +549,11 @@ static inline void rcc_enableapb3(void)
regval = getreg32(STM32_RCC_APB3ENR);
- /* TODO: ... */
+#ifdef CONFIG_STM32H7_LTDC
+ /* LTDC clock enable */
+
+ regval |= RCC_APB3ENR_LTDCEN;
+#endif
putreg32(regval, STM32_RCC_APB3ENR); /* Enable peripherals */
}
[nuttx] 01/03: arm/stm32h7: Add STM32H745 family
Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 8ceff0dc5a2ee461cec268827df49ae0f49dbb10
Author: raiden00pl <ra...@railab.me>
AuthorDate: Wed Jul 12 10:08:54 2023 +0200
arm/stm32h7: Add STM32H745 family
---
arch/arm/include/stm32h7/chip.h | 6 +-
arch/arm/include/stm32h7/irq.h | 2 +
arch/arm/include/stm32h7/stm32h7x5xx_irq.h | 210 +++++++++++++++++++++
arch/arm/src/stm32h7/Kconfig | 89 +++++++++
arch/arm/src/stm32h7/hardware/stm32_dmamux.h | 2 +
arch/arm/src/stm32h7/hardware/stm32_ethernet.h | 4 +-
arch/arm/src/stm32h7/hardware/stm32_exti.h | 5 +-
arch/arm/src/stm32h7/hardware/stm32_flash.h | 2 +
arch/arm/src/stm32h7/hardware/stm32_gpio.h | 2 +
arch/arm/src/stm32h7/hardware/stm32_i2c.h | 2 +
arch/arm/src/stm32h7/hardware/stm32_memorymap.h | 2 +
arch/arm/src/stm32h7/hardware/stm32_pinmap.h | 2 +
arch/arm/src/stm32h7/hardware/stm32_pwr.h | 2 +
arch/arm/src/stm32h7/hardware/stm32_rcc.h | 2 +
arch/arm/src/stm32h7/hardware/stm32_sdmmc.h | 2 +
arch/arm/src/stm32h7/hardware/stm32_spi.h | 2 +
arch/arm/src/stm32h7/hardware/stm32_syscfg.h | 2 +
arch/arm/src/stm32h7/hardware/stm32_uart.h | 2 +
arch/arm/src/stm32h7/hardware/stm32h7x3xx_gpio.h | 5 +-
arch/arm/src/stm32h7/hardware/stm32h7x3xx_pinmap.h | 5 +-
arch/arm/src/stm32h7/hardware/stm32h7x3xx_spi.h | 5 +-
arch/arm/src/stm32h7/hardware/stm32h7x3xx_uart.h | 5 +-
arch/arm/src/stm32h7/stm32_exti_gpio.c | 5 +-
arch/arm/src/stm32h7/stm32_gpio.c | 5 +-
arch/arm/src/stm32h7/stm32_rcc.c | 2 +
25 files changed, 362 insertions(+), 10 deletions(-)
diff --git a/arch/arm/include/stm32h7/chip.h b/arch/arm/include/stm32h7/chip.h
index 4a317516f4..f0b38971ef 100644
--- a/arch/arm/include/stm32h7/chip.h
+++ b/arch/arm/include/stm32h7/chip.h
@@ -71,7 +71,9 @@
defined (CONFIG_ARCH_CHIP_STM32H753VI) || \
defined (CONFIG_ARCH_CHIP_STM32H753XI) || \
defined (CONFIG_ARCH_CHIP_STM32H753ZI) || \
- defined (CONFIG_ARCH_CHIP_STM32H7B3LI)
+ defined (CONFIG_ARCH_CHIP_STM32H7B3LI) || \
+ defined (CONFIG_ARCH_CHIP_STM32H745XI) || \
+ defined (CONFIG_ARCH_CHIP_STM32H745ZI)
#elif defined(CONFIG_ARCH_CHIP_STM32H747XI)
#else
# error STM32 H7 chip not identified
@@ -79,7 +81,7 @@
/* Size SRAM */
-#if defined(CONFIG_STM32H7_STM32H7X3XX)
+#if defined(CONFIG_STM32H7_STM32H7X3XX) || defined(CONFIG_STM32H7_STM32H7X5XX)
/* Memory */
# define STM32H7_SRAM_SIZE (512*1024) /* 512Kb SRAM on AXI bus Matrix (D1) */
diff --git a/arch/arm/include/stm32h7/irq.h b/arch/arm/include/stm32h7/irq.h
index e35f97d6d0..a6582a4b36 100644
--- a/arch/arm/include/stm32h7/irq.h
+++ b/arch/arm/include/stm32h7/irq.h
@@ -71,6 +71,8 @@
# include <arch/stm32h7/stm32h7x3xx_irq.h>
#elif defined(CONFIG_STM32H7_STM32H7B3XX)
# include <arch/stm32h7/stm32h7x3xx_irq.h>
+#elif defined(CONFIG_STM32H7_STM32H7X5XX)
+# include <arch/stm32h7/stm32h7x5xx_irq.h>
#elif defined(CONFIG_STM32H7_STM32H7X7XX)
# include <arch/stm32h7/stm32h7x7xx_irq.h>
#else
diff --git a/arch/arm/include/stm32h7/stm32h7x5xx_irq.h b/arch/arm/include/stm32h7/stm32h7x5xx_irq.h
new file mode 100644
index 0000000000..539a064c5d
--- /dev/null
+++ b/arch/arm/include/stm32h7/stm32h7x5xx_irq.h
@@ -0,0 +1,210 @@
+/****************************************************************************
+ * arch/arm/include/stm32h7/stm32h7x5xx_irq.h
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/* This file should never be included directly but, rather,
+ * only indirectly through arch/irq.h
+ */
+
+#ifndef __ARCH_ARM_INCLUDE_STM32H7_STM32H7X5XX_IRQ_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+/****************************************************************************
+ * Pre-processor Prototypes
+ ****************************************************************************/
+
+/* 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/stm32h7/irq.h which includes
+ * this file
+ *
+ * External interrupts (vectors >= 16)
+ */
+
+#define STM32_IRQ_WWDG1 (STM32_IRQ_FIRST + 0) /* 0: Window Watchdog interrupt */
+#define STM32_IRQ_PVDPVM (STM32_IRQ_FIRST + 1) /* 1: PVD through EXTI line detection interrupt */
+#define STM32_IRQ_RTC (STM32_IRQ_FIRST + 2) /* 2: RTC tamper, timestamp */
+#define STM32_IRQ_CSSLSE (STM32_IRQ_FIRST + 2) /* 2: CSS LSE */
+#define STM32_IRQ_RTCWKUP (STM32_IRQ_FIRST + 3) /* 3: RTC Wakeup interrupt through the EXTI line */
+#define STM32_IRQ_FLASH (STM32_IRQ_FIRST + 4) /* 4: Flash memory 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 Stream0 global interrupt */
+#define STM32_IRQ_DMA1S1 (STM32_IRQ_FIRST + 12) /* 12: DMA1 Stream1 global interrupt */
+#define STM32_IRQ_DMA1S2 (STM32_IRQ_FIRST + 13) /* 13: DMA1 Stream2 global interrupt */
+#define STM32_IRQ_DMA1S3 (STM32_IRQ_FIRST + 14) /* 14: DMA1 Stream3 global interrupt */
+#define STM32_IRQ_DMA1S4 (STM32_IRQ_FIRST + 15) /* 15: DMA1 Stream4 global interrupt */
+#define STM32_IRQ_DMA1S5 (STM32_IRQ_FIRST + 16) /* 16: DMA1 Stream5 global interrupt */
+#define STM32_IRQ_DMA1S6 (STM32_IRQ_FIRST + 17) /* 17: DMA1 Stream6 global interrupt */
+#define STM32_IRQ_ADC12 (STM32_IRQ_FIRST + 18) /* 18: ADC1 and ADC2 global interrupt */
+#define STM32_IRQ_FDCAN1_0 (STM32_IRQ_FIRST + 19) /* 19: FDCAN1 Interrupt 0 */
+#define STM32_IRQ_FDCAN2_0 (STM32_IRQ_FIRST + 20) /* 20: FDCAN2 Interrupt 0 */
+#define STM32_IRQ_FDCAN1_1 (STM32_IRQ_FIRST + 21) /* 21: FDCAN1 Interrupt 1 */
+#define STM32_IRQ_FDCAN2_1 (STM32_IRQ_FIRST + 22) /* 22: FDCAN2 Interrupt 1 */
+#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_TIM1UP (STM32_IRQ_FIRST + 25) /* 25: TIM1 update interrupt */
+#define STM32_IRQ_TIM1TRGCOM (STM32_IRQ_FIRST + 26) /* 26: TIM1 trigger and commutation interrupts */
+#define STM32_IRQ_TIMCC (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_RTCALARM (STM32_IRQ_FIRST + 41) /* 41: RTC alarms (A and B) through EXTI Line interrupts */
+#define STM32_IRQ_RESERVED42 (STM32_IRQ_FIRST + 42) /* 42: Reserved */
+#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 /commutation interrupt */
+#define STM32_IRQ_TIM14 (STM32_IRQ_FIRST + 45) /* 45: TIM14 global interrupts */
+#define STM32_IRQ_TIM8CC (STM32_IRQ_FIRST + 46) /* 46: TIM8 capture / compare interrupts */
+#define STM32_IRQ_DMA1S7 (STM32_IRQ_FIRST + 47) /* 47: DMA1 Stream7 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_DAC1 (STM32_IRQ_FIRST + 54) /* 54: DAC1 underrun error interrupt */
+#define STM32_IRQ_TIM7 (STM32_IRQ_FIRST + 55) /* 55: TIM7 global interrupt */
+#define STM32_IRQ_DMA2S0 (STM32_IRQ_FIRST + 56) /* 56: DMA2 Stream0 interrupt */
+#define STM32_IRQ_DMA2S1 (STM32_IRQ_FIRST + 57) /* 57: DMA2 Stream1 interrupt */
+#define STM32_IRQ_DMA2S2 (STM32_IRQ_FIRST + 58) /* 58: FMA2 Stream2 interrupt */
+#define STM32_IRQ_DMA2S3 (STM32_IRQ_FIRST + 59) /* 59: DMA2 Stream3 interrupt */
+#define STM32_IRQ_DMA2S4 (STM32_IRQ_FIRST + 60) /* 60: DMA2 Stream4 interrupt */
+#define STM32_IRQ_ETH (STM32_IRQ_FIRST + 61) /* 61: Ethernet global interrupt */
+#define STM32_IRQ_ETHWKUP (STM32_IRQ_FIRST + 62) /* 62: Ethernet wakeup through EXTI line interrupt */
+#define STM32_IRQ_FDCANCAL (STM32_IRQ_FIRST + 63) /* 63: CAN2TX interrupts */
+#define STM32_IRQ_RESERVED64 (STM32_IRQ_FIRST + 64) /* 64: Reserved */
+#define STM32_IRQ_RESERVED65 (STM32_IRQ_FIRST + 65) /* 65: Reserved */
+#define STM32_IRQ_RESERVED66 (STM32_IRQ_FIRST + 66) /* 66: Reserved */
+#define STM32_IRQ_RESERVED67 (STM32_IRQ_FIRST + 67) /* 67: Reserved */
+#define STM32_IRQ_DMA2S5 (STM32_IRQ_FIRST + 68) /* 68: DMA2 Stream5 interrupt */
+#define STM32_IRQ_DMA2S6 (STM32_IRQ_FIRST + 69) /* 69: DMA2 Stream6 interrupt */
+#define STM32_IRQ_DMA2S7 (STM32_IRQ_FIRST + 70) /* 70: DMA2 Stream7 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_OTGHS_EP1OUT (STM32_IRQ_FIRST + 74) /* 74: OTG_HS out global interrupt */
+#define STM32_IRQ_OTGHS_EP1IN (STM32_IRQ_FIRST + 75) /* 75: OTG_HS in global interrupt */
+#define STM32_IRQ_OTGHS_WKUP (STM32_IRQ_FIRST + 76) /* 76: OTG_HS wakeup interrupt */
+#define STM32_IRQ_OTGHS (STM32_IRQ_FIRST + 77) /* 77: OTG_HS global interrupt */
+#define STM32_IRQ_DCMI (STM32_IRQ_FIRST + 78) /* 78: DCMI global interrupt */
+#define STM32_IRQ_CRYP (STM32_IRQ_FIRST + 79) /* 79: CRYP global interrupt */
+#define STM32_IRQ_HASH (STM32_IRQ_FIRST + 80) /* 80: HASH global interrupt */
+#define STM32_IRQ_RNG (STM32_IRQ_FIRST + 80) /* 80: RNG global interrupt */
+#define STM32_IRQ_FPU (STM32_IRQ_FIRST + 81) /* 81: CPU FPU */
+#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_SPI6 (STM32_IRQ_FIRST + 86) /* 86: SPI6 global interrupt */
+#define STM32_IRQ_SAI1 (STM32_IRQ_FIRST + 87) /* 87: SAI1 global interrupt */
+#define STM32_IRQ_LTDC (STM32_IRQ_FIRST + 88) /* 88: LCD-TFT global interrupt */
+#define STM32_IRQ_LTDCER (STM32_IRQ_FIRST + 89) /* 89: LCD-TFT error interrupt */
+#define STM32_IRQ_DMA2D (STM32_IRQ_FIRST + 90) /* 90: DMA2D 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_LPTIM1 (STM32_IRQ_FIRST + 93) /* 93: LPTIM1 global interrupt */
+#define STM32_IRQ_CEC (STM32_IRQ_FIRST + 94) /* 94: HDMI-CEC global interrupt */
+#define STM32_IRQ_I2C4EV (STM32_IRQ_FIRST + 95) /* 95: I2C4 event interrupt */
+#define STM32_IRQ_I2C4ER (STM32_IRQ_FIRST + 96) /* 96: I2C4 error interrupt */
+#define STM32_IRQ_SPDIF (STM32_IRQ_FIRST + 97) /* 97: SPDIFRX global interrupt */
+#define STM32_IRQ_OTGFS_EP1OUT (STM32_IRQ_FIRST + 98) /* 98: OTG_FS out global interrupt */
+#define STM32_IRQ_OTGFS_EP1IN (STM32_IRQ_FIRST + 99) /* 99: OTG_FS in global interrupt */
+#define STM32_IRQ_OTGFS_WKUP (STM32_IRQ_FIRST + 100) /* 100: OTG_FS wakeup */
+#define STM32_IRQ_OTGFS (STM32_IRQ_FIRST + 101) /* 101: OTG_FS global interrupt */
+#define STM32_IRQ_DMAMUX1OV (STM32_IRQ_FIRST + 102) /* 102: DMAMUX1 overrun interrupt */
+#define STM32_IRQ_HRTIM1MST (STM32_IRQ_FIRST + 103) /* 103: HRTIM1 master timer interrupt */
+#define STM32_IRQ_HRTIM1TIMA (STM32_IRQ_FIRST + 104) /* 104: HRTIM1 timer A interrupt */
+#define STM32_IRQ_HRTIMTIMB (STM32_IRQ_FIRST + 105) /* 105: HRTIM1 timer B interrupt */
+#define STM32_IRQ_HRTIM1TIMC (STM32_IRQ_FIRST + 106) /* 106: HRTIM1 timer C interrupt */
+#define STM32_IRQ_HRTIM1TIMD (STM32_IRQ_FIRST + 107) /* 107: HRTIM1 timer D interrupt */
+#define STM32_IRQ_HRTIMTIME (STM32_IRQ_FIRST + 108) /* 108: HRTIM1 timer E interrupt */
+#define STM32_IRQ_HRTIM1FLT (STM32_IRQ_FIRST + 109) /* 109: HRTIM1 fault interrupt */
+#define STM32_IRQ_DFSDM1FLT0 (STM32_IRQ_FIRST + 110) /* 110: DFSDM1 filter 0 interrupt */
+#define STM32_IRQ_DFSDM1FLT1 (STM32_IRQ_FIRST + 111) /* 111: DFSDM1 filter 1 interrupt */
+#define STM32_IRQ_DFSDM1FLT2 (STM32_IRQ_FIRST + 112) /* 112: DFSDM1 filter 2 interrupt */
+#define STM32_IRQ_DFSDM1FLT3 (STM32_IRQ_FIRST + 113) /* 113: DFSDM1 filter 3 interrupt */
+#define STM32_IRQ_SAI3 (STM32_IRQ_FIRST + 114) /* 114: SAI3 global interrupt */
+#define STM32_IRQ_SWPMI1 (STM32_IRQ_FIRST + 115) /* 115: SWPMI global interrupt/wakeup */
+#define STM32_IRQ_TIM15 (STM32_IRQ_FIRST + 116) /* 116: TIM15 global interrupt */
+#define STM32_IRQ_TIM16 (STM32_IRQ_FIRST + 117) /* 117: TIM16 global interrupt */
+#define STM32_IRQ_TIM17 (STM32_IRQ_FIRST + 118) /* 118: TIM17 global interrupt */
+#define STM32_IRQ_MDIOSWKUP (STM32_IRQ_FIRST + 119) /* 119: MDIOS wakeup */
+#define STM32_IRQ_MDIOS (STM32_IRQ_FIRST + 120) /* 120: MDIOS global interrupt */
+#define STM32_IRQ_JPEG (STM32_IRQ_FIRST + 121) /* 121: JPEG global interrupt */
+#define STM32_IRQ_MDMA (STM32_IRQ_FIRST + 122) /* 122: MDMA */
+#define STM32_IRQ_RESERVED123 (STM32_IRQ_FIRST + 123) /* 123: Reserved */
+#define STM32_IRQ_SDMMC2 (STM32_IRQ_FIRST + 124) /* 124: SDMMC2 global interrupt */
+#define STM32_IRQ_HSEM0 (STM32_IRQ_FIRST + 125) /* 125: HSEM global interrupt 1 */
+#define STM32_IRQ_RESERVED126 (STM32_IRQ_FIRST + 126) /* 126: Reserved */
+#define STM32_IRQ_ADC3 (STM32_IRQ_FIRST + 127) /* 127: ADC3 global interrupt */
+#define STM32_IRQ_DMAMUX2OVR (STM32_IRQ_FIRST + 128) /* 128: DMAMUX2 overrun interrupt */
+#define STM32_IRQ_BDMACH1 (STM32_IRQ_FIRST + 129) /* 129: BDMA channel 1 interrupt */
+#define STM32_IRQ_BDMACH2 (STM32_IRQ_FIRST + 130) /* 130: BDMA channel 2 interrupt */
+#define STM32_IRQ_BDMACH3 (STM32_IRQ_FIRST + 131) /* 131: BDMA channel 3 interrupt */
+#define STM32_IRQ_BDMACH4 (STM32_IRQ_FIRST + 132) /* 132: BDMA channel 4 interrupt */
+#define STM32_IRQ_BDMACH5 (STM32_IRQ_FIRST + 133) /* 133: BDMA channel 5 interrupt */
+#define STM32_IRQ_BDMACH6 (STM32_IRQ_FIRST + 134) /* 134: BDMA channel 6 interrupt */
+#define STM32_IRQ_BDMACH7 (STM32_IRQ_FIRST + 135) /* 135: BDMA channel 7 interrupt */
+#define STM32_IRQ_BDMACH8 (STM32_IRQ_FIRST + 136) /* 136: BDMA channel 8 interrupt */
+#define STM32_IRQ_COMP (STM32_IRQ_FIRST + 137) /* 137: COMP1 and COMP2 exti_comp1_wkup global interrupt */
+#define STM32_IRQ_LPTIM2 (STM32_IRQ_FIRST + 138) /* 138: LPTIM2 timer interrupt */
+#define STM32_IRQ_LPTIM3 (STM32_IRQ_FIRST + 139) /* 139: LPTIM2 timer interrupt */
+#define STM32_IRQ_LPTIM4 (STM32_IRQ_FIRST + 140) /* 140: LPTIM2 timer interrupt */
+#define STM32_IRQ_LPTIM5 (STM32_IRQ_FIRST + 141) /* 141: LPTIM2 timer interrupt */
+#define STM32_IRQ_LPUART (STM32_IRQ_FIRST + 142) /* 142: LPUART global interrupt */
+#define STM32_IRQ_WWDG1RST (STM32_IRQ_FIRST + 143) /* 143: Window Watchdog interrupt */
+#define STM32_IRQ_CRS (STM32_IRQ_FIRST + 144) /* 144: Clock Recovery System global interrupt */
+#define STM32_IRQ_RESERVED145 (STM32_IRQ_FIRST + 145) /* 145: Reserved */
+#define STM32_IRQ_SAI4 (STM32_IRQ_FIRST + 146) /* 146: SAI4 global interrupt */
+#define STM32_IRQ_RESERVED147 (STM32_IRQ_FIRST + 147) /* 147: Reserved */
+#define STM32_IRQ_RESERVED148 (STM32_IRQ_FIRST + 148) /* 148: Reserved */
+#define STM32_IRQ_WKUP (STM32_IRQ_FIRST + 149) /* 149: WKUP1 to WKUP6 pins */
+
+#define STM32_IRQ_NEXTINTS 150
+#define NR_IRQS (STM32_IRQ_FIRST + STM32_IRQ_NEXTINTS)
+
+#endif /* __ARCH_ARM_INCLUDE_STM32H7_STM32H7X5XX_IRQ_H */
diff --git a/arch/arm/src/stm32h7/Kconfig b/arch/arm/src/stm32h7/Kconfig
index 191f912db2..7177fcb2ee 100644
--- a/arch/arm/src/stm32h7/Kconfig
+++ b/arch/arm/src/stm32h7/Kconfig
@@ -142,6 +142,78 @@ config ARCH_CHIP_STM32H743ZI
STM32 H7 Cortex M7, 2048 Kb FLASH, 1024K Kb SRAM,
LQFP144
+config ARCH_CHIP_STM32H745BG
+ bool "STM32H745BG"
+ select STM32H7_STM32H7X5XX
+ select STM32H7_FLASH_CONFIG_G
+ select STM32H7_IO_CONFIG_B
+ ---help---
+ STM32 H7 Cortex M7, 1024 Kb FLASH, 1024K Kb SRAM,
+ LQFP208
+
+config ARCH_CHIP_STM32H745BI
+ bool "STM32H745BI"
+ select STM32H7_STM32H7X5XX
+ select STM32H7_FLASH_CONFIG_I
+ select STM32H7_IO_CONFIG_B
+ ---help---
+ STM32 H7 Cortex M7, 2048 Kb FLASH, 1024K Kb SRAM,
+ LQFP208
+
+config ARCH_CHIP_STM32H745IG
+ bool "STM32H745IG"
+ select STM32H7_STM32H7X5XX
+ select STM32H7_FLASH_CONFIG_G
+ select STM32H7_IO_CONFIG_I
+ ---help---
+ STM32 H7 Cortex M7, 1024 Kb FLASH, 1024K Kb SRAM,
+ LQFP176 or UFBGA176
+
+config ARCH_CHIP_STM32H745II
+ bool "STM32H745II"
+ select STM32H7_STM32H7X5XX
+ select STM32H7_FLASH_CONFIG_I
+ select STM32H7_IO_CONFIG_I
+ ---help---
+ STM32 H7 Cortex M7, 2048 Kb FLASH, 1024K Kb SRAM,
+ LQFP176 or UFBGA176
+
+config ARCH_CHIP_STM32H745XG
+ bool "STM32H745XG"
+ select STM32H7_STM32H7X5XX
+ select STM32H7_FLASH_CONFIG_G
+ select STM32H7_IO_CONFIG_X
+ ---help---
+ STM32 H7 Cortex M7, 1024 Kb FLASH, 1024K Kb SRAM,
+ TFBGA240
+
+config ARCH_CHIP_STM32H745XI
+ bool "STM32H745XI"
+ select STM32H7_STM32H7X5XX
+ select STM32H7_FLASH_CONFIG_I
+ select STM32H7_IO_CONFIG_X
+ ---help---
+ STM32 H7 Cortex M7, 2048 Kb FLASH, 1024K Kb SRAM,
+ TFBGA240
+
+config ARCH_CHIP_STM32H745ZG
+ bool "STM32H745ZG"
+ select STM32H7_STM32H7X5XX
+ select STM32H7_FLASH_CONFIG_G
+ select STM32H7_IO_CONFIG_Z
+ ---help---
+ STM32 H7 Cortex M7, 1024 Kb FLASH, 1024K Kb SRAM,
+ LQFP144
+
+config ARCH_CHIP_STM32H745ZI
+ bool "STM32H745ZI"
+ select STM32H7_STM32H7X5XX
+ select STM32H7_FLASH_CONFIG_I
+ select STM32H7_IO_CONFIG_Z
+ ---help---
+ STM32 H7 Cortex M7, 2048 Kb FLASH, 1024K Kb SRAM,
+ LQFP144
+
config ARCH_CHIP_STM32H747XI
bool "STM32H747XI"
select STM32H7_STM32H7X7XX
@@ -301,6 +373,23 @@ config STM32H7_STM32H7B3XX
select STM32H7_HAVE_SPI5 if !STM32H7_IO_CONFIG_V
select STM32H7_HAVE_SPI6
+config STM32H7_STM32H7X5XX
+ bool
+ default n
+ select ARCH_HAVE_FPU
+ select ARCH_HAVE_DPFPU
+ select ARMV7M_HAVE_ICACHE
+ select ARMV7M_HAVE_DCACHE
+ select ARMV7M_HAVE_ITCM
+ select ARMV7M_HAVE_DTCM
+ select STM32H7_HAVE_ETHERNET
+ select STM32H7_HAVE_FMC
+ select STM32H7_HAVE_GPIOF if !STM32H7_IO_CONFIG_V
+ select STM32H7_HAVE_GPIOG if !STM32H7_IO_CONFIG_V
+ select STM32H7_HAVE_SPI4
+ select STM32H7_HAVE_SPI5 if !STM32H7_IO_CONFIG_V
+ select STM32H7_HAVE_SPI6
+
config STM32H7_STM32H7X7XX
bool
default n
diff --git a/arch/arm/src/stm32h7/hardware/stm32_dmamux.h b/arch/arm/src/stm32h7/hardware/stm32_dmamux.h
index 74d35c5799..f00f6f6321 100644
--- a/arch/arm/src/stm32h7/hardware/stm32_dmamux.h
+++ b/arch/arm/src/stm32h7/hardware/stm32_dmamux.h
@@ -205,6 +205,8 @@
# include "hardware/stm32h7x3xx_dmamux.h"
#elif defined(CONFIG_STM32H7_STM32H7B3XX)
# include "hardware/stm32h7x3xx_dmamux.h"
+#elif defined(CONFIG_STM32H7_STM32H7X5XX)
+# include "hardware/stm32h7x3xx_dmamux.h"
#elif defined(CONFIG_STM32H7_STM32H7X7XX)
# include "hardware/stm32h7x3xx_dmamux.h"
#else
diff --git a/arch/arm/src/stm32h7/hardware/stm32_ethernet.h b/arch/arm/src/stm32h7/hardware/stm32_ethernet.h
index 5ed1e6c008..ce5e72c5d1 100644
--- a/arch/arm/src/stm32h7/hardware/stm32_ethernet.h
+++ b/arch/arm/src/stm32h7/hardware/stm32_ethernet.h
@@ -31,7 +31,9 @@
* families
*/
-#if defined(CONFIG_STM32H7_STM32H7X3XX) || defined(CONFIG_STM32H7_STM32H7B3XX)
+#if defined(CONFIG_STM32H7_STM32H7X3XX) || \
+ defined(CONFIG_STM32H7_STM32H7B3XX) || \
+ defined(CONFIG_STM32H7_STM32H7X5XX)
/****************************************************************************
* Pre-processor Definitions
diff --git a/arch/arm/src/stm32h7/hardware/stm32_exti.h b/arch/arm/src/stm32h7/hardware/stm32_exti.h
index 7c6f2bd6f5..fda6790e81 100644
--- a/arch/arm/src/stm32h7/hardware/stm32_exti.h
+++ b/arch/arm/src/stm32h7/hardware/stm32_exti.h
@@ -33,7 +33,10 @@
* families
*/
-#if defined(CONFIG_STM32H7_STM32H7X3XX) || defined(CONFIG_STM32H7_STM32H7X7XX) || defined(CONFIG_STM32H7_STM32H7B3XX)
+#if defined(CONFIG_STM32H7_STM32H7X3XX) || \
+ defined(CONFIG_STM32H7_STM32H7B3XX) || \
+ defined(CONFIG_STM32H7_STM32H7X5XX) || \
+ defined(CONFIG_STM32H7_STM32H7X7XX)
/****************************************************************************
* Pre-processor Definitions
diff --git a/arch/arm/src/stm32h7/hardware/stm32_flash.h b/arch/arm/src/stm32h7/hardware/stm32_flash.h
index ff722521ec..fc5b1a869a 100644
--- a/arch/arm/src/stm32h7/hardware/stm32_flash.h
+++ b/arch/arm/src/stm32h7/hardware/stm32_flash.h
@@ -32,6 +32,8 @@
# include "hardware/stm32h7x3xx_flash.h"
#elif defined(CONFIG_STM32H7_STM32H7B3XX)
# include "hardware/stm32h7b3xx_flash.h"
+#elif defined(CONFIG_STM32H7_STM32H7X5XX)
+# include "hardware/stm32h7x3xx_flash.h"
#elif defined(CONFIG_STM32H7_STM32H7X7XX)
# include "hardware/stm32h7x3xx_flash.h"
#else
diff --git a/arch/arm/src/stm32h7/hardware/stm32_gpio.h b/arch/arm/src/stm32h7/hardware/stm32_gpio.h
index d12816951d..74350654e2 100644
--- a/arch/arm/src/stm32h7/hardware/stm32_gpio.h
+++ b/arch/arm/src/stm32h7/hardware/stm32_gpio.h
@@ -32,6 +32,8 @@
# include "hardware/stm32h7x3xx_gpio.h"
#elif defined(CONFIG_STM32H7_STM32H7B3XX)
# include "hardware/stm32h7x3xx_gpio.h"
+#elif defined(CONFIG_STM32H7_STM32H7X5XX)
+# include "hardware/stm32h7x3xx_gpio.h"
#elif defined(CONFIG_STM32H7_STM32H7X7XX)
# include "hardware/stm32h7x3xx_gpio.h"
#else
diff --git a/arch/arm/src/stm32h7/hardware/stm32_i2c.h b/arch/arm/src/stm32h7/hardware/stm32_i2c.h
index 77d5602102..4d17cfc4de 100644
--- a/arch/arm/src/stm32h7/hardware/stm32_i2c.h
+++ b/arch/arm/src/stm32h7/hardware/stm32_i2c.h
@@ -32,6 +32,8 @@
# include "hardware/stm32h7x3xx_i2c.h"
#elif defined(CONFIG_STM32H7_STM32H7B3XX)
# include "hardware/stm32h7x3xx_i2c.h"
+#elif defined(CONFIG_STM32H7_STM32H7X5XX)
+# include "hardware/stm32h7x3xx_i2c.h"
#elif defined(CONFIG_STM32H7_STM32H7X7XX)
# include "hardware/stm32h7x3xx_i2c.h"
#else
diff --git a/arch/arm/src/stm32h7/hardware/stm32_memorymap.h b/arch/arm/src/stm32h7/hardware/stm32_memorymap.h
index faeeecca57..c162ed731a 100644
--- a/arch/arm/src/stm32h7/hardware/stm32_memorymap.h
+++ b/arch/arm/src/stm32h7/hardware/stm32_memorymap.h
@@ -32,6 +32,8 @@
# include "hardware/stm32h7x3xx_memorymap.h"
#elif defined(CONFIG_STM32H7_STM32H7B3XX)
# include "hardware/stm32h7x3xx_memorymap.h"
+#elif defined(CONFIG_STM32H7_STM32H7X5XX)
+# include "hardware/stm32h7x3xx_memorymap.h"
#elif defined(CONFIG_STM32H7_STM32H7X7XX)
# include "hardware/stm32h7x3xx_memorymap.h"
#else
diff --git a/arch/arm/src/stm32h7/hardware/stm32_pinmap.h b/arch/arm/src/stm32h7/hardware/stm32_pinmap.h
index 8d139982a8..e3c1a241d2 100644
--- a/arch/arm/src/stm32h7/hardware/stm32_pinmap.h
+++ b/arch/arm/src/stm32h7/hardware/stm32_pinmap.h
@@ -43,6 +43,8 @@
# include "hardware/stm32h7x3xx_pinmap.h"
# elif defined(CONFIG_STM32H7_STM32H7B3XX)
# include "hardware/stm32h7x3xx_pinmap.h"
+# elif defined(CONFIG_STM32H7_STM32H7X5XX)
+# include "hardware/stm32h7x3xx_pinmap.h"
# elif defined(CONFIG_STM32H7_STM32H7X7XX)
# include "hardware/stm32h7x3xx_pinmap.h"
# else
diff --git a/arch/arm/src/stm32h7/hardware/stm32_pwr.h b/arch/arm/src/stm32h7/hardware/stm32_pwr.h
index b603780a4e..8f7ffe9522 100644
--- a/arch/arm/src/stm32h7/hardware/stm32_pwr.h
+++ b/arch/arm/src/stm32h7/hardware/stm32_pwr.h
@@ -32,6 +32,8 @@
# include "hardware/stm32h7x3xx_pwr.h"
#elif defined(CONFIG_STM32H7_STM32H7B3XX)
# include "hardware/stm32h7x3xx_pwr.h"
+#elif defined(CONFIG_STM32H7_STM32H7X5XX)
+# include "hardware/stm32h7x3xx_pwr.h"
#elif defined(CONFIG_STM32H7_STM32H7X7XX)
# include "hardware/stm32h7x3xx_pwr.h"
#else
diff --git a/arch/arm/src/stm32h7/hardware/stm32_rcc.h b/arch/arm/src/stm32h7/hardware/stm32_rcc.h
index 9c33b46002..61527969f0 100644
--- a/arch/arm/src/stm32h7/hardware/stm32_rcc.h
+++ b/arch/arm/src/stm32h7/hardware/stm32_rcc.h
@@ -32,6 +32,8 @@
# include "hardware/stm32h7x3xx_rcc.h"
#elif defined(CONFIG_STM32H7_STM32H7B3XX)
# include "hardware/stm32h7x3xx_rcc.h"
+#elif defined(CONFIG_STM32H7_STM32H7X5XX)
+# include "hardware/stm32h7x3xx_rcc.h"
#elif defined(CONFIG_STM32H7_STM32H7X7XX)
# include "hardware/stm32h7x3xx_rcc.h"
#else
diff --git a/arch/arm/src/stm32h7/hardware/stm32_sdmmc.h b/arch/arm/src/stm32h7/hardware/stm32_sdmmc.h
index 40649e49cc..b40ecc4a28 100644
--- a/arch/arm/src/stm32h7/hardware/stm32_sdmmc.h
+++ b/arch/arm/src/stm32h7/hardware/stm32_sdmmc.h
@@ -32,6 +32,8 @@
# include "stm32h7x3xx_sdmmc.h"
#elif defined(CONFIG_STM32H7_STM32H7B3XX)
# include "stm32h7x3xx_sdmmc.h"
+#elif defined(CONFIG_STM32H7_STM32H7X5XX)
+# include "stm32h7x3xx_sdmmc.h"
#elif defined(CONFIG_STM32H7_STM32H7X7XX)
# include "stm32h7x3xx_sdmmc.h"
#else
diff --git a/arch/arm/src/stm32h7/hardware/stm32_spi.h b/arch/arm/src/stm32h7/hardware/stm32_spi.h
index d8adb5b0ee..a16cd81fb6 100644
--- a/arch/arm/src/stm32h7/hardware/stm32_spi.h
+++ b/arch/arm/src/stm32h7/hardware/stm32_spi.h
@@ -32,6 +32,8 @@
# include "hardware/stm32h7x3xx_spi.h"
#elif defined(CONFIG_STM32H7_STM32H7B3XX)
# include "hardware/stm32h7x3xx_spi.h"
+#elif defined(CONFIG_STM32H7_STM32H7X3XX)
+# include "hardware/stm32h7x3xx_spi.h"
#elif defined(CONFIG_STM32H7_STM32H7X7XX)
# include "hardware/stm32h7x3xx_spi.h"
#else
diff --git a/arch/arm/src/stm32h7/hardware/stm32_syscfg.h b/arch/arm/src/stm32h7/hardware/stm32_syscfg.h
index a047afa39b..9d9ca16dbe 100644
--- a/arch/arm/src/stm32h7/hardware/stm32_syscfg.h
+++ b/arch/arm/src/stm32h7/hardware/stm32_syscfg.h
@@ -32,6 +32,8 @@
# include "hardware/stm32h7x3xx_syscfg.h"
#elif defined(CONFIG_STM32H7_STM32H7B3XX)
# include "hardware/stm32h7x3xx_syscfg.h"
+#elif defined(CONFIG_STM32H7_STM32H7X5XX)
+# include "hardware/stm32h7x3xx_syscfg.h"
#elif defined(CONFIG_STM32H7_STM32H7X7XX)
# include "hardware/stm32h7x3xx_syscfg.h"
#else
diff --git a/arch/arm/src/stm32h7/hardware/stm32_uart.h b/arch/arm/src/stm32h7/hardware/stm32_uart.h
index 7323a412f7..f1677f194a 100644
--- a/arch/arm/src/stm32h7/hardware/stm32_uart.h
+++ b/arch/arm/src/stm32h7/hardware/stm32_uart.h
@@ -32,6 +32,8 @@
# include "hardware/stm32h7x3xx_uart.h"
#elif defined(CONFIG_STM32H7_STM32H7B3XX)
# include "hardware/stm32h7x3xx_uart.h"
+#elif defined(CONFIG_STM32H7_STM32H7X5XX)
+# include "hardware/stm32h7x3xx_uart.h"
#elif defined(CONFIG_STM32H7_STM32H7X7XX)
# include "hardware/stm32h7x3xx_uart.h"
#else
diff --git a/arch/arm/src/stm32h7/hardware/stm32h7x3xx_gpio.h b/arch/arm/src/stm32h7/hardware/stm32h7x3xx_gpio.h
index 4591235978..cf6449cba1 100644
--- a/arch/arm/src/stm32h7/hardware/stm32h7x3xx_gpio.h
+++ b/arch/arm/src/stm32h7/hardware/stm32h7x3xx_gpio.h
@@ -28,7 +28,10 @@
#include <nuttx/config.h>
#include <arch/stm32h7/chip.h>
-#if defined(CONFIG_STM32H7_STM32H7X3XX) || defined(CONFIG_STM32H7_STM32H7X7XX) || defined(CONFIG_STM32H7_STM32H7B3XX)
+#if defined(CONFIG_STM32H7_STM32H7X3XX) || \
+ defined(CONFIG_STM32H7_STM32H7B3XX) || \
+ defined(CONFIG_STM32H7_STM32H7X5XX) || \
+ defined(CONFIG_STM32H7_STM32H7X7XX)
/****************************************************************************
* Pre-processor Definitions
diff --git a/arch/arm/src/stm32h7/hardware/stm32h7x3xx_pinmap.h b/arch/arm/src/stm32h7/hardware/stm32h7x3xx_pinmap.h
index 8b7c76b73e..a483a2157d 100644
--- a/arch/arm/src/stm32h7/hardware/stm32h7x3xx_pinmap.h
+++ b/arch/arm/src/stm32h7/hardware/stm32h7x3xx_pinmap.h
@@ -29,7 +29,10 @@
#include "stm32_gpio.h"
-#if defined(CONFIG_STM32H7_STM32H7X3XX) || defined(CONFIG_STM32H7_STM32H7X7XX) || defined(CONFIG_STM32H7_STM32H7B3XX)
+#if defined(CONFIG_STM32H7_STM32H7X3XX) || \
+ defined(CONFIG_STM32H7_STM32H7B3XX) || \
+ defined(CONFIG_STM32H7_STM32H7X5XX) || \
+ defined(CONFIG_STM32H7_STM32H7X7XX)
/****************************************************************************
* Pre-processor Definitions
diff --git a/arch/arm/src/stm32h7/hardware/stm32h7x3xx_spi.h b/arch/arm/src/stm32h7/hardware/stm32h7x3xx_spi.h
index 2a55696007..8a3fd1a70d 100644
--- a/arch/arm/src/stm32h7/hardware/stm32h7x3xx_spi.h
+++ b/arch/arm/src/stm32h7/hardware/stm32h7x3xx_spi.h
@@ -27,7 +27,10 @@
#include <nuttx/config.h>
-#if defined(CONFIG_STM32H7_STM32H7X3XX) || defined(CONFIG_STM32H7_STM32H7B3XX)
+#if defined(CONFIG_STM32H7_STM32H7X3XX) || \
+ defined(CONFIG_STM32H7_STM32H7B3XX) || \
+ defined(CONFIG_STM32H7_STM32H7X5XX) || \
+ defined(CONFIG_STM32H7_STM32H7X7XX)
/****************************************************************************
* Pre-processor Definitions
diff --git a/arch/arm/src/stm32h7/hardware/stm32h7x3xx_uart.h b/arch/arm/src/stm32h7/hardware/stm32h7x3xx_uart.h
index cedfe52172..579f070c02 100644
--- a/arch/arm/src/stm32h7/hardware/stm32h7x3xx_uart.h
+++ b/arch/arm/src/stm32h7/hardware/stm32h7x3xx_uart.h
@@ -29,7 +29,10 @@
#include "chip.h"
#include "hardware/stm32_memorymap.h"
-#if defined(CONFIG_STM32H7_STM32H7X3XX) || defined(CONFIG_STM32H7_STM32H7X7XX) || defined(CONFIG_STM32H7_STM32H7B3XX)
+#if defined(CONFIG_STM32H7_STM32H7X3XX) || \
+ defined(CONFIG_STM32H7_STM32H7B3XX) || \
+ defined(CONFIG_STM32H7_STM32H7X5XX) || \
+ defined(CONFIG_STM32H7_STM32H7X7XX)
/****************************************************************************
* Pre-processor Definitions
diff --git a/arch/arm/src/stm32h7/stm32_exti_gpio.c b/arch/arm/src/stm32h7/stm32_exti_gpio.c
index 2fbcc9f55e..d73d64bd69 100644
--- a/arch/arm/src/stm32h7/stm32_exti_gpio.c
+++ b/arch/arm/src/stm32h7/stm32_exti_gpio.c
@@ -42,7 +42,10 @@
* families
*/
-#if defined(CONFIG_STM32H7_STM32H7X3XX) || defined(CONFIG_STM32H7_STM32H7X7XX) || defined(CONFIG_STM32H7_STM32H7B3XX)
+#if defined(CONFIG_STM32H7_STM32H7X3XX) || \
+ defined(CONFIG_STM32H7_STM32H7B3XX) || \
+ defined(CONFIG_STM32H7_STM32H7X5XX) || \
+ defined(CONFIG_STM32H7_STM32H7X7XX)
/****************************************************************************
* Private Types
diff --git a/arch/arm/src/stm32h7/stm32_gpio.c b/arch/arm/src/stm32h7/stm32_gpio.c
index f20f9f8d61..71cabaa6d4 100644
--- a/arch/arm/src/stm32h7/stm32_gpio.c
+++ b/arch/arm/src/stm32h7/stm32_gpio.c
@@ -41,7 +41,10 @@
* families
*/
-#if defined(CONFIG_STM32H7_STM32H7X3XX) || defined(CONFIG_STM32H7_STM32H7X7XX) || defined(CONFIG_STM32H7_STM32H7B3XX)
+#if defined(CONFIG_STM32H7_STM32H7X3XX) || \
+ defined(CONFIG_STM32H7_STM32H7B3XX) || \
+ defined(CONFIG_STM32H7_STM32H7X5XX) || \
+ defined(CONFIG_STM32H7_STM32H7X7XX)
#if defined(CONFIG_STM32H7_USE_LEGACY_PINMAP)
# pragma message "CONFIG_STM32H7_USE_LEGACY_PINMAP will be deprecated migrate board.h see tools/stm32_pinmap_tool.py"
diff --git a/arch/arm/src/stm32h7/stm32_rcc.c b/arch/arm/src/stm32h7/stm32_rcc.c
index 39d5ad0b02..924d5a2999 100644
--- a/arch/arm/src/stm32h7/stm32_rcc.c
+++ b/arch/arm/src/stm32h7/stm32_rcc.c
@@ -58,6 +58,8 @@
# include "stm32h7x3xx_rcc.c"
#elif defined(CONFIG_STM32H7_STM32H7B3XX)
# include "stm32h7x3xx_rcc.c"
+#elif defined(CONFIG_STM32H7_STM32H7X5XX)
+# include "stm32h7x3xx_rcc.c"
#elif defined(CONFIG_STM32H7_STM32H7X7XX)
# include "stm32h7x7xx_rcc.c"
#else