This change ports in Marco Krahl's STM32F4 framebuffer overlays for the LTDC and DMA2D into the STM32F7. That driver was same as the STM32F4 driver. I am unable to verify the update because I do not have the STM32F76x hardware. So this commit very likely breaks the LTDC/DMA2D. However, it was probably not left in a functional state anyway so I do not think that there is any loss.

Squashed commit of the following:

    arch/arm/src/stm32f7:  Some minor changes for clean compilation of LTDC.
    arch/arm/src/stm32f7:  Add overly support for LTDC driver header file.
    arch/arm/src/stm32f7:  Add overly support for LTDC driver file.
    arch/arm/src/stm32f7:  Add overly support for DMA2D driver header file.
    arch/arm/src/stm32f7:  Finishes overly support for DMA2D driver.
    arch/arm/src/stm32f7:  Partial overly support in DMA2D driver (a lot more to be donw)
    arch/arm/src/stm32f7/chip:  Clone overlay DMA2D register definitions from F4
    arch/arm/src/stm32f7:  Clone overlay configuration from stm32 F4
This commit is contained in:
Gregory Nutt 2018-06-15 13:13:12 -06:00
parent 5b899b76c4
commit 6dcce0430c
9 changed files with 2427 additions and 4711 deletions

View File

@ -49,22 +49,6 @@
#include <nuttx/video/fb.h>
#include <nuttx/nx/nxglib.h>
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Public Types
****************************************************************************/
/****************************************************************************
* Public Data
****************************************************************************/
/****************************************************************************
* Inline Functions
****************************************************************************/
/****************************************************************************
* Public Functions
****************************************************************************/

View File

