feat(dma2d): enable ASYNC/INTERRUPT with ZephyrOS (#10187)

Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
Co-authored-by: Alain Volmat <alain.volmat@foss.st.com>
This commit is contained in:
Alain Volmat
2026-05-27 10:02:07 +02:00
committed by GitHub
co-authored by Alain Volmat
parent b53e748c99
commit 180adf91d7
+22
View File
@@ -13,6 +13,11 @@
#include "../sw/lv_draw_sw.h"
#include "../../misc/lv_area_private.h"
#if defined(__ZEPHYR__) && LV_USE_DRAW_DMA2D_INTERRUPT
#include <zephyr/kernel.h>
#include <zephyr/irq.h>
#endif
#if !LV_DRAW_DMA2D_ASYNC && LV_USE_DRAW_DMA2D_INTERRUPT
#warning LV_USE_DRAW_DMA2D_INTERRUPT is 1 but has no effect because LV_USE_OS is LV_OS_NONE
#endif
@@ -38,6 +43,9 @@ static int32_t delete_cb(lv_draw_unit_t * draw_unit);
static int32_t wait_finish_cb(lv_draw_unit_t * u);
#endif
static void post_transfer_tasks(lv_draw_dma2d_unit_t * u);
#if defined(__ZEPHYR__) && LV_USE_DRAW_DMA2D_INTERRUPT
static void zephyr_dma2d_irq_handler(void *);
#endif
/**********************
* STATIC VARIABLES
@@ -90,8 +98,13 @@ void lv_draw_dma2d_init(void)
/* disable dead time */
DMA2D->AMTCR = 0;
#if defined(__ZEPHYR__) && LV_USE_DRAW_DMA2D_INTERRUPT
IRQ_CONNECT(DT_IRQN(DT_NODELABEL(dma2d)), DT_IRQ(DT_NODELABEL(dma2d), priority), zephyr_dma2d_irq_handler, NULL, 0);
irq_enable(DT_IRQN(DT_NODELABEL(dma2d)));
#else
/* enable the interrupt */
NVIC_EnableIRQ(DMA2D_IRQn);
#endif
}
void lv_draw_dma2d_deinit(void)
@@ -263,6 +276,15 @@ void lv_draw_dma2d_clean_cache(const lv_draw_dma2d_cache_area_t * mem_area)
/**********************
* STATIC FUNCTIONS
**********************/
#if defined(__ZEPHYR__) && LV_USE_DRAW_DMA2D_INTERRUPT
static void zephyr_dma2d_irq_handler(void *)
{
/* Clear Transfer Complete flag */
DMA2D->IFCR = DMA2D_IFCR_CTCIF;
lv_draw_dma2d_transfer_complete_interrupt_handler();
}
#endif
static int32_t evaluate_cb(lv_draw_unit_t * draw_unit, lv_draw_task_t * task)
{