This is an automated email from the ASF dual-hosted git repository.

GUIDINGLI pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit b990525db8b5781189a5197bb9439a4c61433e0f
Author: raiden00pl <[email protected]>
AuthorDate: Wed Nov 25 10:13:49 2026 +0100

    arch/arm/stm32: Move the STM32F7 DMA2D driver to common.
    
    The STM32F7 DMA2D driver was a copy of the common one.  Use the common
    driver, renamed to stm32_dma2d_v1, on the STM32F4 and STM32F7.  It is
    selected with STM32_HAVE_IP_DMA2D_V1 and built outside the legacy
    block.  The STM32L4 has no DMA2D driver and no longer selects it.
    STM32_DMA2D depends on it and always selects FB and FB_OVERLAY.
    
    Assisted-by: Claude:claude-opus-5-5
    Signed-off-by: raiden00pl <[email protected]>
---
 Documentation/guides/chip-specific/stm32_ports.rst |    4 +-
 arch/arm/src/common/stm32/CMakeLists.txt           |    8 +-
 arch/arm/src/common/stm32/Kconfig.have             |    2 +-
 arch/arm/src/common/stm32/Kconfig.periph           |    9 +-
 arch/arm/src/common/stm32/Make.defs                |   10 +-
 arch/arm/src/common/stm32/stm32_dma2d.h            |    4 +-
 .../{stm32_dma2d_m3m4_v1.c => stm32_dma2d_v1.c}    |   10 +-
 .../{stm32_dma2d_m3m4_v1.h => stm32_dma2d_v1.h}    |    8 +-
 arch/arm/src/common/stm32/stm32_ltdc_v1v2.c        |    2 +-
 arch/arm/src/stm32f4/Kconfig                       |    4 +-
 arch/arm/src/stm32f7/CMakeLists.txt                |    4 -
 arch/arm/src/stm32f7/Kconfig                       |   28 +-
 arch/arm/src/stm32f7/Make.defs                     |    4 -
 arch/arm/src/stm32f7/hardware/stm32_dma2d.h        |  237 ----
 arch/arm/src/stm32f7/stm32_dma2d.c                 | 1167 --------------------
 arch/arm/src/stm32f7/stm32_dma2d.h                 |  191 ----
 arch/arm/src/stm32l4/Kconfig                       |    5 -
 17 files changed, 42 insertions(+), 1655 deletions(-)

diff --git a/Documentation/guides/chip-specific/stm32_ports.rst 
b/Documentation/guides/chip-specific/stm32_ports.rst
index e71fd6adc4e..c15647bd93f 100644
--- a/Documentation/guides/chip-specific/stm32_ports.rst
+++ b/Documentation/guides/chip-specific/stm32_ports.rst
@@ -438,7 +438,7 @@ CAN/FDCAN     bxCAN         
arch/arm/src/common/stm32/stm32_can_m3m4_v1.c
 CRYP          v1            arch/arm/src/common/stm32/stm32_aes_m3m4_v1.c      
   
 DAC           v1            arch/arm/src/common/stm32/stm32_dac_m3m4_v1.c      
   
 DMA           v2            
arch/arm/src/common/stm32/stm32_dma_m3m4_v2_stream.c  
-DMA2D         v1            arch/arm/src/common/stm32/stm32_dma2d_m3m4_v1.c    
   
+DMA2D         v1            arch/arm/src/common/stm32/stm32_dma2d_v1.c       
 ETH           to be done    arch/arm/src/common/stm32/stm32_eth_m3m4_v1.c      
   
 EXTI          v1            
arch/arm/src/common/stm32/stm32_exti_gpio_m3m4_v1v2.c 
 FLASH         F2/F4         arch/arm/src/common/stm32/stm32_flash_m3m4_f2f4.c  
   
@@ -539,7 +539,7 @@ ADC           to be done    arch/arm/src/stm32f7/stm32_adc.c
 CAN/FDCAN     bxCAN         arch/arm/src/stm32f7/stm32_can.c       
 DAC           to be done    not supported                          
 DMA           v2 style      arch/arm/src/stm32f7/stm32_dma.c       
-DMA2D         v1            arch/arm/src/stm32f7/stm32_dma2d.c     
+DMA2D         v1            arch/arm/src/common/stm32/stm32_dma2d_v1.c
 ETH           to be done    arch/arm/src/stm32f7/stm32_ethernet.c  
 EXTI          to be done    arch/arm/src/stm32f7/stm32_exti_gpio.c 
 FLASH         to be done    arch/arm/src/stm32f7/stm32_flash.c     
diff --git a/arch/arm/src/common/stm32/CMakeLists.txt 
b/arch/arm/src/common/stm32/CMakeLists.txt
index fc2c924ea91..98d909e394c 100644
--- a/arch/arm/src/common/stm32/CMakeLists.txt
+++ b/arch/arm/src/common/stm32/CMakeLists.txt
@@ -91,6 +91,10 @@ if(CONFIG_STM32_LTDC AND CONFIG_STM32_HAVE_IP_LTDC_V2)
   list(APPEND SRCS stm32_ltdc_v1v2.c)
 endif()
 
+if(CONFIG_STM32_DMA2D AND CONFIG_STM32_HAVE_IP_DMA2D_V1)
+  list(APPEND SRCS stm32_dma2d_v1.c)
+endif()
+
 if(CONFIG_STM32_SPI AND CONFIG_STM32_HAVE_IP_SPI_V5)
   list(APPEND SRCS stm32_spi_v5.c)
 endif()
@@ -362,10 +366,6 @@ if(CONFIG_STM32_COMMON_LEGACY)
     list(APPEND SRCS stm32_ltdc_v1v2.c)
   endif()
 
-  if(CONFIG_STM32_DMA2D AND CONFIG_STM32_HAVE_IP_DMA2D_M3M4_V1)
-    list(APPEND SRCS stm32_dma2d_m3m4_v1.c)
-  endif()
-
   if(CONFIG_STM32_PWM)
     list(APPEND SRCS stm32_pwm_m3m4_v1v2v3.c)
   endif()
diff --git a/arch/arm/src/common/stm32/Kconfig.have 
b/arch/arm/src/common/stm32/Kconfig.have
index 27d06661601..c2d2e3502b1 100644
--- a/arch/arm/src/common/stm32/Kconfig.have
+++ b/arch/arm/src/common/stm32/Kconfig.have
@@ -347,7 +347,7 @@ config STM32_HAVE_IP_DMA_V1_8CH_DMAMUX
 config STM32_HAVE_IP_DMA_V2_STREAM
        bool
 
-config STM32_HAVE_IP_DMA2D_M3M4_V1
+config STM32_HAVE_IP_DMA2D_V1
        bool
 
 # DTS capabilities
diff --git a/arch/arm/src/common/stm32/Kconfig.periph 
b/arch/arm/src/common/stm32/Kconfig.periph
index 648bfd93baa..fe35ed93cbe 100644
--- a/arch/arm/src/common/stm32/Kconfig.periph
+++ b/arch/arm/src/common/stm32/Kconfig.periph
@@ -122,12 +122,11 @@ config STM32_DMAMUX1
 
 config STM32_DMA2D
        bool "DMA2D"
-       depends on STM32_HAVE_DMA2D
-       select FB if STM32_COMMON_LEGACY && STM32_STM32F429 || 
ARCH_CHIP_STM32F7 && STM32_HAVE_DMA2D
-       select FB_OVERLAY if STM32_COMMON_LEGACY && STM32_STM32F429 || 
ARCH_CHIP_STM32F7 && STM32_HAVE_DMA2D
+       depends on STM32_HAVE_IP_DMA2D_V1
+       select FB
+       select FB_OVERLAY
        ---help---
-               The STM32 DMA2D is an Chrom-Art Accelerator for image 
manipulation
-               available on the STM32F429 and STM32F439 devices.
+               The STM32 DMA2D Chrom-Art Accelerator as framebuffer overlays.
 
 # CLOCK peripherals
 
diff --git a/arch/arm/src/common/stm32/Make.defs 
b/arch/arm/src/common/stm32/Make.defs
index d5982898682..4b212207bc7 100644
--- a/arch/arm/src/common/stm32/Make.defs
+++ b/arch/arm/src/common/stm32/Make.defs
@@ -102,6 +102,10 @@ ifeq 
($(CONFIG_STM32_LTDC)$(CONFIG_STM32_HAVE_IP_LTDC_V2),yy)
 CHIP_CSRCS += stm32_ltdc_v1v2.c
 endif
 
+ifeq ($(CONFIG_STM32_DMA2D)$(CONFIG_STM32_HAVE_IP_DMA2D_V1),yy)
+CHIP_CSRCS += stm32_dma2d_v1.c
+endif
+
 ifeq ($(CONFIG_STM32_SPI)$(CONFIG_STM32_HAVE_IP_SPI_V5),yy)
 CHIP_CSRCS += stm32_spi_v5.c
 endif
@@ -396,12 +400,6 @@ CHIP_CSRCS += stm32_ltdc_v1v2.c
 endif
 endif
 
-ifeq ($(CONFIG_STM32_DMA2D),y)
-ifeq ($(CONFIG_STM32_HAVE_IP_DMA2D_M3M4_V1),y)
-CHIP_CSRCS += stm32_dma2d_m3m4_v1.c
-endif
-endif
-
 ifeq ($(CONFIG_STM32_PWM),y)
 CHIP_CSRCS += stm32_pwm_m3m4_v1v2v3.c
 endif
diff --git a/arch/arm/src/common/stm32/stm32_dma2d.h 
b/arch/arm/src/common/stm32/stm32_dma2d.h
index 548dd220034..6793a004eba 100644
--- a/arch/arm/src/common/stm32/stm32_dma2d.h
+++ b/arch/arm/src/common/stm32/stm32_dma2d.h
@@ -29,8 +29,8 @@
 
 #include <nuttx/config.h>
 
-#if defined(CONFIG_STM32_COMMON_LEGACY)
-#  include "stm32_dma2d_m3m4_v1.h"
+#if defined(CONFIG_STM32_HAVE_IP_DMA2D_V1)
+#  include "stm32_dma2d_v1.h"
 #else
 #  error "Unsupported STM32 stm32_dma2d"
 #endif
diff --git a/arch/arm/src/common/stm32/stm32_dma2d_m3m4_v1.c 
b/arch/arm/src/common/stm32/stm32_dma2d_v1.c
similarity index 99%
rename from arch/arm/src/common/stm32/stm32_dma2d_m3m4_v1.c
rename to arch/arm/src/common/stm32/stm32_dma2d_v1.c
index f1c195a43cd..271ab94e8c8 100644
--- a/arch/arm/src/common/stm32/stm32_dma2d_m3m4_v1.c
+++ b/arch/arm/src/common/stm32/stm32_dma2d_v1.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * arch/arm/src/common/stm32/stm32_dma2d_m3m4_v1.c
+ * arch/arm/src/common/stm32/stm32_dma2d_v1.c
  *
  * SPDX-License-Identifier: Apache-2.0
  *
