2015-10-03 15:28:30 +02:00
|
|
|
/****************************************************************************
|
2014-12-19 20:41:08 +01:00
|
|
|
* arch/arm/src/stm32/stm32_dma2d.h
|
|
|
|
*
|
2018-06-06 18:05:05 +02:00
|
|
|
* Copyright (C) 2014-2015, 2018 Marco Krahl. All rights reserved.
|
2014-12-19 20:41:08 +01:00
|
|
|
* 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.
|
|
|
|
*
|
2015-10-03 15:28:30 +02:00
|
|
|
****************************************************************************/
|
2014-12-19 20:41:08 +01:00
|
|
|
|
|
|
|
#ifndef __ARCH_ARM_SRC_STM32_STM32_DMA2D_H
|
|
|
|
#define __ARCH_ARM_SRC_STM32_STM32_DMA2D_H
|
|
|
|
|
2015-10-03 15:28:30 +02:00
|
|
|
/****************************************************************************
|
2014-12-19 20:41:08 +01:00
|
|
|
* Included Files
|
2015-10-03 15:28:30 +02:00
|
|
|
****************************************************************************/
|
2014-12-19 20:41:08 +01:00
|
|
|
|
|
|
|
#include <nuttx/config.h>
|
|
|
|
#include <nuttx/video/fb.h>
|
|
|
|
|
2018-06-15 23:10:19 +02:00
|
|
|
#ifdef CONFIG_FB_OVERLAY
|
2014-12-19 20:41:08 +01:00
|
|
|
|
2015-10-03 15:28:30 +02:00
|
|
|
/****************************************************************************
|
2014-12-19 20:41:08 +01:00
|
|
|
* Public Types
|
2015-10-03 15:28:30 +02:00
|
|
|
****************************************************************************/
|
2014-12-19 20:41:08 +01:00
|
|
|
|
2018-06-06 18:05:05 +02:00
|
|
|
/* This structure describes DMA2D overlay information */
|
2017-11-06 19:22:48 +01:00
|
|
|
|
2018-06-06 18:05:05 +02:00
|
|
|
struct stm32_dma2d_overlay_s
|
2017-11-06 19:22:48 +01:00
|
|
|
{
|
2018-06-06 18:05:05 +02:00
|
|
|
uint8_t fmt; /* DMA2D pixel format */
|
|
|
|
uint8_t transp_mode; /* DMA2D transparency mode */
|
|
|
|
fb_coord_t xres; /* X-resolution overlay */
|
|
|
|
fb_coord_t yres; /* Y-resolution overlay */
|
|
|
|
FAR struct fb_overlayinfo_s *oinfo; /* Framebuffer overlay information */
|
2017-11-06 19:22:48 +01:00
|
|
|
};
|
|
|
|
|
2018-06-06 18:05:05 +02:00
|
|
|
/* DMA2D is controlled by the following interface */
|
2017-11-06 19:22:48 +01:00
|
|
|
|
|
|
|
struct dma2d_layer_s
|
|
|
|
{
|
|
|
|
/* Name: setclut
|
|
|
|
*
|
|
|
|
* Description:
|
2018-06-06 18:05:05 +02:00
|
|
|
* Set the cmap table for both foreground and background layer.
|
|
|
|
* Up to 256 colors supported.
|
2017-11-06 19:22:48 +01:00
|
|
|
*
|
|
|
|
* Parameter:
|
2018-06-06 18:05:05 +02:00
|
|
|
* cmap - Reference to the cmap table
|
2017-11-06 19:22:48 +01:00
|
|
|
*
|
2018-02-01 17:00:02 +01:00
|
|
|
* Returned Value:
|
2017-11-06 19:22:48 +01:00
|
|
|
* On success - OK
|
|
|
|
* On error - -EINVAL
|
|
|
|
*/
|
|
|
|
|
2018-06-28 20:01:55 +02:00
|
|
|
#ifdef CONFIG_STM32_FB_CMAP
|
2018-06-06 18:05:05 +02:00
|
|
|
int (*setclut)(FAR const struct fb_cmap_s * cmap);
|
2018-06-15 23:10:19 +02:00
|
|
|
#endif
|
2017-11-06 19:22:48 +01:00
|
|
|
|
2018-06-06 18:05:05 +02:00
|
|
|
/* Name: fillcolor
|
2017-11-06 19:22:48 +01:00
|
|
|
*
|
|
|
|
* Description:
|
2018-06-06 18:05:05 +02:00
|
|
|
* Fill a specific memory region with a color.
|
|
|
|
* The caller must ensure that the memory region (area) is within the entire
|
|
|
|
* overlay.
|
2017-11-06 19:22:48 +01:00
|
|
|
*
|
|
|
|
* Parameter:
|
2018-06-06 18:05:05 +02:00
|
|
|
* oinfo - Reference to overlay information
|
|
|
|
* area - Reference to the area to fill
|
|
|
|
* argb - argb8888 color
|
2017-11-06 19:22:48 +01:00
|
|
|
*
|
2018-02-01 17:00:02 +01:00
|
|
|
* Returned Value:
|
2017-11-06 19:22:48 +01:00
|
|
|
* On success - OK
|
2018-06-06 18:05:05 +02:00
|
|
|
* On error - -EINVAL
|
2017-11-06 19:22:48 +01:00
|
|
|
*/
|
|
|
|
|
2018-06-06 18:05:05 +02:00
|
|
|
int (*fillcolor)(FAR struct stm32_dma2d_overlay_s *oinfo,
|
|
|
|
FAR const struct fb_area_s *area, uint32_t argb);
|
2017-11-06 19:22:48 +01:00
|
|
|
|
|
|
|
/* Name: blit
|
|
|
|
*
|
|
|
|
* Description:
|
2018-06-06 18:05:05 +02:00
|
|
|
* Copies memory from a source overlay (defined by sarea) to destination
|
|
|
|
* overlay position (defined by destxpos and destypos) without pixelformat
|
|
|
|
* conversion. The caller must ensure that the memory region (area) is
|
|
|
|
* within the entire overlay.
|
2017-11-06 19:22:48 +01:00
|
|
|
*
|
|
|
|
* Parameter:
|
2018-06-06 18:05:05 +02:00
|
|
|
* doverlay - Reference destination overlay
|
|
|
|
* destxpos - x-Offset destination overlay
|
|
|
|
* destypos - y-Offset destination overlay
|
|
|
|
* soverlay - Reference source overlay
|
|
|
|
* sarea - Reference source area
|
2017-11-06 19:22:48 +01:00
|
|
|
*
|
2018-02-01 17:00:02 +01:00
|
|
|
* Returned Value:
|
2018-06-06 18:05:05 +02:00
|
|
|
* On success - OK
|
|
|
|
* On error - -EINVAL
|
2017-11-06 19:22:48 +01:00
|
|
|
*/
|
|
|
|
|
2018-06-06 18:05:05 +02:00
|
|
|
int (*blit)(FAR struct stm32_dma2d_overlay_s *doverlay,
|
|
|
|
uint32_t destxpos, uint32_t destypos,
|
|
|
|
FAR struct stm32_dma2d_overlay_s *soverlay,
|
|
|
|
FAR const struct fb_area_s *sarea);
|
2017-11-06 19:22:48 +01:00
|
|
|
|
|
|
|
/* Name: blend
|
|
|
|
*
|
|
|
|
* Description:
|
2018-06-06 18:05:05 +02:00
|
|
|
* Blends two source memory areas to a destination memory area with
|
|
|
|
* pixelformat conversion if necessary. The caller must ensure that the
|
|
|
|
* memory region (area) is within the entire overlays.
|
2017-11-06 19:22:48 +01:00
|
|
|
*
|
|
|
|
* Parameter:
|
2018-06-06 18:05:05 +02:00
|
|
|
* doverlay - Destination overlay
|
|
|
|
* destxpos - x-Offset destination overlay
|
|
|
|
* destypos - y-Offset destination overlay
|
|
|
|
* foverlay - Foreground overlay
|
|
|
|
* forexpos - x-Offset foreground overlay
|
|
|
|
* foreypos - y-Offset foreground overlay
|
|
|
|
* boverlay - Background overlay
|
|
|
|
* barea - x-Offset, y-Offset, x-resolution and y-resolution of
|
|
|
|
* background overlay
|
2017-11-06 19:22:48 +01:00
|
|
|
*
|
2018-02-01 17:00:02 +01:00
|
|
|
* Returned Value:
|
2018-06-06 18:05:05 +02:00
|
|
|
* On success - OK
|
|
|
|
* On error - -EINVAL or -ECANCELED
|
2017-11-06 19:22:48 +01:00
|
|
|
*/
|
|
|
|
|
2018-06-06 18:05:05 +02:00
|
|
|
int (*blend)(FAR struct stm32_dma2d_overlay_s *doverlay,
|
|
|
|
uint32_t destxpos, uint32_t destypos,
|
|
|
|
FAR struct stm32_dma2d_overlay_s *foverlay,
|
|
|
|
uint32_t forexpos, uint32_t foreypos,
|
|
|
|
FAR struct stm32_dma2d_overlay_s *boverlay,
|
|
|
|
FAR const struct fb_area_s *barea);
|
2017-11-06 19:22:48 +01:00
|
|
|
};
|
2014-12-19 20:41:08 +01:00
|
|
|
|
2017-11-06 19:22:48 +01:00
|
|
|
/****************************************************************************
|
2018-06-06 18:05:05 +02:00
|
|
|
* Public Functions
|
2017-11-06 19:22:48 +01:00
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
2018-06-06 18:05:05 +02:00
|
|
|
* Name: stm32_dma2ddev
|
2017-11-06 19:22:48 +01:00
|
|
|
*
|
|
|
|
* Description:
|
2018-06-06 18:05:05 +02:00
|
|
|
* Get a reference to the DMA2D controller.
|
2017-11-06 19:22:48 +01:00
|
|
|
*
|
2018-02-01 17:00:02 +01:00
|
|
|
* Returned Value:
|
2018-06-06 18:05:05 +02:00
|
|
|
* On success - A valid DMA2D controller reference
|
2017-11-06 19:22:48 +01:00
|
|
|
* On error - NULL and errno is set to
|
|
|
|
* -EINVAL if one of the parameter is invalid
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2018-06-06 18:05:05 +02:00
|
|
|
FAR struct dma2d_layer_s *stm32_dma2ddev(void);
|
2017-11-06 19:22:48 +01:00
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: up_dma2dinitialize
|
|
|
|
*
|
|
|
|
* Description:
|
2018-06-06 18:05:05 +02:00
|
|
|
* Initialize the DMA2D controller
|
2017-11-06 19:22:48 +01:00
|
|
|
*
|
2018-02-01 17:00:02 +01:00
|
|
|
* Returned Value:
|
2017-11-06 19:22:48 +01:00
|
|
|
* OK - On success
|
|
|
|
* An error if initializing failed.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2018-06-06 18:05:05 +02:00
|
|
|
int stm32_dma2dinitialize(void);
|
2017-11-06 19:22:48 +01:00
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: up_dma2duninitialize
|
|
|
|
*
|
|
|
|
* Description:
|
2018-06-06 18:05:05 +02:00
|
|
|
* Uninitialize the DMA2D controller
|
2017-11-06 19:22:48 +01:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2018-06-06 18:05:05 +02:00
|
|
|
void stm32_dma2duninitialize(void);
|
2014-12-19 20:41:08 +01:00
|
|
|
|
2018-06-15 23:10:19 +02:00
|
|
|
#endif /* CONFIG_FB_OVERLAY */
|
2014-12-19 20:41:08 +01:00
|
|
|
#endif /* __ARCH_ARM_SRC_STM32_STM32_DMA2D_H */
|