@ -1317,6 +1317,8 @@ config STM32F7_DSIHOST
config STM32F7_DMA2D
bool "DMA2D"
default n
select FB
select FB_OVERLAY
depends on STM32F7_HAVE_DMA2D
---help---
The STM32 DMA2D is an Chrom-Art Accelerator for image manipulation
@ -1379,6 +1381,7 @@ config STM32F7_LPTIM1
config STM32F7_LTDC
bool "LTDC"
default n
select FB
depends on STM32F7_HAVE_LTDC
---help---
The STM32 LTDC is an LCD-TFT Display Controller available on
@ -4881,12 +4884,6 @@ if STM32F7_LTDC
menu "LTDC Configuration"
config STM32F7_LTDC_INTERFACE
bool "LTDC interface support"
default n
---help---
Enable the ltdc interface to support ltdc layer control.
config STM32F7_LTDC_USE_DSI
bool "Use DSI as display connection"
default n
@ -4942,6 +4939,7 @@ config STM32F7_LTDC_DITHER_BLUE
config STM32F7_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
@ -4950,6 +4948,20 @@ config STM32F7_LTDC_FB_BASE
config STM32F7_LTDC_FB_SIZE
int "Framebuffer memory size (bytes)"
default 0
---help---
Must be the whole size of the active LTDC layer.
config STM32F7_LTDC_L1_CHROMAKEYEN
bool "Enable chromakey support for layer 1"
default y
config STM32F7_LTDC_L1_CHROMAKEY
hex "Layer L1 initial chroma key"
default 0x00000000
config STM32F7_LTDC_L1_COLOR
hex "Layer L1 default color"
default 0x00000000
choice
prompt "Layer 1 color format"
@ -4957,27 +4969,35 @@ choice
config STM32F7_LTDC_L1_L8
bool "8 bpp L8 (8-bit CLUT)"
depends on FB_CMAP
config STM32F7_LTDC_L1_AL44
bool "8 bpp AL44 (4-bit alpha + 4-bit CLUT)"
depends on FB_CMAP
config STM32F7_LTDC_L1_AL88
bool "16 bpp AL88 (8-bit alpha + 8-bit CLUT)"
depends on FB_CMAP
config STM32F7_LTDC_L1_RGB565
bool "16 bpp RGB 565"
depends on !FB_CMAP
config STM32F7_LTDC_L1_ARGB4444
bool "16 bpp ARGB 4444"
depends on !FB_CMAP
config STM32F7_LTDC_L1_ARGB1555
bool "16 bpp ARGB 1555"
depends on !FB_CMAP
config STM32F7_LTDC_L1_RGB888
bool "24 bpp RGB 888"
depends on !FB_CMAP
config STM32F7_LTDC_L1_ARGB8888
bool "32 bpp ARGB 8888"
depends on !FB_CMAP
endchoice # Layer 1 color format
@ -4987,40 +5007,58 @@ config STM32F7_LTDC_L2
if STM32F7_LTDC_L2
config STM32F7_LTDC_L2_COLOR
hex "Layer L2 default color"
default 0x00000000
config STM32F7_LTDC_L2_CHROMAKEYEN
bool "Enable chromakey support for layer 2"
default y
config STM32F7_LTDC_L2_CHROMAKEY
hex "Layer L2 initial chroma key"
default 0x00000000
choice
prompt "Layer 2 (top layer) color format"
default STM32F7_LTDC_L2_RGB565
config STM32F7_LTDC_L2_L8
depends on STM32F7_LTDC_L1_L8
bool "8 bpp L8 (8-bit CLUT)"
config STM32F7_LTDC_L2_AL44
depends on STM32F7_LTDC_L1_AL44
bool "8 bpp AL44 (4-bit alpha + 4-bit CLUT)"
config STM32F7_LTDC_L2_AL88
depends on STM32F7_LTDC_L1_AL88
bool "16 bpp AL88 (8-bit alpha + 8-bit CLUT)"
config STM32F7_LTDC_L2_RGB565
depends on STM32F7_LTDC_L1_RGB565
bool "16 bpp RGB 565"
config STM32F7_LTDC_L2_ARGB4444
depends on STM32F7_LTDC_L1_ARGB4444
bool "16 bpp ARGB 4444"
config STM32F7_LTDC_L2_ARGB1555
depends on STM32F7_LTDC_L1_ARGB1555
bool "16 bpp ARGB 1555"
config STM32F7_LTDC_L2_RGB888
depends on STM32F7_LTDC_L1_RGB888
bool "24 bpp RGB 888"
config STM32F7_LTDC_L2_ARGB8888
depends on STM32F7_LTDC_L1_ARGB8888
bool "32 bpp ARGB 8888"
endchoice # Layer 2 color format
endif # STM32F7_LTDC_L2
if STM32F7_LTDC_L1_L8 || STM32F7_LTDC_L2_L8
config FB_CMAP
bool "Enable color map support"
default y
@ -5030,12 +5068,11 @@ config FB_CMAP
config FB_TRANSPARENCY
bool "Enable transparency color map support"
default y
depends on FB_CMAP
---help---
Enabling transparency color map support is neccessary for
ltdc L8 format.
endif
config STM32F7_LTDC_REGDEBUG
bool "Enable LTDC register value debug messages"
default n
@ -5053,49 +5090,93 @@ if STM32F7_DMA2D
menu "DMA2D Configuration"
config STM32F7_DMA2D_NLAYERS
int "Number DMA2D layers"
default 2
int "Number DMA2D overlays"
default 1
range 1 256
---help---
Number of allocatable DMA2D layers except the LTDC layer.
Number of supported DMA2D layer.
config STM32F7_DMA2D_LAYER_SHARED
bool "Overlays shared memory region"
default n
---help---
Several overlays can share the same memory region.
Setup a whole memory area (usually multiple size of the visible screen)
allows image preprocessing before they become visible by blit operation.
config STM32F7_DMA2D_LAYER_PPLINE
int "Pixel per line"
default 1
range 1 65535
---help---
If you are using the DMA2D, then you must provide the pixel per line or
width of the overlay.
config STM32F7_DMA2D_FB_BASE
hex "Framebuffer memory start address"
default 0
---help---
If you are using the DMA2D, then you must provide the address
of the start of the DMA2D overlays framebuffer. This address will typically
be in the SRAM or SDRAM memory region of the FSMC.
config STM32F7_DMA2D_FB_SIZE
int "Framebuffer memory size (bytes)"
default 0
---help---
Must be the whole size of all DMA2D overlays.
menu "Supported pixel format"
config STM32F7_DMA2D_L8
depends on FB_CMAP
depends on FB_CMAP && STM32F7_LTDC_L1_L8
bool "8 bpp L8 (8-bit CLUT)"
default y
config STM32F7_DMA2D_AL44
depends on FB_CMAP
depends on FB_CMAP && STM32F7_LTDC_L1_AL44
bool "8 bpp AL44 (4-bit alpha + 4-bit CLUT)"
default n
default y
config STM32F7_DMA2D_AL88
depends on FB_CMAP
depends on FB_CMAP && STM32F7_LTDC_L1_AL88
bool "16 bpp AL88 (8-bit alpha + 8-bit CLUT)"
default n
default y
config STM32F7_DMA2D_RGB565
bool "16 bpp RGB 565"
depends on STM32F7_LTDC_L1_RGB565
default y
config STM32F7_DMA2D_ARGB4444
bool "16 bpp ARGB 4444"
default n
depends on STM32F7_LTDC_L1_ARGB4444
default y
config STM32F7_DMA2D_ARGB1555
bool "16 bpp ARGB 1555"
default n
depends on STM32F7_LTDC_L1_ARGB15555
default y
config STM32F7_DMA2D_RGB888
bool "24 bpp RGB 888"
depends on STM32F7_LTDC_L1_RGB888
default y
config STM32F7_DMA2D_ARGB8888
bool "32 bpp ARGB 8888"
default n
depends on STM32F7_LTDC_L1_ARGB8888
default y
endmenu
config STM32F7_DMA2D_REGDEBUG
bool "DMA2D Register level debug"
depends on DEBUG_INFO && DEBUG_LCD
default n
---help---
Output detailed register-level DMA2D device debug information.
endmenu
endif # STM32F7_DMA2D

View File

