arch/arm/include/stm32 and stm32f7: Remove ltdc.h and dma2d.h. Those header files in that location permitted inclusion into application space logic and, hence, facilitated and encouraged calling into the OS and violating the portable POSIX OS interface. The definitions in those header files were move the appropriate location in the counterpart, architecture specific files at arch/arm/src/stm32 and stm32f7 dma2d.h and ltdc.h.
configs/stm32f429i-disco/ltdc: This configuration has been deleted because it violated the portable POSIX OS interface. It used apps/examples/ltdc and include ltdc.h and dma2d.h which were also removed for the same reason.
This commit is contained in:
parent
d5f8a49f18
commit
08fa834a6a
@ -1,415 +0,0 @@
|
||||
/****************************************************************************
|
||||
* arch/arm/include/stm32/dma2d.h
|
||||
*
|
||||
* Copyright (C) 2015 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ARCH_ARM_INCLUDE_STM32_DMA2D_H
|
||||
#define __ARCH_ARM_INCLUDE_STM32_DMA2D_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <stdbool.h>
|
||||
#include <nuttx/video/fb.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
struct ltdc_area_s; /* see arch/chip/ltdc.h */
|
||||
|
||||
/* Blend mode definitions */
|
||||
|
||||
enum dma2d_blend_e
|
||||
{
|
||||
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 */
|
||||
};
|
||||
|
||||
/* The layer is controlled through the following structure */
|
||||
|
||||
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
|
||||
*
|
||||
* Return:
|
||||
* 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
|
||||
*
|
||||
* Return:
|
||||
* 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
|
||||
*
|
||||
* Return:
|
||||
* 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.
|
||||
*
|
||||
* Parameter:
|
||||
* layer - Reference to the layer structure
|
||||
* cmap - color lookup table with up the 256 entries
|
||||
*
|
||||
* Return:
|
||||
* 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
|
||||
*
|
||||
* Return:
|
||||
* On success - OK
|
||||
* On error - -EINVAL
|
||||
*/
|
||||
|
||||
int (*getclut)(FAR struct dma2d_layer_s *layer, FAR struct fb_cmap_s *cmap);
|
||||
#endif
|
||||
|
||||
/* 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
|
||||
*
|
||||
* Parameter:
|
||||
* layer - Reference to the layer structure
|
||||
* alpha - Alpha value
|
||||
*
|
||||
* Return:
|
||||
* 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
|
||||
*
|
||||
* Return:
|
||||
* 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_*)
|
||||
*
|
||||
* Return:
|
||||
* 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
|
||||
*
|
||||
* Return:
|
||||
* On success - OK
|
||||
* On error - -EINVAL
|
||||
*/
|
||||
|
||||
int (*getblendmode)(FAR struct dma2d_layer_s *layer, uint32_t *mode);
|
||||
|
||||
/* 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 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
|
||||
*
|
||||
* Return:
|
||||
* 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.
|
||||
*/
|
||||
|
||||
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);
|
||||
|
||||
/* 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.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* Return:
|
||||
* 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.
|
||||
*/
|
||||
|
||||
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.
|
||||
*
|
||||
* Return:
|
||||
* 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);
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_dma2dgetlayer
|
||||
*
|
||||
* Description:
|
||||
* Get a dma2d layer structure by the layer identifier
|
||||
*
|
||||
* Parameter:
|
||||
* lid - Layer identifier
|
||||
*
|
||||
* Return:
|
||||
* 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
|
||||
*
|
||||
* Parameter:
|
||||
* width - Layer width
|
||||
* height - Layer height
|
||||
* fmt - Pixel format of the layer
|
||||
*
|
||||
* Return:
|
||||
* 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
|
||||
*
|
||||
* Parameter:
|
||||
* layer - Reference to the layer to remove
|
||||
*
|
||||
* Return:
|
||||
* On success - OK
|
||||
* On error - -EINVAL
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int up_dma2dremovelayer(FAR struct dma2d_layer_s *layer);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_dma2dinitialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize the dma2d controller
|
||||
*
|
||||
* Return:
|
||||
* OK - On success
|
||||
* An error if initializing failed.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int up_dma2dinitialize(void);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_dma2duninitialize
|
||||
*
|
||||
* Description:
|
||||
* Uninitialize the dma2d controller
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void up_dma2duninitialize(void);
|
||||
|
||||
#endif /* __ARCH_ARM_INCLUDE_STM32_DMA2D_H */
|
@ -1,592 +0,0 @@
|
||||
/****************************************************************************
|
||||
* arch/arm/include/stm32/ltdc.h
|
||||
*
|
||||
* 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
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ARCH_ARM_INCLUDE_STM32_LTDC_H
|
||||
#define __ARCH_ARM_INCLUDE_STM32_LTDC_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <stdbool.h>
|
||||
#include <nuttx/video/fb.h>
|
||||
|
||||
#ifdef CONFIG_STM32_LTDC
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
struct dma2d_layer_s; /* see arch/chip/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_STM32_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
|
||||
*
|
||||
* Return:
|
||||
* 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
|
||||
*
|
||||
* Return:
|
||||
* 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
|
||||
*
|
||||
* Return:
|
||||
* 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)
|
||||
*
|
||||
* Return:
|
||||
* 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
|
||||
*
|
||||
* Return:
|
||||
* 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
|
||||
*
|
||||
* Return:
|
||||
* 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
|
||||
*
|
||||
* Return:
|
||||
* 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
|
||||
*
|
||||
* Return:
|
||||
* 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
|
||||
*
|
||||
* Return:
|
||||
* 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
|
||||
*
|
||||
* Return:
|
||||
* 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
|
||||
*
|
||||
* Return:
|
||||
* 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_*)
|
||||
*
|
||||
* Return:
|
||||
* 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
|
||||
*
|
||||
* Return:
|
||||
* 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
|
||||
*
|
||||
* Return:
|
||||
* 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
|
||||
*
|
||||
* Return:
|
||||
* 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_*)
|
||||
*
|
||||
* Return:
|
||||
* 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_STM32_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
|
||||
*
|
||||
* Return:
|
||||
* 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
|
||||
*
|
||||
* Return:
|
||||
* 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.
|
||||
*
|
||||
* Return:
|
||||
* 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
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_ltdcgetlayer
|
||||
*
|
||||
* Description:
|
||||
* Get the ltdc layer structure to perform hardware layer operation
|
||||
*
|
||||
* Parameter:
|
||||
* lid - Layer identifier
|
||||
*
|
||||
* Return:
|
||||
* Reference to the layer control structure on success or Null if parameter
|
||||
* invalid.
|
||||
*
|
||||
****************************************************************************/
|
||||
FAR struct ltdc_layer_s *up_ltdcgetlayer(int lid);
|
||||
#endif /* CONFIG_STM32_LTDC */
|
||||
#endif /* __ARCH_ARM_INCLUDE_STM32_LTDC_H */
|
@ -1,415 +0,0 @@
|
||||
/****************************************************************************
|
||||
* arch/arm/include/stm32/dma2d.h
|
||||
*
|
||||
* Copyright (C) 2015 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ARCH_ARM_INCLUDE_STM32F7_DMA2D_H
|
||||
#define __ARCH_ARM_INCLUDE_STM32F7_DMA2D_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <stdbool.h>
|
||||
#include <nuttx/video/fb.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
struct ltdc_area_s; /* see arch/chip/ltdc.h */
|
||||
|
||||
/* Blend mode definitions */
|
||||
|
||||
enum dma2d_blend_e
|
||||
{
|
||||
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 */
|
||||
};
|
||||
|
||||
/* The layer is controlled through the following structure */
|
||||
|
||||
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
|
||||
*
|
||||
* Return:
|
||||
* 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
|
||||
*
|
||||
* Return:
|
||||
* 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
|
||||
*
|
||||
* Return:
|
||||
* 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.
|
||||
*
|
||||
* Parameter:
|
||||
* layer - Reference to the layer structure
|
||||
* cmap - color lookup table with up the 256 entries
|
||||
*
|
||||
* Return:
|
||||
* 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
|
||||
*
|
||||
* Return:
|
||||
* On success - OK
|
||||
* On error - -EINVAL
|
||||
*/
|
||||
|
||||
int (*getclut)(FAR struct dma2d_layer_s *layer, FAR struct fb_cmap_s *cmap);
|
||||
#endif
|
||||
|
||||
/* 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
|
||||
*
|
||||
* Parameter:
|
||||
* layer - Reference to the layer structure
|
||||
* alpha - Alpha value
|
||||
*
|
||||
* Return:
|
||||
* 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
|
||||
*
|
||||
* Return:
|
||||
* 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_*)
|
||||
*
|
||||
* Return:
|
||||
* 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
|
||||
*
|
||||
* Return:
|
||||
* On success - OK
|
||||
* On error - -EINVAL
|
||||
*/
|
||||
|
||||
int (*getblendmode)(FAR struct dma2d_layer_s *layer, uint32_t *mode);
|
||||
|
||||
/* 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 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
|
||||
*
|
||||
* Return:
|
||||
* 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.
|
||||
*/
|
||||
|
||||
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);
|
||||
|
||||
/* 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.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* Return:
|
||||
* 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.
|
||||
*/
|
||||
|
||||
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.
|
||||
*
|
||||
* Return:
|
||||
* 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);
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_dma2dgetlayer
|
||||
*
|
||||
* Description:
|
||||
* Get a dma2d layer structure by the layer identifier
|
||||
*
|
||||
* Parameter:
|
||||
* lid - Layer identifier
|
||||
*
|
||||
* Return:
|
||||
* 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
|
||||
*
|
||||
* Parameter:
|
||||
* width - Layer width
|
||||
* height - Layer height
|
||||
* fmt - Pixel format of the layer
|
||||
*
|
||||
* Return:
|
||||
* 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
|
||||
*
|
||||
* Parameter:
|
||||
* layer - Reference to the layer to remove
|
||||
*
|
||||
* Return:
|
||||
* On success - OK
|
||||
* On error - -EINVAL
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int up_dma2dremovelayer(FAR struct dma2d_layer_s *layer);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_dma2dinitialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize the dma2d controller
|
||||
*
|
||||
* Return:
|
||||
* OK - On success
|
||||
* An error if initializing failed.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int up_dma2dinitialize(void);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_dma2duninitialize
|
||||
*
|
||||
* Description:
|
||||
* Uninitialize the dma2d controller
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void up_dma2duninitialize(void);
|
||||
|
||||
#endif /* __ARCH_ARM_INCLUDE_STM32F7_DMA2D_H */
|
@ -1,575 +0,0 @@
|
||||
/****************************************************************************
|
||||
* arch/arm/include/stm32/ltdc.h
|
||||
*
|
||||
* 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
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ARCH_ARM_INCLUDE_STM32F7_LTDC_H
|
||||
#define __ARCH_ARM_INCLUDE_STM32F7_LTDC_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <stdbool.h>
|
||||
#include <nuttx/video/fb.h>
|
||||
|
||||
#ifdef CONFIG_STM32F7_LTDC
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
struct dma2d_layer_s; /* see arch/chip/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
|
||||
*
|
||||
* Return:
|
||||
* 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
|
||||
*
|
||||
* Return:
|
||||
* 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
|
||||
*
|
||||
* Return:
|
||||
* 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)
|
||||
*
|
||||
* Return:
|
||||
* 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
|
||||
*
|
||||
* Return:
|
||||
* 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
|
||||
*
|
||||
* Return:
|
||||
* 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
|
||||
*
|
||||
* Return:
|
||||
* 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
|
||||
*
|
||||
* Return:
|
||||
* 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
|
||||
*
|
||||
* Return:
|
||||
* 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
|
||||
*
|
||||
* Return:
|
||||
* 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
|
||||
*
|
||||
* Return:
|
||||
* 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_*)
|
||||
*
|
||||
* Return:
|
||||
* 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
|
||||
*
|
||||
* Return:
|
||||
* 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
|
||||
*
|
||||
* Return:
|
||||
* 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
|
||||
*
|
||||
* Return:
|
||||
* 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_*)
|
||||
*
|
||||
* Return:
|
||||
* 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
|
||||
*
|
||||
* Return:
|
||||
* 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
|
||||
*
|
||||
* Return:
|
||||
* 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.
|
||||
*
|
||||
* Return:
|
||||
* 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
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_ltdcgetlayer
|
||||
*
|
||||
* Description:
|
||||
* Get the ltdc layer structure to perform hardware layer operation
|
||||
*
|
||||
* Parameter:
|
||||
* lid - Layer identifier
|
||||
*
|
||||
* Return:
|
||||
* Reference to the layer control structure on success or Null if parameter
|
||||
* invalid.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
FAR struct ltdc_layer_s *up_ltdcgetlayer(int lid);
|
||||
|
||||
#endif /* CONFIG_STM32F7_LTDC */
|
||||
#endif /* __ARCH_ARM_INCLUDE_STM32F7_LTDC_H */
|
||||
|
@ -53,7 +53,6 @@
|
||||
#include <nuttx/semaphore.h>
|
||||
#include <nuttx/video/fb.h>
|
||||
|
||||
#include <arch/chip/dma2d.h>
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#include "up_arch.h"
|
||||
|
@ -45,23 +45,287 @@
|
||||
#include <arch/chip/ltdc.h>
|
||||
|
||||
#ifdef CONFIG_STM32_DMA2D
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
struct ltdc_area_s; /* see arch/arm/src/stm32/stm32_ltdc.h */
|
||||
|
||||
/* Blend mode definitions */
|
||||
|
||||
enum dma2d_blend_e
|
||||
{
|
||||
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 */
|
||||
};
|
||||
|
||||
/* The layer is controlled through the following structure */
|
||||
|
||||
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
|
||||
*
|
||||
* Return:
|
||||
* 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
|
||||
*
|
||||
* Return:
|
||||
* 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
|
||||
*
|
||||
* Return:
|
||||
* 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.
|
||||
*
|
||||
* Parameter:
|
||||
* layer - Reference to the layer structure
|
||||
* cmap - color lookup table with up the 256 entries
|
||||
*
|
||||
* Return:
|
||||
* 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
|
||||
*
|
||||
* Return:
|
||||
* On success - OK
|
||||
* On error - -EINVAL
|
||||
*/
|
||||
|
||||
int (*getclut)(FAR struct dma2d_layer_s *layer, FAR struct fb_cmap_s *cmap);
|
||||
#endif
|
||||
|
||||
/* 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
|
||||
*
|
||||
* Parameter:
|
||||
* layer - Reference to the layer structure
|
||||
* alpha - Alpha value
|
||||
*
|
||||
* Return:
|
||||
* 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
|
||||
*
|
||||
* Return:
|
||||
* 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_*)
|
||||
*
|
||||
* Return:
|
||||
* 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
|
||||
*
|
||||
* Return:
|
||||
* On success - OK
|
||||
* On error - -EINVAL
|
||||
*/
|
||||
|
||||
int (*getblendmode)(FAR struct dma2d_layer_s *layer, uint32_t *mode);
|
||||
|
||||
/* 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 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
|
||||
*
|
||||
* Return:
|
||||
* 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.
|
||||
*/
|
||||
|
||||
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);
|
||||
|
||||
/* 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.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* Return:
|
||||
* 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.
|
||||
*/
|
||||
|
||||
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.
|
||||
*
|
||||
* Return:
|
||||
* 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);
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
# ifdef CONFIG_STM32_LTDC_INTERFACE
|
||||
struct stm32_ltdc_s; /* Forward declaration */
|
||||
|
||||
/****************************************************************************
|
||||
* Name: stm32_dma2dinitltdc
|
||||
*
|
||||
@ -84,7 +348,88 @@
|
||||
****************************************************************************/
|
||||
|
||||
FAR struct dma2d_layer_s *stm32_dma2dinitltdc(FAR struct stm32_ltdc_s *layer);
|
||||
# endif /* CONFIG_STM32_LTDC_INTERFACE */
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_dma2dgetlayer
|
||||
*
|
||||
* Description:
|
||||
* Get a dma2d layer structure by the layer identifier
|
||||
*
|
||||
* Parameter:
|
||||
* lid - Layer identifier
|
||||
*
|
||||
* Return:
|
||||
* 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
|
||||
*
|
||||
* Parameter:
|
||||
* width - Layer width
|
||||
* height - Layer height
|
||||
* fmt - Pixel format of the layer
|
||||
*
|
||||
* Return:
|
||||
* 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
|
||||
*
|
||||
* Parameter:
|
||||
* layer - Reference to the layer to remove
|
||||
*
|
||||
* Return:
|
||||
* On success - OK
|
||||
* On error - -EINVAL
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int up_dma2dremovelayer(FAR struct dma2d_layer_s *layer);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_dma2dinitialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize the dma2d controller
|
||||
*
|
||||
* Return:
|
||||
* OK - On success
|
||||
* An error if initializing failed.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int up_dma2dinitialize(void);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_dma2duninitialize
|
||||
*
|
||||
* Description:
|
||||
* Uninitialize the dma2d controller
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void up_dma2duninitialize(void);
|
||||
|
||||
#endif /* CONFIG_STM32_DMA2D */
|
||||
#endif /* __ARCH_ARM_SRC_STM32_STM32_DMA2D_H */
|
||||
|
@ -53,8 +53,6 @@
|
||||
#include <nuttx/semaphore.h>
|
||||
#include <nuttx/video/fb.h>
|
||||
|
||||
#include <arch/chip/ltdc.h>
|
||||
#include <arch/chip/dma2d.h>
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#include "up_arch.h"
|
||||
|
@ -61,6 +61,502 @@
|
||||
* Public Types
|
||||
************************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
struct dma2d_layer_s; /* see arch/arm/src/stm32/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_STM32_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
|
||||
*
|
||||
* Return:
|
||||
* 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
|
||||
*
|
||||
* Return:
|
||||
* 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
|
||||
*
|
||||
* Return:
|
||||
* 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)
|
||||
*
|
||||
* Return:
|
||||
* 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
|
||||
*
|
||||
* Return:
|
||||
* 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
|
||||
*
|
||||
* Return:
|
||||
* 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
|
||||
*
|
||||
* Return:
|
||||
* 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
|
||||
*
|
||||
* Return:
|
||||
* 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
|
||||
*
|
||||
* Return:
|
||||
* 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
|
||||
*
|
||||
* Return:
|
||||
* 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
|
||||
*
|
||||
* Return:
|
||||
* 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_*)
|
||||
*
|
||||
* Return:
|
||||
* 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
|
||||
*
|
||||
* Return:
|
||||
* 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
|
||||
*
|
||||
* Return:
|
||||
* 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
|
||||
*
|
||||
* Return:
|
||||
* 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_*)
|
||||
*
|
||||
* Return:
|
||||
* 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_STM32_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
|
||||
*
|
||||
* Return:
|
||||
* 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
|
||||
*
|
||||
* Return:
|
||||
* 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.
|
||||
*
|
||||
* Return:
|
||||
* 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
|
||||
@ -92,7 +588,7 @@ struct stm32_ltdc_s
|
||||
|
||||
/* Operation */
|
||||
|
||||
sem_t *lock; /* Ensure mutually exclusive access */
|
||||
sem_t *lock; /* Ensure mutually exclusive access */
|
||||
};
|
||||
|
||||
/************************************************************************************
|
||||
@ -102,10 +598,22 @@ struct stm32_ltdc_s
|
||||
/************************************************************************************
|
||||
* Public Functions
|
||||
************************************************************************************/
|
||||
|
||||
/* The STM32 LTDC driver uses the common framebuffer interfaces declared in
|
||||
* include/nuttx/video/fb.h.
|
||||
*/
|
||||
|
||||
/************************************************************************************
|
||||
* Name: stm32_ltdcinitialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize the ltdc controller
|
||||
*
|
||||
* Return:
|
||||
* OK
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
int stm32_ltdcinitialize(void);
|
||||
FAR struct fb_vtable_s *stm32_ltdcgetvplane(int vplane);
|
||||
void stm32_ltdcuninitialize(void);
|
||||
|
@ -53,7 +53,6 @@
|
||||
#include <nuttx/semaphore.h>
|
||||
#include <nuttx/video/fb.h>
|
||||
|
||||
#include <arch/chip/dma2d.h>
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#include "up_arch.h"
|
||||
|
@ -46,11 +46,286 @@
|
||||
|
||||
#ifdef CONFIG_STM32F7_DMA2D
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
struct ltdc_area_s; /* see arch/arm/src/stm32f7/stm32_ltdc.h */
|
||||
|
||||
/* Blend mode definitions */
|
||||
|
||||
enum dma2d_blend_e
|
||||
{
|
||||
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 */
|
||||
};
|
||||
|
||||
/* The layer is controlled through the following structure */
|
||||
|
||||
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
|
||||
*
|
||||
* Return:
|
||||
* 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
|
||||
*
|
||||
* Return:
|
||||
* 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
|
||||
*
|
||||
* Return:
|
||||
* 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.
|
||||
*
|
||||
* Parameter:
|
||||
* layer - Reference to the layer structure
|
||||
* cmap - color lookup table with up the 256 entries
|
||||
*
|
||||
* Return:
|
||||
* 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
|
||||
*
|
||||
* Return:
|
||||
* On success - OK
|
||||
* On error - -EINVAL
|
||||
*/
|
||||
|
||||
int (*getclut)(FAR struct dma2d_layer_s *layer, FAR struct fb_cmap_s *cmap);
|
||||
#endif
|
||||
|
||||
/* 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
|
||||
*
|
||||
* Parameter:
|
||||
* layer - Reference to the layer structure
|
||||
* alpha - Alpha value
|
||||
*
|
||||
* Return:
|
||||
* 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
|
||||
*
|
||||
* Return:
|
||||
* 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_*)
|
||||
*
|
||||
* Return:
|
||||
* 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
|
||||
*
|
||||
* Return:
|
||||
* On success - OK
|
||||
* On error - -EINVAL
|
||||
*/
|
||||
|
||||
int (*getblendmode)(FAR struct dma2d_layer_s *layer, uint32_t *mode);
|
||||
|
||||
/* 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 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
|
||||
*
|
||||
* Return:
|
||||
* 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.
|
||||
*/
|
||||
|
||||
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);
|
||||
|
||||
/* 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.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* Return:
|
||||
* 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.
|
||||
*/
|
||||
|
||||
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.
|
||||
*
|
||||
* Return:
|
||||
* 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);
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
# ifdef CONFIG_STM32F7_LTDC_INTERFACE
|
||||
struct stm32_ltdc_s; /* Forward declaration */
|
||||
|
||||
/****************************************************************************
|
||||
* Name: stm32_dma2dinitltdc
|
||||
*
|
||||
@ -72,10 +347,89 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
struct stm32_ltdc_s; // fwd decl
|
||||
|
||||
FAR struct dma2d_layer_s *stm32_dma2dinitltdc(FAR struct stm32_ltdc_s *layer);
|
||||
# endif /* CONFIG_STM32F7_LTDC_INTERFACE */
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_dma2dgetlayer
|
||||
*
|
||||
* Description:
|
||||
* Get a dma2d layer structure by the layer identifier
|
||||
*
|
||||
* Parameter:
|
||||
* lid - Layer identifier
|
||||
*
|
||||
* Return:
|
||||
* 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
|
||||
*
|
||||
* Parameter:
|
||||
* width - Layer width
|
||||
* height - Layer height
|
||||
* fmt - Pixel format of the layer
|
||||
*
|
||||
* Return:
|
||||
* 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
|
||||
*
|
||||
* Parameter:
|
||||
* layer - Reference to the layer to remove
|
||||
*
|
||||
* Return:
|
||||
* On success - OK
|
||||
* On error - -EINVAL
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int up_dma2dremovelayer(FAR struct dma2d_layer_s *layer);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_dma2dinitialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize the dma2d controller
|
||||
*
|
||||
* Return:
|
||||
* OK - On success
|
||||
* An error if initializing failed.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int up_dma2dinitialize(void);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_dma2duninitialize
|
||||
*
|
||||
* Description:
|
||||
* Uninitialize the dma2d controller
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void up_dma2duninitialize(void);
|
||||
|
||||
#endif /* CONFIG_STM32F7_DMA2D */
|
||||
#endif /* __ARCH_ARM_SRC_STM32F7_STM32_DMA2D_H */
|
||||
|
@ -53,8 +53,6 @@
|
||||
#include <nuttx/semaphore.h>
|
||||
#include <nuttx/video/fb.h>
|
||||
|
||||
#include <arch/chip/ltdc.h>
|
||||
#include <arch/chip/dma2d.h>
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#include "up_arch.h"
|
||||
|
@ -57,6 +57,498 @@
|
||||
* 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
|
||||
*
|
||||
* Return:
|
||||
* 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
|
||||
*
|
||||
* Return:
|
||||
* 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
|
||||
*
|
||||
* Return:
|
||||
* 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)
|
||||
*
|
||||
* Return:
|
||||
* 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
|
||||
*
|
||||
* Return:
|
||||
* 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
|
||||
*
|
||||
* Return:
|
||||
* 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
|
||||
*
|
||||
* Return:
|
||||
* 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
|
||||
*
|
||||
* Return:
|
||||
* 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
|
||||
*
|
||||
* Return:
|
||||
* 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
|
||||
*
|
||||
* Return:
|
||||
* 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
|
||||
*
|
||||
* Return:
|
||||
* 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_*)
|
||||
*
|
||||
* Return:
|
||||
* 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
|
||||
*
|
||||
* Return:
|
||||
* 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
|
||||
*
|
||||
* Return:
|
||||
* 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
|
||||
*
|
||||
* Return:
|
||||
* 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_*)
|
||||
*
|
||||
* Return:
|
||||
* 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
|
||||
*
|
||||
* Return:
|
||||
* 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
|
||||
*
|
||||
* Return:
|
||||
* 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.
|
||||
*
|
||||
* Return:
|
||||
* 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
|
||||
|
@ -1,70 +0,0 @@
|
||||
README.txt
|
||||
==========
|
||||
|
||||
STM32F429I-DISCO LTDC Framebuffer demo example
|
||||
|
||||
Configure and build
|
||||
-----------------------------------------------
|
||||
cd tools
|
||||
./configure -a <appdir> stm32f429i-disco/ltdc
|
||||
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
|
||||
|
||||
Executing
|
||||
-----------------------------------------------
|
||||
The ltdc is initialized during boot up.
|
||||
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 &'.
|
||||
|
@ -1,76 +0,0 @@
|
||||
# CONFIG_ARCH_FPU is not set
|
||||
# CONFIG_NX_DISABLE_16BPP is not set
|
||||
# CONFIG_STM32_DMA2D_RGB888 is not set
|
||||
# CONFIG_STM32_FLASH_PREFETCH is not set
|
||||
CONFIG_ARCH_BOARD_STM32F429I_DISCO=y
|
||||
CONFIG_ARCH_BOARD="stm32f429i-disco"
|
||||
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_INITIALIZE=y
|
||||
CONFIG_BOARD_LOOPSPERMSEC=16717
|
||||
CONFIG_BUILTIN=y
|
||||
CONFIG_DEBUG_CUSTOMOPT=y
|
||||
CONFIG_DEBUG_SYMBOLS=y
|
||||
CONFIG_DISABLE_POLL=y
|
||||
CONFIG_EXAMPLES_LTDC=y
|
||||
CONFIG_EXAMPLES_NSH_CXXINITIALIZE=y
|
||||
CONFIG_EXAMPLES_NSH=y
|
||||
CONFIG_EXAMPLES_NX_BPP=16
|
||||
CONFIG_EXAMPLES_NX=y
|
||||
CONFIG_FS_PROCFS_REGISTER=y
|
||||
CONFIG_FS_PROCFS=y
|
||||
CONFIG_HAVE_CXX=y
|
||||
CONFIG_HAVE_CXXINITIALIZE=y
|
||||
CONFIG_HEAP2_BASE=0xD0000000
|
||||
CONFIG_HEAP2_SIZE=8081408
|
||||
CONFIG_INTELHEX_BINARY=y
|
||||
CONFIG_MAX_TASKS=16
|
||||
CONFIG_MAX_WDOGPARMS=2
|
||||
CONFIG_MM_REGIONS=2
|
||||
CONFIG_MQ_MAXMSGSIZE=64
|
||||
CONFIG_NFILE_DESCRIPTORS=8
|
||||
CONFIG_NFILE_STREAMS=8
|
||||
CONFIG_NSH_BUILTIN_APPS=y
|
||||
CONFIG_NSH_FILEIOSIZE=512
|
||||
CONFIG_NSH_LINELEN=64
|
||||
CONFIG_NSH_READLINE=y
|
||||
CONFIG_NX_BLOCKING=y
|
||||
CONFIG_NX=y
|
||||
CONFIG_NXFONT_MONO5X8=y
|
||||
CONFIG_PREALLOC_MQ_MSGS=4
|
||||
CONFIG_PREALLOC_TIMERS=4
|
||||
CONFIG_PREALLOC_WDOGS=4
|
||||
CONFIG_RAM_SIZE=114688
|
||||
CONFIG_RAM_START=0x20000000
|
||||
CONFIG_RAW_BINARY=y
|
||||
CONFIG_RR_INTERVAL=200
|
||||
CONFIG_SCHED_WAITPID=y
|
||||
CONFIG_SDCLONE_DISABLE=y
|
||||
CONFIG_SPI_CMDDATA=y
|
||||
CONFIG_START_DAY=6
|
||||
CONFIG_START_MONTH=12
|
||||
CONFIG_START_YEAR=2011
|
||||
CONFIG_STM32_CCM_PROCFS=y
|
||||
CONFIG_STM32_CCMEXCLUDE=y
|
||||
CONFIG_STM32_DISABLE_IDLE_SLEEP_DURING_DEBUG=y
|
||||
CONFIG_STM32_DMA2D_NLAYERS=4
|
||||
CONFIG_STM32_DMA2D=y
|
||||
CONFIG_STM32_FSMC_SRAM=y
|
||||
CONFIG_STM32_FSMC=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_PWR=y
|
||||
CONFIG_STM32_SPI5=y
|
||||
CONFIG_STM32_USART1=y
|
||||
CONFIG_STM32F429I_DISCO_ILI9341=y
|
||||
CONFIG_TASK_NAME_SIZE=0
|
||||
CONFIG_USART1_SERIAL_CONSOLE=y
|
||||
CONFIG_USER_ENTRYPOINT="nsh_main"
|
||||
CONFIG_WDOG_INTRESERVE=0
|
@ -47,7 +47,6 @@
|
||||
#include <nuttx/lcd/ili9341.h>
|
||||
#include <nuttx/video/fb.h>
|
||||
|
||||
#include <arch/chip/ltdc.h>
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#include "up_arch.h"
|
||||
|
Loading…
Reference in New Issue
Block a user