@@ -48,8 +48,8 @@
 #include "stm32.h"
 #include "hardware/stm32_ltdc.h"
 #include "hardware/stm32_dma2d.h"
-#include "stm32_dma2d_m3m4_v1.h"
-#include "stm32_dma2d_m3m4_v1.h"
+#include "stm32_dma2d_v1.h"
+#include "stm32_dma2d_v1.h"
 
 /****************************************************************************
  * Pre-processor Definitions
@@ -1092,9 +1092,7 @@ int stm32_dma2dinitialize(void)
 
       stm32_dma2duninitialize();
 
-      /* Enable dma2d is done in rcc_enableahb1, see
-       * arch/arm/src/stm32f4/stm32_rcc.c
-       */
+      /* The DMA2D clock is enabled by the chip RCC code */
 
 #ifdef CONFIG_STM32_FB_CMAP
       /* Enable dma2d transfer and clut loading interrupts only */
diff --git a/arch/arm/src/common/stm32/stm32_dma2d_m3m4_v1.h 
b/arch/arm/src/common/stm32/stm32_dma2d_v1.h
similarity index 96%
rename from arch/arm/src/common/stm32/stm32_dma2d_m3m4_v1.h
rename to arch/arm/src/common/stm32/stm32_dma2d_v1.h
index 5bc43e6da99..fb25ab1ecfa 100644
--- a/arch/arm/src/common/stm32/stm32_dma2d_m3m4_v1.h
+++ b/arch/arm/src/common/stm32/stm32_dma2d_v1.h
@@ -1,5 +1,5 @@
 /****************************************************************************
- * arch/arm/src/common/stm32/stm32_dma2d_m3m4_v1.h
+ * arch/arm/src/common/stm32/stm32_dma2d_v1.h
  *
  * SPDX-License-Identifier: Apache-2.0
  *
@@ -20,8 +20,8 @@
  *
  ****************************************************************************/
 
-#ifndef __ARCH_ARM_SRC_COMMON_STM32_STM32_DMA2D_H
-#define __ARCH_ARM_SRC_COMMON_STM32_STM32_DMA2D_H
+#ifndef __ARCH_ARM_SRC_COMMON_STM32_STM32_DMA2D_V1_H
+#define __ARCH_ARM_SRC_COMMON_STM32_STM32_DMA2D_V1_H
 
 /****************************************************************************
  * Included Files
@@ -189,4 +189,4 @@ int stm32_dma2dinitialize(void);
 void stm32_dma2duninitialize(void);
 
 #endif /* CONFIG_FB_OVERLAY */
-#endif /* __ARCH_ARM_SRC_COMMON_STM32_STM32_DMA2D_H */
+#endif /* __ARCH_ARM_SRC_COMMON_STM32_STM32_DMA2D_V1_H */
diff --git a/arch/arm/src/common/stm32/stm32_ltdc_v1v2.c 
b/arch/arm/src/common/stm32/stm32_ltdc_v1v2.c
index d5c0820eaf1..7b513f47ec8 100644
--- a/arch/arm/src/common/stm32/stm32_ltdc_v1v2.c
+++ b/arch/arm/src/common/stm32/stm32_ltdc_v1v2.c
@@ -50,7 +50,7 @@
 #include "hardware/stm32_ltdc.h"
 #include "hardware/stm32_dma2d.h"
 #include "stm32_ltdc_v1v2.h"
