From c149b1625c4adcc979767fc3798280177aa0726c Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 29 Dec 2014 09:45:30 -0600 Subject: [PATCH] stm32: fix faulty access to non existing layer. This disables operation that requires double layer support, when configured for single layer only. Signed-off-by: Marco Krahl --- arch/arm/src/stm32/stm32_ltdc.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/arm/src/stm32/stm32_ltdc.c b/arch/arm/src/stm32/stm32_ltdc.c index 52ec101811..b3663ba320 100644 --- a/arch/arm/src/stm32/stm32_ltdc.c +++ b/arch/arm/src/stm32/stm32_ltdc.c @@ -2906,8 +2906,10 @@ static int stm32_getarea(FAR struct ltdc_layer_s *layer, static int stm32_update(FAR struct ltdc_layer_s *layer, uint32_t mode) { FAR struct stm32_layer_s *priv = (FAR struct stm32_layer_s *)layer; +#ifdef CONFIG_STM32_LTDC_L2 FAR struct stm32_layer_s *active = &LAYER(g_lactive); FAR struct stm32_layer_s *inactive = &LAYER(!g_lactive); +#endif gvdbg("layer = %p, mode = %08x\n", layer, mode); @@ -2932,6 +2934,11 @@ static int stm32_update(FAR struct ltdc_layer_s *layer, uint32_t mode) stm32_ltdc_lupdate(priv); +#ifdef CONFIG_STM32_LTDC_L2 + /* The following operation only useful if layer 2 is supported. + * Otherwise ignore it. + */ + if (mode & LTDC_UPDATE_SIM) { /* Also update the flip layer */ @@ -2989,6 +2996,7 @@ static int stm32_update(FAR struct ltdc_layer_s *layer, uint32_t mode) g_lactive = inactive->state.lid; } +#endif /* Make the changes visible */