2 * Common LCD routines for supported CPUs
4 * (C) Copyright 2001-2002
5 * Wolfgang Denk, DENX Software Engineering -- wd@denx.de
7 * See file CREDITS for list of people who contributed to this
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License as
12 * published by the Free Software Foundation; either version 2 of
13 * the License, or (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
26 /************************************************************************/
28 /************************************************************************/
35 #include <linux/types.h>
36 #include <stdio_dev.h>
37 #if defined(CONFIG_POST)
43 #if defined CONFIG_PXA250 || defined CONFIG_PXA27X || defined CONFIG_CPU_MONAHANS
44 #include <asm/byteorder.h>
47 #if defined(CONFIG_MPC823)
51 #if defined(CONFIG_ATMEL_LCD)
52 #include <atmel_lcdc.h>
55 /************************************************************************/
57 /************************************************************************/
58 #include <video_font.h> /* Get font data, width and height */
60 /************************************************************************/
62 /************************************************************************/
63 #ifdef CONFIG_LCD_LOGO
65 #include <sp_bmp_logo.h>
66 #include <thor_bmp_logo.h>
67 #include <charge_bmp_logo.h>
68 #include <prog_start_logo.h>
69 #include <prog_mid_logo.h>
70 #include <prog_end_logo.h>
71 # if (CONSOLE_COLOR_WHITE >= BMP_LOGO_OFFSET) && (LCD_BPP != LCD_COLOR16)
72 # error Default Color Map overlaps with Logo Color Map
77 #include "../property/tizen_misc.h"
80 DECLARE_GLOBAL_DATA_PTR;
82 ulong lcd_setmem (ulong addr);
84 static void lcd_drawchars (ushort x, ushort y, uchar *str, int count);
85 static inline void lcd_puts_xy (ushort x, ushort y, uchar *s);
86 static inline void lcd_putc_xy (ushort x, ushort y, uchar c);
88 static int lcd_init (void *lcdbase);
90 static int lcd_clear (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]);
91 static void *lcd_logo (void);
93 static int lcd_getbgcolor (void);
94 void lcd_setfgcolor (int color);
95 static void lcd_setbgcolor (int color);
97 extern void lcd_display(void);
99 char lcd_is_enabled = 0;
101 #ifdef NOT_USED_SO_FAR
102 static void lcd_getcolreg (ushort regno,
103 ushort *red, ushort *green, ushort *blue);
104 static int lcd_getfgcolor (void);
105 #endif /* NOT_USED_SO_FAR */
107 /************************************************************************/
109 /*----------------------------------------------------------------------*/
111 static void console_scrollup (void)
113 /* Copy up rows ignoring the first one */
114 memcpy (CONSOLE_ROW_FIRST, CONSOLE_ROW_SECOND, CONSOLE_SCROLL_SIZE);
116 /* Clear the last one */
117 memset (CONSOLE_ROW_LAST, COLOR_MASK(lcd_color_bg), CONSOLE_ROW_SIZE);
120 /*----------------------------------------------------------------------*/
122 static inline void console_back (void)
124 if (--console_col < 0) {
125 console_col = CONSOLE_COLS-1 ;
126 if (--console_row < 0) {
131 lcd_putc_xy (console_col * VIDEO_FONT_WIDTH,
132 console_row * VIDEO_FONT_HEIGHT,
136 /*----------------------------------------------------------------------*/
138 static inline void console_newline (void)
143 /* Check if we need to scroll the terminal */
144 if (console_row >= CONSOLE_ROWS) {
145 /* Scroll everything up */
146 console_scrollup () ;
151 /*----------------------------------------------------------------------*/
153 void lcd_putc (const char c)
155 if (!lcd_is_enabled) {
161 case '\r': console_col = 0;
164 case '\n': console_newline();
167 case '\t': /* Tab (8 chars alignment) */
171 if (console_col >= CONSOLE_COLS) {
176 case '\b': console_back();
179 default: lcd_putc_xy (console_col * VIDEO_FONT_WIDTH,
180 console_row * VIDEO_FONT_HEIGHT,
182 if (++console_col >= CONSOLE_COLS) {
190 /*----------------------------------------------------------------------*/
192 void lcd_puts (const char *s)
194 if (!lcd_is_enabled) {
204 /*----------------------------------------------------------------------*/
206 void lcd_printf(const char *fmt, ...)
209 char buf[CONFIG_SYS_PBSIZE];
212 vsprintf(buf, fmt, args);
218 /************************************************************************/
219 /* ** Low-Level Graphics Routines */
220 /************************************************************************/
222 static void lcd_drawchars (ushort x, ushort y, uchar *str, int count)
227 #if LCD_BPP == LCD_MONOCHROME
228 ushort off = x * (1 << LCD_BPP) % 8;
231 dest = (uchar *)(lcd_base + y * lcd_line_length + x * (1 << LCD_BPP) / 8);
233 for (row=0; row < VIDEO_FONT_HEIGHT; ++row, dest += lcd_line_length) {
236 #if LCD_BPP == LCD_COLOR16
237 ushort *d = (ushort *)dest;
242 #if LCD_BPP == LCD_MONOCHROME
243 uchar rest = *d & -(1 << (8-off));
246 for (i=0; i<count; ++i) {
250 bits = video_fontdata[c * VIDEO_FONT_HEIGHT + row];
252 #if LCD_BPP == LCD_MONOCHROME
253 sym = (COLOR_MASK(lcd_color_fg) & bits) |
254 (COLOR_MASK(lcd_color_bg) & ~bits);
256 *d++ = rest | (sym >> off);
257 rest = sym << (8-off);
258 #elif LCD_BPP == LCD_COLOR8
259 for (c=0; c<8; ++c) {
260 *d++ = (bits & 0x80) ?
261 lcd_color_fg : lcd_color_bg;
264 #elif LCD_BPP == LCD_COLOR16
265 for (c=0; c<8; ++c) {
266 *d++ = (bits & 0x80) ?
267 lcd_color_fg : lcd_color_bg;
272 #if LCD_BPP == LCD_MONOCHROME
273 *d = rest | (*d & ((1 << (8-off)) - 1));
278 /*----------------------------------------------------------------------*/
280 static inline void lcd_puts_xy (ushort x, ushort y, uchar *s)
282 #if defined(CONFIG_LCD_LOGO) && !defined(CONFIG_LCD_INFO_BELOW_LOGO) && !defined(CONFIG_TIZEN)
283 lcd_drawchars (x, y+BMP_LOGO_HEIGHT, s, strlen ((char *)s));
285 lcd_drawchars (x, y, s, strlen ((char *)s));
289 /*----------------------------------------------------------------------*/
291 static inline void lcd_putc_xy (ushort x, ushort y, uchar c)
293 #if defined(CONFIG_LCD_LOGO) && !defined(CONFIG_LCD_INFO_BELOW_LOGO) && !defined(CONFIG_TIZEN)
294 lcd_drawchars (x, y+BMP_LOGO_HEIGHT, &c, 1);
296 lcd_drawchars (x, y, &c, 1);
300 /************************************************************************/
301 /** Small utility to check that you got the colours right */
302 /************************************************************************/
303 #ifdef LCD_TEST_PATTERN
308 static int test_colors[N_BLK_HOR*N_BLK_VERT] = {
309 CONSOLE_COLOR_RED, CONSOLE_COLOR_GREEN, CONSOLE_COLOR_YELLOW,
310 CONSOLE_COLOR_BLUE, CONSOLE_COLOR_MAGENTA, CONSOLE_COLOR_CYAN,
313 static void test_pattern (void)
315 ushort v_max = panel_info.vl_row;
316 ushort h_max = panel_info.vl_col;
317 ushort v_step = (v_max + N_BLK_VERT - 1) / N_BLK_VERT;
318 ushort h_step = (h_max + N_BLK_HOR - 1) / N_BLK_HOR;
320 uchar *pix = (uchar *)lcd_base;
322 printf ("[LCD] Test Pattern: %d x %d [%d x %d]\n",
323 h_max, v_max, h_step, v_step);
325 /* WARNING: Code silently assumes 8bit/pixel */
326 for (v=0; v<v_max; ++v) {
327 uchar iy = v / v_step;
328 for (h=0; h<h_max; ++h) {
329 uchar ix = N_BLK_HOR * iy + (h/h_step);
330 *pix++ = test_colors[ix];
334 #endif /* LCD_TEST_PATTERN */
337 /************************************************************************/
338 /* ** GENERIC Initialization Routines */
339 /************************************************************************/
341 int drv_lcd_init (void)
343 struct stdio_dev lcddev;
346 lcd_base = (void *)(gd->fb_base);
348 lcd_line_length = (panel_info.vl_col * NBITS (panel_info.vl_bpix)) / 8;
350 lcd_init (lcd_base); /* LCD initialization */
352 /* Device initialization */
353 memset (&lcddev, 0, sizeof (lcddev));
355 strcpy (lcddev.name, "lcd");
356 lcddev.ext = 0; /* No extensions */
357 lcddev.flags = DEV_FLAGS_OUTPUT; /* Output only */
358 lcddev.putc = lcd_putc; /* 'putc' function */
359 lcddev.puts = lcd_puts; /* 'puts' function */
361 rc = stdio_register (&lcddev);
363 return (rc == 0) ? 1 : rc;
366 /*----------------------------------------------------------------------*/
367 static int lcd_clear (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
369 #if LCD_BPP == LCD_MONOCHROME
370 /* Setting the palette */
373 #elif LCD_BPP == LCD_COLOR8
374 /* Setting the palette */
375 lcd_setcolreg (CONSOLE_COLOR_BLACK, 0, 0, 0);
376 lcd_setcolreg (CONSOLE_COLOR_RED, 0xFF, 0, 0);
377 lcd_setcolreg (CONSOLE_COLOR_GREEN, 0, 0xFF, 0);
378 lcd_setcolreg (CONSOLE_COLOR_YELLOW, 0xFF, 0xFF, 0);
379 lcd_setcolreg (CONSOLE_COLOR_BLUE, 0, 0, 0xFF);
380 lcd_setcolreg (CONSOLE_COLOR_MAGENTA, 0xFF, 0, 0xFF);
381 lcd_setcolreg (CONSOLE_COLOR_CYAN, 0, 0xFF, 0xFF);
382 lcd_setcolreg (CONSOLE_COLOR_GREY, 0xAA, 0xAA, 0xAA);
383 lcd_setcolreg (CONSOLE_COLOR_WHITE, 0xFF, 0xFF, 0xFF);
386 #ifndef CONFIG_SYS_WHITE_ON_BLACK
387 lcd_setfgcolor (CONSOLE_COLOR_BLACK);
388 lcd_setbgcolor (CONSOLE_COLOR_WHITE);
390 //lcd_setfgcolor (CONSOLE_COLOR_WHITE);
391 #define CONSOLE_COLOR_RED (0x1f<<11)
392 lcd_setfgcolor (CONSOLE_COLOR_RED);
393 lcd_setbgcolor (CONSOLE_COLOR_BLACK);
394 #endif /* CONFIG_SYS_WHITE_ON_BLACK */
396 #ifdef LCD_TEST_PATTERN
399 /* set framebuffer to background color */
400 memset ((char *)lcd_base,
401 COLOR_MASK(lcd_getbgcolor()),
402 lcd_line_length*panel_info.vl_row);
404 /* Paint the logo and retrieve LCD base address */
405 debug ("[LCD] Drawing the logo...\n");
406 lcd_console_address = lcd_logo ();
415 cls, 1, 1, lcd_clear,
420 /*----------------------------------------------------------------------*/
422 static int lcd_init (void *lcdbase)
424 /* Initialize the lcd controller */
425 debug ("[LCD] Initializing LCD frambuffer at %p\n", lcdbase);
427 lcd_ctrl_init (lcdbase);
429 lcd_clear (NULL, 1, 1, NULL); /* dummy args */
432 /* Initialize the console */
434 #ifdef CONFIG_LCD_INFO_BELOW_LOGO
435 console_row = 7 + BMP_LOGO_HEIGHT / VIDEO_FONT_HEIGHT;
437 console_row = 1; /* leave 1 blank line below logo */
444 /************************************************************************/
445 /* ** ROM capable initialization part - needed to reserve FB memory */
446 /************************************************************************/
448 * This is called early in the system initialization to grab memory
449 * for the LCD controller.
450 * Returns new address for monitor, after reserving LCD buffer memory
452 * Note that this is running from ROM, so no write access to global data.
454 ulong lcd_setmem (ulong addr)
457 int line_length = (panel_info.vl_col * NBITS (panel_info.vl_bpix)) / 8;
459 debug ("LCD panel info: %d x %d, %d bit/pix\n",
460 panel_info.vl_col, panel_info.vl_row, NBITS (panel_info.vl_bpix) );
462 size = line_length * panel_info.vl_row;
464 /* Round up to nearest full page */
465 size = (size + (PAGE_SIZE - 1)) & ~(PAGE_SIZE - 1);
467 /* Allocate pages for the frame buffer. */
470 debug ("Reserving %ldk for LCD Framebuffer at: %08lx\n", size>>10, addr);
475 /*----------------------------------------------------------------------*/
477 void lcd_setfgcolor (int color)
479 lcd_color_fg = color;
482 /*----------------------------------------------------------------------*/
484 static void lcd_setbgcolor (int color)
486 lcd_color_bg = color;
489 /*----------------------------------------------------------------------*/
491 #ifdef NOT_USED_SO_FAR
492 static int lcd_getfgcolor (void)
496 #endif /* NOT_USED_SO_FAR */
498 /*----------------------------------------------------------------------*/
500 static int lcd_getbgcolor (void)
505 /*----------------------------------------------------------------------*/
507 /************************************************************************/
508 /* ** Chipset depending Bitmap / Logo stuff... */
509 /************************************************************************/
510 #ifdef CONFIG_LCD_LOGO
511 void _draw_image(int x, int y, int width, int height, unsigned short *palette, unsigned short *bitmap,
512 unsigned int *num_bitmap, unsigned int num_elem, int clear) {
513 unsigned long i, j, k, num_pre_pixels, num_post_pixels;
517 fb16 = (ushort *)(lcd_base);
519 num_pre_pixels = x + y * panel_info.vl_col;
520 num_post_pixels = (panel_info.vl_row * panel_info.vl_col) - (width * height);
524 memset(fb16, 0x0, num_pre_pixels * 2);
525 fb16 += num_pre_pixels;
529 for (i = 0; i < num_elem; i++) {
530 col16 = palette[bitmap[i]];
531 for (j = 0; j < num_bitmap[i]; j++) {
532 if (((k % width) == 0) && (k != 0)) {
533 fb16 += panel_info.vl_col;
535 memset(fb16, 0x0, panel_info.vl_col * 2);
538 (u16)(((col16 & 0xF) << 1) |
539 ((col16 & 0x0F0) << 3) |
540 ((col16 & 0xF00) << 4));
546 memset(fb16, 0x0, num_post_pixels * 2);
549 void draw_image(int mode) {
552 _draw_image(103, 530, sp_width, sp_height, sp_palette, sp_bitmap, sp_num_bitmap, sp_num_elem, 1);
555 _draw_image(171, 360, thor_width, thor_height, thor_palette, thor_bitmap, thor_num_bitmap, thor_num_elem, 1);
558 _draw_image(270, 440, charge_width, charge_height, charge_palette, charge_bitmap, charge_num_bitmap, charge_num_elem, 1);
563 #define DRAW_HEIGHT 925
565 static int last_non_drawn = -1;
567 void draw_progress(int per) {
568 int idx = (per * DRAW_STEP) / 100;
572 _draw_image(180, DRAW_HEIGHT, prog_start_width, prog_start_height, prog_start_palette, prog_start_bitmap, prog_start_num_bitmap, prog_start_num_elem, 0);
573 } else if(idx < DRAW_STEP) {
574 if (last_non_drawn == -1) {
575 _draw_image(180, DRAW_HEIGHT, prog_start_width, prog_start_height, prog_start_palette, prog_start_bitmap, prog_start_num_bitmap, prog_start_num_elem, 0);
578 tmp = last_non_drawn;
580 _draw_image(180 + 17 + (tmp - 1) * 6, DRAW_HEIGHT, prog_mid_width, prog_mid_height, prog_mid_palette, prog_mid_bitmap, prog_mid_num_bitmap, prog_mid_num_elem, 0);
583 if (last_non_drawn < idx)
584 last_non_drawn = idx;
586 if (idx == DRAW_STEP)
587 _draw_image(180, DRAW_HEIGHT, prog_start_width, prog_start_height, prog_start_palette, prog_start_bitmap, prog_start_num_bitmap, prog_start_num_elem, 0);
588 tmp = last_non_drawn;
590 _draw_image(180 + 17 + (tmp - 1) * 6, DRAW_HEIGHT, prog_mid_width, prog_mid_height, prog_mid_palette, prog_mid_bitmap, prog_mid_num_bitmap, prog_mid_num_elem, 0);
594 _draw_image(180 + 17 + (DRAW_STEP - 2) * 6, DRAW_HEIGHT, prog_end_width, prog_end_height, prog_end_palette, prog_end_bitmap, prog_end_num_bitmap, prog_end_num_elem, 0);
596 if (last_non_drawn < idx)
597 last_non_drawn = idx;
601 void bitmap_plot (int x, int y, int mode)
603 #ifdef CONFIG_ATMEL_LCD
611 #if defined CONFIG_PXA250 || defined CONFIG_PXA27X || defined CONFIG_CPU_MONAHANS
612 struct pxafb_info *fbi = &panel_info.pxa;
613 #elif defined(CONFIG_MPC823)
614 volatile immap_t *immr = (immap_t *) CONFIG_SYS_IMMR;
615 volatile cpm8xx_t *cp = &(immr->im_cpm);
618 debug ("Logo: width %d height %d colors %d cmap %d\n",
619 BMP_LOGO_WIDTH, BMP_LOGO_HEIGHT, BMP_LOGO_COLORS,
620 (int)(sizeof(bmp_logo_palette)/(sizeof(ushort))));
622 bmap = &bmp_logo_bitmap[0];
623 fb = (uchar *)(lcd_base + y * lcd_line_length + x);
625 if (NBITS(panel_info.vl_bpix) < 12) {
626 /* Leave room for default color map */
627 #if defined CONFIG_PXA250 || defined CONFIG_PXA27X || defined CONFIG_CPU_MONAHANS
628 cmap = (ushort *)fbi->palette;
629 #elif defined(CONFIG_MPC823)
630 cmap = (ushort *)&(cp->lcd_cmap[BMP_LOGO_OFFSET*sizeof(ushort)]);
631 #elif defined(CONFIG_ATMEL_LCD)
632 cmap = (uint *) (panel_info.mmio + ATMEL_LCDC_LUT(0));
635 * default case: generic system with no cmap (most likely 16bpp)
636 * We set cmap to the source palette, so no change is done.
637 * This avoids even more ifdef in the next stanza
639 cmap = bmp_logo_palette;
645 for (i=0; i<(sizeof(bmp_logo_palette)/(sizeof(ushort))); ++i) {
646 ushort colreg = bmp_logo_palette[i];
647 #ifdef CONFIG_ATMEL_LCD
649 #ifdef CONFIG_ATMEL_LCD_BGR555
650 lut_entry = ((colreg & 0x000F) << 11) |
651 ((colreg & 0x00F0) << 2) |
652 ((colreg & 0x0F00) >> 7);
653 #else /* CONFIG_ATMEL_LCD_RGB565 */
654 lut_entry = ((colreg & 0x000F) << 1) |
655 ((colreg & 0x00F0) << 3) |
656 ((colreg & 0x0F00) << 4);
658 *(cmap + BMP_LOGO_OFFSET) = lut_entry;
660 #else /* !CONFIG_ATMEL_LCD */
661 #ifdef CONFIG_SYS_INVERT_COLORS
662 *cmap++ = 0xffff - colreg;
666 #endif /* CONFIG_ATMEL_LCD */
671 for (i=0; i<BMP_LOGO_HEIGHT; ++i) {
672 memcpy (fb, bmap, BMP_LOGO_WIDTH);
673 bmap += BMP_LOGO_WIDTH;
674 fb += panel_info.vl_col;
677 else { /* true color mode */
684 #endif /* CONFIG_LCD_LOGO */
686 /*----------------------------------------------------------------------*/
687 #if defined(CONFIG_CMD_BMP) || defined(CONFIG_SPLASH_SCREEN)
689 * Display the BMP file located at address bmp_image.
693 #ifdef CONFIG_SPLASH_SCREEN_ALIGN
694 #define BMP_ALIGN_CENTER 0x7FFF
697 int lcd_display_bitmap(ulong bmp_image, int x, int y)
699 #if !defined(CONFIG_MCC200)
702 ushort *cmap_base = NULL;
705 bmp_image_t *bmp=(bmp_image_t *)bmp_image;
708 unsigned long width, height, byte_width;
709 unsigned long pwidth = panel_info.vl_col;
710 unsigned colors, bpix, bmp_bpix;
711 #if defined CONFIG_PXA250 || defined CONFIG_PXA27X || defined CONFIG_CPU_MONAHANS
712 struct pxafb_info *fbi = &panel_info.pxa;
713 #elif defined(CONFIG_MPC823)
714 volatile immap_t *immr = (immap_t *) CONFIG_SYS_IMMR;
715 volatile cpm8xx_t *cp = &(immr->im_cpm);
718 if (!((bmp->header.signature[0]=='B') &&
719 (bmp->header.signature[1]=='M'))) {
720 printf ("Error: no valid bmp image at %lx\n", bmp_image);
724 width = le32_to_cpu (bmp->header.width);
725 height = le32_to_cpu (bmp->header.height);
726 bmp_bpix = le16_to_cpu(bmp->header.bit_count);
727 colors = 1 << bmp_bpix;
729 bpix = NBITS(panel_info.vl_bpix);
731 if ((bpix != 1) && (bpix != 8) && (bpix != 16)) {
732 printf ("Error: %d bit/pixel mode, but BMP has %d bit/pixel\n",
737 /* We support displaying 8bpp BMPs on 16bpp LCDs */
738 if (bpix != bmp_bpix && (bmp_bpix != 8 || bpix != 16)) {
739 printf ("Error: %d bit/pixel mode, but BMP has %d bit/pixel\n",
741 le16_to_cpu(bmp->header.bit_count));
745 debug ("Display-bmp: %d x %d with %d colors\n",
746 (int)width, (int)height, (int)colors);
748 #if !defined(CONFIG_MCC200)
749 /* MCC200 LCD doesn't need CMAP, supports 1bpp b&w only */
751 #if defined CONFIG_PXA250 || defined CONFIG_PXA27X || defined CONFIG_CPU_MONAHANS
752 cmap = (ushort *)fbi->palette;
753 #elif defined(CONFIG_MPC823)
754 cmap = (ushort *)&(cp->lcd_cmap[255*sizeof(ushort)]);
755 #elif !defined(CONFIG_ATMEL_LCD)
756 cmap = panel_info.cmap;
762 for (i=0; i<colors; ++i) {
763 bmp_color_table_entry_t cte = bmp->color_table[i];
764 #if !defined(CONFIG_ATMEL_LCD)
766 ( ((cte.red) << 8) & 0xf800) |
767 ( ((cte.green) << 3) & 0x07e0) |
768 ( ((cte.blue) >> 3) & 0x001f) ;
769 #ifdef CONFIG_SYS_INVERT_COLORS
770 *cmap = 0xffff - colreg;
774 #if defined(CONFIG_MPC823)
779 #else /* CONFIG_ATMEL_LCD */
780 lcd_setcolreg(i, cte.red, cte.green, cte.blue);
787 * BMP format for Monochrome assumes that the state of a
788 * pixel is described on a per Bit basis, not per Byte.
789 * So, in case of Monochrome BMP we should align widths
790 * on a byte boundary and convert them from Bit to Byte
792 * Probably, PXA250 and MPC823 process 1bpp BMP images in
793 * their own ways, so make the converting to be MCC200
796 #if defined(CONFIG_MCC200)
799 width = ((width + 7) & ~7) >> 3;
800 x = ((x + 7) & ~7) >> 3;
801 pwidth= ((pwidth + 7) & ~7) >> 3;
805 padded_line = (width&0x3) ? ((width&~0x3)+4) : (width);
807 #ifdef CONFIG_SPLASH_SCREEN_ALIGN
808 if (x == BMP_ALIGN_CENTER)
809 x = max(0, (pwidth - width) / 2);
811 x = max(0, pwidth - width + x + 1);
813 if (y == BMP_ALIGN_CENTER)
814 y = max(0, (panel_info.vl_row - height) / 2);
816 y = max(0, panel_info.vl_row - height + y + 1);
817 #endif /* CONFIG_SPLASH_SCREEN_ALIGN */
819 if ((x + width)>pwidth)
821 if ((y + height)>panel_info.vl_row)
822 height = panel_info.vl_row - y;
824 bmap = (uchar *)bmp + le32_to_cpu (bmp->header.data_offset);
825 fb = (uchar *) (lcd_base +
826 (y + height - 1) * lcd_line_length + x);
829 case 1: /* pass through */
834 byte_width = width * 2;
836 for (i = 0; i < height; ++i) {
838 for (j = 0; j < width; j++) {
840 #if defined CONFIG_PXA250 || defined CONFIG_PXA27X || defined CONFIG_CPU_MONAHANS || defined(CONFIG_ATMEL_LCD)
842 #elif defined(CONFIG_MPC823) || defined(CONFIG_MCC200)
843 *(fb++) = 255 - *(bmap++);
846 *(uint16_t *)fb = cmap_base[*(bmap++)];
847 fb += sizeof(uint16_t) / sizeof(*fb);
850 bmap += (width - padded_line);
851 fb -= (byte_width + lcd_line_length);
855 #if defined(CONFIG_BMP_16BPP)
857 for (i = 0; i < height; ++i) {
859 for (j = 0; j < width; j++) {
860 #if defined(CONFIG_ATMEL_LCD_BGR555)
861 *(fb++) = ((bmap[0] & 0x1f) << 2) |
863 *(fb++) = (bmap[0] & 0xe0) |
864 ((bmap[1] & 0x7c) >> 2);
871 bmap += (padded_line - width) * 2;
872 fb -= (width * 2 + lcd_line_length);
875 #endif /* CONFIG_BMP_16BPP */
885 static void *lcd_logo (void)
887 #ifdef CONFIG_SPLASH_SCREEN
890 static int do_splash = 1;
892 if (do_splash && (s = getenv("splashimage")) != NULL) {
896 addr = simple_strtoul (s, NULL, 16);
897 #ifdef CONFIG_SPLASH_SCREEN_ALIGN
898 if ((s = getenv ("splashpos")) != NULL) {
900 x = BMP_ALIGN_CENTER;
902 x = simple_strtol (s, NULL, 0);
904 if ((s = strchr (s + 1, ',')) != NULL) {
906 y = BMP_ALIGN_CENTER;
908 y = simple_strtol (s + 1, NULL, 0);
911 #endif /* CONFIG_SPLASH_SCREEN_ALIGN */
913 #ifdef CONFIG_VIDEO_BMP_GZIP
914 bmp_image_t *bmp = (bmp_image_t *)addr;
917 if (!((bmp->header.signature[0]=='B') &&
918 (bmp->header.signature[1]=='M'))) {
919 addr = (ulong)gunzip_bmp(addr, &len);
923 if (lcd_display_bitmap (addr, x, y) == 0) {
924 return ((void *)lcd_base);
927 #endif /* CONFIG_SPLASH_SCREEN */
929 #ifdef CONFIG_LCD_INFO
930 console_col = LCD_INFO_X / VIDEO_FONT_WIDTH;
931 console_row = LCD_INFO_Y / VIDEO_FONT_HEIGHT;
932 lcd_show_board_info();
933 #endif /* CONFIG_LCD_INFO */
935 #if defined(CONFIG_LCD_LOGO) && !defined(CONFIG_LCD_INFO_BELOW_LOGO) && !defined(CONFIG_TIZEN)
936 return ((void *)((ulong)lcd_base + BMP_LOGO_HEIGHT * lcd_line_length));
938 return ((void *)lcd_base);
939 #endif /* CONFIG_LCD_LOGO && !CONFIG_LCD_INFO_BELOW_LOGO */
942 void lcd_set_cur_pos(short row, short col)
947 /************************************************************************/
948 /************************************************************************/