WebRadioApp  0.1
ew_bsp_graphics.h
Go to the documentation of this file.
1 /*******************************************************************************
2  *
3  * E M B E D D E D W I Z A R D P R O J E C T
4  *
5  * Copyright (c) TARA Systems
6  *GmbH written by Paul Banach and Manfred Schweyer
7  *
8  ********************************************************************************
9  *
10  * This software is delivered "as is" and shows the usage of other software
11  * components. It is provided as an example software which is intended to be
12  * modified and extended according to particular requirements.
13  *
14  * TARA Systems hereby disclaims all warranties and conditions with regard to
15  *the software, including all implied warranties and conditions of
16  *merchantability and non-infringement of any third party IPR or other rights
17  *which may result from the use or the inability to use the software.
18  *
19  ********************************************************************************
20  *
21  * DESCRIPTION:
22  * This file is part of the interface (glue layer) between an Embedded Wizard
23  * generated UI application and the board support package (BSP) of a dedicated
24  * target.
25  * This file contains an interface to the DMA2D hardware of the STM32 target
26  * in order to provide graphics acceleration for the Embedded Wizard generated
27  * UI applications.
28  * This interface is intended to be used only by the Graphics Engine of
29  * Embedded Wizard.
30  *
31  *******************************************************************************/
32 
45 #ifndef EW_BSP_GRAPHICS_H
46 #define EW_BSP_GRAPHICS_H
47 
48 #if defined STM32F746xx || defined STM32F750xx || defined STM32F756xx || \
49  defined STM32F769xx
50 #include "stm32f7xx_hal.h"
51 #endif
52 
53 #if defined STM32F429xx || defined STM32F439xx || defined STM32F469xx
54 #include "stm32f4xx_hal.h"
55 #endif
56 
57 #if defined STM32L496xx || defined STM32L4R9xx
58 #include "stm32l4xx_hal.h"
59 #endif
60 
61 #if defined STM32H743xx || defined STM32H745xx || defined STM32H747xx || \
62  defined STM32H750xx || defined STM32H7B3xxQ
63 #include "stm32h7xx_hal.h"
64 #endif
65 
66 #ifdef __cplusplus
67 extern "C" {
68 #endif
69 
70 /*
71  EW_USE_DMA2D_INTERRUPT_MODE - Flag to switch on/off the usage of the interrupt
72  mode for the DMA2D (graphics accelerator).
73  Per default, the usage of the interrupt mode is enabled. If the interrupt mode
74  is swtched off, polling mode is used instead. To switch off the usage of the
75  DMA2D interrupt mode, please set the macro EW_USE_DMA2D_INTERRUPT_MODE to 0
76  within your makefile. This can be achieved by using the compiler flag
77  -DEW_USE_DMA2D_INTERRUPT_MODE=0
78 */
79 #ifndef EW_USE_DMA2D_INTERRUPT_MODE
80 #define EW_USE_DMA2D_INTERRUPT_MODE 1
81 #endif
82 
83 #if EW_USE_DMA2D_INTERRUPT_MODE == 0
84 #undef EW_USE_DMA2D_INTERRUPT_MODE
85 #endif
86 
87 /*******************************************************************************
88  * FUNCTION:
89  * EwBspGraphicsInit
90  *
91  * DESCRIPTION:
92  * Initialize the DMA2D graphics accelerator.
93  *
94  * ARGUMENTS:
95  * aDstColorMode - Colorformat of the destination bitmap
96  *
97  * RETURN VALUE:
98  * If successful, returns != 0.
99  *
100  *******************************************************************************/
101 int EwBspGraphicsInit(uint32_t aDstColorMode);
102 
103 /*******************************************************************************
104  * FUNCTION:
105  * EwBspGraphicsDone
106  *
107  * DESCRIPTION:
108  * Deinitialize the DMA2D graphics accelerator.
109  *
110  * ARGUMENTS:
111  * None
112  *
113  * RETURN VALUE:
114  * None
115  *
116  *******************************************************************************/
117 void EwBspGraphicsDone(void);
118 
119 /*******************************************************************************
120  * FUNCTION:
121  * EwBspGraphicsWaitForCompletion
122  *
123  * DESCRIPTION:
124  * The function EwBspGraphicsWaitForCompletion returns as soon as the DMA2D
125  *has completed a pending graphics instruction. If the DMA2D is in idle mode,
126  * the function returns immediately.
127  *
128  * ARGUMENTS:
129  * None
130  *
131  * RETURN VALUE:
132  * None
133  *
134  *******************************************************************************/
136 
137 /*******************************************************************************
138  * FUNCTION:
139  * EwBspGraphicsConcurrentOperation
140  *
141  * DESCRIPTION:
142  * The function EwBspGraphicsConcurrentOperation configures the operation mode
143  * of DMA2D and CPU. If concurrent operation is enabled, the CPU will work in
144  * parallel while the DMA2D is transferring data. If concurrent operation is
145  * disabled, the CPU will wait everytime the DMA2D is active.
146  * This feature is intended to limit the memory bandwidth, e.g. during display
147  * update or other bandwidth consuming activities.
148  *
149  * ARGUMENTS:
150  * aEnable - flag to switch on/off concurrent operation mode.
151  *
152  * RETURN VALUE:
153  * None
154  *
155  *******************************************************************************/
156 void EwBspGraphicsConcurrentOperation(int aEnable);
157 
158 /*******************************************************************************
159  * FUNCTION:
160  * EwBspGraphicsFill
161  *
162  * DESCRIPTION:
163  * The function EwBspGraphicsFill is used by the Graphics Engine, when a
164  * rectangular area should be filled with a constant color by using the DMA2D
165  * functionality.
166  *
167  * ARGUMENTS:
168  * aDstAddr - Destination address of the transfer.
169  * aDstOffset - Offset in pixel to next row within the destination.
170  * aWidth,
171  * aHeight - Size of the area to fill.
172  * aDstColorMode - Colorformat of the destination.
173  * aSrcColor - Color to fill the rectangular area.
174  *
175  * RETURN VALUE:
176  * None
177  *
178  *******************************************************************************/
179 void EwBspGraphicsFill(uint32_t aDstAddr, uint32_t aDstOffset, uint32_t aWidth,
180  uint32_t aHeight, uint32_t aDstColorMode,
181  uint32_t aSrcColor);
182 
183 /*******************************************************************************
184  * FUNCTION:
185  * EwBspGraphicsFillBlend
186  *
187  * DESCRIPTION:
188  * The function EwBspGraphicsFillBlend is used by the Graphics Engine, when a
189  * rectangular area should be blended with a constant color by using the DMA2D
190  * functionality.
191  *
192  * ARGUMENTS:
193  * aDstAddr - Destination address of the transfer.
194  * aDstOffset - Offset in pixel to next row within the destination.
195  * aWidth,
196  * aHeight - Size of the area to blend.
197  * aDstColorMode - Colorformat of the destination.
198  * aSrcColor - Color to blend the rectangular area.
199  *
200  * RETURN VALUE:
201  * None
202  *
203  *******************************************************************************/
204 void EwBspGraphicsFillBlend(uint32_t aDstAddr, uint32_t aDstOffset,
205  uint32_t aWidth, uint32_t aHeight,
206  uint32_t aDstColorMode, uint32_t aSrcColor);
207 
208 /*******************************************************************************
209  * FUNCTION:
210  * EwBspGraphicsCopy
211  *
212  * DESCRIPTION:
213  * The function EwBspGraphicsCopy is used by the Graphics Engine, when a
214  *source bitmap should be copied into a destination bitmap by using the DMA2D
215  * functionality.
216  *
217  * ARGUMENTS:
218  * aDstAddr - Destination address of the transfer.
219  * aSrcAddr - Source address of the transfer.
220  * aDstOffset - Offset in pixel to next row within the destination bitmap.
221  * aSrcOffset - Offset in pixel to next row within the source bitmap.
222  * aWidth,
223  * aHeight - Size of the area to transfer the bitmap.
224  * aDstColorMode - Colorformat of the destination bitmap
225  * aSrcColorMode - Colorformat of the source bitmap.
226  * aSrcColor - Color/alpha value to be used for the transfer.
227  *
228  * RETURN VALUE:
229  * None
230  *
231  *******************************************************************************/
232 void EwBspGraphicsCopy(uint32_t aDstAddr, uint32_t aSrcAddr,
233  uint32_t aDstOffset, uint32_t aSrcOffset,
234  uint32_t aWidth, uint32_t aHeight,
235  uint32_t aDstColorMode, uint32_t aSrcColorMode,
236  uint32_t aSrcColor);
237 
238 /*******************************************************************************
239  * FUNCTION:
240  * EwBspGraphicsCopyBlend
241  *
242  * DESCRIPTION:
243  * The function EwBspGraphicsCopyBlend is used by the Graphics Engine, when a
244  * source bitmap should be blended over a destination bitmap by using the
245  *DMA2D functionality.
246  *
247  * ARGUMENTS:
248  * aDstAddr - Destination address of the transfer.
249  * aSrcAddr - Source address of the transfer.
250  * aDstOffset - Offset in pixel to next row within the destination bitmap.
251  * aSrcOffset - Offset in pixel to next row within the source bitmap.
252  * aWidth,
253  * aHeight - Size of the area to transfer the bitmap.
254  * aDstColorMode - Colorformat of the destination bitmap
255  * aSrcColorMode - Colorformat of the source bitmap.
256  * aSrcColor - Color/alpha value to be used for the transfer.
257  *
258  * RETURN VALUE:
259  * None
260  *
261  *******************************************************************************/
262 void EwBspGraphicsCopyBlend(uint32_t aDstAddr, uint32_t aSrcAddr,
263  uint32_t aDstOffset, uint32_t aSrcOffset,
264  uint32_t aWidth, uint32_t aHeight,
265  uint32_t aDstColorMode, uint32_t aSrcColorMode,
266  uint32_t aSrcColor);
267 
268 /*******************************************************************************
269  * FUNCTION:
270  * EwBspGraphicsLoadClut
271  *
272  * DESCRIPTION:
273  * The function EwBspGraphicsLoadClut is used by the Graphics Engine, when
274  * a Index8 source bitmap should be copied into a destination bitmap by using
275  * the DMA2D functionality. In this case, the CLUT of the DMA2D has to be
276  *loaded with the given CLUT.
277  *
278  * ARGUMENTS:
279  * aClutAddr - Address of the first color entry of the CLUT.
280  * aClutSize - Number of color entries within the CLUT.
281  *
282  * RETURN VALUE:
283  * None
284  *
285  *******************************************************************************/
286 void EwBspGraphicsLoadClut(uint32_t aClutAddr, uint32_t aClutSize);
287 
288 #ifdef __cplusplus
289 }
290 #endif
291 
292 #endif /* EW_BSP_GRAPHICS_H */
293 
294 /* msy */
295 
ew_bsp_graphics.h
HAL_DMA2D_MspInit
void HAL_DMA2D_MspInit(DMA2D_HandleTypeDef *hdma2d)
DMA2D MSP Initialization This function configures the hardware resources used in this example:
Definition: ew_bsp_graphics.c:75
EwBspGraphicsConcurrentOperation
void EwBspGraphicsConcurrentOperation(int aEnable)
The function EwBspGraphicsConcurrentOperation configures the operation mode of DMA2D and CPU....
Definition: ew_bsp_graphics.c:212
EwBspGraphicsWaitForCompletion
void EwBspGraphicsWaitForCompletion()
The function EwBspGraphicsWaitForCompletion returns as soon as the DMA2D has completed a pending grap...
Definition: ew_bsp_graphics.c:166
EwBspGraphicsFillBlend
void EwBspGraphicsFillBlend(uint32_t aDstAddr, uint32_t aDstOffset, uint32_t aWidth, uint32_t aHeight, uint32_t aDstColorMode, uint32_t aSrcColor)
The function EwBspGraphicsFillBlend is used by the Graphics Engine, when a rectangular area should be...
Definition: ew_bsp_graphics.c:280
EwBspGraphicsFill
void EwBspGraphicsFill(uint32_t aDstAddr, uint32_t aDstOffset, uint32_t aWidth, uint32_t aHeight, uint32_t aDstColorMode, uint32_t aSrcColor)
The function EwBspGraphicsFill is used by the Graphics Engine, when a rectangular area should be fill...
Definition: ew_bsp_graphics.c:231
TransferInProgress
static volatile char TransferInProgress
Definition: ew_bsp_graphics.c:63
ew_bsp_clock.h
DMA2D_IRQHandler
void DMA2D_IRQHandler(void)
DMA2D Interrupt Handler.
Definition: ew_bsp_graphics.c:547
EwBspGraphicsInit
int EwBspGraphicsInit(uint32_t aDstColorMode)
Initialize the DMA2D graphics accelerator.
Definition: ew_bsp_graphics.c:115
CPU_LOAD_SET_ACTIVE
#define CPU_LOAD_SET_ACTIVE()
Definition: ew_bsp_clock.h:56
ConcurrentOperation
static char ConcurrentOperation
Definition: ew_bsp_graphics.c:64
EwBspGraphicsDone
void EwBspGraphicsDone(void)
Deinitialize the DMA2D graphics accelerator.
Definition: ew_bsp_graphics.c:153
Accelerator
static DMA2D_HandleTypeDef Accelerator
Definition: ew_bsp_graphics.c:65
HAL_DMA2D_MspDeInit
void HAL_DMA2D_MspDeInit(DMA2D_HandleTypeDef *hdma2d)
DMA2D MSP De-Initialization This function frees the hardware resources used in this example:
Definition: ew_bsp_graphics.c:95
CPU_LOAD_SET_IDLE
#define CPU_LOAD_SET_IDLE()
Definition: ew_bsp_clock.h:55
EwBspGraphicsCopyBlend
void EwBspGraphicsCopyBlend(uint32_t aDstAddr, uint32_t aSrcAddr, uint32_t aDstOffset, uint32_t aSrcOffset, uint32_t aWidth, uint32_t aHeight, uint32_t aDstColorMode, uint32_t aSrcColorMode, uint32_t aSrcColor)
The function EwBspGraphicsCopyBlend is used by the Graphics Engine, when a source bitmap should be bl...
Definition: ew_bsp_graphics.c:431
ewconfig.h
This file contains general configuration settings for the target system, like memory ranges and displ...
EwBspGraphicsCopy
void EwBspGraphicsCopy(uint32_t aDstAddr, uint32_t aSrcAddr, uint32_t aDstOffset, uint32_t aSrcOffset, uint32_t aWidth, uint32_t aHeight, uint32_t aDstColorMode, uint32_t aSrcColorMode, uint32_t aSrcColor)
The function EwBspGraphicsCopy is used by the Graphics Engine, when a source bitmap should be copied ...
Definition: ew_bsp_graphics.c:357
EwBspGraphicsLoadClut
void EwBspGraphicsLoadClut(uint32_t aClutAddr, uint32_t aClutSize)
The function EwBspGraphicsLoadClut is used by the Graphics Engine, when a Index8 source bitmap should...
Definition: ew_bsp_graphics.c:508