summaryrefslogtreecommitdiff
path: root/common/lcd_console.c
diff options
context:
space:
mode:
authorPeng Fan <Peng.Fan@freescale.com>2015-03-14 18:17:06 +0800
committerPeng Fan <Peng.Fan@freescale.com>2015-04-29 15:00:31 +0800
commit2b899b9c52fb82ce9a8f3599c8e4799c974bc68b (patch)
tree9915e7480b9a6cdbdde7f87b88d94fc1a4d7e1f9 /common/lcd_console.c
parentfe02c2c77fa7b29b1a073cc08ecea34af6d87fd2 (diff)
downloadu-boot-imx-2b899b9c52fb82ce9a8f3599c8e4799c974bc68b.zip
u-boot-imx-2b899b9c52fb82ce9a8f3599c8e4799c974bc68b.tar.gz
u-boot-imx-2b899b9c52fb82ce9a8f3599c8e4799c974bc68b.tar.bz2
MLK-10774-31 lcd: add LCD_MONOCHROME
LCD_MONOCHROME is removed in commit f4469f50b0367820121ef2d313517d422ed70e1d. Add related code back to support epdc. In this patch, also include crm_regs.h in mx6slevk.c to make epdc code be compiled ok. COLOR_MASK is also added from commit a7de2953f51e70754190d3516167d58d27d17219 Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Diffstat (limited to 'common/lcd_console.c')
-rw-r--r--common/lcd_console.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/common/lcd_console.c b/common/lcd_console.c
index 8bf83b9..7aab81f 100644
--- a/common/lcd_console.c
+++ b/common/lcd_console.c
@@ -61,6 +61,10 @@ static void lcd_drawchars(ushort x, ushort y, uchar *str, int count)
ushort row;
int fg_color, bg_color;
+#if LCD_BPP == LCD_MONOCHROME
+ ushort off = x * (1 << LCD_BPP) % 8;
+#endif
+
dest = (uchar *)(lcd_console_address +
y * lcd_line_length + x * NBITS(LCD_BPP) / 8);
@@ -77,17 +81,33 @@ static void lcd_drawchars(ushort x, ushort y, uchar *str, int count)
fg_color = lcd_getfgcolor();
bg_color = lcd_getbgcolor();
+
+#if LCD_BPP == LCD_MONOCHROME
+ uchar rest = *d & -(1 << (8 - off));
+ uchar sym;
+#endif
for (i = 0; i < count; ++i) {
uchar c, bits;
c = *s++;
bits = video_fontdata[c * VIDEO_FONT_HEIGHT + row];
+#if LCD_BPP == LCD_MONOCHROME
+ sym = (COLOR_MASK(fg_color) & bits) |
+ (COLOR_MASK(bg_color) & ~bits);
+
+ *d++ = rest | (sym >> off);
+ rest = sym << (8-off);
+#else /* LCD_BPP == LCD_COLOR8 or LCD_COLOR16 or LCD_COLOR32 */
for (c = 0; c < 8; ++c) {
*d++ = (bits & 0x80) ? fg_color : bg_color;
bits <<= 1;
}
+#endif
}
+#if LCD_BPP == LCD_MONOCHROME
+ *d = rest | (*d & ((1 << (8 - off)) - 1));
+#endif
}
}
@@ -109,7 +129,7 @@ static void console_scrollup(void)
/* Clear the last rows */
#if (LCD_BPP != LCD_COLOR32)
memset(lcd_console_address + CONSOLE_SIZE - CONSOLE_ROW_SIZE * rows,
- bg_color, CONSOLE_ROW_SIZE * rows);
+ COLOR_MASK(bg_color), CONSOLE_ROW_SIZE * rows);
#else
u32 *ppix = lcd_console_address +
CONSOLE_SIZE - CONSOLE_ROW_SIZE * rows;
@@ -117,7 +137,7 @@ static void console_scrollup(void)
for (i = 0;
i < (CONSOLE_ROW_SIZE * rows) / NBYTES(panel_info.vl_bpix);
i++) {
- *ppix++ = bg_color;
+ *ppix++ = COLOR_MASK(bg_color);
}
#endif
lcd_sync();