Add support for the new DMA2D features to the STM32F429i-Disco LTDC configuration. From Marco Krahl.
This commit is contained in:
parent
8ed4b1acfa
commit
eb28a666b4
@ -168,7 +168,6 @@
|
||||
#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 */
|
||||
|
@ -10,6 +10,49 @@ cd tools
|
||||
cd ..
|
||||
make
|
||||
|
||||
Note!
|
||||
In the current implementation the DMA2D driver only supports clut pixel format
|
||||
if the LTDC driver it does. Otherwise it will not be compatible with the nx
|
||||
framework. If CONFIG_FB_CMAP is configured, nx expects that any pixel format
|
||||
supports color lookup tables. This is also the case for non CLUT formats e.g.
|
||||
FB_FMT_RGB16_565. This may result in wrong color representation by nx if the
|
||||
pixel format is unequal to FB_FMT_RGB8.
|
||||
|
||||
On the other hand layers with CLUT pixel format are not supported by the DMA2D
|
||||
controller, in the case they will be used as destination layer for the following
|
||||
operations:
|
||||
- blit
|
||||
- blend
|
||||
- fillarea
|
||||
|
||||
To enable clut support in both LTDC and DMA2D driver the following
|
||||
configurations are valid:
|
||||
|
||||
1.
|
||||
- Enable LTDC_INTERFACE and LAYER1/LAYER2
|
||||
- Layer1 FB_FMT_RGB8
|
||||
- Layer2 any non clut format
|
||||
|
||||
But Layer2 can only be used as destination layer for dma2d operations above.
|
||||
This configuration is not compatibly to nx because LAYER2 will be referenced
|
||||
by up_fbgetvplane and is an invalid CLUT pixel format.
|
||||
|
||||
2.
|
||||
- Enable LTDC_INTERFACE and LAYER1/LAYER2
|
||||
- Layer2 FB_FMT_RGB8
|
||||
- Layer1 any non clut format
|
||||
|
||||
But Layer1 can only be used as destination layer for dma2d operations above.
|
||||
This configuration should be compatibly to nx because LAYER2 will be referenced
|
||||
by up_fbgetvplane and is an valid CLUT pixel format.
|
||||
|
||||
All other non clut configuration work fine.
|
||||
|
||||
If using the DMA2D controller without the LTDC controller e.g. camera interface
|
||||
than enable CONFIG_FB_CMAP and optional CONFIG_FB_TRANSPARENCY in your board
|
||||
specific configuration.
|
||||
|
||||
|
||||
Loading
|
||||
-----------------------------------------------
|
||||
st-flash write nuttx.bin 0x8000000
|
||||
@ -21,3 +64,7 @@ Interaction with NSH is via the serial console at 115200 8N1 baud.
|
||||
From the nsh comandline execute one (or both) of the examples:
|
||||
- nx (default nx example)
|
||||
- ltdc (trivial ltdc interface test)
|
||||
|
||||
Note! The ltdc example ends in an infinite loop. To get control of the nsh
|
||||
start this example in the background with 'ltdc &'.
|
||||
|
||||
|
@ -41,7 +41,7 @@ CONFIG_RAW_BINARY=y
|
||||
#
|
||||
# Debug Options
|
||||
#
|
||||
# CONFIG_DEBUG is not set
|
||||
CONFIG_DEBUG=y
|
||||
CONFIG_ARCH_HAVE_STACKCHECK=y
|
||||
CONFIG_ARCH_HAVE_HEAPCHECK=y
|
||||
CONFIG_DEBUG_SYMBOLS=y
|
||||
@ -284,7 +284,7 @@ CONFIG_STM32_FSMC=y
|
||||
# CONFIG_STM32_I2C2 is not set
|
||||
# CONFIG_STM32_I2C3 is not set
|
||||
CONFIG_STM32_LTDC=y
|
||||
# CONFIG_STM32_DMA2D is not set
|
||||
CONFIG_STM32_DMA2D=y
|
||||
# CONFIG_STM32_OTGFS is not set
|
||||
# CONFIG_STM32_OTGHS is not set
|
||||
CONFIG_STM32_PWR=y
|
||||
@ -333,7 +333,9 @@ CONFIG_STM32_JTAG_SW_ENABLE=y
|
||||
CONFIG_STM32_DISABLE_IDLE_SLEEP_DURING_DEBUG=y
|
||||
# CONFIG_STM32_FORCEPOWER is not set
|
||||
# CONFIG_ARCH_BOARD_STM32_CUSTOM_CLOCKCONFIG is not set
|
||||
# CONFIG_STM32_CCMEXCLUDE is not set
|
||||
CONFIG_STM32_CCMEXCLUDE=y
|
||||
CONFIG_STM32_CCM_ALLOCATOR=y
|
||||
CONFIG_STM32_CCM_PROCFS=y
|
||||
CONFIG_STM32_FSMC_SRAM=y
|
||||
CONFIG_STM32_USART=y
|
||||
|
||||
@ -394,6 +396,25 @@ CONFIG_STM32_LTDC_L2_RGB565=y
|
||||
# CONFIG_STM32_LTDC_L2_ARGB1555 is not set
|
||||
# CONFIG_STM32_LTDC_L2_RGB888 is not set
|
||||
# CONFIG_STM32_LTDC_L2_ARGB8888 is not set
|
||||
# CONFIG_FB_CMAP is not set
|
||||
# CONFIG_FB_TRANSPARENCY is not set
|
||||
|
||||
#
|
||||
# DMA2D Configuration
|
||||
#
|
||||
CONFIG_STM32_DMA2D_NLAYERS=4
|
||||
|
||||
#
|
||||
# Supported pixel format
|
||||
#
|
||||
# CONFIG_STM32_DMA2D_L8 is not set
|
||||
# CONFIG_STM32_DMA2D_AL44 is not set
|
||||
# CONFIG_STM32_DMA2D_AL88 is not set
|
||||
CONFIG_STM32_DMA2D_RGB565=y
|
||||
# CONFIG_STM32_DMA2D_ARGB4444 is not set
|
||||
# CONFIG_STM32_DMA2D_ARGB1555 is not set
|
||||
# CONFIG_STM32_DMA2D_RGB888 is not set
|
||||
# CONFIG_STM32_DMA2D_ARGB8888 is not set
|
||||
|
||||
#
|
||||
# Architecture Options
|
||||
@ -720,7 +741,7 @@ CONFIG_FS_MQUEUE_MPATH="/var/mqueue"
|
||||
# CONFIG_FS_ROMFS is not set
|
||||
# CONFIG_FS_SMARTFS is not set
|
||||
# CONFIG_FS_BINFS is not set
|
||||
# CONFIG_FS_PROCFS is not set
|
||||
CONFIG_FS_PROCFS=y
|
||||
|
||||
#
|
||||
# System Logging
|
||||
@ -821,7 +842,7 @@ CONFIG_NXFONT_MONO5X8=y
|
||||
# Memory Management
|
||||
#
|
||||
# CONFIG_MM_SMALL is not set
|
||||
CONFIG_MM_REGIONS=3
|
||||
CONFIG_MM_REGIONS=2
|
||||
CONFIG_ARCH_HAVE_HEAP2=y
|
||||
CONFIG_HEAP2_BASE=0xD0000000
|
||||
CONFIG_HEAP2_SIZE=8081408
|
||||
@ -1072,6 +1093,7 @@ CONFIG_NSH_BUILTIN_APPS=y
|
||||
CONFIG_NSH_CMDOPT_DF_H=y
|
||||
CONFIG_NSH_CODECS_BUFSIZE=128
|
||||
CONFIG_NSH_CMDOPT_HEXDUMP=y
|
||||
CONFIG_NSH_PROC_MOUNTPOINT="/proc"
|
||||
CONFIG_NSH_FILEIOSIZE=512
|
||||
|
||||
#
|
||||
|
@ -46,6 +46,7 @@
|
||||
|
||||
#include "up_arch.h"
|
||||
#include "stm32f429i-disco.h"
|
||||
#include "stm32_ccm.h"
|
||||
|
||||
/************************************************************************************
|
||||
* Pre-processor Definitions
|
||||
@ -64,47 +65,54 @@
|
||||
*
|
||||
* Description:
|
||||
* All STM32 architectures must provide the following entry point. This entry point
|
||||
* is called early in the intitialization -- after all memory has been configured
|
||||
* 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)
|
||||
{
|
||||
#if defined(CONFIG_STM32_SPI1) || defined(CONFIG_STM32_SPI2) || \
|
||||
defined(CONFIG_STM32_SPI3) || defined(CONFIG_STM32_SPI4) || \
|
||||
defined(CONFIG_STM32_SPI5)
|
||||
/* Configure SPI chip selects if 1) SPI is not disabled, and 2) the weak function
|
||||
* stm32_spiinitialize() has been brought into the link.
|
||||
*/
|
||||
|
||||
#if defined(CONFIG_STM32_SPI1) || defined(CONFIG_STM32_SPI2) || defined(CONFIG_STM32_SPI3) ||\
|
||||
defined(CONFIG_STM32_SPI4) || defined(CONFIG_STM32_SPI5)
|
||||
if (stm32_spiinitialize)
|
||||
{
|
||||
stm32_spiinitialize();
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_STM32_OTGHS
|
||||
/* Initialize USB if the 1) OTG HS controller is in the configuration and 2)
|
||||
* disabled, and 3) the weak function stm32_usbinitialize() has been brought
|
||||
* into the build. Presumeably either CONFIG_USBDEV or CONFIG_USBHOST is also
|
||||
* into the build. Presumably either CONFIG_USBDEV or CONFIG_USBHOST is also
|
||||
* selected.
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_STM32_OTGHS
|
||||
if (stm32_usbinitialize)
|
||||
{
|
||||
stm32_usbinitialize();
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ARCH_LEDS
|
||||
/* Configure on-board LEDs if LED support has been selected. */
|
||||
|
||||
#ifdef CONFIG_ARCH_LEDS
|
||||
board_led_initialize();
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_STM32_FSMC
|
||||
stm32_enablefsmc();
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CCM_HEAP
|
||||
/* Initialize ccm allocator */
|
||||
|
||||
ccm_initialize();
|
||||
#endif
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@ -124,15 +132,17 @@ void stm32_boardinitialize(void)
|
||||
void board_initialize(void)
|
||||
{
|
||||
#ifdef CONFIG_STM32_LTDC
|
||||
/* Initialize the framebuffer driver */
|
||||
|
||||
up_fbinitialize();
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_NSH_LIBRARY) && !defined(CONFIG_NSH_ARCHINIT)
|
||||
/* Perform NSH initialization here instead of from the NSH. This
|
||||
* alternative NSH initialization is necessary when NSH is ran in user-space
|
||||
* but the initialization function must run in kernel space.
|
||||
*/
|
||||
|
||||
#if defined(CONFIG_NSH_LIBRARY) && !defined(CONFIG_NSH_ARCHINIT)
|
||||
(void)board_app_initialize();
|
||||
#endif
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/************************************************************************************
|
||||
* configs/stm32f429i-disco/src/stm32_lcd.c
|
||||
*
|
||||
* Copyright (C) 2014 Marco Krahl. All rights reserved.
|
||||
* Copyright (C) 2014-2015 Marco Krahl. All rights reserved.
|
||||
* Author: Marco Krahl <ocram.lhark@gmail.com>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -53,7 +53,6 @@
|
||||
#include "up_arch.h"
|
||||
#include "stm32f429i-disco.h"
|
||||
#include "stm32_ltdc.h"
|
||||
#include "stm32_dma2d.h"
|
||||
|
||||
/************************************************************************************
|
||||
* Pre-processor Definitions
|
||||
@ -508,8 +507,8 @@ int board_lcd_initialize(void)
|
||||
|
||||
return -errno;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_STM32F429I_DISCO_ILI9341_LCDIFACE */
|
||||
|
||||
#ifdef CONFIG_STM32_LTDC
|
||||
/*******************************************************************************
|
||||
* Name: up_fbinitialize
|
||||
@ -526,6 +525,7 @@ int up_fbinitialize(void)
|
||||
{
|
||||
#ifdef CONFIG_STM32F429I_DISCO_ILI9341_FBIFACE
|
||||
int ret;
|
||||
|
||||
/* Initialize the ili9341 LCD controller */
|
||||
|
||||
ret = stm32_ili9341_initialize();
|
||||
@ -533,33 +533,14 @@ int up_fbinitialize(void)
|
||||
if (ret == OK)
|
||||
{
|
||||
ret = stm32_ltdcinitialize();
|
||||
# ifdef CONFIG_STM32_DMA2D
|
||||
if (ret == OK)
|
||||
{
|
||||
ret = up_dma2dinitialize();
|
||||
}
|
||||
# endif
|
||||
}
|
||||
|
||||
return ret;
|
||||
#else
|
||||
|
||||
#else
|
||||
/* Custom LCD display with RGB interface */
|
||||
|
||||
# ifdef CONFIG_STM32_DMA2D
|
||||
int ret;
|
||||
|
||||
ret = stm32_ltdcinitialize();
|
||||
|
||||
if (ret == OK)
|
||||
{
|
||||
ret = up_dma2dinitialize();
|
||||
}
|
||||
|
||||
return ret;
|
||||
# else
|
||||
return stm32_ltdcinitialize();
|
||||
# endif
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -606,10 +587,12 @@ void fb_uninitialize(void)
|
||||
* lid - The specific layer identifier
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#ifdef CONFIG_STM32_LTDC_INTERFACE
|
||||
FAR struct ltdc_layer_s *up_ltdcgetlayer(int lid)
|
||||
{
|
||||
return stm32_ltdcgetlayer(lid);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CONFIG_STM32_LTDC */
|
||||
|
Loading…
Reference in New Issue
Block a user