From a0727124c280d9382208e028539e734430e5148c Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 29 Dec 2014 09:59:46 -0600 Subject: [PATCH] stm32: update description and code documentation. Also fixes a few code formattings. Signed-off-by: Marco Krahl --- arch/arm/src/stm32/stm32_ltdc.c | 39 +++++++++++++++++---------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/arch/arm/src/stm32/stm32_ltdc.c b/arch/arm/src/stm32/stm32_ltdc.c index ed88bb9d4e..11940578e7 100644 --- a/arch/arm/src/stm32/stm32_ltdc.c +++ b/arch/arm/src/stm32/stm32_ltdc.c @@ -922,11 +922,10 @@ static void stm32_ltdc_gpioconfig(void) static void stm32_ltdc_periphconfig(void) { - uint32_t regval; + uint32_t regval; - /* Configure GPIO's external */ + /* Configure GPIO's */ - gvdbg("Configure lcd pins\n"); stm32_ltdc_gpioconfig(); /* Configure APB2 LTDC clock external */ @@ -1092,7 +1091,7 @@ static void stm32_ltdc_reload(uint8_t value) { } - /* Reload shadow register after vertical blank */ + /* Reload shadow register */ regvdbg("set LTDC_SRCR=%08x\n", value & ~LTDC_SRCR_WAIT); putreg32(value & ~LTDC_SRCR_WAIT, STM32_LTDC_SRCR); @@ -1154,8 +1153,6 @@ static void stm32_global_configure(void) stm32_ltdc_bgcolor(STM32_LTDC_BACKCOLOR); - /* Enable lcd interrupts only if neccessary */ - /* Enable line interrupt */ stm32_ltdc_interrupt(STM32_LTDC_IER_LIE, 1); @@ -1536,7 +1533,9 @@ static inline void stm32_ltdc_lframebuffer(FAR struct stm32_layer_s *layer) regvdbg("set LTDC_L%dCFBAR=%08x\n", priv->lid + 1, pinfo->fbmem + offset); putreg32(pinfo->fbmem + offset, stm32_cfbar_layer_t[priv->lid]); - /* Change line length */ + /* Configure LxCFBLR register */ + + /* Calculate line length */ cfblr = LTDC_LxCFBLR_CFBP(pinfo->stride) | LTDC_LxCFBLR_CFBLL(area->xres * STM32_LTDC_Lx_BYPP(pinfo->bpp) + 3); @@ -1696,8 +1695,7 @@ static void stm32_ltdc_lclut(FAR struct stm32_layer_s *layer) stm32_ltdc_lclutenable(layer, false); - /* - * Reload shadow control register + /* Reload shadow control register. * This never changed any layer setting as long the layer register not up to * date. This is what stm32_update does. */ @@ -1966,6 +1964,7 @@ static void stm32_ltdc_linit(int lid) #ifdef STM32_LAYER_CLUT_SIZE /* Disable clut by default */ + if (layer->state.vinfo.fmt == FB_FMT_RGB8) { stm32_ltdc_lclutenable(layer, false); @@ -2247,7 +2246,7 @@ static int stm32_setclut(struct ltdc_layer_s *layer, } else { - /* Copy to the layer clut */ + /* Copy to the layer cmap */ stm32_ltdc_cmapcpy(priv->state.cmap, cmap); @@ -2693,7 +2692,7 @@ static int stm32_setblendmode(FAR struct ltdc_layer_s *layer, uint32_t mode) /* Enable blending, restore the alpha value */ stm32_ltdc_lunsetopac(priv); - mode &= ~LTDC_BLEND_ALPHA; + mode &= ~LTDC_BLEND_ALPHA; } if (mode & LTDC_BLEND_COLORKEY) @@ -2712,10 +2711,10 @@ static int stm32_setblendmode(FAR struct ltdc_layer_s *layer, uint32_t mode) if (ret == OK) { - priv->state.blendmode = mode; - priv->operation |= (LTDC_LAYER_SETBLENDMODE| - LTDC_LAYER_SETALPHAVALUE| - LTDC_LAYER_SETCOLORKEY); + priv->state.blendmode = mode; + priv->operation |= (LTDC_LAYER_SETBLENDMODE| + LTDC_LAYER_SETALPHAVALUE| + LTDC_LAYER_SETCOLORKEY); } sem_post(priv->state.lock); @@ -2916,6 +2915,7 @@ static int stm32_update(FAR struct ltdc_layer_s *layer, uint32_t mode) if (stm32_ltdc_lvalidate(priv)) { /* Reload immediately by default */ + uint8_t reload = LTDC_SRCR_IMR; sem_wait(priv->state.lock); @@ -2948,11 +2948,11 @@ static int stm32_update(FAR struct ltdc_layer_s *layer, uint32_t mode) if (mode & LTDC_UPDATE_ACTIVATE) { - /* Set the given layer to the active layer */ + /* Set the given layer to the next active layer */ g_lactive = priv->state.lid; - /* Also change this for flip operation */ + /* Also change the current active layer for flip operation */ active = &LAYER(!g_lactive); } @@ -3163,7 +3163,7 @@ FAR struct ltdc_layer_s *stm32_ltdcgetlayer(int lid) int stm32_ltdcinitialize(void) { - gvdbg("Entry\n"); + gvdbg("Initialize LTDC driver\n"); /* Disable the LCD */ @@ -3238,7 +3238,7 @@ struct fb_vtable_s *stm32_ltdcgetvplane(int vplane) return (struct fb_vtable_s *)&g_vtable; } - return NULL; + return NULL; } /**************************************************************************** @@ -3294,6 +3294,7 @@ void stm32_lcdclear(nxgl_mxpixel_t color) void stm32_backlight(bool blon) { /* Set default backlight level CONFIG_STM32_LTDC_DEFBACKLIGHT */ + gdbg("Not supported\n"); } #endif