-#include "stm32_dma2d_m3m4_v1.h"
+#include "stm32_dma2d_v1.h"
 
 /****************************************************************************
  * Pre-processor Definitions
diff --git a/arch/arm/src/stm32f4/Kconfig b/arch/arm/src/stm32f4/Kconfig
index dd67699d26e..4d7666c519d 100644
--- a/arch/arm/src/stm32f4/Kconfig
+++ b/arch/arm/src/stm32f4/Kconfig
@@ -540,7 +540,7 @@ config STM32_STM32F429
        bool
        default n
        select STM32_HAVE_DMA2D
-       select STM32_HAVE_IP_DMA2D_M3M4_V1
+       select STM32_HAVE_IP_DMA2D_V1
        select STM32_HAVE_OVERDRIVE
        select STM32_HAVE_FMC
        select STM32_HAVE_LTDC
@@ -623,7 +623,7 @@ config STM32_STM32F469
        bool
        default n
        select STM32_HAVE_DMA2D
-       select STM32_HAVE_IP_DMA2D_M3M4_V1
+       select STM32_HAVE_IP_DMA2D_V1
        select STM32_HAVE_OVERDRIVE
        select STM32_HAVE_FMC
        select STM32_HAVE_LTDC
diff --git a/arch/arm/src/stm32f7/CMakeLists.txt 
b/arch/arm/src/stm32f7/CMakeLists.txt
index 535d8c2b510..602feb7425e 100644
--- a/arch/arm/src/stm32f7/CMakeLists.txt
+++ b/arch/arm/src/stm32f7/CMakeLists.txt
@@ -136,10 +136,6 @@ if(CONFIG_STM32_LTDC)
   list(APPEND SRCS stm32_ltdc.c)
 endif()
 
-if(CONFIG_STM32_DMA2D)
-  list(APPEND SRCS stm32_dma2d.c)
-endif()
-
 if(CONFIG_STM32_CAN_CHARDRIVER)
   list(APPEND SRCS stm32_can.c)
 endif()
diff --git a/arch/arm/src/stm32f7/Kconfig b/arch/arm/src/stm32f7/Kconfig
index d8ab3aa41bc..42a8cfb584b 100644
--- a/arch/arm/src/stm32f7/Kconfig
+++ b/arch/arm/src/stm32f7/Kconfig
@@ -884,7 +884,7 @@ config STM32_STM32F745XX
        select STM32_HAVE_SPI6 if !STM32F7_IO_CONFIG_V
        select STM32_HAVE_DCMI
        select STM32_HAVE_DMA2D
-       select STM32_HAVE_IP_DMA2D_M3M4_V1
+       select STM32_HAVE_IP_DMA2D_V1
        select STM32_HAVE_CAN2
        select STM32_HAVE_SPI4
 
@@ -905,7 +905,7 @@ config STM32_STM32F746XX
        select STM32_HAVE_DCMI
        select STM32_HAVE_LTDC
        select STM32_HAVE_DMA2D
-       select STM32_HAVE_IP_DMA2D_M3M4_V1
+       select STM32_HAVE_IP_DMA2D_V1
        select STM32_HAVE_CAN2
        select STM32_HAVE_SPI4
        select STM32_HAVE_EXTERNAL_ULPI
@@ -928,7 +928,7 @@ config STM32_STM32F756XX
        select STM32_HAVE_SPI6 if !STM32F7_IO_CONFIG_V
        select STM32_HAVE_LTDC
        select STM32_HAVE_DMA2D
-       select STM32_HAVE_IP_DMA2D_M3M4_V1
+       select STM32_HAVE_IP_DMA2D_V1
        select STM32_HAVE_CRYP
        select STM32_HAVE_IP_CRYPTO_M3M4_V1
        select STM32_HAVE_HASH
@@ -954,7 +954,7 @@ config STM32_STM32F765XX
        select STM32_HAVE_CAN3
        select STM32_HAVE_DCMI
        select STM32_HAVE_DMA2D
-       select STM32_HAVE_IP_DMA2D_M3M4_V1
+       select STM32_HAVE_IP_DMA2D_V1
        select STM32_HAVE_DFSDM1
        select STM32_HAVE_CAN2
        select STM32_HAVE_SPI4
@@ -980,7 +980,7 @@ config STM32_STM32F767XX
        select STM32_HAVE_DSIHOST if !(STM32F7_IO_CONFIG_V || 
STM32F7_IO_CONFIG_Z)
        select STM32_HAVE_LTDC
        select STM32_HAVE_DMA2D
-       select STM32_HAVE_IP_DMA2D_M3M4_V1
+       select STM32_HAVE_IP_DMA2D_V1
        select STM32_HAVE_JPEG
        select STM32_HAVE_DFSDM1
        select STM32_HAVE_CAN2
@@ -1007,7 +1007,7 @@ config STM32_STM32F768XX # Revisit When parts released
        select STM32_HAVE_DSIHOST if !(STM32F7_IO_CONFIG_V || 
STM32F7_IO_CONFIG_Z)
        select STM32_HAVE_LTDC
        select STM32_HAVE_DMA2D
-       select STM32_HAVE_IP_DMA2D_M3M4_V1
+       select STM32_HAVE_IP_DMA2D_V1
        select STM32_HAVE_JPEG
        select STM32_HAVE_DFSDM1
        select STM32_HAVE_CAN2
@@ -1033,7 +1033,7 @@ config STM32_STM32F768AX # Revisit When parts released
        select STM32_HAVE_DSIHOST
        select STM32_HAVE_LTDC
        select STM32_HAVE_DMA2D
-       select STM32_HAVE_IP_DMA2D_M3M4_V1
+       select STM32_HAVE_IP_DMA2D_V1
        select STM32_HAVE_JPEG
        select STM32_HAVE_DFSDM1
        select STM32_HAVE_CAN2
@@ -1060,7 +1060,7 @@ config STM32_STM32F769XX
        select STM32_HAVE_DSIHOST if !(STM32F7_IO_CONFIG_V || 
STM32F7_IO_CONFIG_Z)
        select STM32_HAVE_LTDC
        select STM32_HAVE_DMA2D
-       select STM32_HAVE_IP_DMA2D_M3M4_V1
+       select STM32_HAVE_IP_DMA2D_V1
        select STM32_HAVE_JPEG
        select STM32_HAVE_DFSDM1
        select STM32_HAVE_CAN2
@@ -1086,7 +1086,7 @@ config STM32_STM32F769AX # Revisit When parts released
        select STM32_HAVE_DSIHOST
        select STM32_HAVE_LTDC
        select STM32_HAVE_DMA2D
-       select STM32_HAVE_IP_DMA2D_M3M4_V1
+       select STM32_HAVE_IP_DMA2D_V1
        select STM32_HAVE_JPEG
        select STM32_HAVE_DFSDM1
        select STM32_HAVE_CAN2
@@ -1113,7 +1113,7 @@ config STM32_STM32F777XX
        select STM32_HAVE_DSIHOST if !(STM32F7_IO_CONFIG_V || 
STM32F7_IO_CONFIG_Z)
        select STM32_HAVE_LTDC
        select STM32_HAVE_DMA2D
-       select STM32_HAVE_IP_DMA2D_M3M4_V1
+       select STM32_HAVE_IP_DMA2D_V1
        select STM32_HAVE_JPEG
        select STM32_HAVE_CRYP
        select STM32_HAVE_IP_CRYPTO_M3M4_V1
@@ -1143,7 +1143,7 @@ config STM32_STM32F778XX # Revisit when parts released
        select STM32_HAVE_DSIHOST
        select STM32_HAVE_LTDC
        select STM32_HAVE_DMA2D
-       select STM32_HAVE_IP_DMA2D_M3M4_V1
+       select STM32_HAVE_IP_DMA2D_V1
        select STM32_HAVE_JPEG
        select STM32_HAVE_CRYP
        select STM32_HAVE_IP_CRYPTO_M3M4_V1
@@ -1172,7 +1172,7 @@ config STM32_STM32F778AX
        select STM32_HAVE_DSIHOST
        select STM32_HAVE_LTDC
        select STM32_HAVE_DMA2D
-       select STM32_HAVE_IP_DMA2D_M3M4_V1
+       select STM32_HAVE_IP_DMA2D_V1
        select STM32_HAVE_JPEG
        select STM32_HAVE_CRYP
        select STM32_HAVE_IP_CRYPTO_M3M4_V1
@@ -1202,7 +1202,7 @@ config STM32_STM32F779XX
        select STM32_HAVE_DSIHOST if !(STM32F7_IO_CONFIG_V || 
STM32F7_IO_CONFIG_Z)
        select STM32_HAVE_LTDC
        select STM32_HAVE_DMA2D
-       select STM32_HAVE_IP_DMA2D_M3M4_V1
+       select STM32_HAVE_IP_DMA2D_V1
        select STM32_HAVE_JPEG
        select STM32_HAVE_CRYP
        select STM32_HAVE_IP_CRYPTO_M3M4_V1
@@ -1231,7 +1231,7 @@ config STM32_STM32F779AX
        select STM32_HAVE_DSIHOST if !(STM32F7_IO_CONFIG_V || 
STM32F7_IO_CONFIG_Z)
        select STM32_HAVE_LTDC
        select STM32_HAVE_DMA2D
-       select STM32_HAVE_IP_DMA2D_M3M4_V1
+       select STM32_HAVE_IP_DMA2D_V1
        select STM32_HAVE_JPEG
        select STM32_HAVE_CRYP
        select STM32_HAVE_IP_CRYPTO_M3M4_V1
diff --git a/arch/arm/src/stm32f7/Make.defs b/arch/arm/src/stm32f7/Make.defs
index fb42c00821b..4a21b83eda7 100644
--- a/arch/arm/src/stm32f7/Make.defs
+++ b/arch/arm/src/stm32f7/Make.defs
@@ -137,10 +137,6 @@ ifeq ($(CONFIG_STM32_LTDC),y)
 CHIP_CSRCS += stm32_ltdc.c
 endif
 
-ifeq ($(CONFIG_STM32_DMA2D),y)
-CHIP_CSRCS += stm32_dma2d.c
-endif
-
 
 ifeq ($(CONFIG_STM32_CAN_CHARDRIVER),y)
 CHIP_CSRCS += stm32_can.c
diff --git a/arch/arm/src/stm32f7/hardware/stm32_dma2d.h 
b/arch/arm/src/stm32f7/hardware/stm32_dma2d.h
deleted file mode 100644
index fa266cffd1e..00000000000
--- a/arch/arm/src/stm32f7/hardware/stm32_dma2d.h
+++ /dev/null
@@ -1,237 +0,0 @@
-/****************************************************************************
- * arch/arm/src/stm32f7/hardware/stm32_dma2d.h
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- * 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_HARDWARE_STM32_DMA2D_H
-#define __ARCH_ARM_SRC_STM32F7_HARDWARE_STM32_DMA2D_H
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include <nuttx/config.h>
-#include "hardware/stm32_memorymap.h"
-
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-
-#define STM32_DMA2D_NCLUT           256    /* Number of entries in the CLUT */
-
-/* DMA2D Register Offsets ***************************************************/
-
-#define STM32_DMA2D_CR_OFFSET       0x0000 /* DMA2D Control Register */
-#define STM32_DMA2D_ISR_OFFSET      0x0004 /* DMA2D Interrupt Status Register 
*/
-#define STM32_DMA2D_IFCR_OFFSET     0x0008 /* DMA2D Interrupt Flag Clear 
Register */
-#define STM32_DMA2D_FGMAR_OFFSET    0x000C /* DMA2D Foreground Memory Address 
Register */
-#define STM32_DMA2D_FGOR_OFFSET     0x0010 /* DMA2D Foreground Offset Register 
*/
-#define STM32_DMA2D_BGMAR_OFFSET    0x0014 /* DMA2D Background Memory Address 
Register */
-#define STM32_DMA2D_BGOR_OFFSET     0x0018 /* DMA2D Background Offset Register 
*/
-#define STM32_DMA2D_FGPFCCR_OFFSET  0x001C /* DMA2D Foreground PFC Control 
Register */
-#define STM32_DMA2D_FGCOLR_OFFSET   0x0020 /* DMA2D Foreground Color Register 
*/
-#define STM32_DMA2D_BGPFCCR_OFFSET  0x0024 /* DMA2D Background PFC Control 
Register */
-#define STM32_DMA2D_BGCOLR_OFFSET   0x0028 /* DMA2D Background Color Register 
*/
-#define STM32_DMA2D_FGCMAR_OFFSET   0x002C /* DMA2D Foreground CLUT Memory 
Address Register */
-#define STM32_DMA2D_BGCMAR_OFFSET   0x0030 /* DMA2D Background CLUT Memory 
Address Register */
-#define STM32_DMA2D_OPFCCR_OFFSET   0x0034 /* DMA2D Output PFC Control 
Register */
-#define STM32_DMA2D_OCOLR_OFFSET    0x0038 /* DMA2D Output Color Register */
-#define STM32_DMA2D_OMAR_OFFSET     0x003C /* DMA2D Output Memory Address 
Register */
-#define STM32_DMA2D_OOR_OFFSET      0x0040 /* DMA2D Output Offset Register */
-#define STM32_DMA2D_NLR_OFFSET      0x0044 /* DMA2D Number Of Line Register */
-#define STM32_DMA2D_LWR_OFFSET      0x0048 /* DMA2D Line Watermark Register */
-#define STM32_DMA2D_AMTCR_OFFSET    0x004c /* DMA2D AHB Master Time 
Configuration Register */
-
-/* DMA2D Register Addresses *************************************************/
-
-#define STM32_DMA2D_CR              (STM32_DMA2D_BASE + STM32_DMA2D_CR_OFFSET)
-#define STM32_DMA2D_ISR             (STM32_DMA2D_BASE + STM32_DMA2D_ISR_OFFSET)
-#define STM32_DMA2D_IFCR            (STM32_DMA2D_BASE + 
STM32_DMA2D_IFCR_OFFSET)
-#define STM32_DMA2D_FGMAR           (STM32_DMA2D_BASE + 
STM32_DMA2D_FGMAR_OFFSET)
-#define STM32_DMA2D_FGOR            (STM32_DMA2D_BASE + 
STM32_DMA2D_FGOR_OFFSET)
-#define STM32_DMA2D_BGMAR           (STM32_DMA2D_BASE + 
STM32_DMA2D_BGMAR_OFFSET)
-#define STM32_DMA2D_BGOR            (STM32_DMA2D_BASE + 
STM32_DMA2D_BGOR_OFFSET)
-#define STM32_DMA2D_FGPFCCR         (STM32_DMA2D_BASE + 
STM32_DMA2D_FGPFCCR_OFFSET)
-#define STM32_DMA2D_FGCOLR          (STM32_DMA2D_BASE + 
STM32_DMA2D_FGCOLR_OFFSET)
-#define STM32_DMA2D_BGPFCCR         (STM32_DMA2D_BASE + 
STM32_DMA2D_BGPFCCR_OFFSET)
-#define STM32_DMA2D_BGCOLR          (STM32_DMA2D_BASE + 
STM32_DMA2D_BGCOLR_OFFSET)
-#define STM32_DMA2D_FGCMAR          (STM32_DMA2D_BASE + 
STM32_DMA2D_FGCMAR_OFFSET)
-#define STM32_DMA2D_BGCMAR          (STM32_DMA2D_BASE + 
STM32_DMA2D_BGCMAR_OFFSET)
-#define STM32_DMA2D_OPFCCR          (STM32_DMA2D_BASE + 
STM32_DMA2D_OPFCCR_OFFSET)
-#define STM32_DMA2D_OCOLR           (STM32_DMA2D_BASE + 
STM32_DMA2D_OCOLR_OFFSET)
-#define STM32_DMA2D_OMAR            (STM32_DMA2D_BASE + 
STM32_DMA2D_OMAR_OFFSET)
-#define STM32_DMA2D_OOR             (STM32_DMA2D_BASE + STM32_DMA2D_OOR_OFFSET)
-#define STM32_DMA2D_NLR             (STM32_DMA2D_BASE + STM32_DMA2D_NLR_OFFSET)
-#define STM32_DMA2D_LWR             (STM32_DMA2D_BASE + STM32_DMA2D_LWR_OFFSET)
-
-/* DMA2D Register Bit Definitions *******************************************/
-
-/* DMA2D Control Register */
-
-#define DMA2D_CR_START              (1 << 0)  /* Start Bit */
-#define DMA2D_CR_SUSP               (1 << 1)  /* Suspend Bit */
-#define DMA2D_CR_ABORT              (1 << 2)  /* Abort Bit */
-#define DMA2D_CR_TEIE               (1 << 8)  /* Transfer Error Interrupt 
Enable Bit */
-#define DMA2D_CR_TCIE               (1 << 9)  /* Transfer Complete Interrupt 
Enable Bit */
-#define DMA2D_CR_TWIE               (1 << 10) /* Transfer Watermark Interrupt 
Enable Bit */
-#define DMA2D_CR_CAEIE              (1 << 11) /* CLUT Access Error Interrupt 
Enable Bit */
-#define DMA2D_CR_CTCIE              (1 << 12) /* CLUT Transfer Complete 
Interrupt Enable Bit */
-#define DMA2D_CR_CEIE               (1 << 13) /* Configuration Error Interrupt 
Enable Bit */
-#define DMA2D_CR_MODE_SHIFT         (16)      /* Bits 16-17 DMA2D mode Bits */
-#define DMA2D_CR_MODE_MASK          (3 << DMA2D_CR_MODE_SHIFT)
-#define DMA2D_CR_MODE(n)            ((uint32_t)(n) << DMA2D_CR_MODE_SHIFT)
-
-/* DMA2D Interrupt Status Register */
-
-#define DMA2D_ISR_TEIF              (1 << 0)  /* Transfer error interrupt flag 
*/
-#define DMA2D_ISR_TCIF              (1 << 1)  /* Transfer Complete Interrupt 
flag */
-#define DMA2D_ISR_TWIF              (1 << 2)  /* Transfer Watermark Interrupt 
flag */
-#define DMA2D_ISR_CAEIF             (1 << 3)  /* CLUT Access Error Interrupt 
flag */
-#define DMA2D_ISR_CTCIF             (1 << 4)  /* CLUT Transfer Complete 
Interrupt flag */
-#define DMA2D_ISR_CEIF              (1 << 5)  /* Configuration Error Interrupt 
flag */
-
-/* DMA2D Interrupt Flag Clear Register */
-
-#define DMA2D_IFCR_CTEIF            (1 << 0)  /* Clear Transfer Interrupt Flag 
*/
-#define DMA2D_IFCR_CTCIF            (1 << 1)  /* Clear Transfer Complete 
Interrupt Flag */
-#define DMA2D_IFCR_CTWIF            (1 << 2)  /* Clear Transfer Watermark 
Interrupt Flag */
-#define DMA2D_IFCR_CAECIF           (1 << 3)  /* Clear CLUT Access Error 
Interrupt Flag */
-#define DMA2D_IFCR_CCTCIF           (1 << 4)  /* Clear CLUT Transfer Complete 
Interrupt Flag */
-#define DMA2D_IFCR_CCEIF            (1 << 5)  /* Clear Configuration Error 
Interrupt Flag */
-
-/* DMA2D Foreground Memory Access Register */
-
-/* DMA2D Background Memory Access Register */
-
-/* DMA2D Foreground/Background Offset Register */
-
-#define DMA2D_XGOR_SHIFT            (0)       /* Bits 0-13 Line Offset */
-#define DMA2D_XGOR_MASK             (0x3fff << DMA2D_XGOR_SHIFT)
-#define DMA2D_XGOR(n)               ((uint32_t)(n) << DMA2D_XGOR_SHIFT)
-
-/* DMA2D Foreground/Background PFC Control Register */
-
-#define DMA2D_XGPFCCR_CM_SHIFT      (0)       /* Bits 0-3 Color Mode */
-#define DMA2D_XGPFCCR_CM_MASK       (0xf << DMA2D_XGPFCCR_CM_SHIFT)
-#define DMA2D_XGPFCCR_CM(n)         ((uint32_t)(n) << DMA2D_XGPFCCR_CM_SHIFT)
-#define DMA2D_XGPFCCR_CCM           (1 << 4)  /* CLUT Color Mode */
-#define DMA2D_XGPFCCR_START         (1 << 5)  /* Start */
-#define DMA2D_XGPFCCR_CS_SHIFT      (8)       /* Bits 8-15 CLUT Size */
-#define DMA2D_XGPFCCR_CS_MASK       (0xff << DMA2D_XGPFCCR_CS_SHIFT)
-#define DMA2D_XGPFCCR_CS(n)         ((uint32_t)(n) << DMA2D_XGPFCCR_CS_SHIFT)
-#define DMA2D_XGPFCCR_AM_SHIFT      (16)      /* Bits 16-17 Alpha Mode */
-#define DMA2D_XGPFCCR_AM_MASK       (3 << DMA2D_XGPFCCR_AM_SHIFT)
-#define DMA2D_XGPFCCR_AM(n)         ((uint32_t)(n) << DMA2D_XGPFCCR_AM_SHIFT)
-#define DMA2D_XGPFCCR_ALPHA_SHIFT   (24)      /* Bits 24-31 Alpha Value */
-#define DMA2D_XGPFCCR_ALPHA_MASK    (0xff << DMA2D_XGPFCCR_ALPHA_SHIFT)
-#define DMA2D_XGPFCCR_ALPHA(n)      ((uint32_t)(n) << 
DMA2D_XGPFCCR_ALPHA_SHIFT)
-
-/* DMA2D PFC alpha mode */
-
-#define STM32_DMA2D_PFCCR_AM_NONE   0
-#define STM32_DMA2D_PFCCR_AM_CONST  1
-#define STM32_DMA2D_PFCCR_AM_PIXEL  2
-
-/* DMA2D Foreground/Background Color Register */
-
-#define DMA2D_XGCOLR_BLUE_SHIFT     (0)       /* Bits 0-7 Blue Value */
-#define DMA2D_XGCOLR_BLUE_MASK      (0xff << DMA2D_XGCOLR_BLUE_SHIFT)
-#define DMA2D_XGCOLR_BLUE(n)        ((uint32_t)(n) << DMA2D_XGCOLR_BLUE_SHIFT)
-#define DMA2D_XGCOLR_GREEN_SHIFT    (8)       /* Bits 8-15 Green Value */
-#define DMA2D_XGCOLR_GREEN_MASK     (0xff << DMA2D_XGCOLR_GREEN_SHIFT)
-#define DMA2D_XGCOLR_GREEN(n)       ((uint32_t)(n) << DMA2D_XGCOLR_GREEN_SHIFT)
-#define DMA2D_XGCOLR_RED_SHIFT      (16)      /* Bits 16-23 Red Value */
-#define DMA2D_XGCOLR_RED_MASK       (0xff << DMA2D_XGCOLR_RED_SHIFT)
-#define DMA2D_XGCOLR_RED(n)         ((uint32_t)(n) << DMA2D_XGCOLR_RED_SHIFT)
-
-/* DMA2D Foreground CLUT Memory Address Register */
-
-/* DMA2D Background CLUT Memory Address Register */
-
-/* DMA2D Output PFC Control Register */
-
-#define DMA2D_OPFCCR_CM_SHIFT       (0)       /* Bits 0-2 Color Mode */
-#define DMA2D_OPFCCR_CM_MASK        (7 << DMA2D_OPFCCR_CM_SHIFT)
-#define DMA2D_OPFCCR_CM(n)          ((uint32_t)(n) << DMA2D_OPFCCR_CM_SHIFT)
-
-/* DMA2D PFC Pixel Format */
-
-#define DMA2D_PF_ARGB8888           0
-#define DMA2D_PF_RGB888             1
-#define DMA2D_PF_RGB565             2
-#define DMA2D_PF_ARGB1555           3
-#define DMA2D_PF_ARGB14444          4
-#define DMA2D_PF_L8                 5
-#define DMA2D_PF_AL44               6
-#define DMA2D_PF_AL88               7
-#define DMA2D_PF_L4                 8
-#define DMA2D_PF_A8                 9
-#define DMA2D_PF_A4                 10
-
-/* DMA2D Output Color Register */
-
-#define DMA2D_OCOLR_BLUE_SHIFT      (0)       /* Bits 0-7 Blue Value */
-#define DMA2D_OCOLR_BLUE_MASK       (0xff << DMA2D_OCOLR_BLUE_SHIFT)
-#define DMA2D_OCOLR_BLUE(n)         ((uint32_t)(n) << DMA2D_OCOLR_BLUE_SHIFT)
-#define DMA2D_OCOLR_GREEN_SHIFT     (8)       /* Bits 8-15 Green Value */
-#define DMA2D_OCOLR_GREEN_MASK      (0xff << DMA2D_OCOLR_GREEN_SHIFT)
-#define DMA2D_OCOLR_GREEN(n)        ((uint32_t)(n) << DMA2D_OCOLR_GREEN_SHIFT)
-#define DMA2D_OCOLR_RED_SHIFT       (16)      /* Bits 16-23 Red Value */
-#define DMA2D_OCOLR_RED_MASK        (0xff << DMA2D_OCOLR_RED_SHIFT)
-#define DMA2D_OCOLR_RED(n)          ((uint32_t)(n) << DMA2D_OCOLR_RED_SHIFT)
-#define DMA2D_OCOLR_ALPHA_SHIFT     (24)      /* Bits 24-31 Alpha Value */
-#define DMA2D_OCOLR_ALPHA_MASK      (0xff << DMA2D_OCOLR_ALPHA_SHIFT)
-#define DMA2D_OCOLR_ALPHA(n)        ((uint32_t)(n) << DMA2D_OCOLR_ALPHA_SHIFT)
-
-/* DMA2D Output Memory Address Register */
-
-/* DMA2D Output Offset Register */
-
-#define DMA2D_OOR_LO_SHIFT          (0)       /* Bits 0-13 Line Offset */
-#define DMA2D_OOR_LO_MASK           (0x3fff << DMA2D_OOR_LO_SHIFT)
-#define DMA2D_OOR_LO(n)             ((uint32_t)(n) << DMA2D_OOR_LO_SHIFT)
-
-/* DMA2D Number Of Line Register */
-
-#define DMA2D_NLR_NL_SHIFT          (0)       /* Bits 0-15 Number Of Lines */
-#define DMA2D_NLR_NL_MASK           (0xffff << DMA2D_NLR_NL_SHIFT)
-#define DMA2D_NLR_NL(n)             ((uint32_t)(n) << DMA2D_NLR_NL_SHIFT)
-#define DMA2D_NLR_PL_SHIFT          (16)      /* Bits 16-29 Pixel per Lines */
-#define DMA2D_NLR_PL_MASK           (0x3fff << DMA2D_NLR_PL_SHIFT)
-#define DMA2D_NLR_PL(n)             ((uint32_t)(n) << DMA2D_NLR_PL_SHIFT)
-
-/* DMA2D Line Watermark Register */
-
-#define DMA2D_LWR_LW_SHIFT          (0)       /* Bits 0-15 Line Watermark */
-#define DMA2D_LWR_LW_MASK           (0xffff << DMA2D_LWR_LW_SHIFT)
-#define DMA2D_LWR_LW(n)             ((uint32_t)(n) << DMA2D_LWR_LW_SHIFT)
-
-/* DMA2D AHB Master Timer Configuration Register */
-
-#define DMA2D_AMTCR_EN              (1 << 0)  /* Enable */
-#define DMA2D_AMTCR_DT_SHIFT        (0)       /* Bits 8-15 Dead Time */
-#define DMA2D_AMTCR_DT_MASK         (0xff << DMA2D_AMTCR_DT_SHIFT)
-#define DMA2D_AMTCR_DT(n)           ((uint32_t)(n) << DMA2D_AMTCR_DT_SHIFT)
-
-/****************************************************************************
- * Public Types
- ****************************************************************************/
-
-#endif /* __ARCH_ARM_SRC_STM32F7_HARDWARE_STM32_DMA2D_H */
diff --git a/arch/arm/src/stm32f7/stm32_dma2d.c 
b/arch/arm/src/stm32f7/stm32_dma2d.c
deleted file mode 100644
index cb8cdc15fe6..00000000000
--- a/arch/arm/src/stm32f7/stm32_dma2d.c
+++ /dev/null
@@ -1,1167 +0,0 @@
-/****************************************************************************
- * arch/arm/src/stm32f7/stm32_dma2d.c
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- * 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
- */
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include <nuttx/config.h>
-
-#include <stdint.h>
-#include <string.h>
-#include <assert.h>
-#include <errno.h>
-
-#include <nuttx/debug.h>
-#include <nuttx/irq.h>
-#include <nuttx/kmalloc.h>
-#include <nuttx/mutex.h>
-#include <nuttx/video/fb.h>
-
-#include <arch/board/board.h>
-
-#include "arm_internal.h"
-#include "hardware/stm32_ltdc.h"
-#include "hardware/stm32_dma2d.h"
-#include "hardware/stm32_dtcm.h"
-#include "stm32_dma2d.h"
-#include "stm32_ltdc.h"
-#include "stm32_gpio.h"
-
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-
-/* DMA2D supported operation layer (output, foreground, background) */
-
-#define DMA2D_NLAYERS                       3
-
-/* DMA2D blender control */
-
-#define STM32_DMA2D_CR_MODE_BLIT            DMA2D_CR_MODE(0)
-#define STM32_DMA2D_CR_MODE_BLITPFC         DMA2D_CR_MODE(1)
-#define STM32_DMA2D_CR_MODE_BLEND           DMA2D_CR_MODE(2)
-#define STM32_DMA2D_CR_MODE_COLOR           DMA2D_CR_MODE(3)
-#define STM32_DMA2D_CR_MODE_CLEAR           STM32_DMA2D_CR_MODE_BLITPFC | \
-                                            STM32_DMA2D_CR_MODE_BLEND   | \
-                                            STM32_DMA2D_CR_MODE_COLOR
-
-/* Only 8 bit per pixel overall supported */
-
-#define DMA2D_PF_BYPP(n)                    ((n) / 8)
-
-/* CC clut size */
-
-#define DMA2D_CLUT_SIZE                     STM32_DMA2D_NCLUT - 1
-
-/* Layer argb cmap conversion */
-
-#define DMA2D_CLUT_ALPHA(n)                 ((uint32_t)(n) << 24)
-#define DMA2D_CLUT_RED(n)                   ((uint32_t)(n) << 16)
-#define DMA2D_CLUT_GREEN(n)                 ((uint32_t)(n) << 8)
-#define DMA2D_CLUT_BLUE(n)                  ((uint32_t)(n) << 0)
-
-#define DMA2D_CMAP_ALPHA(n)                 ((uint32_t)(n) >> 24)
-#define DMA2D_CMAP_RED(n)                   ((uint32_t)(n) >> 16)
-#define DMA2D_CMAP_GREEN(n)                 ((uint32_t)(n) >> 8)
-#define DMA2D_CMAP_BLUE(n)                  ((uint32_t)(n) >> 0)
-
-/* Debug option */
-
-#ifdef CONFIG_STM32_DMA2D_REGDEBUG
-#  define regerr                            lcderr
-#  define reginfo                           lcdinfo
-#else
-#  define regerr(x...)
-#  define reginfo(x...)
-#endif
-
-/****************************************************************************
- * Private Types
- ****************************************************************************/
-
-/* DMA2D General layer information */
-
-struct stm32_dma2d_s
-{
-  struct dma2d_layer_s dma2d;  /* Public dma2d interface */
-
-#ifdef CONFIG_STM32_FB_CMAP
-  uint32_t *clut;              /* Color lookup table */
-#endif
-
-  mutex_t *lock;               /* Ensure mutually exclusive access */
-};
-
-/* Interrupt handling */
-
-struct stm32_interrupt_s
-{
-  int irq;                     /* irq number */
-  int error;                   /* Interrupt error */
-  sem_t *sem;                  /* Semaphore for waiting for irq */
-};
-
-/* This enumeration foreground and background layer supported by the dma2d
- * controller
- */
-
-enum stm32_layer_e
-{
-  DMA2D_LAYER_LFORE = 0,       /* Foreground Layer */
-  DMA2D_LAYER_LBACK,           /* Background Layer */
-  DMA2D_LAYER_LOUT,            /* Output Layer */
-};
-
-/* DMA2D memory address register */
-
-static const uintptr_t stm32_mar_layer_t[DMA2D_NLAYERS] =
-{
-  STM32_DMA2D_FGMAR,
-  STM32_DMA2D_BGMAR,
-  STM32_DMA2D_OMAR
-};
-
-/* DMA2D offset register */
-
-static const uintptr_t stm32_or_layer_t[DMA2D_NLAYERS] =
-{
-  STM32_DMA2D_FGOR,
-  STM32_DMA2D_BGOR,
-  STM32_DMA2D_OOR
-};
-
-/* DMA2D pfc control register */
-
-static const uintptr_t stm32_pfccr_layer_t[DMA2D_NLAYERS] =
-{
-  STM32_DMA2D_FGPFCCR,
-  STM32_DMA2D_BGPFCCR,
-  STM32_DMA2D_OPFCCR
-};
-
-/* DMA2D color register */
-
-static const uintptr_t stm32_color_layer_t[DMA2D_NLAYERS] =
-{
-  STM32_DMA2D_FGCOLR,
-  STM32_DMA2D_BGCOLR,
-  STM32_DMA2D_OCOLR
-};
-
-#ifdef CONFIG_STM32_FB_CMAP
-/* DMA2D clut memory address register */
-
-static const uintptr_t stm32_cmar_layer_t[DMA2D_NLAYERS - 1] =
-{
-  STM32_DMA2D_FGCMAR,
-  STM32_DMA2D_BGCMAR
-};
-#endif
-
-/****************************************************************************
- * Private Function Prototypes
- ****************************************************************************/
-
-/* Private functions */
-
-static void stm32_dma2d_control(uint32_t setbits, uint32_t clrbits);
-static int stm32_dma2dirq(int irq, void *context, void *arg);
-static int stm32_dma2d_waitforirq(void);
-static int stm32_dma2d_start(void);
-#ifdef CONFIG_STM32_FB_CMAP
-static int stm32_dma2d_loadclut(uintptr_t reg);
-#endif
-static uint32_t
-stm32_dma2d_memaddress(struct stm32_dma2d_overlay_s *oinfo,
-                       uint32_t xpos, uint32_t ypos);
-static uint32_t
-stm32_dma2d_lineoffset(struct stm32_dma2d_overlay_s *oinfo,
-                       const struct fb_area_s *area);
-static void stm32_dma2d_lfifo(struct stm32_dma2d_overlay_s *oinfo,
-                              int lid, uint32_t xpos, uint32_t ypos,
-                              const struct fb_area_s *area);
-static void stm32_dma2d_lcolor(int lid, uint32_t argb);
-static void stm32_dma2d_llnr(const struct fb_area_s *area);
-static int stm32_dma2d_loutpfc(uint8_t fmt);
-static void stm32_dma2d_lpfc(int lid, uint32_t blendmode, uint8_t alpha,
-                             uint8_t fmt);
-
-/* Public Functions */
-
-#ifdef CONFIG_STM32_FB_CMAP
-static int stm32_dma2d_setclut(const struct fb_cmap_s *cmap);
-#endif
-static int stm32_dma2d_fillcolor(struct stm32_dma2d_overlay_s *oinfo,
-                                 const struct fb_area_s *area,
-                                 uint32_t argb);
-static int stm32_dma2d_blit(struct stm32_dma2d_overlay_s *doverlay,
-                            uint32_t destxpos, uint32_t destypos,
-                            struct stm32_dma2d_overlay_s *soverlay,
-                            const struct fb_area_s *sarea);
-static int stm32_dma2d_blend(struct stm32_dma2d_overlay_s *doverlay,
-                             uint32_t destxpos, uint32_t destypos,
-                             struct stm32_dma2d_overlay_s *foverlay,
-                             uint32_t forexpos, uint32_t foreypos,
-                             struct stm32_dma2d_overlay_s *boverlay,
-                             const struct fb_area_s *barea);
-
-/****************************************************************************
- * Private Data
- ****************************************************************************/
-
-/* The initialized state of the driver */
-
-static bool g_initialized;
-
-/* Allocate clut */
-
-#ifdef CONFIG_STM32_FB_CMAP
-static uint32_t g_clut[STM32_DMA2D_NCLUT *
-#  ifdef CONFIG_STM32_FB_TRANSPARENCY
-                      4
-#  else
-                      3
-#  endif
-                      / 4];
-#endif /* CONFIG_STM32_FB_CMAP */
-
-/* The DMA2D mutex that enforces mutually exclusive access */
-
-static mutex_t g_lock = NXMUTEX_INITIALIZER;
-
-/* Semaphore for interrupt handling */
-
-static sem_t g_semirq = SEM_INITIALIZER(0);
-
-/* This structure provides irq handling */
-
-static struct stm32_interrupt_s g_interrupt =
-{
-  .irq     = STM32_IRQ_DMA2D,
-  .error   = OK,
-  .sem     = &g_semirq
-};
-
-static struct stm32_dma2d_s g_dma2ddev =
-{
-  .dma2d =
-  {
-#ifdef CONFIG_STM32_FB_CMAP
-    .setclut   = stm32_dma2d_setclut,
-#endif
-    .fillcolor = stm32_dma2d_fillcolor,
-    .blit      = stm32_dma2d_blit,
-    .blend     = stm32_dma2d_blend
-  },
-#ifdef CONFIG_STM32_FB_CMAP
-  .clut = g_clut,
-#endif
-  .lock = &g_lock
-};
-
-/****************************************************************************
- * Public Data
- ****************************************************************************/
-
-/****************************************************************************
- * Private Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: stm32_dma2d_control
- *
- * Description:
- *   Change the DMA2D control register
- *
- * Input Parameters:
- *   setbits - The bits to set
- *   clrbits - The bits to clear
- *
- ****************************************************************************/
-
-static void stm32_dma2d_control(uint32_t setbits, uint32_t clrbits)
-{
-  uint32_t   cr;
-
-  lcdinfo("setbits=%08" PRIx32 ", clrbits=%08" PRIx32 "\n",
-          setbits, clrbits);
-
-  cr = getreg32(STM32_DMA2D_CR);
-  cr &= ~clrbits;
-  cr |= setbits;
-
-  lcdinfo("cr=%08" PRIx32 "\n", cr);
-  putreg32(cr, STM32_DMA2D_CR);
-}
-
-/****************************************************************************
- * Name: stm32_dma2dirq
- *
- * Description:
- *   DMA2D interrupt handler
- *
- ****************************************************************************/
-
-static int stm32_dma2dirq(int irq, void *context, void *arg)
-{
-  int ret;
-  uint32_t regval = getreg32(STM32_DMA2D_ISR);
-  struct stm32_interrupt_s *priv = &g_interrupt;
-
-  reginfo("irq = %d, regval = %08" PRIx32 "\n", irq, regval);
-
-  if (regval & DMA2D_ISR_TCIF)
-    {
-      /* Transfer complete interrupt */
-
-      /* Clear the interrupt status register */
-
-      reginfo("DMA transfer complete\n");
-      putreg32(DMA2D_IFCR_CTCIF, STM32_DMA2D_IFCR);
-      priv->error = OK;
-    }
-#ifdef CONFIG_STM32_DMA2D_L8
-  else if (regval & DMA2D_ISR_CTCIF)
-    {
-      /* CLUT transfer complete interrupt */
-
-      /* Clear the interrupt status register */
-
-      reginfo("CLUT transfer complete\n");
-      putreg32(DMA2D_IFCR_CCTCIF, STM32_DMA2D_IFCR);
-      priv->error = OK;
-    }
-#endif
-  else if (regval & DMA2D_ISR_TWIF)
-    {
-      /* Watermark transfer complete interrupt */
-
-      /* Clear the interrupt status register */
-
-      reginfo("Watermark transfer complete\n");
-      putreg32(DMA2D_IFCR_CTWIF, STM32_DMA2D_IFCR);
-      priv->error = OK;
-    }
-  else if (regval & DMA2D_ISR_TEIF)
-    {
-      /* Transfer error interrupt */
-
-      /* Clear the interrupt status register */
-
-      reginfo("ERROR: transfer\n");
-      putreg32(DMA2D_IFCR_CTEIF, STM32_DMA2D_IFCR);
-      priv->error = -ECANCELED;
-    }
-  else if (regval & DMA2D_ISR_CAEIF)
-    {
-      /* CLUT access error interrupt */
-
-      /* Clear the interrupt status register */
-
-      reginfo("ERROR: clut access\n");
-      putreg32(DMA2D_IFCR_CAECIF, STM32_DMA2D_IFCR);
-      priv->error = -ECANCELED;
-    }
-  else if (regval & DMA2D_ISR_CEIF)
-    {
-      /* Configuration error interrupt */
-
-      /* Clear the interrupt status register */
-
-      reginfo("ERROR: configuration\n");
-      putreg32(DMA2D_IFCR_CCEIF, STM32_DMA2D_IFCR);
-      priv->error = -ECANCELED;
-    }
-  else
-    {
-      /* Unknown irq, should not occur */
-
-      DEBUGASSERT("Unknown interrupt error\n");
-    }
-
-  /* Unlock the semaphore if locked */
-
-  ret = nxsem_post(priv->sem);
-
-  if (ret < 0)
-    {
-      lcderr("ERROR: nxsem_post() failed\n");
-    }
-
-  return OK;
-}
-
-/****************************************************************************
- * Name: stm32_dma2d_waitforirq
- *
- * Description:
- *   Helper waits until the dma2d irq occurs. That means that an ongoing clut
- *   loading or dma transfer was completed.
- *   Note! The caller must use this function within a critical section.
- *
- * Returned Value:
- *   On success OK otherwise ERROR
- *
- ****************************************************************************/
-
-static int stm32_dma2d_waitforirq(void)
-{
-  int ret;
-  struct stm32_interrupt_s *priv = &g_interrupt;
-
-  ret = nxsem_wait(priv->sem);
-
-  if (ret < 0)
-    {
-      lcderr("ERROR: nxsem_wait() failed\n");
-      return ret;
-    }
-
-  ret = priv->error;
-
-  return ret;
-}
-
-/****************************************************************************
- * Name: stm32_dma2d_loadclut
- *
- * Description:
- *   Starts clut loading but doesn't wait until loading is complete!
- *
- * Input Parameters:
- *   pfcreg - PFC control Register
- *
- * Returned Value:
- *   On success - OK
- *   On error - -EINVAL
- *
- ****************************************************************************/
-
-#ifdef CONFIG_STM32_DMA2D_L8
-static int stm32_dma2d_loadclut(uintptr_t pfcreg)
-{
-  int      ret;
-  uint32_t regval;
-
-  /* Start clut loading */
-
-  regval  = getreg32(pfcreg);
-  regval |= DMA2D_XGPFCCR_START;
-  reginfo("set regval=%08" PRIx32 "\n", regval);
-  putreg32(regval, pfcreg);
-  reginfo("configured regval=%08" PRIx32 "\n", getreg32(pfcreg));
-
-  /* Wait until clut is finished */
-
-  ret = stm32_dma2d_waitforirq();
-
-  return ret;
-}
-#endif
-
-/****************************************************************************
- * Name: stm32_dma2d_start
- *
- * Description:
- *   Starts the dma transfer and waits until completed.
- *
- * Input Parameters:
- *   reg       - Register to set the start
- *   startflag - The related flag to start the dma transfer
- *   irqflag   - The interrupt enable flag in the DMA2D_CR register
- *
- ****************************************************************************/
-
-static int stm32_dma2d_start(void)
-{
-  int ret;
-
-  /* Start dma transfer */
-
-  stm32_dma2d_control(DMA2D_CR_START, 0);
-
-  /* wait until transfer is complete */
-
-  ret = stm32_dma2d_waitforirq();
-
-  return ret;
-}
-
-/****************************************************************************
- * Name: stm32_dma2d_memaddress
- *
- * Description:
- *   Helper to calculate the layer memory address
- *
- * Input Parameters:
- *   oinfo - Reference to overlay information
- *   xpos  - x-Offset
- *   ypos  - y-Offset
- *
- * Returned Value:
- *   memory address
- *
- ****************************************************************************/
-
-static uint32_t
-stm32_dma2d_memaddress(struct stm32_dma2d_overlay_s *oinfo,
-                       uint32_t xpos, uint32_t ypos)
-{
-  uint32_t offset;
-  struct fb_overlayinfo_s *poverlay = oinfo->oinfo;
-
-  offset = xpos * DMA2D_PF_BYPP(poverlay->bpp) + poverlay->stride * ypos;
-
-  lcdinfo("%p, offset=%d\n", ((uint32_t) poverlay->fbmem) + offset, offset);
-  return ((uint32_t) poverlay->fbmem) + offset;
-}
-
-/****************************************************************************
- * Name: stm32_dma2d_lineoffset
- *
- * Description:
- *   Helper to calculate the layer line offset
- *
- * Input Parameters:
- *   oinfo - Reference to overlay information
- *
- * Returned Value:
- *   line offset
- *
- ****************************************************************************/
-
-static uint32_t
-stm32_dma2d_lineoffset(struct stm32_dma2d_overlay_s *oinfo,
-                       const struct fb_area_s *area)
-{
-  uint32_t loffset;
-
-  /* offset at the end of each line in the context to the area layer */
-
-  loffset = oinfo->xres - area->w;
-
-  lcdinfo("%d\n", loffset);
-  return loffset;
-}
-
-/****************************************************************************
- * Name: stm32_dma2d_lfifo
- *
- * Description:
- *   Set the fifo for the foreground, background and output layer
- *   Configures the memory address register
- *   Configures the line offset register
- *
- * Input Parameters:
- *   layer - Reference to the common layer state structure
- *
- ****************************************************************************/
-
-static void stm32_dma2d_lfifo(struct stm32_dma2d_overlay_s *oinfo,
-                              int lid, uint32_t xpos, uint32_t ypos,
-                              const struct fb_area_s *area)
-{
-  lcdinfo("oinfo=%p, lid=%d, xpos=%d, ypos=%d, area=%p\n",
-           oinfo, lid, xpos, ypos, area);
-
-  putreg32(stm32_dma2d_memaddress(oinfo, xpos, ypos),
-           stm32_mar_layer_t[lid]);
-  putreg32(stm32_dma2d_lineoffset(oinfo, area),
-           stm32_or_layer_t[lid]);
-}
-
-/****************************************************************************
- * Name: stm32_dma2d_lcolor
- *
- * Description:
- *   Set the color for the layer
- *
- * Input Parameters:
- *   lid  - Layer type (output, foreground, background)
- *   argb - argb8888 color
- *
- ****************************************************************************/
-
-static void stm32_dma2d_lcolor(int lid, uint32_t argb)
-{
-  lcdinfo("lid=%d, argb=%08" PRIx32 "\n", lid, argb);
-  putreg32(argb, stm32_color_layer_t[lid]);
-}
-
-/****************************************************************************
- * Name: stm32_dma2d_llnr
- *
- * Description:
- *   Set the number of line register
- *
- * Input Parameters:
- *   area - Reference to area information
- *
- ****************************************************************************/
-
-static void stm32_dma2d_llnr(const struct fb_area_s *area)
-{
-  uint32_t nlrreg;
-
-  lcdinfo("pixel per line: %d, number of lines: %d\n", area->w, area->h);
-
-  nlrreg = getreg32(STM32_DMA2D_NLR);
-  nlrreg = (DMA2D_NLR_PL(area->w) | DMA2D_NLR_NL(area->h));
-  putreg32(nlrreg, STM32_DMA2D_NLR);
-}
-
-/****************************************************************************
- * Name: stm32_dma2d_loutpfc
- *
- * Description:
- *   Set the output PFC control register
- *
- * Input Parameters:
- *   fmt - DMA2D pixel format
- *
- ****************************************************************************/
-
-static int stm32_dma2d_loutpfc(uint8_t fmt)
-{
-  lcdinfo("pixel format: %d\n", fmt);
-
-  /* Set the mapped pixel format of the destination layer */
-
-  putreg32(DMA2D_OPFCCR_CM(fmt), STM32_DMA2D_OPFCCR);
-
-  return OK;
-}
-
-/****************************************************************************
- * Name: stm32_dma2d_lpfc
- *
- * Description:
- *   Configure foreground and background layer PFC control register
- *
- * Input Parameters:
- *   lid       - Layer id (output, foreground, background)
- *   blendmode - Layer blendmode (dma2d register values)
- *   alpha     - Transparency
- *
- ****************************************************************************/
-
-static void stm32_dma2d_lpfc(int lid, uint32_t blendmode, uint8_t alpha,
-                             uint8_t fmt)
-{
-  uint32_t   pfccrreg;
-
-  lcdinfo("lid=%d, blendmode=%08" PRIx32 ", alpha=%02x, fmt=%d\n",
-          lid, blendmode, alpha, fmt);
-
-  /* Set color format */
-
-  pfccrreg = DMA2D_XGPFCCR_CM(fmt);
-
-#ifdef CONFIG_STM32_FB_CMAP
-  if (fmt == DMA2D_PF_L8)
-    {
-      struct stm32_dma2d_s *layer = &g_dma2ddev;
-
-      /* Load CLUT automatically */
-
-      pfccrreg |= DMA2D_XGPFCCR_START;
-
-      /* Set the CLUT color mode */
-
-#  ifndef CONFIG_STM32_FB_TRANSPARENCY
-      pfccrreg |= DMA2D_XGPFCCR_CCM;
-#  endif
-
-      /* Set CLUT size */
-
-      pfccrreg |= DMA2D_XGPFCCR_CS(DMA2D_CLUT_SIZE);
-
-      /* Set the CLUT memory address */
-
-      putreg32((uint32_t) layer->clut, stm32_cmar_layer_t[lid]);
-
-      /* Start async clut loading */
-
-      stm32_dma2d_loadclut(stm32_pfccr_layer_t[lid]);
-    }
-#endif /* CONFIG_STM32_FB_CMAP */
-
-  /* Set alpha blend mode */
-
-  pfccrreg |= DMA2D_XGPFCCR_AM(blendmode);
-
-  if (blendmode == STM32_DMA2D_PFCCR_AM_CONST ||
-        blendmode == STM32_DMA2D_PFCCR_AM_PIXEL)
-    {
-      /* Set alpha value */
-
-      pfccrreg |= DMA2D_XGPFCCR_ALPHA(alpha);
-    }
-
-  putreg32(pfccrreg, stm32_pfccr_layer_t[lid]);
-}
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: stm32_dma2d_setclut
- *
- * Description:
- *   Configure layer clut (color lookup table).
- *
- * Input Parameters:
- *   cmap   - Color lookup table with up the 256 entries
- *
- * Returned Value:
- *   On success - OK
- *   On error   - -EINVAL
- *
- ****************************************************************************/
-
-#ifdef CONFIG_STM32_FB_CMAP
-static int stm32_dma2d_setclut(const struct fb_cmap_s *cmap)
-{
-  int n;
-  struct stm32_dma2d_s *priv = &g_dma2ddev;
-
-  lcdinfo("cmap=%p\n", cmap);
-
-  nxmutex_lock(priv->lock);
-
-  for (n = cmap->first; n < cmap->len - 1 && n < STM32_DMA2D_NCLUT; n++)
-    {
-      /* Update the layer clut entry, will be automatically loaded before
-       * blit operation becomes active
-       */
-
-#  ifndef CONFIG_STM32_FB_TRANSPARENCY
-      uint8_t *clut   = (uint8_t *)g_dma2ddev.clut;
-      uint16_t offset = 3 * n;
-
-      clut[offset]     = cmap->blue[n];
-      clut[offset + 1] = cmap->green[n];
-      clut[offset + 2] = cmap->red[n];
-
-      reginfo("n=%d, red=%02x, green=%02x, blue=%02x\n", n, clut[offset],
-              clut[offset + 1], clut[offset + 2]);
-#  else
-      uint32_t *clut  = g_dma2ddev.clut;
-
-      clut[n] = (uint32_t)DMA2D_CLUT_ALPHA(cmap->transp[n]) |
-                (uint32_t)DMA2D_CLUT_RED(cmap->red[n]) |
-                (uint32_t)DMA2D_CLUT_GREEN(cmap->green[n]) |
-                (uint32_t)DMA2D_CLUT_BLUE(cmap->blue[n]);
-
-      reginfo("n=%d, alpha=%02x, red=%02x, green=%02x, blue=%02x\n", n,
-                DMA2D_CLUT_ALPHA(cmap->transp[n]),
-                DMA2D_CLUT_RED(cmap->red[n]),
-                DMA2D_CLUT_GREEN(cmap->green[n]),
-                DMA2D_CLUT_BLUE(cmap->blue[n]));
-#  endif
-    }
-
-  nxmutex_unlock(priv->lock);
-  return OK;
-}
-#endif /* CONFIG_STM32_FB_CMAP */
-
-/****************************************************************************
- * Name: stm32_dma2d_fillcolor
- *
- * Description:
- *   Fill the selected area of the whole overlay with a specific color.
- *   The caller must ensure that the area is within the entire overlay.
- *
- * Input Parameters:
- *   oinfo - Overlay to fill
- *   area  - Reference to the valid area structure select the area
- *   argb  - Color to fill the selected area. Color must be argb8888
- *           formatted.
- *
- * Returned Value:
- *    OK        - On success
- *   -EINVAL    - If one of the parameter invalid or if the size of the
- *                selected area outside the visible area of the layer.
- *   -ECANCELED - Operation cancelled, something goes wrong.
- *
- ****************************************************************************/
-
-static int stm32_dma2d_fillcolor(struct stm32_dma2d_overlay_s *oinfo,
-                                 const struct fb_area_s *area,
-                                 uint32_t argb)
-{
-  int ret;
-  struct stm32_dma2d_s *priv = &g_dma2ddev;
-  DEBUGASSERT(oinfo != NULL && oinfo->oinfo != NULL && area != NULL);
-
-  lcdinfo("oinfo=%p, argb=%08" PRIx32 "\n", oinfo, argb);
-
-#ifdef CONFIG_STM32_FB_CMAP
-  if (oinfo->fmt == DMA2D_PF_L8)
-    {
-      /* CLUT output not supported */
-
-      lcderr("ERROR: Returning ENOSYS, "
-             "output to layer with CLUT format not supported.\n");
-      return -ENOSYS;
-    }
-#endif
-
-  nxmutex_lock(priv->lock);
-
-  /* Set output pfc */
-
-  stm32_dma2d_loutpfc(oinfo->fmt);
-
-  /* Set output fifo */
-
-  stm32_dma2d_lfifo(oinfo, DMA2D_LAYER_LOUT, area->x, area->y, area);
-
-  /* Set the output color register */
-
-  stm32_dma2d_lcolor(DMA2D_LAYER_LOUT, argb);
-
-  /* Set number of lines and pixel per line */
-
-  stm32_dma2d_llnr(area);
-
-  /* Set register to memory transfer */
-
-  stm32_dma2d_control(STM32_DMA2D_CR_MODE_COLOR, STM32_DMA2D_CR_MODE_CLEAR);
-
-  /* Start DMA2D and wait until completed */
-
-  ret = stm32_dma2d_start();
-
-  if (ret != OK)
-    {
-      ret = -ECANCELED;
-      lcderr("ERROR: Returning ECANCELED\n");
-    }
-
-  nxmutex_unlock(priv->lock);
-  return ret;
-}
-
-/****************************************************************************
- * Name: stm32_dma2d_blit
- *
- * Description:
- *   Copy memory from a source overlay (defined by sarea) to destination
- *   overlay position (defined by destxpos and destypos).
- *
- * Input Parameters:
- *   doverlay - Valid reference to the destination overlay
- *   destxpos - Valid selected x position of the destination overlay
- *   destypos - Valid selected y position of the destination overlay
- *   soverlay - Valid reference to the source overlay
- *   sarea    - Valid reference to the selected area of the source overlay
- *
- * Returned Value:
- *    OK        - On success
- *   -EINVAL    - If one of the parameter invalid or if the size of the
- *                selected source area outside the visible area of the
- *                destination layer.  (The visible area usually represents
- *                the display size)
- *   -ECANCELED - Operation cancelled, something goes wrong.
- *
- ****************************************************************************/
-
-static int stm32_dma2d_blit(struct stm32_dma2d_overlay_s *doverlay,
-                            uint32_t destxpos, uint32_t destypos,
-                            struct stm32_dma2d_overlay_s *soverlay,
-                            const struct fb_area_s *sarea)
-{
-  int      ret;
-  uint32_t mode;
-  struct stm32_dma2d_s *priv = &g_dma2ddev;
-
-  lcdinfo("doverlay=%p, destxpos=%d, destypos=%d, soverlay=%p, sarea=%p\n",
-          doverlay, destxpos, destypos, soverlay, sarea);
-
-  nxmutex_lock(priv->lock);
-
-  /* Set output pfc */
-
-  stm32_dma2d_loutpfc(doverlay->fmt);
-
-  /* Set foreground pfc */
-
-  stm32_dma2d_lpfc(DMA2D_LAYER_LFORE, STM32_DMA2D_PFCCR_AM_NONE, 0,
-                   soverlay->fmt);
-
-  /* Set foreground fifo */
-
-  stm32_dma2d_lfifo(soverlay, DMA2D_LAYER_LFORE, sarea->x, sarea->y, sarea);
-
-  /* Set output fifo */
-
-  stm32_dma2d_lfifo(doverlay, DMA2D_LAYER_LOUT, destxpos, destypos, sarea);
-
-  /* Set number of lines and pixel per line */
-
-  stm32_dma2d_llnr(sarea);
-
-  /* Set dma2d mode for blit operation */
-
-  if (doverlay->fmt == soverlay->fmt)
-    {
-      /* Blit without pfc */
-
-      mode = STM32_DMA2D_CR_MODE_BLIT;
-    }
-  else
-    {
-      /* Blit with pfc */
-
-      mode = STM32_DMA2D_CR_MODE_BLITPFC;
-    }
-
-  stm32_dma2d_control(mode, STM32_DMA2D_CR_MODE_CLEAR);
-
-  /* Start DMA2D and wait until completed */
-
-  ret = stm32_dma2d_start();
-
-  if (ret != OK)
-    {
-      ret = -ECANCELED;
-      lcderr("ERROR: Returning ECANCELED\n");
-    }
-
-  nxmutex_unlock(priv->lock);
-  return ret;
-}
-
-/****************************************************************************
- * Name: stm32_dma2d_blend
- *
- * Description:
- *   Blends the selected area from a background layer with selected position
- *   of the foreground layer. Copies the result to the selected position of
- *   the destination layer. Note! The content of the foreground and
- *   background layer keeps unchanged as long destination layer is unequal
- *   to the foreground and background layer.
- *
- * Input Parameters:
- *   doverlay - Destination overlay
- *   destxpos - x-Offset destination overlay
- *   destypos - y-Offset destination overlay
- *   foverlay - Foreground overlay
- *   forexpos - x-Offset foreground overlay
- *   foreypos - y-Offset foreground overlay
- *   boverlay - Background overlay
- *   barea    - x-Offset, y-Offset, x-resolution and y-resolution of
- *              background overlay
- *
- * Returned Value:
- *    OK        - On success
- *   -EINVAL    - If one of the parameter invalid or if the size of the
- *                selected source area outside the visible area of the
- *                destination layer.  (The visible area usually represents
- *                the display size)
- *   -ECANCELED - Operation cancelled, something goes wrong.
- *
- ****************************************************************************/
-
-static int stm32_dma2d_blend(struct stm32_dma2d_overlay_s *doverlay,
-                             uint32_t destxpos, uint32_t destypos,
-                             struct stm32_dma2d_overlay_s *foverlay,
-                             uint32_t forexpos, uint32_t foreypos,
-                             struct stm32_dma2d_overlay_s *boverlay,
-                             const struct fb_area_s *barea)
-{
-  int ret;
-  struct stm32_dma2d_s *priv = &g_dma2ddev;
-
-  lcdinfo("doverlay=%p, destxpos=%d, destypos=%d, "
-          "foverlay=%p, forexpos=%d, foreypos=%d, "
-          "boverlay=%p, barea=%p, barea.x=%d, barea.y=%d, barea.w=%d, "
-          "barea.h=%d\n", doverlay, destxpos, destypos, foverlay, forexpos,
-          foreypos, boverlay, barea, barea->x, barea->y, barea->w, barea->h);
-
-#ifdef CONFIG_STM32_FB_CMAP
-  if (doverlay->fmt == DMA2D_PF_L8)
-    {
-      /* CLUT output not supported */
-
-      lcderr("ERROR: Returning ENOSYS, "
-             "output to layer with CLUT format not supported.\n");
-      return -ENOSYS;
-    }
-#endif
-
-  nxmutex_lock(priv->lock);
-
-  /* Set output pfc */
-
-  stm32_dma2d_loutpfc(doverlay->fmt);
-
-  /* Set background pfc */
-
-  stm32_dma2d_lpfc(DMA2D_LAYER_LBACK, boverlay->transp_mode,
-                   boverlay->oinfo->transp.transp, boverlay->fmt);
-
-  /* Set foreground pfc */
-
-  stm32_dma2d_lpfc(DMA2D_LAYER_LFORE, foverlay->transp_mode,
-                   foverlay->oinfo->transp.transp, foverlay->fmt);
-
-  /* Set background fifo */
-
-  stm32_dma2d_lfifo(boverlay, DMA2D_LAYER_LBACK, barea->x, barea->y, barea);
-
-  /* Set foreground fifo */
-
-  stm32_dma2d_lfifo(foverlay, DMA2D_LAYER_LFORE, forexpos, foreypos, barea);
-
-  /* Set output fifo */
-
-  stm32_dma2d_lfifo(doverlay, DMA2D_LAYER_LOUT, destxpos, destypos, barea);
-
-  /* Set number of lines and pixel per line */
-
-  stm32_dma2d_llnr(barea);
-
-  /* Set watermark */
-
-  /* Enable DMA2D blender */
-
-  stm32_dma2d_control(STM32_DMA2D_CR_MODE_BLEND, STM32_DMA2D_CR_MODE_CLEAR);
-
-  /* Start DMA2D and wait until completed */
-
-  ret = stm32_dma2d_start();
-
-  if (ret != OK)
-    {
-      ret = -ECANCELED;
-      lcderr("ERROR: Returning ECANCELED\n");
-    }
-
-  nxmutex_unlock(priv->lock);
-  return ret;
-}
-
-/****************************************************************************
- * Name: stm32_dma2dinitialize
- *
- * Description:
- *   Initialize the dma2d controller
- *
- * Returned Value:
- *   OK - On success
- *   An error if initializing failed.
- *
- ****************************************************************************/
-
-int stm32_dma2dinitialize(void)
-{
-  lcdinfo("Initialize DMA2D driver\n");
-
-  if (g_initialized == false)
-    {
-      /* Abort current dma2d data transfer */
-
-      stm32_dma2duninitialize();
-
-      /* Enable dma2d is done in rcc_enableahb1, see
-       * arch/arm/src/stm32f7/stm32f7xxxx_rcc.c
-       */
-
-#ifdef CONFIG_STM32_FB_CMAP
-      /* Enable dma2d transfer and clut loading interrupts only */
-
-      stm32_dma2d_control(DMA2D_CR_TCIE | DMA2D_CR_CTCIE, DMA2D_CR_TEIE |
-                          DMA2D_CR_TWIE | DMA2D_CR_CAEIE | DMA2D_CR_CEIE);
-#else
-      /* Enable dma transfer interrupt only */
-
-      stm32_dma2d_control(DMA2D_CR_TCIE, DMA2D_CR_TEIE | DMA2D_CR_TWIE |
-                          DMA2D_CR_CAEIE | DMA2D_CR_CTCIE | DMA2D_CR_CEIE);
-#endif
-
-      stm32_dma2d_control(DMA2D_CR_TCIE | DMA2D_CR_CTCIE | DMA2D_CR_TEIE |
-                          DMA2D_CR_CAEIE | DMA2D_CR_CTCIE | DMA2D_CR_CEIE,
-                          0);
-
-      /* Attach DMA2D interrupt vector */
-
-      irq_attach(g_interrupt.irq, stm32_dma2dirq, NULL);
-
-      /* Enable the IRQ at the NVIC */
-
-      up_enable_irq(g_interrupt.irq);
-
-      g_initialized = true;
-    }
-
-  return OK;
-}
-
-/****************************************************************************
- * Name: stm32_dma2duninitialize
- *
- * Description:
- *   Uninitialize the dma2d controller
- *
- ****************************************************************************/
-
-void stm32_dma2duninitialize(void)
-{
-  /* Disable DMA2D interrupts */
-
-  up_disable_irq(g_interrupt.irq);
-  irq_detach(g_interrupt.irq);
-
-  /* Abort current dma2d transfer */
-
-  stm32_dma2d_control(DMA2D_CR_ABORT, 0);
-
-  /* Set initialized state */
-
-  g_initialized = false;
-}
-
-/****************************************************************************
- * Name: stm32_dma2ddev
- *
- * Description:
- *   Get a reference to the dma2d controller.
- *
- * Returned Value:
- *   On success - A valid dma2d layer reference
- *   On error   - NULL
- *
- ****************************************************************************/
-
-struct dma2d_layer_s *stm32_dma2ddev(void)
-{
-  return &g_dma2ddev.dma2d;
-}
diff --git a/arch/arm/src/stm32f7/stm32_dma2d.h 
b/arch/arm/src/stm32f7/stm32_dma2d.h
deleted file mode 100644
index 06ace50a01d..00000000000
--- a/arch/arm/src/stm32f7/stm32_dma2d.h
+++ /dev/null
@@ -1,191 +0,0 @@
-/****************************************************************************
- * arch/arm/src/stm32f7/stm32_dma2d.h
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- * 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_DMA2D_H
-#define __ARCH_ARM_SRC_STM32F7_STM32_DMA2D_H
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include <nuttx/config.h>
-#include <nuttx/video/fb.h>
-
-#ifdef CONFIG_FB_OVERLAY
-
-/****************************************************************************
- * Public Types
- ****************************************************************************/
-
-/* This structure describes DMA2D overlay information */
-
-struct stm32_dma2d_overlay_s
-{
-  uint8_t    fmt;                 /* DMA2D pixel format */
-  uint8_t    transp_mode;         /* DMA2D transparency mode */
-  fb_coord_t xres;                /* X-resolution overlay */
-  fb_coord_t yres;                /* Y-resolution overlay */
-  struct fb_overlayinfo_s *oinfo; /* Framebuffer overlay information */
-};
-
-/* DMA2D is controlled by the following interface */
-
-struct dma2d_layer_s
-{
-  /* Name: setclut
-   *
-   * Description:
-   *   Set the cmap table for both foreground and background layer.
-   *   Up to 256 colors supported.
-   *
-   * Parameter:
-   *   cmap  - Reference to the cmap table
-   *
-   * Returned Value:
-   *   On success - OK
-   *   On error   - -EINVAL
-   */
-
-#ifdef CONFIG_STM32_FB_CMAP
-  int (*setclut)(const struct fb_cmap_s * cmap);
-#endif
-
-  /* Name: fillcolor
-   *
-   * Description:
-   *   Fill a specific memory region with a color. The caller must ensure
-   *   that the memory region (area) is within the entire overlay.
-   *
-   * Parameter:
-   *   oinfo  - Reference to overlay information
-   *   area   - Reference to the area to fill
-   *   argb   - argb8888 color
-   *
-   * Returned Value:
-   *   On success - OK
-   *   On error   - -EINVAL
-   */
-
-  int (*fillcolor)(struct stm32_dma2d_overlay_s *oinfo,
-                   const struct fb_area_s *area, uint32_t argb);
-
-  /* Name: blit
-   *
-   * Description:
-   *   Copies memory from a source overlay (defined by sarea) to destination
-   *   overlay position (defined by destxpos and destypos) without
-   *   pixelformat conversion. The caller must ensure that the memory region
-   *   (area) is within the entire overlay.
-   *
-   * Parameter:
-   *   doverlay - Reference destination overlay
-   *   destxpos - x-Offset destination overlay
-   *   destypos - y-Offset destination overlay
-   *   soverlay - Reference source overlay
-   *   sarea    - Reference source area
-   *
-   * Returned Value:
-   *   On success - OK
-   *   On error   - -EINVAL
-   */
-
-  int (*blit)(struct stm32_dma2d_overlay_s *doverlay,
-              uint32_t destxpos, uint32_t destypos,
-              struct stm32_dma2d_overlay_s *soverlay,
-              const struct fb_area_s *sarea);
-
-  /* Name: blend
-   *
-   * Description:
-   *   Blends two source memory areas to a destination memory area with
-   *   pixelformat conversion if necessary. The caller must ensure that the
-   *   memory region (area) is within the entire overlays.
-   *
-   * Parameter:
-   *   doverlay - Destination overlay
-   *   destxpos - x-Offset destination overlay
-   *   destypos - y-Offset destination overlay
-   *   foverlay - Foreground overlay
-   *   forexpos - x-Offset foreground overlay
-   *   foreypos - y-Offset foreground overlay
-   *   boverlay - Background overlay
-   *   barea    - x-Offset, y-Offset, x-resolution and y-resolution of
-   *              background overlay
-   *
-   * Returned Value:
-   *   On success - OK
-   *   On error   - -EINVAL or -ECANCELED
-   */
-
-  int (*blend)(struct stm32_dma2d_overlay_s *doverlay,
-               uint32_t destxpos, uint32_t destypos,
-               struct stm32_dma2d_overlay_s *foverlay,
-               uint32_t forexpos, uint32_t foreypos,
-               struct stm32_dma2d_overlay_s *boverlay,
-               const struct fb_area_s *barea);
-};
-
-/****************************************************************************
- * Public Function Prototypes
- ****************************************************************************/
-
-/****************************************************************************
- * Name: stm32_dma2ddev
- *
- * Description:
- *   Get a reference to the DMA2D controller.
- *
- * Returned Value:
- *   On success - A valid DMA2D controller reference
- *   On error   - NULL and errno is set to
- *                -EINVAL if one of the parameter is invalid
- *
- ****************************************************************************/
-
-struct dma2d_layer_s *stm32_dma2ddev(void);
-
-/****************************************************************************
- * Name: up_dma2dinitialize
- *
- * Description:
- *   Initialize the DMA2D controller
- *
- * Returned Value:
- *   OK - On success
- *   An error if initializing failed.
- *
- ****************************************************************************/
-
-int stm32_dma2dinitialize(void);
-
-/****************************************************************************
- * Name: up_dma2duninitialize
- *
- * Description:
- *   Uninitialize the DMA2D controller
- *
- ****************************************************************************/
-
-void stm32_dma2duninitialize(void);
-
-#endif /* CONFIG_FB_OVERLAY */
-#endif /* __ARCH_ARM_SRC_STM32F7_STM32_DMA2D_H */
diff --git a/arch/arm/src/stm32l4/Kconfig b/arch/arm/src/stm32l4/Kconfig
index 67d390ada6a..362105d0407 100644
--- a/arch/arm/src/stm32l4/Kconfig
+++ b/arch/arm/src/stm32l4/Kconfig
@@ -907,7 +907,6 @@ config STM32_STM32L496XX
        select STM32_HAVE_CAN2
        select STM32_HAVE_DCMI
        select STM32_HAVE_DMA2D
