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);
98 char lcd_is_enabled = 0;
100 #ifdef NOT_USED_SO_FAR
101 static void lcd_getcolreg (ushort regno,
102 ushort *red, ushort *green, ushort *blue);
103 static int lcd_getfgcolor (void);
104 #endif /* NOT_USED_SO_FAR */
106 /************************************************************************/
108 /*----------------------------------------------------------------------*/
110 static void console_scrollup (void)
112 /* Copy up rows ignoring the first one */
113 memcpy (CONSOLE_ROW_FIRST, CONSOLE_ROW_SECOND, CONSOLE_SCROLL_SIZE);
115 /* Clear the last one */
116 memset (CONSOLE_ROW_LAST, COLOR_MASK(lcd_color_bg), CONSOLE_ROW_SIZE);
119 /*----------------------------------------------------------------------*/
121 static inline void console_back (void)
123 if (--console_col < 0) {
124 console_col = CONSOLE_COLS-1 ;
125 if (--console_row < 0) {
130 lcd_putc_xy (console_col * VIDEO_FONT_WIDTH,
131 console_row * VIDEO_FONT_HEIGHT,
135 /*----------------------------------------------------------------------*/
137 static inline void console_newline (void)
142 /* Check if we need to scroll the terminal */
143 if (console_row >= CONSOLE_ROWS) {
144 /* Scroll everything up */
145 console_scrollup () ;
150 /*----------------------------------------------------------------------*/
152 void lcd_putc (const char c)
154 if (!lcd_is_enabled) {
160 case '\r': console_col = 0;
163 case '\n': console_newline();
166 case '\t': /* Tab (8 chars alignment) */
170 if (console_col >= CONSOLE_COLS) {
175 case '\b': console_back();
178 default: lcd_putc_xy (console_col * VIDEO_FONT_WIDTH,
179 console_row * VIDEO_FONT_HEIGHT,
181 if (++console_col >= CONSOLE_COLS) {
189 /*----------------------------------------------------------------------*/
191 void lcd_puts (const char *s)
193 if (!lcd_is_enabled) {
203 /*----------------------------------------------------------------------*/
205 void lcd_printf(const char *fmt, ...)
208 char buf[CONFIG_SYS_PBSIZE];
211 vsprintf(buf, fmt, args);
217 /************************************************************************/
218 /* ** Low-Level Graphics Routines */
219 /************************************************************************/
221 static void lcd_drawchars (ushort x, ushort y, uchar *str, int count)
226 dest = (uchar *)(lcd_base + y * lcd_line_length + x * (1 << LCD_BPP) / 8);
227 off = x * (1 << LCD_BPP) % 8;
229 for (row=0; row < VIDEO_FONT_HEIGHT; ++row, dest += lcd_line_length) {
232 #if LCD_BPP == LCD_COLOR16
233 ushort *d = (ushort *)dest;
238 #if LCD_BPP == LCD_MONOCHROME
239 uchar rest = *d & -(1 << (8-off));
242 for (i=0; i<count; ++i) {
246 bits = video_fontdata[c * VIDEO_FONT_HEIGHT + row];
248 #if LCD_BPP == LCD_MONOCHROME
249 sym = (COLOR_MASK(lcd_color_fg) & bits) |
250 (COLOR_MASK(lcd_color_bg) & ~bits);
252 *d++ = rest | (sym >> off);
253 rest = sym << (8-off);
254 #elif LCD_BPP == LCD_COLOR8
255 for (c=0; c<8; ++c) {
256 *d++ = (bits & 0x80) ?
257 lcd_color_fg : lcd_color_bg;
260 #elif LCD_BPP == LCD_COLOR16
261 for (c=0; c<8; ++c) {
262 *d++ = (bits & 0x80) ?
263 lcd_color_fg : lcd_color_bg;
268 #if LCD_BPP == LCD_MONOCHROME
269 *d = rest | (*d & ((1 << (8-off)) - 1));
274 /*----------------------------------------------------------------------*/
276 static inline void lcd_puts_xy (ushort x, ushort y, uchar *s)
278 #if defined(CONFIG_LCD_LOGO) && !defined(CONFIG_LCD_INFO_BELOW_LOGO) && !defined(CONFIG_TIZEN)
279 lcd_drawchars (x, y+BMP_LOGO_HEIGHT, s, strlen ((char *)s));
281 lcd_drawchars (x, y, s, strlen ((char *)s));
285 /*----------------------------------------------------------------------*/
287 static inline void lcd_putc_xy (ushort x, ushort y, uchar c)
289 #if defined(CONFIG_LCD_LOGO) && !defined(CONFIG_LCD_INFO_BELOW_LOGO) && !defined(CONFIG_TIZEN)
290 lcd_drawchars (x, y+BMP_LOGO_HEIGHT, &c, 1);
292 lcd_drawchars (x, y, &c, 1);
296 /************************************************************************/
297 /** Small utility to check that you got the colours right */
298 /************************************************************************/
299 #ifdef LCD_TEST_PATTERN
304 static int test_colors[N_BLK_HOR*N_BLK_VERT] = {
305 CONSOLE_COLOR_RED, CONSOLE_COLOR_GREEN, CONSOLE_COLOR_YELLOW,
306 CONSOLE_COLOR_BLUE, CONSOLE_COLOR_MAGENTA, CONSOLE_COLOR_CYAN,
309 static void test_pattern (void)
311 ushort v_max = panel_info.vl_row;
312 ushort h_max = panel_info.vl_col;
313 ushort v_step = (v_max + N_BLK_VERT - 1) / N_BLK_VERT;
314 ushort h_step = (h_max + N_BLK_HOR - 1) / N_BLK_HOR;
316 uchar *pix = (uchar *)lcd_base;
318 printf ("[LCD] Test Pattern: %d x %d [%d x %d]\n",
319 h_max, v_max, h_step, v_step);
321 /* WARNING: Code silently assumes 8bit/pixel */
322 for (v=0; v<v_max; ++v) {
323 uchar iy = v / v_step;
324 for (h=0; h<h_max; ++h) {
325 uchar ix = N_BLK_HOR * iy + (h/h_step);
326 *pix++ = test_colors[ix];
330 #endif /* LCD_TEST_PATTERN */
333 /************************************************************************/
334 /* ** GENERIC Initialization Routines */
335 /************************************************************************/
337 int drv_lcd_init (void)
339 struct stdio_dev lcddev;
342 lcd_base = (void *)(gd->fb_base);
344 lcd_line_length = (panel_info.vl_col * NBITS (panel_info.vl_bpix)) / 8;
346 lcd_init (lcd_base); /* LCD initialization */
348 /* Device initialization */
349 memset (&lcddev, 0, sizeof (lcddev));
351 strcpy (lcddev.name, "lcd");
352 lcddev.ext = 0; /* No extensions */
353 lcddev.flags = DEV_FLAGS_OUTPUT; /* Output only */
354 lcddev.putc = lcd_putc; /* 'putc' function */
355 lcddev.puts = lcd_puts; /* 'puts' function */
357 rc = stdio_register (&lcddev);
359 return (rc == 0) ? 1 : rc;
362 /*----------------------------------------------------------------------*/
363 static int lcd_clear (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
365 #if LCD_BPP == LCD_MONOCHROME
366 /* Setting the palette */
369 #elif LCD_BPP == LCD_COLOR8
370 /* Setting the palette */
371 lcd_setcolreg (CONSOLE_COLOR_BLACK, 0, 0, 0);
372 lcd_setcolreg (CONSOLE_COLOR_RED, 0xFF, 0, 0);
373 lcd_setcolreg (CONSOLE_COLOR_GREEN, 0, 0xFF, 0);
374 lcd_setcolreg (CONSOLE_COLOR_YELLOW, 0xFF, 0xFF, 0);
375 lcd_setcolreg (CONSOLE_COLOR_BLUE, 0, 0, 0xFF);
376 lcd_setcolreg (CONSOLE_COLOR_MAGENTA, 0xFF, 0, 0xFF);
377 lcd_setcolreg (CONSOLE_COLOR_CYAN, 0, 0xFF, 0xFF);
378 lcd_setcolreg (CONSOLE_COLOR_GREY, 0xAA, 0xAA, 0xAA);
379 lcd_setcolreg (CONSOLE_COLOR_WHITE, 0xFF, 0xFF, 0xFF);
382 #ifndef CONFIG_SYS_WHITE_ON_BLACK
383 lcd_setfgcolor (CONSOLE_COLOR_BLACK);
384 lcd_setbgcolor (CONSOLE_COLOR_WHITE);
386 //lcd_setfgcolor (CONSOLE_COLOR_WHITE);
387 #define CONSOLE_COLOR_RED (0x1f<<11)
388 lcd_setfgcolor (CONSOLE_COLOR_RED);
389 lcd_setbgcolor (CONSOLE_COLOR_BLACK);
390 #endif /* CONFIG_SYS_WHITE_ON_BLACK */
392 #ifdef LCD_TEST_PATTERN
395 /* set framebuffer to background color */
396 memset ((char *)lcd_base,
397 COLOR_MASK(lcd_getbgcolor()),
398 lcd_line_length*panel_info.vl_row);
400 /* Paint the logo and retrieve LCD base address */
401 debug ("[LCD] Drawing the logo...\n");
402 lcd_console_address = lcd_logo ();
411 cls, 1, 1, lcd_clear,
416 /*----------------------------------------------------------------------*/
418 static int lcd_init (void *lcdbase)
420 /* Initialize the lcd controller */
421 debug ("[LCD] Initializing LCD frambuffer at %p\n", lcdbase);
423 lcd_ctrl_init (lcdbase);
425 lcd_clear (NULL, 1, 1, NULL); /* dummy args */
428 /* Initialize the console */
430 #ifdef CONFIG_LCD_INFO_BELOW_LOGO
431 console_row = 7 + BMP_LOGO_HEIGHT / VIDEO_FONT_HEIGHT;
433 console_row = 1; /* leave 1 blank line below logo */
440 /************************************************************************/
441 /* ** ROM capable initialization part - needed to reserve FB memory */
442 /************************************************************************/
444 * This is called early in the system initialization to grab memory
445 * for the LCD controller.
446 * Returns new address for monitor, after reserving LCD buffer memory
448 * Note that this is running from ROM, so no write access to global data.
450 ulong lcd_setmem (ulong addr)
453 int line_length = (panel_info.vl_col * NBITS (panel_info.vl_bpix)) / 8;
455 debug ("LCD panel info: %d x %d, %d bit/pix\n",
456 panel_info.vl_col, panel_info.vl_row, NBITS (panel_info.vl_bpix) );
458 size = line_length * panel_info.vl_row;
460 /* Round up to nearest full page */
461 size = (size + (PAGE_SIZE - 1)) & ~(PAGE_SIZE - 1);
463 /* Allocate pages for the frame buffer. */
466 debug ("Reserving %ldk for LCD Framebuffer at: %08lx\n", size>>10, addr);
471 /*----------------------------------------------------------------------*/
473 void lcd_setfgcolor (int color)
475 lcd_color_fg = color;
478 /*----------------------------------------------------------------------*/
480 static void lcd_setbgcolor (int color)
482 lcd_color_bg = color;
485 /*----------------------------------------------------------------------*/
487 #ifdef NOT_USED_SO_FAR
488 static int lcd_getfgcolor (void)
492 #endif /* NOT_USED_SO_FAR */
494 /*----------------------------------------------------------------------*/
496 static int lcd_getbgcolor (void)
501 /*----------------------------------------------------------------------*/
503 /************************************************************************/
504 /* ** Chipset depending Bitmap / Logo stuff... */
505 /************************************************************************/
506 #ifdef CONFIG_LCD_LOGO
507 void _draw_image(int x, int y, int width, int height, unsigned short *palette, unsigned short *bitmap,
508 unsigned int *num_bitmap, unsigned int num_elem, int clear) {
509 unsigned long i, j, k, num_pre_pixels, num_post_pixels;
514 fb16 = (ushort *)(lcd_base);
516 num_pre_pixels = x + y * panel_info.vl_col;
517 num_post_pixels = (panel_info.vl_row * panel_info.vl_col) - (width * height);
521 memset(fb16, 0x0, num_pre_pixels * 2);
522 fb16 += num_pre_pixels;
526 for (i = 0; i < num_elem; i++) {
527 col16 = palette[bitmap[i]];
528 for (j = 0; j < num_bitmap[i]; j++) {
529 if (((k % width) == 0) && (k != 0)) {
530 fb16 += panel_info.vl_col;
532 memset(fb16, 0x0, panel_info.vl_col * 2);
535 (u16)(((col16 & 0xF) << 1) |
536 ((col16 & 0x0F0) << 3) |
537 ((col16 & 0xF00) << 4));
543 memset(fb16, 0x0, num_post_pixels * 2);
546 void draw_image(int mode) {
549 _draw_image(103, 530, sp_width, sp_height, sp_palette, sp_bitmap, sp_num_bitmap, sp_num_elem, 1);
552 _draw_image(171, 360, thor_width, thor_height, thor_palette, thor_bitmap, thor_num_bitmap, thor_num_elem, 1);
555 _draw_image(270, 440, charge_width, charge_height, charge_palette, charge_bitmap, charge_num_bitmap, charge_num_elem, 1);
560 #define DRAW_HEIGHT 925
562 static int last_non_drawn = -1;
564 void draw_progress(int per) {
565 int idx = (per * DRAW_STEP) / 100;
569 _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);
570 } else if(idx < DRAW_STEP) {
571 if (last_non_drawn == -1) {
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);
575 tmp = last_non_drawn;
577 _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);
580 if (last_non_drawn < idx)
581 last_non_drawn = idx;
583 if (idx == DRAW_STEP)
584 _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);
585 tmp = last_non_drawn;
587 _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);
591 _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);
593 if (last_non_drawn < idx)
594 last_non_drawn = idx;
598 void bitmap_plot (int x, int y, int mode)
600 #ifdef CONFIG_ATMEL_LCD
609 #if defined CONFIG_PXA250 || defined CONFIG_PXA27X || defined CONFIG_CPU_MONAHANS
610 struct pxafb_info *fbi = &panel_info.pxa;
611 #elif defined(CONFIG_MPC823)
612 volatile immap_t *immr = (immap_t *) CONFIG_SYS_IMMR;
613 volatile cpm8xx_t *cp = &(immr->im_cpm);
616 debug ("Logo: width %d height %d colors %d cmap %d\n",
617 BMP_LOGO_WIDTH, BMP_LOGO_HEIGHT, BMP_LOGO_COLORS,
618 (int)(sizeof(bmp_logo_palette)/(sizeof(ushort))));
620 bmap = &bmp_logo_bitmap[0];
621 fb = (uchar *)(lcd_base + y * lcd_line_length + x);
623 if (NBITS(panel_info.vl_bpix) < 12) {
624 /* Leave room for default color map */
625 #if defined CONFIG_PXA250 || defined CONFIG_PXA27X || defined CONFIG_CPU_MONAHANS
626 cmap = (ushort *)fbi->palette;
627 #elif defined(CONFIG_MPC823)
628 cmap = (ushort *)&(cp->lcd_cmap[BMP_LOGO_OFFSET*sizeof(ushort)]);
629 #elif defined(CONFIG_ATMEL_LCD)
630 cmap = (uint *) (panel_info.mmio + ATMEL_LCDC_LUT(0));
633 * default case: generic system with no cmap (most likely 16bpp)
634 * We set cmap to the source palette, so no change is done.
635 * This avoids even more ifdef in the next stanza
637 cmap = bmp_logo_palette;
643 for (i=0; i<(sizeof(bmp_logo_palette)/(sizeof(ushort))); ++i) {
644 ushort colreg = bmp_logo_palette[i];
645 #ifdef CONFIG_ATMEL_LCD
647 #ifdef CONFIG_ATMEL_LCD_BGR555
648 lut_entry = ((colreg & 0x000F) << 11) |
649 ((colreg & 0x00F0) << 2) |
650 ((colreg & 0x0F00) >> 7);
651 #else /* CONFIG_ATMEL_LCD_RGB565 */
652 lut_entry = ((colreg & 0x000F) << 1) |
653 ((colreg & 0x00F0) << 3) |
654 ((colreg & 0x0F00) << 4);
656 *(cmap + BMP_LOGO_OFFSET) = lut_entry;
658 #else /* !CONFIG_ATMEL_LCD */
659 #ifdef CONFIG_SYS_INVERT_COLORS
660 *cmap++ = 0xffff - colreg;
664 #endif /* CONFIG_ATMEL_LCD */
669 for (i=0; i<BMP_LOGO_HEIGHT; ++i) {
670 memcpy (fb, bmap, BMP_LOGO_WIDTH);
671 bmap += BMP_LOGO_WIDTH;
672 fb += panel_info.vl_col;
675 else { /* true color mode */
682 #endif /* CONFIG_LCD_LOGO */
684 /*----------------------------------------------------------------------*/
685 #if defined(CONFIG_CMD_BMP) || defined(CONFIG_SPLASH_SCREEN)
687 * Display the BMP file located at address bmp_image.
691 #ifdef CONFIG_SPLASH_SCREEN_ALIGN
692 #define BMP_ALIGN_CENTER 0x7FFF
695 int lcd_display_bitmap(ulong bmp_image, int x, int y)
697 #if !defined(CONFIG_MCC200)
700 ushort *cmap_base = NULL;
703 bmp_image_t *bmp=(bmp_image_t *)bmp_image;
706 unsigned long width, height, byte_width;
707 unsigned long pwidth = panel_info.vl_col;
708 unsigned colors, bpix, bmp_bpix;
709 unsigned long compression;
710 #if defined CONFIG_PXA250 || defined CONFIG_PXA27X || defined CONFIG_CPU_MONAHANS
711 struct pxafb_info *fbi = &panel_info.pxa;
712 #elif defined(CONFIG_MPC823)
713 volatile immap_t *immr = (immap_t *) CONFIG_SYS_IMMR;
714 volatile cpm8xx_t *cp = &(immr->im_cpm);
717 if (!((bmp->header.signature[0]=='B') &&
718 (bmp->header.signature[1]=='M'))) {
719 printf ("Error: no valid bmp image at %lx\n", bmp_image);
723 width = le32_to_cpu (bmp->header.width);
724 height = le32_to_cpu (bmp->header.height);
725 bmp_bpix = le16_to_cpu(bmp->header.bit_count);
726 colors = 1 << bmp_bpix;
727 compression = le32_to_cpu (bmp->header.compression);
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 /************************************************************************/