[U-Boot] [PATCH V2 10/12] lcd: make lcd_drawchars() independant of lcd_base

Nikita Kiryanov nikita at compulab.co.il
Sun Nov 30 13:29:43 CET 2014


lcd_logo() has the following return value:

 #if defined(CONFIG_LCD_LOGO) && !defined(CONFIG_LCD_INFO_BELOW_LOGO)
	return (void *)((ulong)lcd_base + BMP_LOGO_HEIGHT * lcd_line_length);
 #else
	return (void *)lcd_base;
 #endif

This return value gets assigned to lcd_console_address.
lcd_console_address is not assigned or modified anywhere else.
Thus:

 #if defined(CONFIG_LCD_LOGO) && !defined(CONFIG_LCD_INFO_BELOW_LOGO):
	y' = BMP_LOGO_HEIGHT + y;
	lcd_base + y' * lcd_line_length ==
	lcd_base + (BMP_LOGO_HEIGHT + y) * lcd_line_length ==
	lcd_base + BMP_LOGO_HEIGHT * lcd_line_length + y * lcd_line_length ==
	lcd_console_address + y * lcd_line_length
 #else
	lcd_base + y * lcd_line_length == lcd_console_address + y * lcd_line_length
 #endif

This is a preparatory step for extracting lcd console code into its own
file.

Signed-off-by: Nikita Kiryanov <nikita at compulab.co.il>
Cc: Anatolij Gustschin <agust at denx.de>
Cc: Simon Glass <sjg at chromium.org>
---
Changes in V2:
	- New patch.

 common/lcd.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/common/lcd.c b/common/lcd.c
index a75c616..b55dd4c 100644
--- a/common/lcd.c
+++ b/common/lcd.c
@@ -317,11 +317,8 @@ static void lcd_drawchars(ushort x, ushort y, uchar *str, int count)
 	uchar *dest;
 	ushort row;
 
-#if defined(CONFIG_LCD_LOGO) && !defined(CONFIG_LCD_INFO_BELOW_LOGO)
-	y += BMP_LOGO_HEIGHT;
-#endif
-
-	dest = (uchar *)(lcd_base + y * lcd_line_length + x * NBITS(LCD_BPP)/8);
+	dest = (uchar *)(lcd_console_address +
+			y * lcd_line_length + x * NBITS(LCD_BPP) / 8);
 
 	for (row = 0; row < VIDEO_FONT_HEIGHT; ++row, dest += lcd_line_length) {
 		uchar *s = str;
-- 
1.9.1



More information about the U-Boot mailing list