2 * (C) Copyright 2002 ELTEC Elektronik AG
3 * Frank Gottschling <fgottschling@eltec.de>
5 * See file CREDITS for list of people who contributed to this
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
27 * Color Framebuffer Console driver for 8/15/16/24/32 bits per pixel.
29 * At the moment only the 8x16 font is tested and the font fore- and
30 * background color is limited to black/white/gray colors. The Linux
31 * logo can be placed in the upper left corner and additional board
32 * information strings (that normally goes to serial port) can be drawn.
34 * The console driver can use the standard PC keyboard interface (i8042)
35 * for character input. Character output goes to a memory mapped video
36 * framebuffer with little or big-endian organisation.
37 * With environment setting 'console=serial' the console i/o can be
38 * forced to serial port.
40 * The driver uses graphic specific defines/parameters/functions:
42 * (for SMI LynxE graphic chip)
44 * CONFIG_VIDEO_SMI_LYNXEM - use graphic driver for SMI 710,712,810
45 * VIDEO_FB_LITTLE_ENDIAN - framebuffer organisation default: big endian
46 * VIDEO_HW_RECTFILL - graphic driver supports hardware rectangle fill
47 * VIDEO_HW_BITBLT - graphic driver supports hardware bit blt
49 * Console Parameters are set by graphic drivers global struct:
51 * VIDEO_VISIBLE_COLS - x resolution
52 * VIDEO_VISIBLE_ROWS - y resolution
53 * VIDEO_PIXEL_SIZE - storage size in byte per pixel
54 * VIDEO_DATA_FORMAT - graphical data format GDF
55 * VIDEO_FB_ADRS - start of video memory
57 * CONFIG_I8042_KBD - AT Keyboard driver for i8042
58 * VIDEO_KBD_INIT_FCT - init function for keyboard
59 * VIDEO_TSTC_FCT - keyboard_tstc function
60 * VIDEO_GETC_FCT - keyboard_getc function
62 * CONFIG_CONSOLE_CURSOR - on/off drawing cursor is done with
63 * delay loop in VIDEO_TSTC_FCT (i8042)
65 * CONFIG_SYS_CONSOLE_BLINK_COUNT - value for delay loop - blink rate
66 * CONFIG_CONSOLE_TIME - display time/date in upper right
67 * corner, needs CONFIG_CMD_DATE and
68 * CONFIG_CONSOLE_CURSOR
69 * CONFIG_VIDEO_LOGO - display Linux Logo in upper left corner
70 * CONFIG_VIDEO_BMP_LOGO - use bmp_logo instead of linux_logo
71 * CONFIG_CONSOLE_EXTRA_INFO - display additional board information
72 * strings that normaly goes to serial
73 * port. This define requires a board
75 * video_drawstring (VIDEO_INFO_X,
76 * VIDEO_INFO_Y + i*VIDEO_FONT_HEIGHT,
78 * that fills a info buffer at i=row.
79 * s.a: board/eltec/bab7xx.
80 * CONFIG_VGA_AS_SINGLE_DEVICE - If set the framebuffer device will be
81 * initialized as an output only device.
82 * The Keyboard driver will not be
83 * set-up. This may be used, if you have
84 * no or more than one Keyboard devices
85 * (USB Keyboard, AT Keyboard).
87 * CONFIG_VIDEO_SW_CURSOR: - Draws a cursor after the last
88 * character. No blinking is provided.
89 * Uses the macros CURSOR_SET and
92 * CONFIG_VIDEO_HW_CURSOR: - Uses the hardware cursor capability
93 * of the graphic chip. Uses the macro
94 * CURSOR_SET. ATTENTION: If booting an
95 * OS, the display driver must disable
96 * the hardware register of the graphic
97 * chip. Otherwise a blinking field is
104 #include <linux/compiler.h>
107 * Console device defines with SMI graphic
108 * Any other graphic must change this section
111 #ifdef CONFIG_VIDEO_SMI_LYNXEM
113 #define VIDEO_FB_LITTLE_ENDIAN
114 #define VIDEO_HW_RECTFILL
115 #define VIDEO_HW_BITBLT
119 * Defines for the CT69000 driver
121 #ifdef CONFIG_VIDEO_CT69000
123 #define VIDEO_FB_LITTLE_ENDIAN
124 #define VIDEO_HW_RECTFILL
125 #define VIDEO_HW_BITBLT
129 * Defines for the SED13806 driver
131 #ifdef CONFIG_VIDEO_SED13806
133 #ifndef CONFIG_TOTAL5200
134 #define VIDEO_FB_LITTLE_ENDIAN
136 #define VIDEO_HW_RECTFILL
137 #define VIDEO_HW_BITBLT
141 * Defines for the SED13806 driver
143 #ifdef CONFIG_VIDEO_SM501
146 #define VIDEO_FB_LITTLE_ENDIAN
151 * Defines for the MB862xx driver
153 #ifdef CONFIG_VIDEO_MB862xx
155 #ifdef CONFIG_VIDEO_CORALP
156 #define VIDEO_FB_LITTLE_ENDIAN
158 #ifdef CONFIG_VIDEO_MB862xx_ACCEL
159 #define VIDEO_HW_RECTFILL
160 #define VIDEO_HW_BITBLT
165 * Defines for the i.MX31 driver (mx3fb.c)
167 #if defined(CONFIG_VIDEO_MX3) || defined(CONFIG_VIDEO_MX5)
168 #define VIDEO_FB_16BPP_WORD_SWAP
172 * Include video_fb.h after definitions of VIDEO_HW_RECTFILL etc.
174 #include <video_fb.h>
179 #define VIDEO_VISIBLE_COLS (pGD->winSizeX)
180 #define VIDEO_VISIBLE_ROWS (pGD->winSizeY)
181 #define VIDEO_PIXEL_SIZE (pGD->gdfBytesPP)
182 #define VIDEO_DATA_FORMAT (pGD->gdfIndex)
183 #define VIDEO_FB_ADRS (pGD->frameAdrs)
186 * Console device defines with i8042 keyboard controller
187 * Any other keyboard controller must change this section
190 #ifdef CONFIG_I8042_KBD
193 #define VIDEO_KBD_INIT_FCT i8042_kbd_init()
194 #define VIDEO_TSTC_FCT i8042_tstc
195 #define VIDEO_GETC_FCT i8042_getc
203 #include <linux/types.h>
204 #include <stdio_dev.h>
205 #include <video_font.h>
206 #include <video_font_data.h>
208 #if defined(CONFIG_CMD_DATE)
212 #if defined(CONFIG_CMD_BMP) || defined(CONFIG_SPLASH_SCREEN)
213 #include <watchdog.h>
214 #include <bmp_layout.h>
216 #ifdef CONFIG_SPLASH_SCREEN_ALIGN
217 #define BMP_ALIGN_CENTER 0x7FFF
224 * CONFIG_CONSOLE_CURSOR: Uses a timer function (see drivers/input/i8042.c)
225 * to let the cursor blink. Uses the macros
226 * CURSOR_OFF and CURSOR_ON.
227 * CONFIG_VIDEO_SW_CURSOR: Draws a cursor after the last character. No
228 * blinking is provided. Uses the macros CURSOR_SET
230 * CONFIG_VIDEO_HW_CURSOR: Uses the hardware cursor capability of the
231 * graphic chip. Uses the macro CURSOR_SET.
232 * ATTENTION: If booting an OS, the display driver
233 * must disable the hardware register of the graphic
234 * chip. Otherwise a blinking field is displayed
236 #if !defined(CONFIG_CONSOLE_CURSOR) && \
237 !defined(CONFIG_VIDEO_SW_CURSOR) && \
238 !defined(CONFIG_VIDEO_HW_CURSOR)
239 /* no Cursor defined */
245 #if defined(CONFIG_CONSOLE_CURSOR) || defined(CONFIG_VIDEO_SW_CURSOR)
246 #if defined(CURSOR_ON) || \
247 (defined(CONFIG_CONSOLE_CURSOR) && defined(CONFIG_VIDEO_SW_CURSOR))
248 #error only one of CONFIG_CONSOLE_CURSOR, CONFIG_VIDEO_SW_CURSOR, \
249 or CONFIG_VIDEO_HW_CURSOR can be defined
251 void console_cursor(int state);
253 #define CURSOR_ON console_cursor(1)
254 #define CURSOR_OFF console_cursor(0)
255 #define CURSOR_SET video_set_cursor()
256 #endif /* CONFIG_CONSOLE_CURSOR || CONFIG_VIDEO_SW_CURSOR */
258 #ifdef CONFIG_CONSOLE_CURSOR
259 #ifndef CONFIG_CONSOLE_TIME
260 #error CONFIG_CONSOLE_CURSOR must be defined for CONFIG_CONSOLE_TIME
262 #ifndef CONFIG_I8042_KBD
263 #warning Cursor drawing on/off needs timer function s.a. drivers/input/i8042.c
265 #endif /* CONFIG_CONSOLE_CURSOR */
268 #ifdef CONFIG_VIDEO_HW_CURSOR
270 #error only one of CONFIG_CONSOLE_CURSOR, CONFIG_VIDEO_SW_CURSOR, \
271 or CONFIG_VIDEO_HW_CURSOR can be defined
275 #define CURSOR_SET video_set_hw_cursor(console_col * VIDEO_FONT_WIDTH, \
276 (console_row * VIDEO_FONT_HEIGHT) + video_logo_height)
277 #endif /* CONFIG_VIDEO_HW_CURSOR */
279 #ifdef CONFIG_VIDEO_LOGO
280 #ifdef CONFIG_VIDEO_BMP_LOGO
281 #include <bmp_logo.h>
282 #include <bmp_logo_data.h>
283 #define VIDEO_LOGO_WIDTH BMP_LOGO_WIDTH
284 #define VIDEO_LOGO_HEIGHT BMP_LOGO_HEIGHT
285 #define VIDEO_LOGO_LUT_OFFSET BMP_LOGO_OFFSET
286 #define VIDEO_LOGO_COLORS BMP_LOGO_COLORS
288 #else /* CONFIG_VIDEO_BMP_LOGO */
289 #define LINUX_LOGO_WIDTH 80
290 #define LINUX_LOGO_HEIGHT 80
291 #define LINUX_LOGO_COLORS 214
292 #define LINUX_LOGO_LUT_OFFSET 0x20
294 #include <linux_logo.h>
295 #define VIDEO_LOGO_WIDTH LINUX_LOGO_WIDTH
296 #define VIDEO_LOGO_HEIGHT LINUX_LOGO_HEIGHT
297 #define VIDEO_LOGO_LUT_OFFSET LINUX_LOGO_LUT_OFFSET
298 #define VIDEO_LOGO_COLORS LINUX_LOGO_COLORS
299 #endif /* CONFIG_VIDEO_BMP_LOGO */
300 #define VIDEO_INFO_X (VIDEO_LOGO_WIDTH)
301 #define VIDEO_INFO_Y (VIDEO_FONT_HEIGHT/2)
302 #else /* CONFIG_VIDEO_LOGO */
303 #define VIDEO_LOGO_WIDTH 0
304 #define VIDEO_LOGO_HEIGHT 0
305 #endif /* CONFIG_VIDEO_LOGO */
307 #define VIDEO_COLS VIDEO_VISIBLE_COLS
308 #define VIDEO_ROWS VIDEO_VISIBLE_ROWS
309 #define VIDEO_SIZE (VIDEO_ROWS*VIDEO_COLS*VIDEO_PIXEL_SIZE)
310 #define VIDEO_PIX_BLOCKS (VIDEO_SIZE >> 2)
311 #define VIDEO_LINE_LEN (VIDEO_COLS*VIDEO_PIXEL_SIZE)
312 #define VIDEO_BURST_LEN (VIDEO_COLS/8)
314 #ifdef CONFIG_VIDEO_LOGO
315 #define CONSOLE_ROWS ((VIDEO_ROWS - video_logo_height) / VIDEO_FONT_HEIGHT)
317 #define CONSOLE_ROWS (VIDEO_ROWS / VIDEO_FONT_HEIGHT)
320 #define CONSOLE_COLS (VIDEO_COLS / VIDEO_FONT_WIDTH)
321 #define CONSOLE_ROW_SIZE (VIDEO_FONT_HEIGHT * VIDEO_LINE_LEN)
322 #define CONSOLE_ROW_FIRST (video_console_address)
323 #define CONSOLE_ROW_SECOND (video_console_address + CONSOLE_ROW_SIZE)
324 #define CONSOLE_ROW_LAST (video_console_address + CONSOLE_SIZE - CONSOLE_ROW_SIZE)
325 #define CONSOLE_SIZE (CONSOLE_ROW_SIZE * CONSOLE_ROWS)
326 #define CONSOLE_SCROLL_SIZE (CONSOLE_SIZE - CONSOLE_ROW_SIZE)
329 #ifdef VIDEO_FB_LITTLE_ENDIAN
330 #define SWAP16(x) ((((x) & 0x00ff) << 8) | \
333 #define SWAP32(x) ((((x) & 0x000000ff) << 24) | \
334 (((x) & 0x0000ff00) << 8) | \
335 (((x) & 0x00ff0000) >> 8) | \
336 (((x) & 0xff000000) >> 24) \
338 #define SHORTSWAP32(x) ((((x) & 0x000000ff) << 8) | \
339 (((x) & 0x0000ff00) >> 8) | \
340 (((x) & 0x00ff0000) << 8) | \
341 (((x) & 0xff000000) >> 8) \
344 #define SWAP16(x) (x)
345 #define SWAP32(x) (x)
346 #if defined(VIDEO_FB_16BPP_WORD_SWAP)
347 #define SHORTSWAP32(x) (((x) >> 16) | ((x) << 16))
349 #define SHORTSWAP32(x) (x)
353 #ifdef CONFIG_CONSOLE_EXTRA_INFO
355 * setup a board string: type, speed, etc.
357 * line_number: location to place info string beside logo
358 * info: buffer for info string
360 extern void video_get_info_str(int line_number, char *info);
364 static GraphicDevice *pGD; /* Pointer to Graphic array */
366 static void *video_fb_address; /* frame buffer address */
367 static void *video_console_address; /* console buffer start address */
369 static int video_logo_height = VIDEO_LOGO_HEIGHT;
371 static int __maybe_unused cursor_state;
372 static int __maybe_unused old_col;
373 static int __maybe_unused old_row;
375 static int console_col; /* cursor col */
376 static int console_row; /* cursor row */
378 static u32 eorx, fgx, bgx; /* color pats */
380 static const int video_font_draw_table8[] = {
381 0x00000000, 0x000000ff, 0x0000ff00, 0x0000ffff,
382 0x00ff0000, 0x00ff00ff, 0x00ffff00, 0x00ffffff,
383 0xff000000, 0xff0000ff, 0xff00ff00, 0xff00ffff,
384 0xffff0000, 0xffff00ff, 0xffffff00, 0xffffffff
387 static const int video_font_draw_table15[] = {
388 0x00000000, 0x00007fff, 0x7fff0000, 0x7fff7fff
391 static const int video_font_draw_table16[] = {
392 0x00000000, 0x0000ffff, 0xffff0000, 0xffffffff
395 static const int video_font_draw_table24[16][3] = {
396 {0x00000000, 0x00000000, 0x00000000},
397 {0x00000000, 0x00000000, 0x00ffffff},
398 {0x00000000, 0x0000ffff, 0xff000000},
399 {0x00000000, 0x0000ffff, 0xffffffff},
400 {0x000000ff, 0xffff0000, 0x00000000},
401 {0x000000ff, 0xffff0000, 0x00ffffff},
402 {0x000000ff, 0xffffffff, 0xff000000},
403 {0x000000ff, 0xffffffff, 0xffffffff},
404 {0xffffff00, 0x00000000, 0x00000000},
405 {0xffffff00, 0x00000000, 0x00ffffff},
406 {0xffffff00, 0x0000ffff, 0xff000000},
407 {0xffffff00, 0x0000ffff, 0xffffffff},
408 {0xffffffff, 0xffff0000, 0x00000000},
409 {0xffffffff, 0xffff0000, 0x00ffffff},
410 {0xffffffff, 0xffffffff, 0xff000000},
411 {0xffffffff, 0xffffffff, 0xffffffff}
414 static const int video_font_draw_table32[16][4] = {
415 {0x00000000, 0x00000000, 0x00000000, 0x00000000},
416 {0x00000000, 0x00000000, 0x00000000, 0x00ffffff},
417 {0x00000000, 0x00000000, 0x00ffffff, 0x00000000},
418 {0x00000000, 0x00000000, 0x00ffffff, 0x00ffffff},
419 {0x00000000, 0x00ffffff, 0x00000000, 0x00000000},
420 {0x00000000, 0x00ffffff, 0x00000000, 0x00ffffff},
421 {0x00000000, 0x00ffffff, 0x00ffffff, 0x00000000},
422 {0x00000000, 0x00ffffff, 0x00ffffff, 0x00ffffff},
423 {0x00ffffff, 0x00000000, 0x00000000, 0x00000000},
424 {0x00ffffff, 0x00000000, 0x00000000, 0x00ffffff},
425 {0x00ffffff, 0x00000000, 0x00ffffff, 0x00000000},
426 {0x00ffffff, 0x00000000, 0x00ffffff, 0x00ffffff},
427 {0x00ffffff, 0x00ffffff, 0x00000000, 0x00000000},
428 {0x00ffffff, 0x00ffffff, 0x00000000, 0x00ffffff},
429 {0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00000000},
430 {0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff}
433 static void video_drawchars(int xx, int yy, unsigned char *s, int count)
435 u8 *cdat, *dest, *dest0;
438 offset = yy * VIDEO_LINE_LEN + xx * VIDEO_PIXEL_SIZE;
439 dest0 = video_fb_address + offset;
441 switch (VIDEO_DATA_FORMAT) {
442 case GDF__8BIT_INDEX:
443 case GDF__8BIT_332RGB:
446 cdat = video_fontdata + c * VIDEO_FONT_HEIGHT;
447 for (rows = VIDEO_FONT_HEIGHT, dest = dest0;
448 rows--; dest += VIDEO_LINE_LEN) {
452 (video_font_draw_table8[bits >> 4] &
455 (video_font_draw_table8[bits & 15] &
458 dest0 += VIDEO_FONT_WIDTH * VIDEO_PIXEL_SIZE;
463 case GDF_15BIT_555RGB:
466 cdat = video_fontdata + c * VIDEO_FONT_HEIGHT;
467 for (rows = VIDEO_FONT_HEIGHT, dest = dest0;
468 rows--; dest += VIDEO_LINE_LEN) {
472 SHORTSWAP32((video_font_draw_table15
473 [bits >> 6] & eorx) ^
476 SHORTSWAP32((video_font_draw_table15
477 [bits >> 4 & 3] & eorx) ^
480 SHORTSWAP32((video_font_draw_table15
481 [bits >> 2 & 3] & eorx) ^
484 SHORTSWAP32((video_font_draw_table15
488 dest0 += VIDEO_FONT_WIDTH * VIDEO_PIXEL_SIZE;
493 case GDF_16BIT_565RGB:
496 cdat = video_fontdata + c * VIDEO_FONT_HEIGHT;
497 for (rows = VIDEO_FONT_HEIGHT, dest = dest0;
498 rows--; dest += VIDEO_LINE_LEN) {
502 SHORTSWAP32((video_font_draw_table16
503 [bits >> 6] & eorx) ^
506 SHORTSWAP32((video_font_draw_table16
507 [bits >> 4 & 3] & eorx) ^
510 SHORTSWAP32((video_font_draw_table16
511 [bits >> 2 & 3] & eorx) ^
514 SHORTSWAP32((video_font_draw_table16
518 dest0 += VIDEO_FONT_WIDTH * VIDEO_PIXEL_SIZE;
523 case GDF_32BIT_X888RGB:
526 cdat = video_fontdata + c * VIDEO_FONT_HEIGHT;
527 for (rows = VIDEO_FONT_HEIGHT, dest = dest0;
528 rows--; dest += VIDEO_LINE_LEN) {
532 SWAP32((video_font_draw_table32
533 [bits >> 4][0] & eorx) ^ bgx);
535 SWAP32((video_font_draw_table32
536 [bits >> 4][1] & eorx) ^ bgx);
538 SWAP32((video_font_draw_table32
539 [bits >> 4][2] & eorx) ^ bgx);
541 SWAP32((video_font_draw_table32
542 [bits >> 4][3] & eorx) ^ bgx);
544 SWAP32((video_font_draw_table32
545 [bits & 15][0] & eorx) ^ bgx);
547 SWAP32((video_font_draw_table32
548 [bits & 15][1] & eorx) ^ bgx);
550 SWAP32((video_font_draw_table32
551 [bits & 15][2] & eorx) ^ bgx);
553 SWAP32((video_font_draw_table32
554 [bits & 15][3] & eorx) ^ bgx);
556 dest0 += VIDEO_FONT_WIDTH * VIDEO_PIXEL_SIZE;
561 case GDF_24BIT_888RGB:
564 cdat = video_fontdata + c * VIDEO_FONT_HEIGHT;
565 for (rows = VIDEO_FONT_HEIGHT, dest = dest0;
566 rows--; dest += VIDEO_LINE_LEN) {
570 (video_font_draw_table24[bits >> 4][0]
573 (video_font_draw_table24[bits >> 4][1]
576 (video_font_draw_table24[bits >> 4][2]
579 (video_font_draw_table24[bits & 15][0]
582 (video_font_draw_table24[bits & 15][1]
585 (video_font_draw_table24[bits & 15][2]
588 dest0 += VIDEO_FONT_WIDTH * VIDEO_PIXEL_SIZE;
595 static inline void video_drawstring(int xx, int yy, unsigned char *s)
597 video_drawchars(xx, yy, s, strlen((char *) s));
600 static void video_putchar(int xx, int yy, unsigned char c)
602 video_drawchars(xx, yy + video_logo_height, &c, 1);
605 #if defined(CONFIG_CONSOLE_CURSOR) || defined(CONFIG_VIDEO_SW_CURSOR)
606 static void video_set_cursor(void)
613 static void video_invertchar(int xx, int yy)
615 int firstx = xx * VIDEO_PIXEL_SIZE;
616 int lastx = (xx + VIDEO_FONT_WIDTH) * VIDEO_PIXEL_SIZE;
617 int firsty = yy * VIDEO_LINE_LEN;
618 int lasty = (yy + VIDEO_FONT_HEIGHT) * VIDEO_LINE_LEN;
620 for (y = firsty; y < lasty; y += VIDEO_LINE_LEN) {
621 for (x = firstx; x < lastx; x++) {
622 u8 *dest = (u8 *)(video_fb_address) + x + y;
628 void console_cursor(int state)
630 #ifdef CONFIG_CONSOLE_TIME
634 /* time update only if cursor is on (faster scroll) */
638 sprintf(info, " %02d:%02d:%02d ", tm.tm_hour, tm.tm_min,
640 video_drawstring(VIDEO_VISIBLE_COLS - 10 * VIDEO_FONT_WIDTH,
641 VIDEO_INFO_Y, (uchar *) info);
643 sprintf(info, "%02d.%02d.%04d", tm.tm_mday, tm.tm_mon,
645 video_drawstring(VIDEO_VISIBLE_COLS - 10 * VIDEO_FONT_WIDTH,
646 VIDEO_INFO_Y + 1 * VIDEO_FONT_HEIGHT,
651 if (cursor_state != state) {
653 /* turn off the cursor */
654 video_invertchar(old_col * VIDEO_FONT_WIDTH,
655 old_row * VIDEO_FONT_HEIGHT +
658 /* turn off the cursor and record where it is */
659 video_invertchar(console_col * VIDEO_FONT_WIDTH,
660 console_row * VIDEO_FONT_HEIGHT +
662 old_col = console_col;
663 old_row = console_row;
665 cursor_state = state;
670 #ifndef VIDEO_HW_RECTFILL
671 static void memsetl(int *p, int c, int v)
678 #ifndef VIDEO_HW_BITBLT
679 static void memcpyl(int *d, int *s, int c)
686 static void console_scrollup(void)
688 /* copy up rows ignoring the first one */
690 #ifdef VIDEO_HW_BITBLT
691 video_hw_bitblt(VIDEO_PIXEL_SIZE, /* bytes per pixel */
692 0, /* source pos x */
694 VIDEO_FONT_HEIGHT, /* source pos y */
696 video_logo_height, /* dest pos y */
697 VIDEO_VISIBLE_COLS, /* frame width */
700 - VIDEO_FONT_HEIGHT /* frame height */
703 memcpyl(CONSOLE_ROW_FIRST, CONSOLE_ROW_SECOND,
704 CONSOLE_SCROLL_SIZE >> 2);
707 /* clear the last one */
708 #ifdef VIDEO_HW_RECTFILL
709 video_hw_rectfill(VIDEO_PIXEL_SIZE, /* bytes per pixel */
712 - VIDEO_FONT_HEIGHT, /* dest pos y */
713 VIDEO_VISIBLE_COLS, /* frame width */
714 VIDEO_FONT_HEIGHT, /* frame height */
715 CONSOLE_BG_COL /* fill color */
718 memsetl(CONSOLE_ROW_LAST, CONSOLE_ROW_SIZE >> 2, CONSOLE_BG_COL);
722 static void console_back(void)
726 if (console_col < 0) {
727 console_col = CONSOLE_COLS - 1;
734 static void console_newline(void)
739 /* Check if we need to scroll the terminal */
740 if (console_row >= CONSOLE_ROWS) {
741 /* Scroll everything up */
744 /* Decrement row number */
749 static void console_cr(void)
754 void video_putc(const char c)
761 case 13: /* back to first column */
765 case '\n': /* next line */
766 if (console_col || (!console_col && nl))
772 console_col |= 0x0008;
773 console_col &= ~0x0007;
775 if (console_col >= CONSOLE_COLS)
779 case 8: /* backspace */
783 default: /* draw the char */
784 video_putchar(console_col * VIDEO_FONT_WIDTH,
785 console_row * VIDEO_FONT_HEIGHT, c);
788 /* check for newline */
789 if (console_col >= CONSOLE_COLS) {
797 void video_puts(const char *s)
799 int count = strlen(s);
806 * Do not enforce drivers (or board code) to provide empty
807 * video_set_lut() if they do not support 8 bpp format.
808 * Implement weak default function instead.
810 void __video_set_lut(unsigned int index, unsigned char r,
811 unsigned char g, unsigned char b)
815 void video_set_lut(unsigned int, unsigned char, unsigned char, unsigned char)
816 __attribute__ ((weak, alias("__video_set_lut")));
818 #if defined(CONFIG_CMD_BMP) || defined(CONFIG_SPLASH_SCREEN)
820 #define FILL_8BIT_332RGB(r,g,b) { \
821 *fb = ((r>>5)<<5) | ((g>>5)<<2) | (b>>6); \
825 #define FILL_15BIT_555RGB(r,g,b) { \
826 *(unsigned short *)fb = \
827 SWAP16((unsigned short)(((r>>3)<<10) | \
833 #define FILL_16BIT_565RGB(r,g,b) { \
834 *(unsigned short *)fb = \
835 SWAP16((unsigned short)((((r)>>3)<<11)| \
841 #define FILL_32BIT_X888RGB(r,g,b) { \
842 *(unsigned long *)fb = \
843 SWAP32((unsigned long)(((r<<16) | \
849 #ifdef VIDEO_FB_LITTLE_ENDIAN
850 #define FILL_24BIT_888RGB(r,g,b) { \
857 #define FILL_24BIT_888RGB(r,g,b) { \
865 #if defined(VIDEO_FB_16BPP_PIXEL_SWAP)
866 static inline void fill_555rgb_pswap(uchar *fb, int x, u8 r, u8 g, u8 b)
868 ushort *dst = (ushort *) fb;
869 ushort color = (ushort) (((r >> 3) << 10) |
880 * RLE8 bitmap support
883 #ifdef CONFIG_VIDEO_BMP_RLE8
884 /* Pre-calculated color table entry */
887 unsigned short w; /* word */
888 unsigned int dw; /* double word */
889 } ce; /* color entry */
893 * Helper to draw encoded/unencoded run.
895 static void draw_bitmap(uchar **fb, uchar *bm, struct palette *p,
898 ulong addr = (ulong) *fb;
904 * Setup offset of the color index in the bitmap.
905 * Color index of encoded run is at offset 1.
907 off = enc ? &enc_off : &i;
909 switch (VIDEO_DATA_FORMAT) {
910 case GDF__8BIT_INDEX:
911 for (i = 0; i < cnt; i++)
912 *(unsigned char *) addr++ = bm[*off];
914 case GDF_15BIT_555RGB:
915 case GDF_16BIT_565RGB:
916 /* differences handled while pre-calculating palette */
917 for (i = 0; i < cnt; i++) {
918 *(unsigned short *) addr = p[bm[*off]].ce.w;
922 case GDF_32BIT_X888RGB:
923 for (i = 0; i < cnt; i++) {
924 *(unsigned long *) addr = p[bm[*off]].ce.dw;
929 *fb = (uchar *) addr; /* return modified address */
932 static int display_rle8_bitmap(bmp_image_t *img, int xoff, int yoff,
933 int width, int height)
937 unsigned int cnt, runlen;
939 int x, y, bpp, i, ncolors;
940 struct palette p[256];
941 bmp_color_table_entry_t cte;
942 int green_shift, red_off;
943 int limit = VIDEO_COLS * VIDEO_ROWS;
947 y = __le32_to_cpu(img->header.height) - 1;
948 ncolors = __le32_to_cpu(img->header.colors_used);
949 bpp = VIDEO_PIXEL_SIZE;
950 fbp = (unsigned char *) ((unsigned int) video_fb_address +
951 (((y + yoff) * VIDEO_COLS) + xoff) * bpp);
953 bm = (uchar *) img + __le32_to_cpu(img->header.data_offset);
955 /* pre-calculate and setup palette */
956 switch (VIDEO_DATA_FORMAT) {
957 case GDF__8BIT_INDEX:
958 for (i = 0; i < ncolors; i++) {
959 cte = img->color_table[i];
960 video_set_lut(i, cte.red, cte.green, cte.blue);
963 case GDF_15BIT_555RGB:
964 case GDF_16BIT_565RGB:
965 if (VIDEO_DATA_FORMAT == GDF_15BIT_555RGB) {
972 for (i = 0; i < ncolors; i++) {
973 cte = img->color_table[i];
974 p[i].ce.w = SWAP16((unsigned short)
975 (((cte.red >> 3) << red_off) |
976 ((cte.green >> green_shift) << 5) |
980 case GDF_32BIT_X888RGB:
981 for (i = 0; i < ncolors; i++) {
982 cte = img->color_table[i];
983 p[i].ce.dw = SWAP32((cte.red << 16) |
989 printf("RLE Bitmap unsupported in video mode 0x%x\n",
999 /* scan line end marker */
1003 fbp = (unsigned char *)
1004 ((unsigned int) video_fb_address +
1005 (((y + yoff) * VIDEO_COLS) +
1009 /* end of bitmap data marker */
1013 /* run offset marker */
1016 fbp = (unsigned char *)
1017 ((unsigned int) video_fb_address +
1018 (((y + yoff) * VIDEO_COLS) +
1036 if (x + runlen > width)
1038 draw_bitmap(&fbp, bm, p, cnt, 0);
1044 bm++; /* 0 padding if length is odd */
1055 if (y < height) { /* only draw into visible area */
1061 if (x + runlen > width)
1063 draw_bitmap(&fbp, bm, p, cnt, 1);
1072 printf("Error: Too much encoded pixel data, validate your bitmap\n");
1078 * Display the BMP file located at address bmp_image.
1080 int video_display_bitmap(ulong bmp_image, int x, int y)
1082 ushort xcount, ycount;
1084 bmp_image_t *bmp = (bmp_image_t *) bmp_image;
1087 unsigned long width, height, bpp;
1089 unsigned long compression;
1090 bmp_color_table_entry_t cte;
1092 #ifdef CONFIG_VIDEO_BMP_GZIP
1093 unsigned char *dst = NULL;
1099 if (!((bmp->header.signature[0] == 'B') &&
1100 (bmp->header.signature[1] == 'M'))) {
1102 #ifdef CONFIG_VIDEO_BMP_GZIP
1104 * Could be a gzipped bmp image, try to decrompress...
1106 len = CONFIG_SYS_VIDEO_LOGO_MAX_SIZE;
1107 dst = malloc(CONFIG_SYS_VIDEO_LOGO_MAX_SIZE);
1109 printf("Error: malloc in gunzip failed!\n");
1112 if (gunzip(dst, CONFIG_SYS_VIDEO_LOGO_MAX_SIZE,
1113 (uchar *) bmp_image,
1115 printf("Error: no valid bmp or bmp.gz image at %lx\n",
1120 if (len == CONFIG_SYS_VIDEO_LOGO_MAX_SIZE) {
1121 printf("Image could be truncated "
1122 "(increase CONFIG_SYS_VIDEO_LOGO_MAX_SIZE)!\n");
1126 * Set addr to decompressed image
1128 bmp = (bmp_image_t *) dst;
1130 if (!((bmp->header.signature[0] == 'B') &&
1131 (bmp->header.signature[1] == 'M'))) {
1132 printf("Error: no valid bmp.gz image at %lx\n",
1138 printf("Error: no valid bmp image at %lx\n", bmp_image);
1140 #endif /* CONFIG_VIDEO_BMP_GZIP */
1143 width = le32_to_cpu(bmp->header.width);
1144 height = le32_to_cpu(bmp->header.height);
1145 bpp = le16_to_cpu(bmp->header.bit_count);
1146 colors = le32_to_cpu(bmp->header.colors_used);
1147 compression = le32_to_cpu(bmp->header.compression);
1149 debug("Display-bmp: %ld x %ld with %d colors\n",
1150 width, height, colors);
1152 if (compression != BMP_BI_RGB
1153 #ifdef CONFIG_VIDEO_BMP_RLE8
1154 && compression != BMP_BI_RLE8
1157 printf("Error: compression type %ld not supported\n",
1159 #ifdef CONFIG_VIDEO_BMP_GZIP
1166 padded_line = (((width * bpp + 7) / 8) + 3) & ~0x3;
1168 #ifdef CONFIG_SPLASH_SCREEN_ALIGN
1169 if (x == BMP_ALIGN_CENTER)
1170 x = max(0, (VIDEO_VISIBLE_COLS - width) / 2);
1172 x = max(0, VIDEO_VISIBLE_COLS - width + x + 1);
1174 if (y == BMP_ALIGN_CENTER)
1175 y = max(0, (VIDEO_VISIBLE_ROWS - height) / 2);
1177 y = max(0, VIDEO_VISIBLE_ROWS - height + y + 1);
1178 #endif /* CONFIG_SPLASH_SCREEN_ALIGN */
1180 if ((x + width) > VIDEO_VISIBLE_COLS)
1181 width = VIDEO_VISIBLE_COLS - x;
1182 if ((y + height) > VIDEO_VISIBLE_ROWS)
1183 height = VIDEO_VISIBLE_ROWS - y;
1185 bmap = (uchar *) bmp + le32_to_cpu(bmp->header.data_offset);
1186 fb = (uchar *) (video_fb_address +
1187 ((y + height - 1) * VIDEO_COLS * VIDEO_PIXEL_SIZE) +
1188 x * VIDEO_PIXEL_SIZE);
1190 #ifdef CONFIG_VIDEO_BMP_RLE8
1191 if (compression == BMP_BI_RLE8) {
1192 return display_rle8_bitmap(bmp, x, y, width, height);
1196 /* We handle only 4, 8, or 24 bpp bitmaps */
1197 switch (le16_to_cpu(bmp->header.bit_count)) {
1199 padded_line -= width / 2;
1202 switch (VIDEO_DATA_FORMAT) {
1203 case GDF_32BIT_X888RGB:
1207 * Don't assume that 'width' is an
1210 for (xcount = 0; xcount < width; xcount++) {
1218 cte = bmp->color_table[idx];
1219 FILL_32BIT_X888RGB(cte.red, cte.green,
1222 bmap += padded_line;
1223 fb -= (VIDEO_VISIBLE_COLS + width) *
1228 puts("4bpp bitmap unsupported with current "
1235 padded_line -= width;
1236 if (VIDEO_DATA_FORMAT == GDF__8BIT_INDEX) {
1238 for (xcount = 0; xcount < colors; ++xcount) {
1239 cte = bmp->color_table[xcount];
1240 video_set_lut(xcount, cte.red, cte.green,
1245 switch (VIDEO_DATA_FORMAT) {
1246 case GDF__8BIT_INDEX:
1253 bmap += padded_line;
1254 fb -= (VIDEO_VISIBLE_COLS + width) *
1258 case GDF__8BIT_332RGB:
1263 cte = bmp->color_table[*bmap++];
1264 FILL_8BIT_332RGB(cte.red, cte.green,
1267 bmap += padded_line;
1268 fb -= (VIDEO_VISIBLE_COLS + width) *
1272 case GDF_15BIT_555RGB:
1274 #if defined(VIDEO_FB_16BPP_PIXEL_SWAP)
1280 cte = bmp->color_table[*bmap++];
1281 #if defined(VIDEO_FB_16BPP_PIXEL_SWAP)
1282 fill_555rgb_pswap(fb, xpos++, cte.red,
1287 FILL_15BIT_555RGB(cte.red, cte.green,
1291 bmap += padded_line;
1292 fb -= (VIDEO_VISIBLE_COLS + width) *
1296 case GDF_16BIT_565RGB:
1301 cte = bmp->color_table[*bmap++];
1302 FILL_16BIT_565RGB(cte.red, cte.green,
1305 bmap += padded_line;
1306 fb -= (VIDEO_VISIBLE_COLS + width) *
1310 case GDF_32BIT_X888RGB:
1315 cte = bmp->color_table[*bmap++];
1316 FILL_32BIT_X888RGB(cte.red, cte.green,
1319 bmap += padded_line;
1320 fb -= (VIDEO_VISIBLE_COLS + width) *
1324 case GDF_24BIT_888RGB:
1329 cte = bmp->color_table[*bmap++];
1330 FILL_24BIT_888RGB(cte.red, cte.green,
1333 bmap += padded_line;
1334 fb -= (VIDEO_VISIBLE_COLS + width) *
1341 padded_line -= 3 * width;
1343 switch (VIDEO_DATA_FORMAT) {
1344 case GDF__8BIT_332RGB:
1349 FILL_8BIT_332RGB(bmap[2], bmap[1],
1353 bmap += padded_line;
1354 fb -= (VIDEO_VISIBLE_COLS + width) *
1358 case GDF_15BIT_555RGB:
1360 #if defined(VIDEO_FB_16BPP_PIXEL_SWAP)
1366 #if defined(VIDEO_FB_16BPP_PIXEL_SWAP)
1367 fill_555rgb_pswap(fb, xpos++, bmap[2],
1371 FILL_15BIT_555RGB(bmap[2], bmap[1],
1376 bmap += padded_line;
1377 fb -= (VIDEO_VISIBLE_COLS + width) *
1381 case GDF_16BIT_565RGB:
1386 FILL_16BIT_565RGB(bmap[2], bmap[1],
1390 bmap += padded_line;
1391 fb -= (VIDEO_VISIBLE_COLS + width) *
1395 case GDF_32BIT_X888RGB:
1400 FILL_32BIT_X888RGB(bmap[2], bmap[1],
1404 bmap += padded_line;
1405 fb -= (VIDEO_VISIBLE_COLS + width) *
1409 case GDF_24BIT_888RGB:
1414 FILL_24BIT_888RGB(bmap[2], bmap[1],
1418 bmap += padded_line;
1419 fb -= (VIDEO_VISIBLE_COLS + width) *
1424 printf("Error: 24 bits/pixel bitmap incompatible "
1425 "with current video mode\n");
1430 printf("Error: %d bit/pixel bitmaps not supported by U-Boot\n",
1431 le16_to_cpu(bmp->header.bit_count));
1435 #ifdef CONFIG_VIDEO_BMP_GZIP
1446 #ifdef CONFIG_VIDEO_LOGO
1447 void logo_plot(void *screen, int width, int x, int y)
1451 int skip = (width - VIDEO_LOGO_WIDTH) * VIDEO_PIXEL_SIZE;
1452 int ycount = video_logo_height;
1453 unsigned char r, g, b, *logo_red, *logo_blue, *logo_green;
1454 unsigned char *source;
1455 unsigned char *dest = (unsigned char *) screen +
1456 ((y * width * VIDEO_PIXEL_SIZE) + x * VIDEO_PIXEL_SIZE);
1458 #ifdef CONFIG_VIDEO_BMP_LOGO
1459 source = bmp_logo_bitmap;
1461 /* Allocate temporary space for computing colormap */
1462 logo_red = malloc(BMP_LOGO_COLORS);
1463 logo_green = malloc(BMP_LOGO_COLORS);
1464 logo_blue = malloc(BMP_LOGO_COLORS);
1465 /* Compute color map */
1466 for (i = 0; i < VIDEO_LOGO_COLORS; i++) {
1467 logo_red[i] = (bmp_logo_palette[i] & 0x0f00) >> 4;
1468 logo_green[i] = (bmp_logo_palette[i] & 0x00f0);
1469 logo_blue[i] = (bmp_logo_palette[i] & 0x000f) << 4;
1472 source = linux_logo;
1473 logo_red = linux_logo_red;
1474 logo_green = linux_logo_green;
1475 logo_blue = linux_logo_blue;
1478 if (VIDEO_DATA_FORMAT == GDF__8BIT_INDEX) {
1479 for (i = 0; i < VIDEO_LOGO_COLORS; i++) {
1480 video_set_lut(i + VIDEO_LOGO_LUT_OFFSET,
1481 logo_red[i], logo_green[i],
1487 #if defined(VIDEO_FB_16BPP_PIXEL_SWAP)
1490 xcount = VIDEO_LOGO_WIDTH;
1492 r = logo_red[*source - VIDEO_LOGO_LUT_OFFSET];
1493 g = logo_green[*source - VIDEO_LOGO_LUT_OFFSET];
1494 b = logo_blue[*source - VIDEO_LOGO_LUT_OFFSET];
1496 switch (VIDEO_DATA_FORMAT) {
1497 case GDF__8BIT_INDEX:
1500 case GDF__8BIT_332RGB:
1501 *dest = ((r >> 5) << 5) |
1505 case GDF_15BIT_555RGB:
1506 #if defined(VIDEO_FB_16BPP_PIXEL_SWAP)
1507 fill_555rgb_pswap(dest, xpos++, r, g, b);
1509 *(unsigned short *) dest =
1510 SWAP16((unsigned short) (
1516 case GDF_16BIT_565RGB:
1517 *(unsigned short *) dest =
1518 SWAP16((unsigned short) (
1523 case GDF_32BIT_X888RGB:
1524 *(unsigned long *) dest =
1525 SWAP32((unsigned long) (
1530 case GDF_24BIT_888RGB:
1531 #ifdef VIDEO_FB_LITTLE_ENDIAN
1543 dest += VIDEO_PIXEL_SIZE;
1547 #ifdef CONFIG_VIDEO_BMP_LOGO
1554 static void *video_logo(void)
1558 __maybe_unused int y_off = 0;
1560 #ifdef CONFIG_SPLASH_SCREEN
1564 s = getenv("splashimage");
1568 addr = simple_strtoul(s, NULL, 16);
1569 #ifdef CONFIG_SPLASH_SCREEN_ALIGN
1570 s = getenv("splashpos");
1573 x = BMP_ALIGN_CENTER;
1575 x = simple_strtol(s, NULL, 0);
1577 s = strchr(s + 1, ',');
1580 y = BMP_ALIGN_CENTER;
1582 y = simple_strtol(s + 1, NULL, 0);
1585 #endif /* CONFIG_SPLASH_SCREEN_ALIGN */
1587 if (video_display_bitmap(addr, x, y) == 0) {
1588 video_logo_height = 0;
1589 return ((void *) (video_fb_address));
1592 #endif /* CONFIG_SPLASH_SCREEN */
1594 logo_plot(video_fb_address, VIDEO_COLS, 0, 0);
1596 sprintf(info, " %s", version_string);
1598 space = (VIDEO_LINE_LEN / 2 - VIDEO_INFO_X) / VIDEO_FONT_WIDTH;
1602 video_drawchars(VIDEO_INFO_X, VIDEO_INFO_Y,
1603 (uchar *) info, space);
1604 video_drawchars(VIDEO_INFO_X + VIDEO_FONT_WIDTH,
1605 VIDEO_INFO_Y + VIDEO_FONT_HEIGHT,
1606 (uchar *) info + space, len - space);
1609 video_drawstring(VIDEO_INFO_X, VIDEO_INFO_Y, (uchar *) info);
1611 #ifdef CONFIG_CONSOLE_EXTRA_INFO
1614 ((video_logo_height -
1615 VIDEO_FONT_HEIGHT) / VIDEO_FONT_HEIGHT);
1617 for (i = 1; i < n; i++) {
1618 video_get_info_str(i, info);
1624 video_drawchars(VIDEO_INFO_X,
1628 (uchar *) info, space);
1630 video_drawchars(VIDEO_INFO_X +
1635 (uchar *) info + space,
1638 video_drawstring(VIDEO_INFO_X,
1648 return (video_fb_address + video_logo_height * VIDEO_LINE_LEN);
1652 static int video_init(void)
1654 unsigned char color8;
1656 pGD = video_hw_init();
1660 video_fb_address = (void *) VIDEO_FB_ADRS;
1661 #ifdef CONFIG_VIDEO_HW_CURSOR
1662 video_init_hw_cursor(VIDEO_FONT_WIDTH, VIDEO_FONT_HEIGHT);
1665 /* Init drawing pats */
1666 switch (VIDEO_DATA_FORMAT) {
1667 case GDF__8BIT_INDEX:
1668 video_set_lut(0x01, CONSOLE_FG_COL, CONSOLE_FG_COL,
1670 video_set_lut(0x00, CONSOLE_BG_COL, CONSOLE_BG_COL,
1675 case GDF__8BIT_332RGB:
1676 color8 = ((CONSOLE_FG_COL & 0xe0) |
1677 ((CONSOLE_FG_COL >> 3) & 0x1c) |
1678 CONSOLE_FG_COL >> 6);
1679 fgx = (color8 << 24) | (color8 << 16) | (color8 << 8) |
1681 color8 = ((CONSOLE_BG_COL & 0xe0) |
1682 ((CONSOLE_BG_COL >> 3) & 0x1c) |
1683 CONSOLE_BG_COL >> 6);
1684 bgx = (color8 << 24) | (color8 << 16) | (color8 << 8) |
1687 case GDF_15BIT_555RGB:
1688 fgx = (((CONSOLE_FG_COL >> 3) << 26) |
1689 ((CONSOLE_FG_COL >> 3) << 21) |
1690 ((CONSOLE_FG_COL >> 3) << 16) |
1691 ((CONSOLE_FG_COL >> 3) << 10) |
1692 ((CONSOLE_FG_COL >> 3) << 5) |
1693 (CONSOLE_FG_COL >> 3));
1694 bgx = (((CONSOLE_BG_COL >> 3) << 26) |
1695 ((CONSOLE_BG_COL >> 3) << 21) |
1696 ((CONSOLE_BG_COL >> 3) << 16) |
1697 ((CONSOLE_BG_COL >> 3) << 10) |
1698 ((CONSOLE_BG_COL >> 3) << 5) |
1699 (CONSOLE_BG_COL >> 3));
1701 case GDF_16BIT_565RGB:
1702 fgx = (((CONSOLE_FG_COL >> 3) << 27) |
1703 ((CONSOLE_FG_COL >> 2) << 21) |
1704 ((CONSOLE_FG_COL >> 3) << 16) |
1705 ((CONSOLE_FG_COL >> 3) << 11) |
1706 ((CONSOLE_FG_COL >> 2) << 5) |
1707 (CONSOLE_FG_COL >> 3));
1708 bgx = (((CONSOLE_BG_COL >> 3) << 27) |
1709 ((CONSOLE_BG_COL >> 2) << 21) |
1710 ((CONSOLE_BG_COL >> 3) << 16) |
1711 ((CONSOLE_BG_COL >> 3) << 11) |
1712 ((CONSOLE_BG_COL >> 2) << 5) |
1713 (CONSOLE_BG_COL >> 3));
1715 case GDF_32BIT_X888RGB:
1716 fgx = (CONSOLE_FG_COL << 16) |
1717 (CONSOLE_FG_COL << 8) |
1719 bgx = (CONSOLE_BG_COL << 16) |
1720 (CONSOLE_BG_COL << 8) |
1723 case GDF_24BIT_888RGB:
1724 fgx = (CONSOLE_FG_COL << 24) |
1725 (CONSOLE_FG_COL << 16) |
1726 (CONSOLE_FG_COL << 8) |
1728 bgx = (CONSOLE_BG_COL << 24) |
1729 (CONSOLE_BG_COL << 16) |
1730 (CONSOLE_BG_COL << 8) |
1736 #ifdef CONFIG_VIDEO_LOGO
1737 /* Plot the logo and get start point of console */
1738 debug("Video: Drawing the logo ...\n");
1739 video_console_address = video_logo();
1741 video_console_address = video_fb_address;
1744 /* Initialize the console */
1752 * Implement a weak default function for boards that optionally
1753 * need to skip the video initialization.
1755 int __board_video_skip(void)
1757 /* As default, don't skip test */
1761 int board_video_skip(void)
1762 __attribute__ ((weak, alias("__board_video_skip")));
1764 int drv_video_init(void)
1767 struct stdio_dev console_dev;
1769 /* Check if video initialization should be skipped */
1770 if (board_video_skip())
1773 /* Init video chip - returns with framebuffer cleared */
1774 skip_dev_init = (video_init() == -1);
1776 #if !defined(CONFIG_VGA_AS_SINGLE_DEVICE)
1777 debug("KBD: Keyboard init ...\n");
1778 skip_dev_init |= (VIDEO_KBD_INIT_FCT == -1);
1784 /* Init vga device */
1785 memset(&console_dev, 0, sizeof(console_dev));
1786 strcpy(console_dev.name, "vga");
1787 console_dev.ext = DEV_EXT_VIDEO; /* Video extensions */
1788 console_dev.flags = DEV_FLAGS_OUTPUT | DEV_FLAGS_SYSTEM;
1789 console_dev.putc = video_putc; /* 'putc' function */
1790 console_dev.puts = video_puts; /* 'puts' function */
1791 console_dev.tstc = NULL; /* 'tstc' function */
1792 console_dev.getc = NULL; /* 'getc' function */
1794 #if !defined(CONFIG_VGA_AS_SINGLE_DEVICE)
1795 /* Also init console device */
1796 console_dev.flags |= DEV_FLAGS_INPUT;
1797 console_dev.tstc = VIDEO_TSTC_FCT; /* 'tstc' function */
1798 console_dev.getc = VIDEO_GETC_FCT; /* 'getc' function */
1799 #endif /* CONFIG_VGA_AS_SINGLE_DEVICE */
1801 if (stdio_register(&console_dev) != 0)
1804 /* Return success */