-       select STM32_HAVE_IP_DMA2D_M3M4_V1
        select STM32_HAVE_DFSDM1
        select STM32_HAVE_HSI48
 
@@ -937,14 +936,12 @@ config STM32_STM32L4R7XX
        default n
        select STM32_STM32L4XR
        select STM32_HAVE_DMA2D
-       select STM32_HAVE_IP_DMA2D_M3M4_V1
 
 config STM32_STM32L4S7XX
        bool
        default n
        select STM32_STM32L4XR
        select STM32_HAVE_DMA2D
-       select STM32_HAVE_IP_DMA2D_M3M4_V1
        select STM32_HAVE_AES
        select STM32_HAVE_HASH
        select STM32_HAVE_IP_AES_M3M4_V1
@@ -954,7 +951,6 @@ config STM32_STM32L4R9XX
        default n
        select STM32_STM32L4XR
        select STM32_HAVE_DMA2D
-       select STM32_HAVE_IP_DMA2D_M3M4_V1
        select STM32_HAVE_LTDC
 
 config STM32_STM32L4S9XX
@@ -962,7 +958,6 @@ config STM32_STM32L4S9XX
        default n
        select STM32_STM32L4XR
        select STM32_HAVE_DMA2D
-       select STM32_HAVE_IP_DMA2D_M3M4_V1
        select STM32_HAVE_LTDC
        select STM32_HAVE_AES
        select STM32_HAVE_HASH

Reply via email to