@ -1,5 +1,5 @@
/****************************************************************************
* arch/arm/src/stm32/chip/stm32_dma2d.h
* arch/arm/src/stm32f7/chip/stm32_dma2d.h
*
* Copyright (C) 2014-2015 Marco Krahl. All rights reserved.
* Author: Marco Krahl <ocram.lhark@gmail.com>
@ -33,8 +33,8 @@
*
****************************************************************************/
#ifndef __ARCH_ARM_SRC_STM32_CHIP_STM32_DMA2D_H
#define __ARCH_ARM_SRC_STM32_CHIP_STM32_DMA2D_H
#ifndef __ARCH_ARM_SRC_STM32F7_CHIP_STM32_DMA2D_H
#define __ARCH_ARM_SRC_STM32F7_CHIP_STM32_DMA2D_H
/****************************************************************************
* Included Files
@ -70,7 +70,7 @@
#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 */
#define STM32_DMA2D_AMTCR_OFFSET 0x004c /* DMA2D AHB Master Time Configuration Register */
/* DMA2D Register Addresses **************************************************/
@ -156,6 +156,12 @@
#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 */
@ -178,6 +184,20 @@
#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 */
@ -227,4 +247,4 @@
* Public Types
****************************************************************************/
#endif /* __ARCH_ARM_SRC_STM32_CHIP_STM32_DMA2D_H */
#endif /* __ARCH_ARM_SRC_STM32F7_CHIP_STM32_DMA2D_H */

View File

