From 462a40c59747e22f0fcc8b3652ff11e47b0d11db Mon Sep 17 00:00:00 2001 From: Travis Geiselbrecht Date: Wed, 19 Aug 2015 17:53:34 -0700 Subject: [PATCH] [target][stm32746g-eval2] add cache flushing routine to lcd updates --- target/stm32746g-eval2/lcd.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/target/stm32746g-eval2/lcd.c b/target/stm32746g-eval2/lcd.c index 4d07736b..ddbe964b 100644 --- a/target/stm32746g-eval2/lcd.c +++ b/target/stm32746g-eval2/lcd.c @@ -381,6 +381,20 @@ uint8_t BSP_LCD_Init(void) } /* LK display api here */ + +static void display_flush(uint starty, uint endy) +{ + if (endy <= starty) + return; + + uint32_t xsize = BSP_LCD_GetXSize(); + uint8_t *ptr = (uint8_t *)hLtdcEval.LayerCfg[ActiveLayer].FBStartAdress + starty * xsize; + size_t len = (endy - starty) * xsize * 4; + + /* flush the dirty cache lines for the updated region */ + SCB_CleanDCache_by_Addr((uint32_t *)ptr, len); +} + void display_get_info(struct display_info *info) { info->framebuffer = (void *)hLtdcEval.LayerCfg[ActiveLayer].FBStartAdress; @@ -399,6 +413,6 @@ void display_get_info(struct display_info *info) info->width = BSP_LCD_GetXSize(); info->height = BSP_LCD_GetYSize(); info->stride = BSP_LCD_GetXSize(); - info->flush = NULL; // XXX cache flush + info->flush = &display_flush; }