Defines a second interface for the dma2d controller. Controlling both LTDC and DMA2D was unpractical from the programmers view because both controllers are to different. LTDC only controls the display visibility but the DMA2D controller changes the content of the frame buffer (buffer of the layer).
The main features are: 1. DMA2D interface Supports the nuttx pixel formats: - FB_FMT_RGB8 - FB_FMT_RGB24 - FB_FMT_RGB16_565 Dynamic layer allocation during runtime for the supported formats - The number of allocatable layer can be configured. Supported dma2d operation: - blit (Copy content from source to destination layer) also works with selectable area. - blend (Blend two layer and copy the result to a destination layer wich can be a third layer or one of the source layer) also works with selectable area. - fillarea (Fill a defined area of the whole layer with a specific color) As a result of that the dma2d controller can't transfer data from the core coupled memory, CCM is disabled but usable by the ccm allocator. Currently the ccm allocator is used for allocating the layer structurei only. For the dma memory (layers frame buffer) memory is allocated from heap 2 and 3. 2. LTDC interface I have changed the api for the currently non implemented operations: - blit (Copy content from a dma2d layer to an ltdc layer) also works with selectable area. - blend (Blend two dma2d layer and copy the result to a destination ltdc layer) also works with selectable area. Note! ltdc layer is a layer referenced by the ltdc interface. dma2d layer is a layer referenced by the dma2d interface. One of the most important questions for me was, How can i flexible use an ltdc layer with the dma2d interface, e.g. as source layer for dma2d operations? Get the layer id of the related dma2d layer by a special flag when using getlid() function of the ltdc interface and use the layer id to reference the specific dma2d layer by the dma2d interface. The ltdc coupled dma2d layers are predefined and can't be dynamically allocated of freed. They use the same frame buffer memory and the same color lookup table. Changes: - layer internal format of the clut table - interrupt handling for register reload (vertical vblank) instead using waiting loop - small fixes and refactoring From Marco Krahl.
This commit is contained in:
parent
7bf9be7c33
commit
8ed4b1acfa
415
arch/arm/include/stm32/dma2d.h
Normal file
415
arch/arm/include/stm32/dma2d.h
Normal file
@ -0,0 +1,415 @@
|
||||
/*******************************************************************************
|
||||
* arch/arm/src/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,7 +1,7 @@
|
||||
/*******************************************************************************
|
||||
* arch/arm/src/include/stm32/ltdc.h
|
||||
*
|
||||
* Copyright (C) 2014 Marco Krahl. All rights reserved.
|
||||
* Copyright (C) 2014-2015 Marco Krahl. All rights reserved.
|
||||
* Author: Marco Krahl <ocram.lhark@gmail.com>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -53,15 +53,18 @@
|
||||
* 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_COLORKEY = 0x2, /* Enable colorkey */
|
||||
LTDC_BLEND_SRCPIXELALPHA = 0x4, /* Use pixel alpha of source */
|
||||
LTDC_BLEND_DESTPIXELALPHA = 0x8 /* Use pixel alpha of destination */
|
||||
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 */
|
||||
@ -73,6 +76,9 @@ enum ltdc_layer_e
|
||||
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 */
|
||||
@ -447,8 +453,9 @@ struct ltdc_layer_s
|
||||
* mode - operation mode (see LTDC_UPDATE_*)
|
||||
*
|
||||
* Return:
|
||||
* OK - On success
|
||||
* -EINVAL - If one of the parameter invalid
|
||||
* OK - On success
|
||||
* -EINVAL - If one of the parameter invalid
|
||||
* -ECANCELED - Operation cancelled, something goes wrong
|
||||
*
|
||||
* Procedure information:
|
||||
* LTDC_UPDATE_SIM:
|
||||
@ -480,59 +487,81 @@ struct ltdc_layer_s
|
||||
* Name: blit
|
||||
*
|
||||
* Description:
|
||||
* Copy selected area from a background layer to selected position of the
|
||||
* foreground layer. Copies the result to the destination layer.
|
||||
* Copy selected area from a source layer to selected position of the
|
||||
* destination layer.
|
||||
*
|
||||
* Parameter:
|
||||
* dest - Reference to the destination layer
|
||||
* fore - Reference to the foreground layer
|
||||
* forexpos - Selected x target position of the destination layer
|
||||
* foreypos - Selected y target position of the destination layer
|
||||
* back - Reference to the background layer
|
||||
* backarea - Reference to the selected area of the background 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)
|
||||
* 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,
|
||||
FAR struct ltdc_layer_s *fore,
|
||||
fb_coord_t forexpos, fb_coord_t foreypos,
|
||||
FAR struct ltdc_layer_s *back,
|
||||
FAR const struct ltdc_area_s *backarea);
|
||||
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:
|
||||
* Blend the selected area from a background layer with selected position of
|
||||
* the foreground layer. Blends the result with the destination layer.
|
||||
* Note! This is the same as the blit operation but with blending depending
|
||||
* on the blendmode settings of the layer.
|
||||
* 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 target position of the destination layer
|
||||
* foreypos - Selected y target position of the destination 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)
|
||||
* 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,
|
||||
FAR struct ltdc_layer_s *fore,
|
||||
fb_coord_t destxpos, fb_coord_t destypos,
|
||||
FAR const struct dma2d_layer_s *fore,
|
||||
fb_coord_t forexpos, fb_coord_t foreypos,
|
||||
FAR struct ltdc_layer_s *back,
|
||||
FAR const struct ltdc_area_s *backarea)
|
||||
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
|
||||
};
|
||||
|
||||
|
@ -3944,7 +3944,13 @@ config FB_CMAP
|
||||
bool "Enable color map support"
|
||||
default y
|
||||
---help---
|
||||
Enabling color map suport is neccessary for ltdc L8 format.
|
||||
Enabling color map support is neccessary for ltdc L8 format.
|
||||
|
||||
config FB_TRANSPARENCY
|
||||
bool "Enable transparency color map support"
|
||||
default y
|
||||
---help---
|
||||
Enabling transparency color map support is neccessary for ltdc L8 format.
|
||||
|
||||
endif
|
||||
endmenu
|
||||
@ -3964,14 +3970,17 @@ config STM32_DMA2D_NLAYERS
|
||||
menu "Supported pixel format"
|
||||
|
||||
config STM32_DMA2D_L8
|
||||
depends on FB_CMAP
|
||||
bool "8 bpp L8 (8-bit CLUT)"
|
||||
default y
|
||||
|
||||
config STM32_DMA2D_AL44
|
||||
depends on FB_CMAP
|
||||
bool "8 bpp AL44 (4-bit alpha + 4-bit CLUT)"
|
||||
default n
|
||||
|
||||
config STM32_DMA2D_AL88
|
||||
depends on FB_CMAP
|
||||
bool "16 bpp AL88 (8-bit alpha + 8-bit CLUT)"
|
||||
default n
|
||||
|
||||
|
231
arch/arm/src/stm32/chip/stm32_dma2d.h
Normal file
231
arch/arm/src/stm32/chip/stm32_dma2d.h
Normal file
@ -0,0 +1,231 @@
|
||||
/******************************************************************************
|
||||
* arch/arm/src/stm32/chip/stm32_dma2d.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_SRC_STM32_CHIP_STM32_DMA2D_H
|
||||
#define __ARCH_ARM_SRC_STM32_CHIP_STM32_DMA2D_H
|
||||
|
||||
/*****************************************************************************
|
||||
* Included Files
|
||||
*****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include "chip/stm32_memorymap.h"
|
||||
|
||||
/*****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
*****************************************************************************/
|
||||
|
||||
#define STM32_DMA2D_NCLUT 256 /* Number of entries in the CLUT */
|
||||
|
||||
/* DMA2D Register Offsets ****************************************************/
|
||||
|
||||
#define STM32_DMA2D_CR_OFFSET 0x0000 /* DMA2D Control Register */
|
||||
#define STM32_DMA2D_ISR_OFFSET 0x0004 /* DMA2D Interrupt Status Register */
|
||||
#define STM32_DMA2D_IFCR_OFFSET 0x0008 /* DMA2D Interrupt Flag Clear Register */
|
||||
#define STM32_DMA2D_FGMAR_OFFSET 0x000C /* DMA2D Foreground Memory Address Register */
|
||||
#define STM32_DMA2D_FGOR_OFFSET 0x0010 /* DMA2D Foreground Offset Register */
|
||||
#define STM32_DMA2D_BGMAR_OFFSET 0x0014 /* DMA2D Background Memory Address Register */
|
||||
#define STM32_DMA2D_BGOR_OFFSET 0x0018 /* DMA2D Background Offset Register */
|
||||
#define STM32_DMA2D_FGPFCCR_OFFSET 0x001C /* DMA2D Foreground PFC Control Register */
|
||||
#define STM32_DMA2D_FGCOLR_OFFSET 0x0020 /* DMA2D Foreground Color Register */
|
||||
#define STM32_DMA2D_BGPFCCR_OFFSET 0x0024 /* DMA2D Background PFC Control Register */
|
||||
#define STM32_DMA2D_BGCOLR_OFFSET 0x0028 /* DMA2D Background Color Register */
|
||||
#define STM32_DMA2D_FGCMAR_OFFSET 0x002C /* DMA2D Foreground CLUT Memory Address Register */
|
||||
#define STM32_DMA2D_BGCMAR_OFFSET 0x0030 /* DMA2D Background CLUT Memory Address Register */
|
||||
#define STM32_DMA2D_OPFCCR_OFFSET 0x0034 /* DMA2D Output PFC Control Register */
|
||||
#define STM32_DMA2D_OCOLR_OFFSET 0x0038 /* DMA2D Output Color Register */
|
||||
#define STM32_DMA2D_OMAR_OFFSET 0x003C /* DMA2D Output Memory Address Register */
|
||||
#define STM32_DMA2D_OOR_OFFSET 0x0040 /* DMA2D Output Offset Register */
|
||||
#define STM32_DMA2D_NLR_OFFSET 0x0044 /* DMA2D Number Of Line Register */
|
||||
#define STM32_DMA2D_LWR_OFFSET 0x0048 /* DMA2D Line Watermark Register */
|
||||
#define STM32_DMA2D_AMTCR_OFFSET 0x004C /* DMA2D AHB Master Time Configuration Register */
|
||||
|
||||
/* DMA2D Register Addresses **************************************************/
|
||||
|
||||
#define STM32_DMA2D_CR (STM32_DMA2D_BASE+STM32_DMA2D_CR_OFFSET)
|
||||
#define STM32_DMA2D_ISR (STM32_DMA2D_BASE+STM32_DMA2D_ISR_OFFSET)
|
||||
#define STM32_DMA2D_IFCR (STM32_DMA2D_BASE+STM32_DMA2D_IFCR_OFFSET)
|
||||
#define STM32_DMA2D_FGMAR (STM32_DMA2D_BASE+STM32_DMA2D_FGMAR_OFFSET)
|
||||
#define STM32_DMA2D_FGOR (STM32_DMA2D_BASE+STM32_DMA2D_FGOR_OFFSET)
|
||||
#define STM32_DMA2D_BGMAR (STM32_DMA2D_BASE+STM32_DMA2D_BGMAR_OFFSET)
|
||||
#define STM32_DMA2D_BGOR (STM32_DMA2D_BASE+STM32_DMA2D_BGOR_OFFSET)
|
||||
#define STM32_DMA2D_FGPFCCR (STM32_DMA2D_BASE+STM32_DMA2D_FGPFCCR_OFFSET)
|
||||
#define STM32_DMA2D_FGCOLR (STM32_DMA2D_BASE+STM32_DMA2D_FGCOLR_OFFSET)
|
||||
#define STM32_DMA2D_BGPFCCR (STM32_DMA2D_BASE+STM32_DMA2D_BGPFCCR_OFFSET)
|
||||
#define STM32_DMA2D_BGCOLR (STM32_DMA2D_BASE+STM32_DMA2D_BGCOLR_OFFSET)
|
||||
#define STM32_DMA2D_FGCMAR (STM32_DMA2D_BASE+STM32_DMA2D_FGCMAR_OFFSET)
|
||||
#define STM32_DMA2D_BGCMAR (STM32_DMA2D_BASE+STM32_DMA2D_BGCMAR_OFFSET)
|
||||
#define STM32_DMA2D_OPFCCR (STM32_DMA2D_BASE+STM32_DMA2D_OPFCCR_OFFSET)
|
||||
#define STM32_DMA2D_OCOLR (STM32_DMA2D_BASE+STM32_DMA2D_OCOLR_OFFSET)
|
||||
#define STM32_DMA2D_OMAR (STM32_DMA2D_BASE+STM32_DMA2D_OMAR_OFFSET)
|
||||
#define STM32_DMA2D_OOR (STM32_DMA2D_BASE+STM32_DMA2D_OOR_OFFSET)
|
||||
#define STM32_DMA2D_NLR (STM32_DMA2D_BASE+STM32_DMA2D_NLR_OFFSET)
|
||||
#define STM32_DMA2D_LWR (STM32_DMA2D_BASE+STM32_DMA2D_LWR_OFFSET)
|
||||
|
||||
/* DMA2D Register Bit Definitions ********************************************/
|
||||
|
||||
/* DMA2D Control Register */
|
||||
|
||||
#define DMA2D_CR_START (1 << 0) /* Start Bit */
|
||||
#define DMA2D_CR_SUSP (1 << 1) /* Suspend Bit */
|
||||
#define DMA2D_CR_ABORT (1 << 2) /* Abort Bit */
|
||||
#define DMA2D_CR_TEIE (1 << 8) /* Transfer Error Interupt Enable Bit */
|
||||
#define DMA2D_CR_TCIE (1 << 9) /* Transfer Complete Interrupt Enable Bit */
|
||||
#define DMA2D_CR_TWIE (1 << 10) /* Transfer Watermark Interrupt Enable Bit */
|
||||
#define DMA2D_CR_CAEIE (1 << 11) /* CLUT Access Error Interrupt Enable Bit */
|
||||
#define DMA2D_CR_CTCIE (1 << 12) /* CLUT Transfer Complete Interrupt Enable Bit */
|
||||
#define DMA2D_CR_CEIE (1 << 13) /* Configuration Error Interrupt Enable Bit */
|
||||
#define DMA2D_CR_MODE_SHIFT (16) /* Bits 16-17 DMA2D mode Bits */
|
||||
#define DMA2D_CR_MODE_MASK (3 << DMA2D_CR_MODE_SHIFT)
|
||||
#define DMA2D_CR_MODE(n) ((uint32_t)(n) << DMA2D_CR_MODE_SHIFT)
|
||||
|
||||
/* DMA2D Interrupt Status Register */
|
||||
|
||||
#define DMA2D_ISR_TEIF (1 << 0) /* Transfer error interrupt flag */
|
||||
#define DMA2D_ISR_TCIF (1 << 1) /* Transfer Complete Interrupt flag */
|
||||
#define DMA2D_ISR_TWIF (1 << 2) /* Transfer Watermark Interrupt flag */
|
||||
#define DMA2D_ISR_CAEIF (1 << 3) /* CLUT Access Error Interrupt flag */
|
||||
#define DMA2D_ISR_CTCIF (1 << 4) /* CLUT Transfer Complete Interrupt flag */
|
||||
#define DMA2D_ISR_CEIF (1 << 5) /* Configuration Error Interrupt flag */
|
||||
|
||||
/* DMA2D Interrupt Flag Clear Register */
|
||||
|
||||
#define DMA2D_IFCR_CTEIF (1 << 0) /* Clear Transfer Interrupt Flag */
|
||||
#define DMA2D_IFCR_CTCIF (1 << 1) /* Clear Transfer Complete Interrupt Flag */
|
||||
#define DMA2D_IFCR_CTWIF (1 << 2) /* Clear Transfer Watermark Interrupt Flag */
|
||||
#define DMA2D_IFCR_CAECIF (1 << 3) /* Clear CLUT Access Error Interrupt Flag */
|
||||
#define DMA2D_IFCR_CCTCIF (1 << 4) /* Clear CLUT Transfer Complete Interrupt Flag */
|
||||
#define DMA2D_IFCR_CCEIF (1 << 5) /* Clear Configuration Error Interrupt Flag */
|
||||
|
||||
/* DMA2D Foreground Memory Access Register */
|
||||
|
||||
/* DMA2D Background Memory Access Register */
|
||||
|
||||
/* DMA2D Foreground/Background Offset Register */
|
||||
|
||||
#define DMA2D_xGOR_SHIFT (0) /* Bits 0-13 Line Offset */
|
||||
#define DMA2D_xGOR_MASK (0x3FFF << DMA2D_xGOR_SHIFT)
|
||||
#define DMA2D_xGOR(n) ((uint32_t)(n) << DMA2D_xGOR_SHIFT)
|
||||
|
||||
/* DMA2D Foreground/Background PFC Control Register */
|
||||
|
||||
#define DMA2D_xGPFCCR_CM_SHIFT (0) /* Bits 0-3 Color Mode */
|
||||
#define DMA2D_xGPFCCR_CM_MASK (0xF << DMA2D_xGPFCCR_CM_SHIFT)
|
||||
#define DMA2D_xGPFCCR_CM(n) ((uint32_t)(n) << DMA2D_xGPFCCR_CM_SHIFT)
|
||||
#define DMA2D_xGPFCCR_CCM (1 << 4) /* CLUT Color Mode */
|
||||
#define DMA2D_xGPFCCR_START (1 << 5) /* Start */
|
||||
#define DMA2D_xGPFCCR_CS_SHIFT (8) /* Bits 8-15 CLUT Size */
|
||||
#define DMA2D_xGPFCCR_CS_MASK (0xFF << DMA2D_xGPFCCR_CS_SHIFT)
|
||||
#define DMA2D_xGPFCCR_CS(n) ((uint32_t)(n) << DMA2D_xGPFCCR_CS_SHIFT)
|
||||
#define DMA2D_xGPFCCR_AM_SHIFT (16) /* Bits 16-17 Alpha Mode */
|
||||
#define DMA2D_xGPFCCR_AM_MASK (3 << DMA2D_xGPFCCR_AM_SHIFT)
|
||||
#define DMA2D_xGPFCCR_AM(n) ((uint32_t)(n) << DMA2D_xGPFCCR_AM_SHIFT)
|
||||
#define DMA2D_xGPFCCR_ALPHA_SHIFT (24) /* Bits 24-31 Alpha Value */
|
||||
#define DMA2D_xGPFCCR_ALPHA_MASK (0xFF << DMA2D_xGPFCCR_ALPHA_SHIFT)
|
||||
#define DMA2D_xGPFCCR_ALPHA(n) ((uint32_t)(n) << DMA2D_xGPFCCR_ALPHA_SHIFT)
|
||||
|
||||
/* DMA2D Foreground/Background Color Register */
|
||||
|
||||
#define DMA2D_xGCOLR_BLUE_SHIFT (0) /* Bits 0-7 Blue Value */
|
||||
#define DMA2D_xGCOLR_BLUE_MASK (0xFF << DMA2D_xGCOLR_BLUE_SHIFT)
|
||||
#define DMA2D_xGCOLR_BLUE(n) ((uint32_t)(n) << DMA2D_xGCOLR_BLUE_SHIFT)
|
||||
#define DMA2D_xGCOLR_GREEN_SHIFT (8) /* Bits 8-15 Green Value */
|
||||
#define DMA2D_xGCOLR_GREEN_MASK (0xFF << DMA2D_xGCOLR_GREEN_SHIFT)
|
||||
#define DMA2D_xGCOLR_GREEN(n) ((uint32_t)(n) << DMA2D_xGCOLR_GREEN_SHIFT)
|
||||
#define DMA2D_xGCOLR_RED_SHIFT (16) /* Bits 16-23 Red Value */
|
||||
#define DMA2D_xGCOLR_RED_MASK (0xFF << DMA2D_xGCOLR_RED_SHIFT)
|
||||
#define DMA2D_xGCOLR_RED(n) ((uint32_t)(n) << DMA2D_xGCOLR_RED_SHIFT)
|
||||
|
||||
|
||||
/* DMA2D Foreground CLUT Memory Address Register */
|
||||
|
||||
/* DMA2D Background CLUT Memory Address Register */
|
||||
|
||||
/* DMA2D Output PFC Control Register */
|
||||
|
||||
#define DMA2D_OPFCCR_CM_SHIFT (0) /* Bits 0-2 Color Mode */
|
||||
#define DMA2D_OPFCCR_CM_MASK (7 << DMA2D_OPFCCR_CM_SHIFT)
|
||||
#define DMA2D_OPFCCR_CM(n) ((uint32_t)(n) << DMA2D_OPFCCR_CM_SHIFT)
|
||||
|
||||
/* DMA2D Output Color Register */
|
||||
|
||||
#define DMA2D_OCOLR_BLUE_SHIFT (0) /* Bits 0-7 Blue Value */
|
||||
#define DMA2D_OCOLR_BLUE_MASK (0xFF << DMA2D_OCOLR_BLUE_SHIFT)
|
||||
#define DMA2D_OCOLR_BLUE(n) ((uint32_t)(n) << DMA2D_OCOLR_BLUE_SHIFT)
|
||||
#define DMA2D_OCOLR_GREEN_SHIFT (8) /* Bits 8-15 Green Value */
|
||||
#define DMA2D_OCOLR_GREEN_MASK (0xFF << DMA2D_OCOLR_GREEN_SHIFT)
|
||||
#define DMA2D_OCOLR_GREEN(n) ((uint32_t)(n) << DMA2D_OCOLR_GREEN_SHIFT)
|
||||
#define DMA2D_OCOLR_RED_SHIFT (16) /* Bits 16-23 Red Value */
|
||||
#define DMA2D_OCOLR_RED_MASK (0xFF << DMA2D_OCOLR_RED_SHIFT)
|
||||
#define DMA2D_OCOLR_RED(n) ((uint32_t)(n) << DMA2D_OCOLR_RED_SHIFT)
|
||||
#define DMA2D_OCOLR_ALPHA_SHIFT (24) /* Bits 24-31 Alpha Value */
|
||||
#define DMA2D_OCOLR_ALPHA_MASK (0xFF << DMA2D_OCOLR_ALPHA_SHIFT)
|
||||
#define DMA2D_OCOLR_ALPHA(n) ((uint32_t)(n) << DMA2D_OCOLR_ALPHA_SHIFT)
|
||||
|
||||
/* DMA2D Output Memory Address Register */
|
||||
|
||||
/* DMA2D Output Offset Register */
|
||||
|
||||
#define DMA2D_OOR_LO_SHIFT (0) /* Bits 0-13 Line Offset */
|
||||
#define DMA2D_OOR_LO_MASK (0x3FFF << DMA2D_OOR_LO_SHIFT)
|
||||
#define DMA2D_OOR_LO(n) ((uint32_t)(n) << DMA2D_OOR_LO_SHIFT)
|
||||
|
||||
/* DMA2D Number Of Line Register */
|
||||
|
||||
#define DMA2D_NLR_NL_SHIFT (0) /* Bits 0-15 Number Of Lines */
|
||||
#define DMA2D_NLR_NL_MASK (0xFFFF << DMA2D_NLR_NL_SHIFT)
|
||||
#define DMA2D_NLR_NL(n) ((uint32_t)(n) << DMA2D_NLR_NL_SHIFT)
|
||||
#define DMA2D_NLR_PL_SHIFT (16) /* Bits 16-29 Pixel per Lines */
|
||||
#define DMA2D_NLR_PL_MASK (0x3FFF << DMA2D_NLR_PL_SHIFT)
|
||||
#define DMA2D_NLR_PL(n) ((uint32_t)(n) << DMA2D_NLR_PL_SHIFT)
|
||||
|
||||
/* DMA2D Line Watermark Register */
|
||||
|
||||
#define DMA2D_LWR_LW_SHIFT (0) /* Bits 0-15 Line Watermark */
|
||||
#define DMA2D_LWR_LW_MASK (0xFFFF << DMA2D_LWR_LW_SHIFT)
|
||||
#define DMA2D_LWR_LW(n) ((uint32_t)(n) << DMA2D_LWR_LW_SHIFT)
|
||||
|
||||
/* DMA2D AHB Master Timer Configuration Register */
|
||||
|
||||
#define DMA2D_AMTCR_EN (1 << 0) /* Enable */
|
||||
#define DMA2D_AMTCR_DT_SHIFT (0) /* Bits 8-15 Dead Time */
|
||||
#define DMA2D_AMTCR_DT_MASK (0xFF << DMA2D_AMTCR_DT_SHIFT)
|
||||
#define DMA2D_AMTCR_DT(n) ((uint32_t)(n) << DMA2D_AMTCR_DT_SHIFT)
|
||||
|
||||
/*****************************************************************************
|
||||
* Public Types
|
||||
*****************************************************************************/
|
||||
|
||||
#endif /* __ARCH_ARM_SRC_STM32_CHIP_STM32_DMA2D_H */
|
@ -82,7 +82,7 @@
|
||||
*/
|
||||
|
||||
#define ccm_initialize() \
|
||||
mm_initialize(&g_ccm_heap, (uintptr_t)CCM_START, CCM_END-CCM_START)
|
||||
mm_initialize(&g_ccm_heap, (FAR void *)CCM_START, CCM_END-CCM_START)
|
||||
|
||||
/* The ccm_addregion interface could be used if, for example, you want to
|
||||
* add some other memory region to the CCM heap. I don't really know why
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,7 +1,7 @@
|
||||
/******************************************************************************
|
||||
* arch/arm/src/stm32/stm32_dma2d.h
|
||||
*
|
||||
* Copyright (C) 2014 Marco Krahl. All rights reserved.
|
||||
* Copyright (C) 2014-2015 Marco Krahl. All rights reserved.
|
||||
* Author: Marco Krahl <ocram.lhark@gmail.com>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -43,7 +43,6 @@
|
||||
#include <nuttx/config.h>
|
||||
#include <nuttx/video/fb.h>
|
||||
#include <arch/chip/ltdc.h>
|
||||
#include "stm32_ltdc.h"
|
||||
|
||||
#ifdef CONFIG_STM32_DMA2D
|
||||
/******************************************************************************
|
||||
@ -62,86 +61,30 @@
|
||||
* Public Functions
|
||||
******************************************************************************/
|
||||
|
||||
# ifdef CONFIG_STM32_LTDC_INTERFACE
|
||||
/******************************************************************************
|
||||
* Name: stm32_dma2dblit
|
||||
* Name: stm32_dma2dinitltdc
|
||||
*
|
||||
* Description:
|
||||
* Copy selected area from a background layer to selected position of the
|
||||
* foreground layer. Copies the result to the destination layer.
|
||||
* Get a reference to the dma2d layer coupled with the ltdc layer.
|
||||
* It not intends to use this function by user space applications.
|
||||
* It resolves the following requirements:
|
||||
* 1. Share the color lookup table
|
||||
* 2. Share the planeinfo information
|
||||
* 3. Share the videoinfo information
|
||||
*
|
||||
* Parameter:
|
||||
* dest - Valid reference to the destination layer
|
||||
* fore - Valid reference to the foreground layer
|
||||
* forexpos - Valid selected x target position of the destination layer
|
||||
* foreypos - Valid selected y target position of the destination layer
|
||||
* back - Valid reference to the background layer
|
||||
* backarea - Valid reference to the selected area of the background layer
|
||||
* layer - a valid reference to the low level ltdc layer structure
|
||||
*
|
||||
* Return:
|
||||
* OK - On success
|
||||
* -EINVAL - On error
|
||||
* On success - A valid dma2d layer reference
|
||||
* On error - NULL and errno is set to
|
||||
* -EINVAL if one of the parameter is invalid
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
int stm32_dma2dblit(FAR struct stm32_ltdc_s *dest,
|
||||
FAR struct stm32_ltdc_s *fore,
|
||||
fb_coord_t forexpos, fb_coord_t foreypos,
|
||||
FAR struct stm32_ltdc_s *back,
|
||||
FAR const struct ltdc_area_s *backarea);
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* Name: stm32_dma2dblend
|
||||
*
|
||||
* Description:
|
||||
* Blends the selected area from a background layer with selected position of
|
||||
* the foreground layer. Blends the result with the destination layer.
|
||||
* Note! This is the same as the blit operation but with blending depending on
|
||||
* the blendmode settings of the layer.
|
||||
*
|
||||
* Parameter:
|
||||
* dest - Valid reference to the destination layer
|
||||
* fore - Valid reference to the foreground layer
|
||||
* forexpos - Valid selected x target position of the destination layer
|
||||
* foreypos - Valid selected y target position of the destination layer
|
||||
* back - Valid reference to the background layer
|
||||
* backarea - Valid reference to the selected area of the background layer
|
||||
*
|
||||
* Return:
|
||||
* OK - On success
|
||||
* -EINVAL - On error
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
int stm32_dma2dblend(FAR struct stm32_ltdc_s *dest,
|
||||
FAR struct stm32_ltdc_s *fore,
|
||||
fb_coord_t forexpos, fb_coord_t foreypos,
|
||||
FAR struct stm32_ltdc_s *back,
|
||||
FAR const struct ltdc_area_s *backarea);
|
||||
|
||||
/******************************************************************************
|
||||
* 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);
|
||||
FAR struct dma2d_layer_s * stm32_dma2dinitltdc(FAR struct stm32_ltdc_s *layer);
|
||||
# endif /* CONFIG_STM32_LTDC_INTERFACE */
|
||||
|
||||
#endif /* CONFIG_STM32_DMA2D */
|
||||
#endif /* __ARCH_ARM_SRC_STM32_STM32_DMA2D_H */
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -81,7 +81,7 @@ struct stm32_ltdc_s
|
||||
|
||||
uint32_t color; /* Layer color definition */
|
||||
#ifdef CONFIG_FB_CMAP
|
||||
struct fb_cmap_s *cmap; /* Reference to the valid color lookup table */
|
||||
uint32_t *clut; /* 32-bit aligned clut color table */
|
||||
#endif
|
||||
|
||||
/* Blending */
|
||||
|
@ -209,6 +209,12 @@ static inline void rcc_enableahb1(void)
|
||||
|
||||
#endif /* CONFIG_STM32_OTGHS */
|
||||
|
||||
#ifdef CONFIG_STM32_DMA2D
|
||||
/* DMA2D clock */
|
||||
|
||||
regval |= RCC_AHB1ENR_DMA2DEN;
|
||||
#endif
|
||||
|
||||
putreg32(regval, STM32_RCC_AHB1ENR); /* Enable peripherals */
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user