mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 08:36:24 +08:00
Merged in MarcoKrahl/nuttx/ltdc (pull request #652)
ports stm32 ltdc and stm32 dma2d to framebuffer interface
* stm32: Removes current dma2d and ltdc implementation for replacement
Signed-off-by: Marco Krahl <ocram.lhark@gmail.com>
* stm32f429i-disco: Removes obsolete functions call
Signed-off-by: Marco Krahl <ocram.lhark@gmail.com>
* stm32_dma2d: Adds pixel format and transparency definitions
Signed-off-by: Marco Krahl <ocram.lhark@gmail.com>
* stm32_dma2d: Adds interface definition
Signed-off-by: Marco Krahl <ocram.lhark@gmail.com>
* stm32_dma2d: Reimplements dma2d driver
Signed-off-by: Marco Krahl <ocram.lhark@gmail.com>
* stm32_ltdc: Adds interface definition
Signed-off-by: Marco Krahl <ocram.lhark@gmail.com>
* stm32_ltdc: Reimplements ltdc driver
Signed-off-by: Marco Krahl <ocram.lhark@gmail.com>
* stm32: Updates LTDC and DMA2D Kconfig definitions
Signed-off-by: Marco Krahl <ocram.lhark@gmail.com>
* stm32f429i-disco: Fix compile error when ldc debug is enabled
Signed-off-by: Marco Krahl <ocram.lhark@gmail.com>
* stm32f429i-disco: Adds helper script for frambuffer and heap2 calculation
Signed-off-by: Marco Krahl <ocram.lhark@gmail.com>
* stm32f429i-disco: Update README for framebuffer configuration
Signed-off-by: Marco Krahl <ocram.lhark@gmail.com>
* stm32f429i-disco: Update board configuration of framebuffer example
Signed-off-by: Marco Krahl <ocram.lhark@gmail.com>
Approved-by: Gregory Nutt <gnutt@nuttx.org>
This commit is contained in:
committed by
Gregory Nutt
parent
977d41d519
commit
af9bf8d721
+97
-20
@@ -8119,12 +8119,6 @@ if STM32_LTDC
|
||||
|
||||
menu "LTDC Configuration"
|
||||
|
||||
config STM32_LTDC_INTERFACE
|
||||
bool "LTDC interface support"
|
||||
default n
|
||||
---help---
|
||||
Enable the ltdc interface to support ltdc layer control.
|
||||
|
||||
config STM32_LTDC_BACKLIGHT
|
||||
bool "Backlight support"
|
||||
default y
|
||||
@@ -8170,6 +8164,7 @@ config STM32_LTDC_DITHER_BLUE
|
||||
|
||||
config STM32_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
|
||||
@@ -8178,6 +8173,16 @@ config STM32_LTDC_FB_BASE
|
||||
config STM32_LTDC_FB_SIZE
|
||||
int "Framebuffer memory size (bytes)"
|
||||
default 0
|
||||
---help---
|
||||
Must be the whole size of the active LTDC layer.
|
||||
|
||||
config STM32_LTDC_L1_CHROMAKEY
|
||||
bool "Enable chromakey support for layer 1"
|
||||
default y
|
||||
|
||||
config STM32_LTDC_L1_COLOR
|
||||
hex "Layer L1 default color"
|
||||
default 0x00000000
|
||||
|
||||
choice
|
||||
prompt "Layer 1 color format"
|
||||
@@ -8185,27 +8190,35 @@ choice
|
||||
|
||||
config STM32_LTDC_L1_L8
|
||||
bool "8 bpp L8 (8-bit CLUT)"
|
||||
depends on FB_CMAP
|
||||
|
||||
config STM32_LTDC_L1_AL44
|
||||
bool "8 bpp AL44 (4-bit alpha + 4-bit CLUT)"
|
||||
depends on FB_CMAP
|
||||
|
||||
config STM32_LTDC_L1_AL88
|
||||
bool "16 bpp AL88 (8-bit alpha + 8-bit CLUT)"
|
||||
depends on FB_CMAP
|
||||
|
||||
config STM32_LTDC_L1_RGB565
|
||||
bool "16 bpp RGB 565"
|
||||
depends on !FB_CMAP
|
||||
|
||||
config STM32_LTDC_L1_ARGB4444
|
||||
bool "16 bpp ARGB 4444"
|
||||
depends on !FB_CMAP
|
||||
|
||||
config STM32_LTDC_L1_ARGB1555
|
||||
bool "16 bpp ARGB 1555"
|
||||
depends on !FB_CMAP
|
||||
|
||||
config STM32_LTDC_L1_RGB888
|
||||
bool "24 bpp RGB 888"
|
||||
depends on !FB_CMAP
|
||||
|
||||
config STM32_LTDC_L1_ARGB8888
|
||||
bool "32 bpp ARGB 8888"
|
||||
depends on !FB_CMAP
|
||||
|
||||
endchoice # Layer 1 color format
|
||||
|
||||
@@ -8215,40 +8228,54 @@ config STM32_LTDC_L2
|
||||
|
||||
if STM32_LTDC_L2
|
||||
|
||||
config STM32_LTDC_L2_COLOR
|
||||
hex "Layer L2 default color"
|
||||
default 0x00000000
|
||||
|
||||
config STM32_LTDC_L2_CHROMAKEY
|
||||
bool "Enable chromakey support for layer 2"
|
||||
default y
|
||||
|
||||
choice
|
||||
prompt "Layer 2 (top layer) color format"
|
||||
default STM32_LTDC_L2_RGB565
|
||||
|
||||
config STM32_LTDC_L2_L8
|
||||
depends on STM32_LTDC_L1_L8
|
||||
bool "8 bpp L8 (8-bit CLUT)"
|
||||
|
||||
config STM32_LTDC_L2_AL44
|
||||
depends on STM32_LTDC_L1_AL44
|
||||
bool "8 bpp AL44 (4-bit alpha + 4-bit CLUT)"
|
||||
|
||||
config STM32_LTDC_L2_AL88
|
||||
depends on STM32_LTDC_L1_AL88
|
||||
bool "16 bpp AL88 (8-bit alpha + 8-bit CLUT)"
|
||||
|
||||
config STM32_LTDC_L2_RGB565
|
||||
depends on STM32_LTDC_L1_RGB565
|
||||
bool "16 bpp RGB 565"
|
||||
|
||||
config STM32_LTDC_L2_ARGB4444
|
||||
depends on STM32_LTDC_L1_ARGB4444
|
||||
bool "16 bpp ARGB 4444"
|
||||
|
||||
config STM32_LTDC_L2_ARGB1555
|
||||
depends on STM32_LTDC_L1_ARGB1555
|
||||
bool "16 bpp ARGB 1555"
|
||||
|
||||
config STM32_LTDC_L2_RGB888
|
||||
depends on STM32_LTDC_L1_RGB888
|
||||
bool "24 bpp RGB 888"
|
||||
|
||||
config STM32_LTDC_L2_ARGB8888
|
||||
depends on STM32_LTDC_L1_ARGB8888
|
||||
bool "32 bpp ARGB 8888"
|
||||
|
||||
endchoice # Layer 2 color format
|
||||
|
||||
endif # STM32_LTDC_L2
|
||||
|
||||
if STM32_LTDC_L1_L8 || STM32_LTDC_L2_L8
|
||||
|
||||
config FB_CMAP
|
||||
bool "Enable color map support"
|
||||
default y
|
||||
@@ -8257,11 +8284,17 @@ config FB_CMAP
|
||||
|
||||
config FB_TRANSPARENCY
|
||||
bool "Enable transparency color map support"
|
||||
depends on FB_CMAP
|
||||
default y
|
||||
---help---
|
||||
Enabling transparency color map support is neccessary for ltdc L8 format.
|
||||
|
||||
endif
|
||||
config STM32_LTDC_REGDEBUG
|
||||
bool "LTDC Register level debug"
|
||||
depends on DEBUG_INFO && DEBUG_LCD
|
||||
default n
|
||||
---help---
|
||||
Output detailed register-level LTDC device debug information.
|
||||
endmenu
|
||||
|
||||
endif # STM32_LTDC
|
||||
@@ -8271,49 +8304,93 @@ if STM32_DMA2D
|
||||
menu "DMA2D Configuration"
|
||||
|
||||
config STM32_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 STM32_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 STM32_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 STM32_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 STM32_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 STM32_DMA2D_L8
|
||||
depends on FB_CMAP
|
||||
depends on FB_CMAP && STM32_LTDC_L1_L8
|
||||
bool "8 bpp L8 (8-bit CLUT)"
|
||||
default y
|
||||
|
||||
config STM32_DMA2D_AL44
|
||||
depends on FB_CMAP
|
||||
depends on FB_CMAP && STM32_LTDC_L1_AL44
|
||||
bool "8 bpp AL44 (4-bit alpha + 4-bit CLUT)"
|
||||
default n
|
||||
default y
|
||||
|
||||
config STM32_DMA2D_AL88
|
||||
depends on FB_CMAP
|
||||
depends on FB_CMAP && STM32_LTDC_L1_AL88
|
||||
bool "16 bpp AL88 (8-bit alpha + 8-bit CLUT)"
|
||||
default n
|
||||
default y
|
||||
|
||||
config STM32_DMA2D_RGB565
|
||||
bool "16 bpp RGB 565"
|
||||
depends on STM32_LTDC_L1_RGB565
|
||||
default y
|
||||
|
||||
config STM32_DMA2D_ARGB4444
|
||||
bool "16 bpp ARGB 4444"
|
||||
default n
|
||||
depends on STM32_LTDC_L1_ARGB4444
|
||||
default y
|
||||
|
||||
config STM32_DMA2D_ARGB1555
|
||||
bool "16 bpp ARGB 1555"
|
||||
default n
|
||||
depends on STM32_LTDC_L1_ARGB15555
|
||||
default y
|
||||
|
||||
config STM32_DMA2D_RGB888
|
||||
bool "24 bpp RGB 888"
|
||||
depends on STM32_LTDC_L1_RGB888
|
||||
default y
|
||||
|
||||
config STM32_DMA2D_ARGB8888
|
||||
bool "32 bpp ARGB 8888"
|
||||
default n
|
||||
depends on STM32_LTDC_L1_ARGB8888
|
||||
default y
|
||||
|
||||
endmenu
|
||||
|
||||
config STM32_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 # STM32_DMA2D
|
||||
|
||||
|
||||
@@ -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 */
|
||||
|
||||
+512
-1625
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* arch/arm/src/stm32/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
|
||||
@@ -42,376 +42,156 @@
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <nuttx/video/fb.h>
|
||||
#include "stm32_ltdc.h"
|
||||
|
||||
#ifdef CONFIG_STM32_DMA2D
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
struct ltdc_area_s; /* see arch/arm/src/stm32/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_STM32_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
|
||||
* 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 Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Inline Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* 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_STM32_DMA2D_NLAYERS
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
FAR struct dma2d_layer_s *up_dma2dcreatelayer(fb_coord_t width,
|
||||
fb_coord_t height,
|
||||
uint8_t fmt);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_dma2dremovelayer
|
||||
*
|
||||
* Description:
|
||||
* Remove and deallocate the dma2d layer
|
||||
*
|
||||
* 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 +199,16 @@ 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_STM32_DMA2D */
|
||||
#endif /* __ARCH_ARM_SRC_STM32_STM32_DMA2D_H */
|
||||
|
||||
+1520
-2145
File diff suppressed because it is too large
Load Diff
+38
-578
File diff suppressed because it is too large
Load Diff
@@ -11,50 +11,81 @@ 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:
|
||||
Frambuffer calculation
|
||||
----------------------
|
||||
|
||||
- blit
|
||||
- blend
|
||||
- fillarea
|
||||
Use the helper script configs/stm32f429i-disco/tools/fbcalc.sh for calculating
|
||||
the heap2 and framebuffer memory region. The script assumes that all overlay
|
||||
buffers (LTDC and DMA2D) located in heap2 memory region starting at address
|
||||
0xD0000000. When changing the display size (when using a custom display), DMA2D
|
||||
overlay size or the pixel format you have to recalculate the heap2 settings.
|
||||
In this configuration all overlays (LTDC and DMA2D) positioned at the end of
|
||||
heap2.
|
||||
|
||||
To enable clut support in both LTDC and DMA2D driver the following
|
||||
configurations are valid:
|
||||
|
||||
1.
|
||||
LTDC hardware acceleration
|
||||
--------------------------
|
||||
|
||||
- Enable LTDC_INTERFACE and LAYER1/LAYER2
|
||||
- Layer1 FB_FMT_RGB8
|
||||
- Layer2 any non clut format
|
||||
The LTDC driver provides two 2 LTDC overlays and supports the following hardware
|
||||
acceleration and features:
|
||||
|
||||
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.
|
||||
Configured at build time
|
||||
- background color
|
||||
- default color (outside visible screen)
|
||||
|
||||
2.
|
||||
Configurable by nuttx frambuffer interface
|
||||
- cmap support (color table is shared by both LTDC overlays and DMA2D when
|
||||
enabled)
|
||||
|
||||
- Enable LTDC_INTERFACE and LAYER1/LAYER2
|
||||
- Layer2 FB_FMT_RGB8
|
||||
- Layer1 any non clut format
|
||||
Configurable via the nuttx framebuffer interface (for each layer separately)
|
||||
- chromakey
|
||||
- transparency (const alpha and pixel alpha)
|
||||
- blank
|
||||
- color (if DMA2D is enabled and cmap is disabled)
|
||||
- blit (if DMA2D is enabled)
|
||||
- blend (if DMA2D is enabled and cmap is disabled)
|
||||
|
||||
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.
|
||||
LTDC overlays are similar to a non-destructive overlay. Both LTDC overlays will
|
||||
be permanently blended in the order (background -> overlay 0 -> overlay 1) and
|
||||
converted to a resulting video signal by the LTDC controller. That means each
|
||||
operation with a LTDC overlay (Overlay 0 and Overlay 1) via nuttx framebuffer
|
||||
interface will be visible immediatelly.
|
||||
Think about continuous blending between both overlays.
|
||||
|
||||
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.
|
||||
DMA2D hardware acceleration
|
||||
---------------------------
|
||||
|
||||
The DMA2D driver implements the following hardware acceleration:
|
||||
|
||||
Configurable via the nuttx framebuffer interface
|
||||
- cmap support (color table is shared by all DMA2D overlays and LTDC overlays)
|
||||
|
||||
Configurable via the nuttx framebuffer interface (for each layer separately)
|
||||
|
||||
- color (fill memory region with a specific ARGB8888 color immediatelly), if
|
||||
cmap is disabled
|
||||
- blit (copy memory region to another memory region with pixel format
|
||||
conversion if neccessary)
|
||||
- blend (blend two memory regions and copy the result to a third memory region
|
||||
with pixel format conversion if neccessary), if cmap is disabled
|
||||
|
||||
Blit and blend operation using a fixes memory size defined by the background
|
||||
layer. DMA2D controller doesn't support scaling.
|
||||
|
||||
DMA2D overlays are similar to destructive overlays. They are invisible. They can
|
||||
be used for image preprocessing. The memory region affected by the operations
|
||||
(color, blit, blend) can be addressed by the area control command before. The
|
||||
configured overlay transparency of DMA2D overlays will be used for subsequently
|
||||
blend operation and is valid for the whole overlay.
|
||||
|
||||
|
||||
Configuration
|
||||
------------
|
||||
|
||||
This configuration provides 2 LTDC (visible overlays) and 2 DMA2D overlays with
|
||||
pixel format RGB565 and a resolution of 240x320.
|
||||
|
||||
|
||||
Loading
|
||||
@@ -62,6 +93,7 @@ Loading
|
||||
|
||||
st-flash write nuttx.bin 0x8000000
|
||||
|
||||
|
||||
Executing
|
||||
---------
|
||||
|
||||
@@ -70,5 +102,11 @@ console at 115200 8N1 baud. From the nsh comandline execute the fb example:
|
||||
|
||||
nsh> fb
|
||||
|
||||
The test will put a pattern of concentric squares in the framebuffer and terminate.
|
||||
The test will put a pattern of concentric squares in the framebuffer and
|
||||
terminate.
|
||||
|
||||
You can also test overlay hardware acceleration functionality by executing the
|
||||
follwing command (shows a commandline help):
|
||||
|
||||
nsh> fboverlay
|
||||
|
||||
|
||||
@@ -1,31 +1,34 @@
|
||||
# CONFIG_ARCH_FPU is not set
|
||||
# CONFIG_STM32_DMA2D_RGB888 is not set
|
||||
# CONFIG_FB_CMAP is not set
|
||||
# CONFIG_STM32_FLASH_PREFETCH is not set
|
||||
CONFIG_ARCH_BOARD_STM32F429I_DISCO=y
|
||||
CONFIG_ARCH="arm"
|
||||
CONFIG_ARCH_BOARD="stm32f429i-disco"
|
||||
CONFIG_ARCH_BOARD_STM32F429I_DISCO=y
|
||||
CONFIG_ARCH_BUTTONS=y
|
||||
CONFIG_ARCH_CHIP_STM32=y
|
||||
CONFIG_ARCH_CHIP_STM32F429Z=y
|
||||
CONFIG_ARCH_STACKDUMP=y
|
||||
CONFIG_ARCH="arm"
|
||||
CONFIG_ARMV7M_TOOLCHAIN_CODESOURCERYL=y
|
||||
CONFIG_BOARD_LOOPSPERMSEC=16717
|
||||
CONFIG_BUILTIN=y
|
||||
CONFIG_DEBUG_CUSTOMOPT=y
|
||||
CONFIG_DEBUG_SYMBOLS=y
|
||||
CONFIG_DISABLE_POLL=y
|
||||
CONFIG_DRIVERS_VIDEO=y
|
||||
CONFIG_EXAMPLES_FB=y
|
||||
CONFIG_EXAMPLES_NSH_CXXINITIALIZE=y
|
||||
CONFIG_EXAMPLES_FBOVERLAY=y
|
||||
CONFIG_EXAMPLES_NSH=y
|
||||
CONFIG_EXAMPLES_NSH_CXXINITIALIZE=y
|
||||
CONFIG_EXAMPLES_TOUCHSCREEN=y
|
||||
CONFIG_FB_OVERLAY=y
|
||||
CONFIG_FB_OVERLAY_BLIT=y
|
||||
CONFIG_FB_SYNC=y
|
||||
CONFIG_FS_PROCFS=y
|
||||
CONFIG_HAVE_CXX=y
|
||||
CONFIG_HAVE_CXXINITIALIZE=y
|
||||
CONFIG_HEAP2_BASE=0xD0000000
|
||||
CONFIG_HEAP2_SIZE=8081408
|
||||
CONFIG_INPUT_STMPE811=y
|
||||
CONFIG_HEAP2_SIZE=7774208
|
||||
CONFIG_INPUT=y
|
||||
CONFIG_INPUT_STMPE811=y
|
||||
CONFIG_INTELHEX_BINARY=y
|
||||
CONFIG_MAX_TASKS=16
|
||||
CONFIG_MAX_WDOGPARMS=2
|
||||
@@ -36,7 +39,8 @@ CONFIG_NFILE_STREAMS=8
|
||||
CONFIG_NSH_ARCHINIT=y
|
||||
CONFIG_NSH_BUILTIN_APPS=y
|
||||
CONFIG_NSH_FILEIOSIZE=512
|
||||
CONFIG_NSH_LINELEN=64
|
||||
CONFIG_NSH_LINELEN=128
|
||||
CONFIG_NSH_MAXARGUMENTS=17
|
||||
CONFIG_NSH_READLINE=y
|
||||
CONFIG_PREALLOC_MQ_MSGS=4
|
||||
CONFIG_PREALLOC_TIMERS=4
|
||||
@@ -52,22 +56,24 @@ CONFIG_SPI_CMDDATA=y
|
||||
CONFIG_START_DAY=15
|
||||
CONFIG_START_MONTH=11
|
||||
CONFIG_START_YEAR=2017
|
||||
CONFIG_STM32F429I_DISCO_ILI9341=y
|
||||
CONFIG_STM32_CCMEXCLUDE=y
|
||||
CONFIG_STM32_DISABLE_IDLE_SLEEP_DURING_DEBUG=y
|
||||
CONFIG_STM32_DMA2D_NLAYERS=1
|
||||
CONFIG_STM32_DMA2D=y
|
||||
CONFIG_STM32_FSMC_SRAM=y
|
||||
CONFIG_STM32_DMA2D_FB_BASE=0xD07B5000
|
||||
CONFIG_STM32_DMA2D_FB_SIZE=307200
|
||||
CONFIG_STM32_DMA2D_LAYER_PPLINE=240
|
||||
CONFIG_STM32_DMA2D_NLAYERS=2
|
||||
CONFIG_STM32_FSMC=y
|
||||
CONFIG_STM32_FSMC_SRAM=y
|
||||
CONFIG_STM32_I2C3=y
|
||||
CONFIG_STM32_JTAG_SW_ENABLE=y
|
||||
CONFIG_STM32_LTDC_FB_BASE=0xD07B5000
|
||||
CONFIG_STM32_LTDC_FB_SIZE=307200
|
||||
CONFIG_STM32_LTDC_INTERFACE=y
|
||||
CONFIG_STM32_LTDC=y
|
||||
CONFIG_STM32_LTDC_FB_BASE=0xD076A000
|
||||
CONFIG_STM32_LTDC_FB_SIZE=307200
|
||||
CONFIG_STM32_PWR=y
|
||||
CONFIG_STM32_SPI5=y
|
||||
CONFIG_STM32_USART1=y
|
||||
CONFIG_STM32F429I_DISCO_ILI9341=y
|
||||
CONFIG_STMPE811_ACTIVELOW=y
|
||||
CONFIG_STMPE811_EDGE=y
|
||||
CONFIG_STMPE811_THRESHX=39
|
||||
|
||||
@@ -320,6 +320,7 @@ static int stm32_ili9341_initialize(void)
|
||||
#ifdef CONFIG_DEBUG_LCD_INFO
|
||||
/* Read display identification */
|
||||
|
||||
uint8_t param;
|
||||
lcd->sendcmd(lcd, ILI9341_READ_ID1);
|
||||
lcd->recvparam(lcd, ¶m);
|
||||
lcdinfo("ili9341 LCD driver: LCD modules manufacturer ID: %d\n", param);
|
||||
@@ -590,24 +591,4 @@ void up_fbuninitialize(int display)
|
||||
{
|
||||
stm32_ltdcuninitialize();
|
||||
}
|
||||
|
||||
/************************************************************************************
|
||||
* Name: up_ltdcgetlayer
|
||||
*
|
||||
* Description:
|
||||
* The application function name to get a reference to the hardware layer of
|
||||
* the ltdc device.
|
||||
*
|
||||
* Input Parameters:
|
||||
* 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 */
|
||||
|
||||
Executable
+194
@@ -0,0 +1,194 @@
|
||||
#!/bin/bash
|
||||
#############################################################################
|
||||
# configs/stm32f429-disco/tools/fbcalc.sh
|
||||
#
|
||||
# Copyright (C) 2018 Marco Krahl. All rights reserved.
|
||||
# Author: Marco Krahl <ocram.lhark@gmail.com>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# 3. Neither the name NuttX nor the names of its contributors may be
|
||||
# used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
#############################################################################
|
||||
|
||||
heap2base=0xD0000000
|
||||
heap2size=$((1024 * 1024 * 8))
|
||||
heap2end=$((${heap2base} + ${heap2size}))
|
||||
|
||||
usage()
|
||||
{
|
||||
cat << EOF
|
||||
${0}: <xres> <yres> <bpp> <n> <xres2> <yres2> <n2> <base>
|
||||
|
||||
options:
|
||||
xres LTDC display x-resolution
|
||||
yres LTDC display y-resolution
|
||||
bpp LTDC bits per pixel (8/16/24/32)
|
||||
n Number of LTDC overlays
|
||||
xres2 DMA2D display x-resolution
|
||||
yres2 DMA2D display y-resolution
|
||||
n2 Number of DMA2D overlays
|
||||
base Framebuffer positioning in heap2 memory region (optional)
|
||||
0: base of heap2 (default)
|
||||
1: end of heap2
|
||||
|
||||
example:
|
||||
${0} 240 320 16 2 240 320 2 0
|
||||
EOF
|
||||
}
|
||||
|
||||
fbinfo()
|
||||
{
|
||||
# $1: LTDC start address
|
||||
# $2: LTDC len
|
||||
# $3: DMA2D len
|
||||
# $4: Set framebuffer to end
|
||||
|
||||
if [ ${4} -eq 0 ] ; then
|
||||
cat << EOF
|
||||
-------------------------------------------------------
|
||||
Framebuffer calculation
|
||||
-------------------------------------------------------
|
||||
Framebuffer base address: $(printf 0x%08X ${1})
|
||||
CONFIG_STM32_LTDC_FB_BASE: $(printf 0x%08X ${1})
|
||||
CONFIG_STM32_LTDC_FB_SIZE: ${2}
|
||||
CONFIG_STM32_DMA2D_FB_BASE: $(printf 0x%08X $((${1} + ${2})))
|
||||
CONFIG_STM32_DMA2D_FB_SIZE: ${3}
|
||||
EOF
|
||||
|
||||
else
|
||||
cat << EOF
|
||||
-------------------------------------------------------
|
||||
Framebuffer calculation
|
||||
-------------------------------------------------------
|
||||
Framebuffer end address: $(printf 0x%08X $((${1} + ${heap2size})))
|
||||
CONFIG_STM32_LTDC_FB_BASE: $(printf 0x%08X $((${1} + ${heap2size} - ${2} - ${3})))
|
||||
CONFIG_STM32_LTDC_FB_SIZE: ${2}
|
||||
CONFIG_STM32_DMA2D_FB_BASE: $(printf 0x%08X $((${1} - ${3} + ${heap2size})))
|
||||
CONFIG_STM32_DMA2D_FB_SIZE: ${3}
|
||||
EOF
|
||||
|
||||
fi
|
||||
}
|
||||
|
||||
heap2info()
|
||||
{
|
||||
# $1: LTDC start address
|
||||
# $2: LTDC + DMA2D len
|
||||
# $3: Set framebuffer to end
|
||||
|
||||
if [ $((${1} + 0)) -ge $((${heap2base} + 0)) ] && \
|
||||
[ $((${1} + 0)) -le ${heap2end} ] ; then
|
||||
|
||||
if [ ${3} -ne 0 ] ; then
|
||||
cat << EOF
|
||||
-------------------------------------------------------
|
||||
Heap2 calculation
|
||||
-------------------------------------------------------
|
||||
Framebuffer end address: $(printf 0x%08X $((${1} + ${heap2size})))
|
||||
CONFIG_HEAP2_BASE: $(printf 0x%08X ${1})
|
||||
CONFIG_HEAP2_SIZE: $(printf %d $((${heap2size} - ${2})))
|
||||
EOF
|
||||
else
|
||||
cat << EOF
|
||||
-------------------------------------------------------
|
||||
Heap2 calculation
|
||||
-------------------------------------------------------
|
||||
Framebuffer base address: $(printf 0x%08X ${1})
|
||||
CONFIG_HEAP2_BASE: $(printf 0x%08X $((${1} - ${2} + ${heap2size})))
|
||||
CONFIG_HEAP2_SIZE: $(printf %d $((${heap2size} - ${2})))
|
||||
EOF
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
fbstride()
|
||||
{
|
||||
# $1: bpp
|
||||
# $2: pixel per line
|
||||
|
||||
bpp=${1}
|
||||
ppl=${2}
|
||||
stride=0
|
||||
|
||||
if [ $bpp -eq 8 ] ; then
|
||||
stride=$(((${ppl} * ${bpp} + 7) / 8))
|
||||
elif [ $bpp -eq 16 ] ; then
|
||||
stride=$(((${ppl} * ${bpp} + 7) / 8))
|
||||
elif [ $bpp -eq 24 ] ; then
|
||||
stride=$(((${ppl} * ${bpp} + 7) / 8))
|
||||
elif [ $bpp -eq 32 ] ; then
|
||||
stride=$(((${ppl} * ${bpp} + 7) / 8))
|
||||
else
|
||||
echo "Pixel format with ${bpp} not supported" 1>&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
echo $stride
|
||||
return 0
|
||||
}
|
||||
|
||||
if [ -z $7 ] ; then
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
fbaddr=${heap2base}
|
||||
xres=${1}
|
||||
yres=${2}
|
||||
bpp=${3}
|
||||
noverlays=${4}
|
||||
xres2=${5}
|
||||
yres2=${6}
|
||||
noverlays2=${7}
|
||||
|
||||
if [ ! -z $8 ] ; then
|
||||
base=${8}
|
||||
else
|
||||
base=0
|
||||
fi
|
||||
|
||||
if [ ! -z $9 ] ; then
|
||||
config=${9}
|
||||
else
|
||||
config=""
|
||||
fi
|
||||
|
||||
stride=$(fbstride ${bpp} ${xres})
|
||||
if [ $? -ne 0 ] ; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
stride2=$(fbstride ${bpp} ${xres2})
|
||||
if [ $? -ne 0 ] ; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
size=$((${stride} * ${yres} * ${noverlays}))
|
||||
size2=$((${stride2} * ${yres2} * ${noverlays2}))
|
||||
|
||||
fbinfo ${fbaddr} ${size} ${size2} ${base}
|
||||
heap2info ${fbaddr} $((${size} + ${size2})) ${base}
|
||||
Reference in New Issue
Block a user