blob: e64972fd813a6e10ade52623140df65fa234249c [file] [log] [blame]
wdenk8655b6f2004-10-09 23:25:58 +00001/*
2 * Common LCD routines for supported CPUs
3 *
4 * (C) Copyright 2001-2002
5 * Wolfgang Denk, DENX Software Engineering -- wd@denx.de
6 *
7 * See file CREDITS for list of people who contributed to this
8 * project.
9 *
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.
14 *
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.
19 *
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,
23 * MA 02111-1307 USA
24 */
25
26/************************************************************************/
27/* ** HEADER FILES */
28/************************************************************************/
29
30/* #define DEBUG */
31
32#include <config.h>
33#include <common.h>
34#include <command.h>
35#include <version.h>
36#include <stdarg.h>
37#include <linux/types.h>
38#include <devices.h>
39#if defined(CONFIG_POST)
40#include <post.h>
41#endif
42#include <lcd.h>
wdenk8b0bfc62005-04-03 23:11:38 +000043#include <watchdog.h>
wdenk8655b6f2004-10-09 23:25:58 +000044
45#if defined(CONFIG_PXA250)
46#include <asm/byteorder.h>
47#endif
48
49#if defined(CONFIG_MPC823)
wdenk8655b6f2004-10-09 23:25:58 +000050#include <lcdvideo.h>
51#endif
52
53
54#ifdef CONFIG_LCD
55
56/************************************************************************/
57/* ** FONT DATA */
58/************************************************************************/
59#include <video_font.h> /* Get font data, width and height */
60
wdenk88804d12005-07-04 00:03:16 +000061/************************************************************************/
62/* ** LOGO DATA */
63/************************************************************************/
64#ifdef CONFIG_LCD_LOGO
65# include <bmp_logo.h> /* Get logo data, width and height */
66# if (CONSOLE_COLOR_WHITE >= BMP_LOGO_OFFSET)
67# error Default Color Map overlaps with Logo Color Map
68# endif
69#endif
wdenk8655b6f2004-10-09 23:25:58 +000070
71ulong lcd_setmem (ulong addr);
72
73static void lcd_drawchars (ushort x, ushort y, uchar *str, int count);
74static inline void lcd_puts_xy (ushort x, ushort y, uchar *s);
75static inline void lcd_putc_xy (ushort x, ushort y, uchar c);
76
77static int lcd_init (void *lcdbase);
78
79static int lcd_clear (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]);
80extern void lcd_ctrl_init (void *lcdbase);
81extern void lcd_enable (void);
82static void *lcd_logo (void);
83
84
85#if LCD_BPP == LCD_COLOR8
86extern void lcd_setcolreg (ushort regno,
87 ushort red, ushort green, ushort blue);
88#endif
89#if LCD_BPP == LCD_MONOCHROME
90extern void lcd_initcolregs (void);
91#endif
92
93static int lcd_getbgcolor (void);
94static void lcd_setfgcolor (int color);
95static void lcd_setbgcolor (int color);
96
97char lcd_is_enabled = 0;
98extern vidinfo_t panel_info;
99
100#ifdef NOT_USED_SO_FAR
101static void lcd_getcolreg (ushort regno,
102 ushort *red, ushort *green, ushort *blue);
103static int lcd_getfgcolor (void);
104#endif /* NOT_USED_SO_FAR */
105
106/************************************************************************/
107
108/*----------------------------------------------------------------------*/
109
110static void console_scrollup (void)
111{
112#if 1
113 /* Copy up rows ignoring the first one */
114 memcpy (CONSOLE_ROW_FIRST, CONSOLE_ROW_SECOND, CONSOLE_SCROLL_SIZE);
115
116 /* Clear the last one */
117 memset (CONSOLE_ROW_LAST, COLOR_MASK(lcd_color_bg), CONSOLE_ROW_SIZE);
118#else
119 /*
120 * Poor attempt to optimize speed by moving "long"s.
121 * But the code is ugly, and not a bit faster :-(
122 */
123 ulong *t = (ulong *)CONSOLE_ROW_FIRST;
124 ulong *s = (ulong *)CONSOLE_ROW_SECOND;
125 ulong l = CONSOLE_SCROLL_SIZE / sizeof(ulong);
126 uchar c = lcd_color_bg & 0xFF;
127 ulong val= (c<<24) | (c<<16) | (c<<8) | c;
128
129 while (l--)
130 *t++ = *s++;
131
132 t = (ulong *)CONSOLE_ROW_LAST;
133 l = CONSOLE_ROW_SIZE / sizeof(ulong);
134
135 while (l-- > 0)
136 *t++ = val;
137#endif
138}
139
140/*----------------------------------------------------------------------*/
141
142static inline void console_back (void)
143{
144 if (--console_col < 0) {
145 console_col = CONSOLE_COLS-1 ;
146 if (--console_row < 0) {
147 console_row = 0;
148 }
149 }
150
151 lcd_putc_xy (console_col * VIDEO_FONT_WIDTH,
152 console_row * VIDEO_FONT_HEIGHT,
153 ' ');
154}
155
156/*----------------------------------------------------------------------*/
157
158static inline void console_newline (void)
159{
160 ++console_row;
161 console_col = 0;
162
163 /* Check if we need to scroll the terminal */
164 if (console_row >= CONSOLE_ROWS) {
165 /* Scroll everything up */
166 console_scrollup () ;
167 --console_row;
168 }
169}
170
171/*----------------------------------------------------------------------*/
172
173void lcd_putc (const char c)
174{
175 if (!lcd_is_enabled) {
176 serial_putc(c);
177 return;
178 }
179
180 switch (c) {
181 case '\r': console_col = 0;
182 return;
183
184 case '\n': console_newline();
185 return;
186
187 case '\t': /* Tab (8 chars alignment) */
188 console_col |= 8;
189 console_col &= ~7;
190
191 if (console_col >= CONSOLE_COLS) {
192 console_newline();
193 }
194 return;
195
196 case '\b': console_back();
197 return;
198
199 default: lcd_putc_xy (console_col * VIDEO_FONT_WIDTH,
200 console_row * VIDEO_FONT_HEIGHT,
201 c);
202 if (++console_col >= CONSOLE_COLS) {
203 console_newline();
204 }
205 return;
206 }
207 /* NOTREACHED */
208}
209
210/*----------------------------------------------------------------------*/
211
212void lcd_puts (const char *s)
213{
214 if (!lcd_is_enabled) {
215 serial_puts (s);
216 return;
217 }
218
219 while (*s) {
220 lcd_putc (*s++);
221 }
222}
223
224/************************************************************************/
225/* ** Low-Level Graphics Routines */
226/************************************************************************/
227
228static void lcd_drawchars (ushort x, ushort y, uchar *str, int count)
229{
230 uchar *dest;
231 ushort off, row;
232
233 dest = (uchar *)(lcd_base + y * lcd_line_length + x * (1 << LCD_BPP) / 8);
234 off = x * (1 << LCD_BPP) % 8;
235
236 for (row=0; row < VIDEO_FONT_HEIGHT; ++row, dest += lcd_line_length) {
237 uchar *s = str;
238 uchar *d = dest;
239 int i;
240
241#if LCD_BPP == LCD_MONOCHROME
242 uchar rest = *d & -(1 << (8-off));
243 uchar sym;
244#endif
245 for (i=0; i<count; ++i) {
246 uchar c, bits;
247
248 c = *s++;
249 bits = video_fontdata[c * VIDEO_FONT_HEIGHT + row];
250
251#if LCD_BPP == LCD_MONOCHROME
252 sym = (COLOR_MASK(lcd_color_fg) & bits) |
253 (COLOR_MASK(lcd_color_bg) & ~bits);
254
255 *d++ = rest | (sym >> off);
256 rest = sym << (8-off);
257#elif LCD_BPP == LCD_COLOR8
258 for (c=0; c<8; ++c) {
259 *d++ = (bits & 0x80) ?
260 lcd_color_fg : lcd_color_bg;
261 bits <<= 1;
262 }
263#elif LCD_BPP == LCD_COLOR16
264 for (c=0; c<16; ++c) {
265 *d++ = (bits & 0x80) ?
266 lcd_color_fg : lcd_color_bg;
267 bits <<= 1;
268 }
269#endif
270 }
271#if LCD_BPP == LCD_MONOCHROME
272 *d = rest | (*d & ((1 << (8-off)) - 1));
273#endif
274 }
275}
276
277/*----------------------------------------------------------------------*/
278
279static inline void lcd_puts_xy (ushort x, ushort y, uchar *s)
280{
wdenk88804d12005-07-04 00:03:16 +0000281#if defined(CONFIG_LCD_LOGO) && !defined(CONFIG_LCD_INFO_BELOW_LOGO)
Wolfgang Denk77ddac92005-10-13 16:45:02 +0200282 lcd_drawchars (x, y+BMP_LOGO_HEIGHT, s, strlen ((char *)s));
wdenk8655b6f2004-10-09 23:25:58 +0000283#else
Wolfgang Denk77ddac92005-10-13 16:45:02 +0200284 lcd_drawchars (x, y, s, strlen ((char *)s));
wdenk8655b6f2004-10-09 23:25:58 +0000285#endif
286}
287
288/*----------------------------------------------------------------------*/
289
290static inline void lcd_putc_xy (ushort x, ushort y, uchar c)
291{
wdenk88804d12005-07-04 00:03:16 +0000292#if defined(CONFIG_LCD_LOGO) && !defined(CONFIG_LCD_INFO_BELOW_LOGO)
wdenk8655b6f2004-10-09 23:25:58 +0000293 lcd_drawchars (x, y+BMP_LOGO_HEIGHT, &c, 1);
294#else
295 lcd_drawchars (x, y, &c, 1);
296#endif
297}
298
299/************************************************************************/
300/** Small utility to check that you got the colours right */
301/************************************************************************/
302#ifdef LCD_TEST_PATTERN
303
304#define N_BLK_VERT 2
305#define N_BLK_HOR 3
306
307static int test_colors[N_BLK_HOR*N_BLK_VERT] = {
308 CONSOLE_COLOR_RED, CONSOLE_COLOR_GREEN, CONSOLE_COLOR_YELLOW,
309 CONSOLE_COLOR_BLUE, CONSOLE_COLOR_MAGENTA, CONSOLE_COLOR_CYAN,
310};
311
312static void test_pattern (void)
313{
314 ushort v_max = panel_info.vl_row;
315 ushort h_max = panel_info.vl_col;
316 ushort v_step = (v_max + N_BLK_VERT - 1) / N_BLK_VERT;
317 ushort h_step = (h_max + N_BLK_HOR - 1) / N_BLK_HOR;
318 ushort v, h;
319 uchar *pix = (uchar *)lcd_base;
320
321 printf ("[LCD] Test Pattern: %d x %d [%d x %d]\n",
322 h_max, v_max, h_step, v_step);
323
324 /* WARNING: Code silently assumes 8bit/pixel */
325 for (v=0; v<v_max; ++v) {
326 uchar iy = v / v_step;
327 for (h=0; h<h_max; ++h) {
328 uchar ix = N_BLK_HOR * iy + (h/h_step);
329 *pix++ = test_colors[ix];
330 }
331 }
332}
333#endif /* LCD_TEST_PATTERN */
334
335
336/************************************************************************/
337/* ** GENERIC Initialization Routines */
338/************************************************************************/
339
340int drv_lcd_init (void)
341{
342 DECLARE_GLOBAL_DATA_PTR;
343
344 device_t lcddev;
345 int rc;
346
347 lcd_base = (void *)(gd->fb_base);
348
349 lcd_line_length = (panel_info.vl_col * NBITS (panel_info.vl_bpix)) / 8;
350
351 lcd_init (lcd_base); /* LCD initialization */
352
353 /* Device initialization */
354 memset (&lcddev, 0, sizeof (lcddev));
355
356 strcpy (lcddev.name, "lcd");
357 lcddev.ext = 0; /* No extensions */
358 lcddev.flags = DEV_FLAGS_OUTPUT; /* Output only */
359 lcddev.putc = lcd_putc; /* 'putc' function */
360 lcddev.puts = lcd_puts; /* 'puts' function */
361
362 rc = device_register (&lcddev);
363
364 return (rc == 0) ? 1 : rc;
365}
366
367/*----------------------------------------------------------------------*/
368static int lcd_clear (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
369{
370#if LCD_BPP == LCD_MONOCHROME
371 /* Setting the palette */
372 lcd_initcolregs();
373
374#elif LCD_BPP == LCD_COLOR8
375 /* Setting the palette */
376 lcd_setcolreg (CONSOLE_COLOR_BLACK, 0, 0, 0);
377 lcd_setcolreg (CONSOLE_COLOR_RED, 0xFF, 0, 0);
378 lcd_setcolreg (CONSOLE_COLOR_GREEN, 0, 0xFF, 0);
379 lcd_setcolreg (CONSOLE_COLOR_YELLOW, 0xFF, 0xFF, 0);
380 lcd_setcolreg (CONSOLE_COLOR_BLUE, 0, 0, 0xFF);
381 lcd_setcolreg (CONSOLE_COLOR_MAGENTA, 0xFF, 0, 0xFF);
382 lcd_setcolreg (CONSOLE_COLOR_CYAN, 0, 0xFF, 0xFF);
383 lcd_setcolreg (CONSOLE_COLOR_GREY, 0xAA, 0xAA, 0xAA);
384 lcd_setcolreg (CONSOLE_COLOR_WHITE, 0xFF, 0xFF, 0xFF);
385#endif
386
387#ifndef CFG_WHITE_ON_BLACK
388 lcd_setfgcolor (CONSOLE_COLOR_BLACK);
389 lcd_setbgcolor (CONSOLE_COLOR_WHITE);
390#else
391 lcd_setfgcolor (CONSOLE_COLOR_WHITE);
392 lcd_setbgcolor (CONSOLE_COLOR_BLACK);
393#endif /* CFG_WHITE_ON_BLACK */
394
395#ifdef LCD_TEST_PATTERN
396 test_pattern();
397#else
398 /* set framebuffer to background color */
399 memset ((char *)lcd_base,
400 COLOR_MASK(lcd_getbgcolor()),
401 lcd_line_length*panel_info.vl_row);
402#endif
403 /* Paint the logo and retrieve LCD base address */
404 debug ("[LCD] Drawing the logo...\n");
405 lcd_console_address = lcd_logo ();
406
407 console_col = 0;
408 console_row = 0;
409
410 return (0);
411}
412
413U_BOOT_CMD(
414 cls, 1, 1, lcd_clear,
415 "cls - clear screen\n",
416 NULL
417);
418
419/*----------------------------------------------------------------------*/
420
421static int lcd_init (void *lcdbase)
422{
423 /* Initialize the lcd controller */
424 debug ("[LCD] Initializing LCD frambuffer at %p\n", lcdbase);
425
426 lcd_ctrl_init (lcdbase);
427 lcd_clear (NULL, 1, 1, NULL); /* dummy args */
428 lcd_enable ();
429
430 /* Initialize the console */
431 console_col = 0;
wdenk88804d12005-07-04 00:03:16 +0000432#ifdef CONFIG_LCD_INFO_BELOW_LOGO
wdenk8655b6f2004-10-09 23:25:58 +0000433 console_row = 7 + BMP_LOGO_HEIGHT / VIDEO_FONT_HEIGHT;
434#else
435 console_row = 1; /* leave 1 blank line below logo */
436#endif
437 lcd_is_enabled = 1;
438
439 return 0;
440}
441
442
443/************************************************************************/
444/* ** ROM capable initialization part - needed to reserve FB memory */
445/************************************************************************/
446/*
447 * This is called early in the system initialization to grab memory
448 * for the LCD controller.
449 * Returns new address for monitor, after reserving LCD buffer memory
450 *
451 * Note that this is running from ROM, so no write access to global data.
452 */
453ulong lcd_setmem (ulong addr)
454{
455 ulong size;
456 int line_length = (panel_info.vl_col * NBITS (panel_info.vl_bpix)) / 8;
457
458 debug ("LCD panel info: %d x %d, %d bit/pix\n",
459 panel_info.vl_col, panel_info.vl_row, NBITS (panel_info.vl_bpix) );
460
461 size = line_length * panel_info.vl_row;
462
463 /* Round up to nearest full page */
464 size = (size + (PAGE_SIZE - 1)) & ~(PAGE_SIZE - 1);
465
466 /* Allocate pages for the frame buffer. */
467 addr -= size;
468
469 debug ("Reserving %ldk for LCD Framebuffer at: %08lx\n", size>>10, addr);
470
471 return (addr);
472}
473
474/*----------------------------------------------------------------------*/
475
476static void lcd_setfgcolor (int color)
477{
478 lcd_color_fg = color & 0x0F;
479}
480
481/*----------------------------------------------------------------------*/
482
483static void lcd_setbgcolor (int color)
484{
485 lcd_color_bg = color & 0x0F;
486}
487
488/*----------------------------------------------------------------------*/
489
490#ifdef NOT_USED_SO_FAR
491static int lcd_getfgcolor (void)
492{
493 return lcd_color_fg;
494}
495#endif /* NOT_USED_SO_FAR */
496
497/*----------------------------------------------------------------------*/
498
499static int lcd_getbgcolor (void)
500{
501 return lcd_color_bg;
502}
503
504/*----------------------------------------------------------------------*/
505
506/************************************************************************/
507/* ** Chipset depending Bitmap / Logo stuff... */
508/************************************************************************/
509#ifdef CONFIG_LCD_LOGO
510void bitmap_plot (int x, int y)
511{
512 ushort *cmap;
513 ushort i, j;
514 uchar *bmap;
515 uchar *fb;
516 ushort *fb16;
517#if defined(CONFIG_PXA250)
518 struct pxafb_info *fbi = &panel_info.pxa;
519#elif defined(CONFIG_MPC823)
520 volatile immap_t *immr = (immap_t *) CFG_IMMR;
521 volatile cpm8xx_t *cp = &(immr->im_cpm);
522#endif
523
524 debug ("Logo: width %d height %d colors %d cmap %d\n",
525 BMP_LOGO_WIDTH, BMP_LOGO_HEIGHT, BMP_LOGO_COLORS,
526 sizeof(bmp_logo_palette)/(sizeof(ushort)));
527
528 bmap = &bmp_logo_bitmap[0];
Wolfgang Denk77ddac92005-10-13 16:45:02 +0200529 fb = (uchar *)(lcd_base + y * lcd_line_length + x);
wdenk8655b6f2004-10-09 23:25:58 +0000530
531 if (NBITS(panel_info.vl_bpix) < 12) {
532 /* Leave room for default color map */
533#if defined(CONFIG_PXA250)
534 cmap = (ushort *)fbi->palette;
535#elif defined(CONFIG_MPC823)
536 cmap = (ushort *)&(cp->lcd_cmap[BMP_LOGO_OFFSET*sizeof(ushort)]);
537#endif
538
539 WATCHDOG_RESET();
540
541 /* Set color map */
542 for (i=0; i<(sizeof(bmp_logo_palette)/(sizeof(ushort))); ++i) {
543 ushort colreg = bmp_logo_palette[i];
544#ifdef CFG_INVERT_COLORS
545 *cmap++ = 0xffff - colreg;
546#else
547 *cmap++ = colreg;
548#endif
549 }
550
551 WATCHDOG_RESET();
552
553 for (i=0; i<BMP_LOGO_HEIGHT; ++i) {
554 memcpy (fb, bmap, BMP_LOGO_WIDTH);
555 bmap += BMP_LOGO_WIDTH;
556 fb += panel_info.vl_col;
557 }
558 }
559 else { /* true color mode */
560 fb16 = (ushort *)(lcd_base + y * lcd_line_length + x);
561 for (i=0; i<BMP_LOGO_HEIGHT; ++i) {
562 for (j=0; j<BMP_LOGO_WIDTH; j++) {
563 fb16[j] = bmp_logo_palette[(bmap[j])];
564 }
565 bmap += BMP_LOGO_WIDTH;
566 fb16 += panel_info.vl_col;
567 }
568 }
569
570 WATCHDOG_RESET();
571}
572#endif /* CONFIG_LCD_LOGO */
573
574/*----------------------------------------------------------------------*/
575#if (CONFIG_COMMANDS & CFG_CMD_BMP) || defined(CONFIG_SPLASH_SCREEN)
576/*
577 * Display the BMP file located at address bmp_image.
578 * Only uncompressed.
579 */
580int lcd_display_bitmap(ulong bmp_image, int x, int y)
581{
582 ushort *cmap;
583 ushort i, j;
584 uchar *fb;
585 bmp_image_t *bmp=(bmp_image_t *)bmp_image;
586 uchar *bmap;
587 ushort padded_line;
588 unsigned long width, height;
589 unsigned colors,bpix;
590 unsigned long compression;
591#if defined(CONFIG_PXA250)
592 struct pxafb_info *fbi = &panel_info.pxa;
593#elif defined(CONFIG_MPC823)
594 volatile immap_t *immr = (immap_t *) CFG_IMMR;
595 volatile cpm8xx_t *cp = &(immr->im_cpm);
596#endif
597
598 if (!((bmp->header.signature[0]=='B') &&
599 (bmp->header.signature[1]=='M'))) {
600 printf ("Error: no valid bmp image at %lx\n", bmp_image);
601 return 1;
602}
603
604 width = le32_to_cpu (bmp->header.width);
605 height = le32_to_cpu (bmp->header.height);
606 colors = 1<<le16_to_cpu (bmp->header.bit_count);
607 compression = le32_to_cpu (bmp->header.compression);
608
609 bpix = NBITS(panel_info.vl_bpix);
610
611 if ((bpix != 1) && (bpix != 8)) {
612 printf ("Error: %d bit/pixel mode not supported by U-Boot\n",
613 bpix);
614 return 1;
615 }
616
617 if (bpix != le16_to_cpu(bmp->header.bit_count)) {
618 printf ("Error: %d bit/pixel mode, but BMP has %d bit/pixel\n",
619 bpix,
620 le16_to_cpu(bmp->header.bit_count));
621 return 1;
622 }
623
624 debug ("Display-bmp: %d x %d with %d colors\n",
625 (int)width, (int)height, (int)colors);
626
627 if (bpix==8) {
628#if defined(CONFIG_PXA250)
629 cmap = (ushort *)fbi->palette;
630#elif defined(CONFIG_MPC823)
631 cmap = (ushort *)&(cp->lcd_cmap[255*sizeof(ushort)]);
wdenk25d67122004-12-10 11:40:40 +0000632#else
633# error "Don't know location of color map"
wdenk8655b6f2004-10-09 23:25:58 +0000634#endif
635
636 /* Set color map */
637 for (i=0; i<colors; ++i) {
638 bmp_color_table_entry_t cte = bmp->color_table[i];
639 ushort colreg =
640 ( ((cte.red) << 8) & 0xf800) |
Wolfgang Denk59d80bf2005-09-21 15:24:52 +0200641 ( ((cte.green) << 3) & 0x07e0) |
642 ( ((cte.blue) >> 3) & 0x001f) ;
wdenk8655b6f2004-10-09 23:25:58 +0000643#ifdef CFG_INVERT_COLORS
wdenk25d67122004-12-10 11:40:40 +0000644 *cmap = 0xffff - colreg;
wdenk8655b6f2004-10-09 23:25:58 +0000645#else
wdenk25d67122004-12-10 11:40:40 +0000646 *cmap = colreg;
647#endif
648#if defined(CONFIG_PXA250)
649 cmap++;
650#elif defined(CONFIG_MPC823)
651 cmap--;
wdenk8655b6f2004-10-09 23:25:58 +0000652#endif
653 }
654 }
655
656 padded_line = (width&0x3) ? ((width&~0x3)+4) : (width);
657 if ((x + width)>panel_info.vl_col)
658 width = panel_info.vl_col - x;
659 if ((y + height)>panel_info.vl_row)
660 height = panel_info.vl_row - y;
661
662 bmap = (uchar *)bmp + le32_to_cpu (bmp->header.data_offset);
663 fb = (uchar *) (lcd_base +
664 (y + height - 1) * lcd_line_length + x);
665 for (i = 0; i < height; ++i) {
wdenk51152c12005-06-05 20:30:43 +0000666 WATCHDOG_RESET();
wdenk8655b6f2004-10-09 23:25:58 +0000667 for (j = 0; j < width ; j++)
668#if defined(CONFIG_PXA250)
669 *(fb++)=*(bmap++);
670#elif defined(CONFIG_MPC823)
671 *(fb++)=255-*(bmap++);
672#endif
673 bmap += (width - padded_line);
674 fb -= (width + lcd_line_length);
675 }
676
677 return (0);
678}
679#endif /* (CONFIG_COMMANDS & CFG_CMD_BMP) || CONFIG_SPLASH_SCREEN */
680
681
682static void *lcd_logo (void)
683{
wdenk88804d12005-07-04 00:03:16 +0000684#ifdef CONFIG_LCD_INFO
wdenk8655b6f2004-10-09 23:25:58 +0000685 DECLARE_GLOBAL_DATA_PTR;
686
687 char info[80];
688 char temp[32];
wdenk88804d12005-07-04 00:03:16 +0000689#endif /* CONFIG_LCD_INFO */
wdenk8655b6f2004-10-09 23:25:58 +0000690
691#ifdef CONFIG_SPLASH_SCREEN
692 char *s;
693 ulong addr;
694 static int do_splash = 1;
695
696 if (do_splash && (s = getenv("splashimage")) != NULL) {
697 addr = simple_strtoul(s, NULL, 16);
698 do_splash = 0;
699
700 if (lcd_display_bitmap (addr, 0, 0) == 0) {
701 return ((void *)lcd_base);
702 }
703 }
704#endif /* CONFIG_SPLASH_SCREEN */
705
706#ifdef CONFIG_LCD_LOGO
707 bitmap_plot (0, 0);
708#endif /* CONFIG_LCD_LOGO */
709
710#ifdef CONFIG_MPC823
wdenk88804d12005-07-04 00:03:16 +0000711# ifdef CONFIG_LCD_INFO
wdenk8655b6f2004-10-09 23:25:58 +0000712 sprintf (info, "%s (%s - %s) ", U_BOOT_VERSION, __DATE__, __TIME__);
Wolfgang Denk77ddac92005-10-13 16:45:02 +0200713 lcd_drawchars (LCD_INFO_X, LCD_INFO_Y, (uchar *)info, strlen(info));
wdenk8655b6f2004-10-09 23:25:58 +0000714
715 sprintf (info, "(C) 2004 DENX Software Engineering");
716 lcd_drawchars (LCD_INFO_X, LCD_INFO_Y + VIDEO_FONT_HEIGHT,
Wolfgang Denk77ddac92005-10-13 16:45:02 +0200717 (uchar *)info, strlen(info));
wdenk8655b6f2004-10-09 23:25:58 +0000718
719 sprintf (info, " Wolfgang DENK, wd@denx.de");
720 lcd_drawchars (LCD_INFO_X, LCD_INFO_Y + VIDEO_FONT_HEIGHT * 2,
Wolfgang Denk77ddac92005-10-13 16:45:02 +0200721 (uchar *)info, strlen(info));
wdenk88804d12005-07-04 00:03:16 +0000722# ifdef CONFIG_LCD_INFO_BELOW_LOGO
wdenk8655b6f2004-10-09 23:25:58 +0000723 sprintf (info, "MPC823 CPU at %s MHz",
724 strmhz(temp, gd->cpu_clk));
725 lcd_drawchars (LCD_INFO_X, LCD_INFO_Y + VIDEO_FONT_HEIGHT * 3,
726 info, strlen(info));
727 sprintf (info, " %ld MB RAM, %ld MB Flash",
728 gd->ram_size >> 20,
729 gd->bd->bi_flashsize >> 20 );
730 lcd_drawchars (LCD_INFO_X, LCD_INFO_Y + VIDEO_FONT_HEIGHT * 4,
731 info, strlen(info));
wdenk88804d12005-07-04 00:03:16 +0000732# else
wdenk8655b6f2004-10-09 23:25:58 +0000733 /* leave one blank line */
734
735 sprintf (info, "MPC823 CPU at %s MHz, %ld MB RAM, %ld MB Flash",
736 strmhz(temp, gd->cpu_clk),
737 gd->ram_size >> 20,
738 gd->bd->bi_flashsize >> 20 );
739 lcd_drawchars (LCD_INFO_X, LCD_INFO_Y + VIDEO_FONT_HEIGHT * 4,
Wolfgang Denk77ddac92005-10-13 16:45:02 +0200740 (uchar *)info, strlen(info));
wdenk8655b6f2004-10-09 23:25:58 +0000741
wdenk88804d12005-07-04 00:03:16 +0000742# endif /* CONFIG_LCD_INFO_BELOW_LOGO */
743# endif /* CONFIG_LCD_INFO */
wdenk8655b6f2004-10-09 23:25:58 +0000744#endif /* CONFIG_MPC823 */
wdenk8655b6f2004-10-09 23:25:58 +0000745
wdenk88804d12005-07-04 00:03:16 +0000746#if defined(CONFIG_LCD_LOGO) && !defined(CONFIG_LCD_INFO_BELOW_LOGO)
wdenk8655b6f2004-10-09 23:25:58 +0000747 return ((void *)((ulong)lcd_base + BMP_LOGO_HEIGHT * lcd_line_length));
748#else
749 return ((void *)lcd_base);
wdenk88804d12005-07-04 00:03:16 +0000750#endif /* CONFIG_LCD_LOGO && !CONFIG_LCD_INFO_BELOW_LOGO */
wdenk8655b6f2004-10-09 23:25:58 +0000751}
752
753/************************************************************************/
754/************************************************************************/
755
756#endif /* CONFIG_LCD */