diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/lcd.c | 16 | ||||
-rw-r--r-- | common/lcd_console.c | 21 |
2 files changed, 27 insertions, 10 deletions
diff --git a/common/lcd.c b/common/lcd.c index 783626e..3d5c6d0 100644 --- a/common/lcd.c +++ b/common/lcd.c @@ -35,11 +35,6 @@ #define CONFIG_LCD_ALIGNMENT PAGE_SIZE #endif -#if (LCD_BPP != LCD_COLOR8) && (LCD_BPP != LCD_COLOR16) && \ - (LCD_BPP != LCD_COLOR32) -#error Unsupported LCD BPP. -#endif - DECLARE_GLOBAL_DATA_PTR; static int lcd_init(void *lcdbase); @@ -175,7 +170,11 @@ void lcd_clear(void) char *s; ulong addr; static int do_splash = 1; -#if LCD_BPP == LCD_COLOR8 +#if LCD_BPP == LCD_MONOCHROME + /* Setting the palette */ + lcd_initcolregs(); + +#elif LCD_BPP == LCD_COLOR8 /* Setting the palette */ lcd_setcolreg(CONSOLE_COLOR_BLACK, 0, 0, 0); lcd_setcolreg(CONSOLE_COLOR_RED, 0xFF, 0, 0); @@ -203,14 +202,15 @@ void lcd_clear(void) #else /* set framebuffer to background color */ #if (LCD_BPP != LCD_COLOR32) - memset((char *)lcd_base, bg_color, lcd_line_length * panel_info.vl_row); + memset((char *)lcd_base, COLOR_MASK(lcd_getbgcolor()), + lcd_line_length * panel_info.vl_row); #else u32 *ppix = lcd_base; u32 i; for (i = 0; i < (lcd_line_length * panel_info.vl_row)/NBYTES(panel_info.vl_bpix); i++) { - *ppix++ = bg_color; + *ppix++ = COLOR_MASK(lcd_getbgcolor()); } #endif #endif diff --git a/common/lcd_console.c b/common/lcd_console.c index bb0d7c5..4c91def 100644 --- a/common/lcd_console.c +++ b/common/lcd_console.c @@ -46,17 +46,34 @@ static void lcd_putc_xy0(struct console_t *pcons, ushort x, ushort y, char c) { int fg_color = lcd_getfgcolor(); int bg_color = lcd_getbgcolor(); - int i, row; + int row; +#if LCD_BPP == LCD_MONOCHROME + ushort off = x * (1 << LCD_BPP) % 8; +#else + int i; +#endif + fbptr_t *dst = (fbptr_t *)pcons->fbbase + y * pcons->lcdsizex + x; for (row = 0; row < VIDEO_FONT_HEIGHT; row++) { uchar bits = video_fontdata[c * VIDEO_FONT_HEIGHT + row]; +#if LCD_BPP == LCD_MONOCHROME + uchar rest = *dst & -(1 << (8 - off)); + uchar sym; + + sym = (COLOR_MASK(fg_color) & bits) | + (COLOR_MASK(bg_color) & ~bits); + *dst++ = rest | (sym >> off); + rest = sym << (8 - off); + *dst = rest | (*dst & ((1 << (8 - off)) - 1)); +#else /* LCD_BPP == LCD_COLOR8 or LCD_COLOR16 or LCD_COLOR32 */ for (i = 0; i < VIDEO_FONT_WIDTH; ++i) { *dst++ = (bits & 0x80) ? fg_color : bg_color; bits <<= 1; } +#endif dst += (pcons->lcdsizex - VIDEO_FONT_WIDTH); } } @@ -114,7 +131,7 @@ static inline void console_newline(void) for (i = 0; i < cons.rows-rows; i++) cons.fp_console_moverow(&cons, i, i+rows); for (i = 0; i < rows; i++) - cons.fp_console_setrow(&cons, cons.rows-i-1, bg_color); + cons.fp_console_setrow(&cons, cons.rows-i-1, COLOR_MASK(bg_color)); cons.curr_row -= rows; } lcd_sync(); |