@ -1,5 +1,5 @@
/************************************************************************************
* arch/arm/src/stm32/chip/stm32_ltdc.h
* arch/arm/src/stm32f7/chip/stm32_ltdc.h
*
* Copyright (C) 2013 Ken Pettit. All rights reserved.
* Author: Ken Pettit <pettitkd@gmail.com>

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
/****************************************************************************
* arch/arm/src/stm32/stm32_dma2d.h
* arch/arm/src/stm32f7/stm32_dma2d.h
*
* Copyright (C) 2014-2015 Marco Krahl. All rights reserved.
* Copyright (C) 2014-2015, 2018 Marco Krahl. All rights reserved.
* Author: Marco Krahl <ocram.lhark@gmail.com>
*
* Redistribution and use in source and binary forms, with or without
@ -44,374 +44,145 @@
#include <nuttx/video/fb.h>
#include "stm32_ltdc.h"
#ifdef CONFIG_STM32F7_DMA2D
#ifdef CONFIG_FB_OVERLAY
/****************************************************************************
* Public Types
****************************************************************************/
struct ltdc_area_s; /* see arch/arm/src/stm32f7/stm32_ltdc.h */
/* This structure describes DMA2D overlay information */
/* Blend mode definitions */
enum dma2d_blend_e
struct stm32_dma2d_overlay_s
{
DMA2D_BLEND_NONE = 0, /* Disable all blend operation */
DMA2D_BLEND_ALPHA = 0x1, /* Enable alpha blending */
DMA2D_BLEND_PIXELALPHA = 0x2, /* Enable alpha blending from pixel color */
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 */
FAR struct fb_overlayinfo_s *oinfo; /* Framebuffer overlay information */
};
/* The layer is controlled through the following structure */
/* DMA2D is controlled by the following interface */
struct dma2d_layer_s
{
/* Name: getvideoinfo
*
* Description:
* Get video information about the layer
*
* Parameter:
* layer - Reference to the layer control structure
* vinfo - Reference to the video info structure
*
* Returned Value:
* On success - OK
* On error - -EINVAL
*/
int (*getvideoinfo)(FAR struct dma2d_layer_s *layer,
FAR struct fb_videoinfo_s *vinfo);
/* Name: getplaneinfo
*
* Description:
* Get plane information about the layer
*
* Parameter:
* layer - Reference to the layer control structure
* planeno - Number of the plane
* pinfo - Reference to the plane info structure
*
* Returned Value:
* On success - OK
* On error - -EINVAL
*/
int (*getplaneinfo)(FAR struct dma2d_layer_s *layer, int planeno,
FAR struct fb_planeinfo_s *pinfo);
/* Name: getlid
*
* Description:
* Get a specific layer identifier.
*
* Parameter:
* layer - Reference to the layer structure
* lid - Reference to store the layer id
*
* Returned Value:
* On success - OK
* On error - -EINVAL
*/
int (*getlid)(FAR struct dma2d_layer_s *layer, int *lid);
#ifdef CONFIG_STM32F7_DMA2D_L8
/* Name: setclut
*
* Description:
* Configure layer clut (color lookup table).
* Non clut is defined during initializing.
* Set the cmap table for both foreground and background layer.
* Up to 256 colors supported.
*
* Parameter:
* layer - Reference to the layer structure
* cmap - color lookup table with up the 256 entries
* cmap - Reference to the cmap table
*
* Returned Value:
* On success - OK
* On error - -EINVAL
*/
int (*setclut)(FAR struct dma2d_layer_s *layer,
const FAR struct fb_cmap_s *cmap);
/* Name: getclut
*
* Description:
* Get configured layer clut (color lookup table).
*
* Parameter:
* layer - Reference to the layer structure
* cmap - Reference to valid color lookup table accept up the 256 color
* entries
*
* Returned Value:
* On success - OK
* On error - -EINVAL
*/
int (*getclut)(FAR struct dma2d_layer_s *layer, FAR struct fb_cmap_s *cmap);
#ifdef CONFIG_FB_CMAP
int (*setclut)(FAR const struct fb_cmap_s * cmap);
#endif
/* Name: setalpha
/* Name: fillcolor
*
* Description:
* Configure layer alpha value factor into blend operation.
* During the layer blend operation the source alpha value is multiplied
* with this alpha value. If the source color format doesn't support alpha
* channel (e.g. non ARGB8888) this alpha value will be used as constant
* alpha value for blend operation.
* Default value during initializing: 0xff
* Fill a specific memory region with a color.
* The caller must ensure that the memory region (area) is within the entire
* overlay.
*
* Parameter:
* layer - Reference to the layer structure
* alpha - Alpha value
* oinfo - Reference to overlay information
* area - Reference to the area to fill
* argb - argb8888 color
*
* Returned Value:
* On success - OK
* On error - -EINVAL
*/
int (*setalpha)(FAR struct dma2d_layer_s *layer, uint8_t alpha);
/* Name: getalpha
*
* Description:
* Get configured layer alpha value factor for blend operation.
*
* Parameter:
* layer - Reference to the layer structure
* alpha - Reference to store the alpha value
*
* Returned Value:
* On success - OK
* On error - -EINVAL
*/
int (*getalpha)(FAR struct dma2d_layer_s *layer, uint8_t *alpha);
/* Name: setblendmode
*
* Description:
* Configure blend mode of the layer.
* Default mode during initializing: DMA2D_BLEND_NONE
* Blendmode is active after next update.
*
* Parameter:
* layer - Reference to the layer structure
* mode - Blend mode (see DMA2D_BLEND_*)
*
* Returned Value:
* On success - OK
* On error - -EINVAL
*
* Procedure information:
* DMA2D_BLEND_NONE:
* Informs the driver to disable all blend operation for the given layer.
* That means the layer is opaque.
*
* DMA2D_BLEND_ALPHA:
* Informs the driver to enable alpha blending for the given layer.
*
* DMA2D_BLEND_PIXELALPHA:
* Informs the driver to use the pixel alpha value of the layer instead
* the constant alpha value. This is only useful for ARGB8888
* color format.
*/
int (*setblendmode)(FAR struct dma2d_layer_s *layer, uint32_t mode);
/* Name: getblendmode
*
* Description:
* Get configured blend mode of the layer.
*
* Parameter:
* layer - Reference to the layer structure
* mode - Reference to store the blend mode
*
* Returned Value:
* On success - OK
* On error - -EINVAL
*/
int (*getblendmode)(FAR struct dma2d_layer_s *layer, uint32_t *mode);
int (*fillcolor)(FAR struct stm32_dma2d_overlay_s *oinfo,
FAR const struct fb_area_s *area, uint32_t argb);
/* Name: blit
*
* Description:
* Copy selected area from a source layer to selected position of the
* destination layer.
* 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:
* dest - Reference to the destination layer
* destxpos - Selected x target position of the destination layer
* destypos - Selected y target position of the destination layer
* src - Reference to the source layer
* srcarea - Reference to the selected area of the source layer
* doverlay - Reference destination overlay
* destxpos - x-Offset destination overlay
* destypos - y-Offset destination overlay
* soverlay - Reference source overlay
* sarea - Reference source area
*
* 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.
* On success - OK
* On error - -EINVAL
*/
int (*blit)(FAR struct dma2d_layer_s *dest,
fb_coord_t destxpos, fb_coord_t destypos,
FAR const struct dma2d_layer_s *src,
FAR const struct ltdc_area_s *srcarea);
int (*blit)(FAR struct stm32_dma2d_overlay_s *doverlay,
uint32_t destxpos, uint32_t destypos,
FAR struct stm32_dma2d_overlay_s *soverlay,
FAR const struct fb_area_s *sarea);
/* Name: blend
*
* Description:
* Blends the selected area from a background layer with selected position
* of the foreground layer. Copies the result to the selected position of
* the destination layer. Note! The content of the foreground and background
* layer keeps unchanged as long destination layer is unequal to the
* foreground and background layer.
* 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:
* dest - Reference to the destination layer
* fore - Reference to the foreground layer
* forexpos - Selected x target position of the foreground layer
* foreypos - Selected y target position of the foreground layer
* back - Reference to the background layer
* backarea - Reference to the selected area of the background layer
* 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.
* On success - OK
* On error - -EINVAL or -ECANCELED
*/
int (*blend)(FAR struct dma2d_layer_s *dest,
fb_coord_t destxpos, fb_coord_t destypos,
FAR const struct dma2d_layer_s *fore,
fb_coord_t forexpos, fb_coord_t foreypos,
FAR const struct dma2d_layer_s *back,
FAR const struct ltdc_area_s *backarea);
/* Name: fillarea
*
* Description:
* Fill the selected area of the whole layer with a specific color.
*
* Parameter:
* layer - Reference to the layer structure
* area - Reference to the valid area structure select the area
* color - Color to fill the selected area. Color must be formatted
* according to the layer pixel format.
*
* 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.
*/
int (*fillarea)(FAR struct dma2d_layer_s *layer,
FAR const struct ltdc_area_s *area,
uint32_t color);
int (*blend)(FAR struct stm32_dma2d_overlay_s *doverlay,
uint32_t destxpos, uint32_t destypos,
FAR struct stm32_dma2d_overlay_s *foverlay,
uint32_t forexpos, uint32_t foreypos,
FAR struct stm32_dma2d_overlay_s *boverlay,
FAR const struct fb_area_s *barea);
};
/****************************************************************************
* Public Functions
****************************************************************************/
struct stm32_ltdc_s; /* Forward declaration */
/****************************************************************************
* Name: stm32_dma2dinitltdc
* Name: stm32_dma2ddev
*
* Description:
* Get a reference to the dma2d layer coupled with the ltdc layer.
* It not intends to use this function by user space applications.
* It resolves the following requirements:
* 1. Share the color lookup table
* 2. Share the planeinfo information
* 3. Share the videoinfo information
*
* Input Parameters:
* layer - a valid reference to the low level ltdc layer structure
* Get a reference to the DMA2D controller.
*
* Returned Value:
* On success - A valid dma2d layer reference
* On success - A valid DMA2D controller reference
* On error - NULL and errno is set to
* -EINVAL if one of the parameter is invalid
*
****************************************************************************/
FAR struct dma2d_layer_s *stm32_dma2dinitltdc(FAR struct stm32_ltdc_s *layer);
/****************************************************************************
* Name: up_dma2dgetlayer
*
* Description:
* Get a dma2d layer structure by the layer identifier
*
* Input Parameters:
* lid - Layer identifier
*
* Returned Value:
* Reference to the dma2d layer control structure on success or Null if no
* related exist.
*
****************************************************************************/
FAR struct dma2d_layer_s *up_dma2dgetlayer(int lid);
/****************************************************************************
* Name: up_dma2dcreatelayer
*
* Description:
* Create a new dma2d layer object to interact with the dma2d controller
*
* Input Parameters:
* width - Layer width
* height - Layer height
* fmt - Pixel format of the layer
*
* Returned Value:
* On success - A valid dma2d layer reference
* On error - NULL and errno is set to
* -EINVAL if one of the parameter is invalid
* -ENOMEM if no memory available or exceeds
* CONFIG_STM32F7_DMA2D_NLAYERS
*
****************************************************************************/
FAR struct dma2d_layer_s *up_dma2dcreatelayer(fb_coord_t width,
fb_coord_t height,
uint8_t fmt);
/****************************************************************************
* Name: up_dma2dremovelayer
*
* Description:
* Remove and deallocate the dma2d layer
*
* Input Parameters:
* layer - Reference to the layer to remove
*
* Returned Value:
* On success - OK
* On error - -EINVAL
*
****************************************************************************/
int up_dma2dremovelayer(FAR struct dma2d_layer_s *layer);
FAR struct dma2d_layer_s *stm32_dma2ddev(void);
/****************************************************************************
* Name: up_dma2dinitialize
*
* Description:
* Initialize the dma2d controller
* Initialize the DMA2D controller
*
* Returned Value:
* OK - On success
@ -419,17 +190,17 @@ int up_dma2dremovelayer(FAR struct dma2d_layer_s *layer);
*
****************************************************************************/
int up_dma2dinitialize(void);
int stm32_dma2dinitialize(void);
/****************************************************************************
* Name: up_dma2duninitialize
*
* Description:
* Uninitialize the dma2d controller
* Uninitialize the DMA2D controller
*
****************************************************************************/
void up_dma2duninitialize(void);
void stm32_dma2duninitialize(void);
#endif /* CONFIG_STM32F7_DMA2D */
#endif /* CONFIG_FB_OVERLAY */
#endif /* __ARCH_ARM_SRC_STM32F7_STM32_DMA2D_H */

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
/************************************************************************************
* arch/arm/src/stm32/stm32_ltdc.h
/****************************************************************************
* arch/arm/src/stm32f7/stm32_ltdc.h
*
* Copyright (C) 2013-2014 Ken Pettit. All rights reserved.
* Copyright (C) 2013-2014, 2018 Ken Pettit. All rights reserved.
* Authors: Ken Pettit <pettitd@gmail.com>
* Marco Krahl <ocram.lhark@gmail.com>
*
@ -32,14 +32,14 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
************************************************************************************/
****************************************************************************/
#ifndef __ARCH_ARM_SRC_STM32F7_STM32_LTDC_H
#define __ARCH_ARM_SRC_STM32F7_STM32_LTDC_H
/************************************************************************************
/****************************************************************************
* Included Files
************************************************************************************/
****************************************************************************/
#include <nuttx/config.h>
@ -49,549 +49,9 @@
#include <nuttx/video/fb.h>
#include <nuttx/nx/nxglib.h>
#ifdef CONFIG_STM32F7_LTDC
/************************************************************************************
* Public Types
************************************************************************************/
struct dma2d_layer_s; /* see arch/arm/src/stm32f7/stm32_dma2d.h */
/* Blend mode definitions */
enum ltdc_blend_e
{
LTDC_BLEND_NONE = 0, /* Disable all blend operation */
LTDC_BLEND_ALPHA = 0x1, /* Enable alpha blending */
LTDC_BLEND_PIXELALPHA = 0x2, /* Enable alpha blending from pixel color */
LTDC_BLEND_COLORKEY = 0x4, /* Enable colorkey */
LTDC_BLEND_ALPHAINV = 0x8, /* Inverse alpha blending of source */
LTDC_BLEND_PIXELALPHAINV = 0x10 /* Invers pixel alpha blending of source */
};
/* layer control definitions */
enum ltdc_layer_e
{
LTDC_LAYER_OWN = 0, /* The given layer */
LTDC_LAYER_TOP = 0x1, /* The initialized top layer */
LTDC_LAYER_BOTTOM = 0x2, /* the initialized bottom layer */
LTDC_LAYER_ACTIVE = 0x4, /* The current visible flip layer */
LTDC_LAYER_INACTIVE = 0x8 /* The current invisible flip layer */
#ifdef CONFIG_STM32F7_DMA2D
,LTDC_LAYER_DMA2D = 0x10 /* The dma2d interface layer id */
#endif
};
/* Update operation flag */
enum ltdc_update_e
{
LTDC_UPDATE_NONE = 0, /* Update given layer only */
LTDC_UPDATE_SIM = 0x1, /* Update both layer simultaneous */
LTDC_UPDATE_FLIP = 0x2, /* Perform flip operation */
LTDC_UPDATE_ACTIVATE = 0x4 /* Set the given layer to the active layer */
};
/* sync mode definitions */
enum ltdc_sync_e
{
LTDC_SYNC_NONE = 0, /* Immediately */
LTDC_SYNC_VBLANK = 0x100, /* Upon vertical sync */
LTDC_SYNC_WAIT = 0x200 /* Waits upon vertical sync */
};
/* Definition of the visible layer position and size */
struct ltdc_area_s
{
fb_coord_t xpos; /* X position in pixel */
fb_coord_t ypos; /* Y position in pixel */
fb_coord_t xres; /* X resolution in pixel */
fb_coord_t yres; /* Y resolution in pixel */
};
/* The layer is controlled through the following structure */
struct ltdc_layer_s
{
/* Name: getvideoinfo
*
* Description:
* Get video information about the layer
*
* Parameter:
* layer - Reference to the layer control structure
* vinfo - Reference to the video info structure
*
* Returned Value:
* On success - OK
* On error - -EINVAL
*/
int (*getvideoinfo)(FAR struct ltdc_layer_s *layer,
FAR struct fb_videoinfo_s *vinfo);
/* Name: getplaneinfo
*
* Description:
* Get plane information about the layer
*
* Parameter:
* layer - Reference to the layer control structure
* planeno - Number of the plane
* pinfo - Reference to the plane info structure
*
* Returned Value:
* On success - OK
* On error - -EINVAL
*/
int (*getplaneinfo)(FAR struct ltdc_layer_s *layer, int planeno,
FAR struct fb_planeinfo_s *pinfo);
/* Name: getlid
*
* Description:
* Get a specific layer identifier.
*
* Parameter:
* layer - Reference to the layer structure
* lid - Reference to store the layer id
* flag - Operation flag describe the layer identifier
* e.g. get the current active or inactive layer.
* See LTDC_LAYER_* for possible values
*
* Returned Value:
* On success - OK
* On error - -EINVAL
*/
int (*getlid)(FAR struct ltdc_layer_s *layer, int *lid, uint32_t flag);
#ifdef CONFIG_FB_CMAP
/* Name: setclut
*
* Description:
* Configure layer clut (color lookup table).
* Non clut is defined during initializing.
* Clut is active during next vertical blank period. Do not need an update.
*
* Parameter:
* layer - Reference to the layer structure
* cmap - color lookup table with up the 256 entries
* enable - Enable or disable clut support (if false cmap is ignored and can
* be NULL)
*
* Returned Value:
* On success - OK
* On error - -EINVAL
*/
int (*setclut)(FAR struct ltdc_layer_s *layer,
const FAR struct fb_cmap_s *cmap);
/* Name: getclut
*
* Description:
* Get configured layer clut (color lookup table).
*
* Parameter:
* layer - Reference to the layer structure
* cmap - Reference to valid color lookup table accept up the 256 color
* entries
*
* Returned Value:
* On success - OK
* On error - -EINVAL
*/
int (*getclut)(FAR struct ltdc_layer_s *layer, FAR struct fb_cmap_s *cmap);
#endif
/* Name: setcolor
*
* Description:
* Configure layer color for the non active layer area.
* Default value during initializing: 0x00000000
* Color is active after next update.
*
* Parameter:
* layer - Reference to the layer structure
* argb - ARGB8888 color value
*
* Returned Value:
* On success - OK
* On error - -EINVAL
*/
int (*setcolor)(FAR struct ltdc_layer_s *layer, uint32_t argb);
/* Name: getcolor
*
* Description:
* Get configured layer color for the non active layer area.
*
* Parameter:
* layer - Reference to the layer structure
* argb - Reference to store the ARGB8888 color value
*
* Returned Value:
* On success - OK
* On error - -EINVAL
*/
int (*getcolor)(FAR struct ltdc_layer_s *layer, uint32_t *argb);
/* Name: setcolorkey
*
* Description:
* Configure the layer color key (chromakey) for transparence.
* Default value during initializing: 0x00000000
* Colorkey is active after next update.
*
* Parameter:
* layer - Reference to the layer structure
* rgb - RGB888 color key
*
* Returned Value:
* On success - OK
* On error - -EINVAL
*/
int (*setcolorkey)(FAR struct ltdc_layer_s *layer, uint32_t rgb);
/* Name: getcolorkey
*
* Description:
* Get the configured layer color key (chromakey) for transparence.
*
* Parameter:
* layer - Reference to the layer structure
* rgb - Reference to store the RGB888 color key
*
* Returned Value:
* On success - OK
* On error - -EINVAL
*/
int (*getcolorkey)(FAR struct ltdc_layer_s *layer, uint32_t *rgb);
/* Name: setalpha
*
* Description:
* Configure layer alpha value factor into blend operation.
* During the layer blend operation the source alpha value is multiplied
* with this alpha value. If the source color format doesn't support alpha
* channel (e.g. non ARGB8888) this alpha value will be used as constant
* alpha value for blend operation.
* Default value during initializing: 0xff
* Alpha is active after next update.
*
* Parameter:
* layer - Reference to the layer structure
* alpha - Alpha value
*
* Returned Value:
* On success - OK
* On error - -EINVAL
*/
int (*setalpha)(FAR struct ltdc_layer_s *layer, uint8_t alpha);
/* Name: getalpha
*
* Description:
* Get configured layer alpha value factor for blend operation.
*
* Parameter:
* layer - Reference to the layer structure
* alpha - Reference to store the alpha value
*
* Returned Value:
* On success - OK
* On error - -EINVAL
*/
int (*getalpha)(FAR struct ltdc_layer_s *layer, uint8_t *alpha);
/* Name: setblendmode
*
* Description:
* Configure blend mode of the layer.
* Default mode during initializing: LTDC_BLEND_NONE
* Blendmode is active after next update.
*
* Parameter:
* layer - Reference to the layer structure
* mode - Blend mode (see LTDC_BLEND_*)
*
* Returned Value:
* On success - OK
* On error - -EINVAL
*
* Procedure information:
* LTDC_BLEND_NONE:
* Informs the driver to disable all blend operation for the given layer.
* That means the layer is opaque. Note this has no effect on the
* colorkey settings.
*
* LTDC_BLEND_ALPHA:
* Informs the driver to enable alpha blending for the given layer.
*
* LTDC_BLEND_COLORKEY:
* Informs the driver to enable colorkeying for the given layer.
*
* LTDC_BLEND_SRCPIXELALPHA:
* Informs the driver to use the pixel alpha value of the layer instead
* the constant alpha value. This is only useful for ARGB8888
* color format.
*
* LTDC_BLEND_DESTPIXELALPHA:
* Informs the driver to use the pixel alpha value of the subjacent layer
* instead the constant alpha value. This is only useful for ARGB8888
* color format.
*/
int (*setblendmode)(FAR struct ltdc_layer_s *layer, uint32_t mode);
/* Name: getblendmode
*
* Description:
* Get configured blend mode of the layer.
*
* Parameter:
* layer - Reference to the layer structure
* mode - Reference to store the blend mode
*
* Returned Value:
* On success - OK
* On error - -EINVAL
*/
int (*getblendmode)(FAR struct ltdc_layer_s *layer, uint32_t *mode);
/* Name: setarea
*
* Description:
* Configure visible layer area and the reference position of the first
* pixel of the whole layer which is the first visible top left pixel in
* the active area.
* Default value during initializing:
* xpos = 0
* ypos = 0
* xres = display x resolution
* yres = display y resolution
*
* Area is active after next update.
*
* Parameter:
* layer - Reference to the layer control structure
* area - Reference to the valid area structure for the new active area
* srcxpos - x position of the visible pixel of the whole layer
* srcypos - y position of the visible pixel of the whole layer
*
* Returned Value:
* On success - OK
* On error - -EINVAL
*
* Procedure Information:
* If the srcxpos and srcypos unequal the xpos and ypos of the coord
* structure this acts like moving the visible area to another position on
* the screen during the next update operation.
*/
int (*setarea)(FAR struct ltdc_layer_s *layer,
FAR const struct ltdc_area_s *area,
fb_coord_t srcxpos,
fb_coord_t srcypos);
/* Name: getarea
*
* Description:
* Get configured visible layer area.
*
* Parameter:
* layer - Reference to the layer control structure
* area - Reference to the area structure to store the active area
* srcxpos - Reference to store the referenced x position of the whole layer
* srcypos - Reference to store the reterenced y position of the whole layer
*
* Returned Value:
* On success - OK
* On error - -EINVAL
*/
int (*getarea)(FAR struct ltdc_layer_s *layer,
FAR struct ltdc_area_s *area,
fb_coord_t *srcxpos,
fb_coord_t *srcypos);
/* Name: update
*
* Description:
* Update current layer settings and make changes visible.
*
* Parameter:
* layer - Reference to the layer structure
* mode - operation mode (see LTDC_UPDATE_*)
*
* Returned Value:
* OK - On success
* -EINVAL - If one of the parameter invalid
* -ECANCELED - Operation cancelled, something goes wrong
*
* Procedure information:
* LTDC_UPDATE_SIM:
* Informs the driver to update both ltdc layers simultaneously. Otherwise
* update the given layer only.
*
* LTDC_UPDATE_FLIP:
* Informs the driver to perform a flip operation.
* This only effects the ltdc layer 1 and 2 and can be useful for double
* buffering. Each flip operation changed the active layer ot the inactive
* and vice versa. In the context of the ltdc that means, the inactive layer
* is complete disabled. So the subjacent layer is the background layer
* (background color). To reactivate both layer and their settings perform
* an update without LTDC_UPDATE_FLIP flag.
*
* LTDC_UPDATE_ACTIVATE:
* Informs the driver that the given layer should be the active layer when
* the operation is complete.
*
* LTDC_SYNC_VBLANK:
* Informs the driver to update the layer upon vertical blank. Otherwise
* immediately.
*/
int (*update)(FAR struct ltdc_layer_s *layer, uint32_t mode);
#ifdef CONFIG_STM32F7_DMA2D
/* Name: blit
*
* Description:
* Copy selected area from a source layer to selected position of the
* destination layer.
*
* Parameter:
* dest - Reference to the destination layer
* destxpos - Selected x position of the destination layer
* destypos - Selected y position of the destination layer
* src - Reference to the source layer
* srcarea - Reference to the selected area of the source layer
*
* 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)
*/
int (*blit)(FAR struct ltdc_layer_s *dest,
fb_coord_t destxpos, fb_coord_t destypos,
FAR const struct dma2d_layer_s *src,
FAR const struct ltdc_area_s *srcarea);
/* Name: blend
*
* Description:
* Blends the selected area from a foreground layer with selected position
* of the background layer. Copy the result to the destination layer. Note!
* The content of the foreground and background layer is not changed.
*
* Parameter:
* dest - Reference to the destination layer
* destxpos - Selected x position of the destination layer
* destypos - Selected y position of the destination layer
* fore - Reference to the foreground layer
* forexpos - Selected x position of the foreground layer
* foreypos - Selected y position of the foreground layer
* back - Reference to the background layer
* backarea - Reference to the selected area of the background layer
*
* 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)
*/
int (*blend)(FAR struct ltdc_layer_s *dest,
fb_coord_t destxpos, fb_coord_t destypos,
FAR const struct dma2d_layer_s *fore,
fb_coord_t forexpos, fb_coord_t foreypos,
FAR const struct dma2d_layer_s *back,
FAR const struct ltdc_area_s *backarea);
/* Name: fillarea
*
* Description:
* Fill the selected area of the whole layer with a specific color.
*
* Parameter:
* layer - Reference to the layer structure
* area - Reference to the valid area structure select the area
* color - Color to fill the selected area. Color must be formatted
* according to the layer pixel format.
*
* 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.
*/
int (*fillarea)(FAR struct ltdc_layer_s *layer,
FAR const struct ltdc_area_s *area,
uint32_t color);
#endif
};
/* Common layer state structure for the LTDC and DMA2D controller */
struct stm32_ltdc_s
{
/* Fixed settings */
int lid; /* Layer identifier */
struct fb_videoinfo_s vinfo; /* Layer videoinfo */
struct fb_planeinfo_s pinfo; /* Layer planeinfo */
/* Positioning */
struct ltdc_area_s area; /* Active layer area */
fb_coord_t xpos; /* Reference x position */
fb_coord_t ypos; /* Reference y position */
/* Coloring */
uint32_t color; /* Layer color definition */
#ifdef CONFIG_FB_CMAP
uint32_t *clut; /* 32-bit aligned clut color table */
#endif
/* Blending */
uint8_t alpha; /* Layer constant alpha value */
uint32_t colorkey; /* Layer colorkey */
uint32_t blendmode; /* Layer blend factor */
/* Operation */
sem_t *lock; /* Ensure mutually exclusive access */
};
/************************************************************************************
* Public Data
************************************************************************************/
/************************************************************************************
/****************************************************************************
* Public Functions
************************************************************************************/
/* The STM32 LTDC driver uses the common framebuffer interfaces declared in
* include/nuttx/video/fb.h.
*/
****************************************************************************/
/************************************************************************************
* Name: stm32_ltdcreset
@ -603,7 +63,7 @@ struct stm32_ltdc_s
void stm32_ltdcreset(void);
/************************************************************************************
/*****************************************************************************
* Name: stm32_ltdcinitialize
*
* Description:
@ -612,54 +72,46 @@ struct stm32_ltdc_s
* Returned Value:
* OK
*
************************************************************************************/
****************************************************************************/
int stm32_ltdcinitialize(void);
FAR struct fb_vtable_s *stm32_ltdcgetvplane(int vplane);
/*****************************************************************************
* Name: stm32_ltdcuninitialize
*
* Description:
* Unitialize the ltdc controller
*
****************************************************************************/
void stm32_ltdcuninitialize(void);
/************************************************************************************
* Name: stm32_ltdcgetlayer
/*****************************************************************************
* Name: stm32_ltdcgetvplane
*
* Description:
* Get the ltdc layer structure to perform hardware layer operation
* Get video plane reference used by framebuffer interface
*
* Input Parameters:
* lid - Layer identifier
* Parameter:
* vplane - Video plane
*
* Returned Value:
* Reference to the layer control structure on success or Null if parameter
* invalid.
* Video plane reference
*
************************************************************************************/
****************************************************************************/
FAR struct ltdc_layer_s *stm32_ltdcgetlayer(int lid);
FAR struct fb_vtable_s *stm32_ltdcgetvplane(int vplane);
/************************************************************************************
* Name: stm32_lcdclear
*
* Description:
* This is a non-standard LCD interface just for the STM32 LTDC. Clearing the
* display in the normal way by writing a sequences of runs that covers the
* entire display can be slow. Here the display is cleared by simply setting
* all video memory to the specified color.
*
************************************************************************************/
void stm32_lcdclear(nxgl_mxpixel_t color);
/************************************************************************************
/****************************************************************************
* 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.
* 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 /* CONFIG_STM32F7_LTDC */
#endif /* __ARCH_ARM_SRC_STM32F7_STM32_LTDC_H */