display-dma2d  1.0.8
display-dma2d
drawing_dma2d.h
Go to the documentation of this file.
1 /*
2  * C
3  *
4  * Copyright 2019-2022 MicroEJ Corp. All rights reserved.
5  * Use of this source code is governed by a BSD-style license that can be found with this software.
6  */
7 
8 #ifndef DRAWING_DMA2D_H
9 #define DRAWING_DMA2D_H
10 
33 #ifdef __cplusplus
34  extern "C" {
35 #endif
36 
37 /* Includes ------------------------------------------------------------------*/
38 
39 #include <stdint.h>
40 #include "LLUI_DISPLAY_IMPL.h"
41 
42 #ifdef STM32F4XX
43 #include "stm32f4xx_hal.h"
44 #endif
45 
46 #ifdef STM32F7XX
47 #include "stm32f7xx_hal.h"
48 #endif
49 
50 #include "sni.h"
51 
52 /* Structs -------------------------------------------------------------------*/
53 
54 /*
55  * @brief Feature "memcpy" data. Function "DRAWING_DMA2D_configure_memcpy()" fills
56  * it with given arguments. In a second time, this structure must be given to
57  * "DRAWING_DMA2D_start_memcpy()".
58  */
59 typedef struct
60 {
61  uint8_t* src_address;
62  uint8_t* dest_address;
63  uint16_t width;
64  uint16_t height;
66 
67 /* API -----------------------------------------------------------------------*/
68 
69 /*
70  * @brief Initializes this library.
71  *
72  * @param[in] binary_semaphore_handle a binary semaphore. It must initialized in such
73  * case the semaphore must first be 'given' before it can be 'taken'.
74  */
75 void DRAWING_DMA2D_initialize(void* binary_semaphore_handle);
76 
77 /*
78  * @brief STM32 HAL DMA2D implementation. DMA2D IRQ handler must call this function.
79  * This function calls STM32 HAL DMA2D "HAL_DMA2D_IRQHandler()" function. Then it
80  * calls the LLUI_DISPLAY "LLUI_DISPLAY_notifyAsynchronousDrawingEnd" or "LLUI_DISPLAY_flushDone"
81  * callbacks to notify the graphical engine about current status.
82  */
83 void DRAWING_DMA2D_IRQHandler(void);
84 
85 /*
86  * @brief Configures the copy from frame buffer to back buffer just after a flush.
87  *
88  * @param[in] srcAddr the address of the buffer to copy.
89  * @param[in] destAddr the address of the destination buffer.
90  * @param[in] xmin the top-left X coordinate of rectangle to copy.
91  * @param[in] ymin the top-left Y coordinate of rectangle to copy.
92  * @param[in] xmax the bottom-right X coordinate of rectangle to copy.
93  * @param[in] ymax the bottom-right Y coordinate of rectangle to copy.
94  * @param[in] stride the buffer row stride in pixels (usually equals to buffer width)
95  * @param[in] memcpy_data the internal representation of memcpy to perform.
96  */
97 void DRAWING_DMA2D_configure_memcpy(uint8_t* srcAddr, uint8_t* destAddr, uint32_t xmin, uint32_t ymin, uint32_t xmax, uint32_t ymax, uint32_t stride, DRAWING_DMA2D_memcpy* memcpy_data);
98 
99 /*
100  * @brief Starts the copy previously configured by a call to "DRAWING_DMA2D_configure_memcpy()".
101  *
102  * @param[in] memcpy_data the internal representation of memcpy to perform.
103  */
104 void DRAWING_DMA2D_start_memcpy(DRAWING_DMA2D_memcpy* memcyp_data);
105 
106 /* EOF -----------------------------------------------------------------------*/
107 
108 #ifdef __cplusplus
109  }
110 #endif
111 
112 #endif // DRAWING_DMA2D_H
113