display-dma2d  2.1.0
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 #ifdef STM32H7XX
51 #include "stm32h7xx_hal.h"
52 #endif
53 
54 #include "sni.h"
55 
56 /* Structs -------------------------------------------------------------------*/
57 
58 /*
59  * @brief Feature "memcpy" data. Function "DRAWING_DMA2D_configure_memcpy()" fills
60  * it with given arguments. In a second time, this structure must be given to
61  * "DRAWING_DMA2D_start_memcpy()".
62  */
63 typedef struct
64 {
65  uint8_t* src_address;
66  uint8_t* dest_address;
67  uint16_t width;
68  uint16_t height;
70 
71 /* API -----------------------------------------------------------------------*/
72 
73 /*
74  * @brief Initializes this library.
75  *
76  * @param[in] binary_semaphore_handle a binary semaphore. It must initialized in such
77  * case the semaphore must first be 'given' before it can be 'taken'.
78  */
79 void DRAWING_DMA2D_initialize(void* binary_semaphore_handle);
80 
81 /*
82  * @brief STM32 HAL DMA2D implementation. DMA2D IRQ handler must call this function.
83  * This function calls STM32 HAL DMA2D "HAL_DMA2D_IRQHandler()" function. Then it
84  * calls the LLUI_DISPLAY "LLUI_DISPLAY_notifyAsynchronousDrawingEnd" or "LLUI_DISPLAY_flushDone"
85  * callbacks to notify the graphical engine about current status.
86  */
87 void DRAWING_DMA2D_IRQHandler(void);
88 
89 /*
90  * @brief Configures the copy from frame buffer to back buffer just after a flush.
91  *
92  * @param[in] srcAddr the address of the buffer to copy.
93  * @param[in] destAddr the address of the destination buffer.
94  * @param[in] xmin the top-left X coordinate of rectangle to copy.
95  * @param[in] ymin the top-left Y coordinate of rectangle to copy.
96  * @param[in] xmax the bottom-right X coordinate of rectangle to copy.
97  * @param[in] ymax the bottom-right Y coordinate of rectangle to copy.
98  * @param[in] stride the buffer row stride in pixels (usually equals to buffer width)
99  * @param[in] memcpy_data the internal representation of memcpy to perform.
100  */
101 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);
102 
103 /*
104  * @brief Starts the copy previously configured by a call to "DRAWING_DMA2D_configure_memcpy()".
105  *
106  * @param[in] memcpy_data the internal representation of memcpy to perform.
107  */
108 void DRAWING_DMA2D_start_memcpy(DRAWING_DMA2D_memcpy* memcyp_data);
109 
110 /* EOF -----------------------------------------------------------------------*/
111 
112 #ifdef __cplusplus
113  }
114 #endif
115 
116 #endif // DRAWING_DMA2D_H
117