blob: 22382afdc3f3570d23bc3ef2dfcd23d81a2be541 [file] [log] [blame]
wdenkc6097192002-11-03 00:24:07 +00001/*
2 * (C) Copyright 2002 ELTEC Elektronik AG
3 * Frank Gottschling <fgottschling@eltec.de>
4 *
5 * See file CREDITS for list of people who contributed to this
6 * project.
7 *
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.
12 *
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.
17 *
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,
21 * MA 02111-1307 USA
22 */
23
24/*
25 * cfb_console.c
26 *
27 * Color Framebuffer Console driver for 8/15/16/24/32 bits per pixel.
28 *
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 normaly goes to serial port) can be drawed.
33 *
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.
39
40 The driver uses graphic specific defines/parameters/functions:
41
42 (for SMI LynxE graphic chip)
43
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
48
49 Console Parameters are set by graphic drivers global struct:
50
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
56
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
61
62 CONFIG_CONSOLE_CURSOR - on/off drawing cursor is done with delay
wdenk57b2d802003-06-27 21:31:46 +000063 loop in VIDEO_TSTC_FCT (i8042)
wdenkc6097192002-11-03 00:24:07 +000064 CFG_CONSOLE_BLINK_COUNT - value for delay loop - blink rate
65 CONFIG_CONSOLE_TIME - display time/date in upper right corner,
wdenk57b2d802003-06-27 21:31:46 +000066 needs CFG_CMD_DATE and CONFIG_CONSOLE_CURSOR
wdenkc6097192002-11-03 00:24:07 +000067 CONFIG_VIDEO_LOGO - display Linux Logo in upper left corner
wdenk9dd2b882002-12-03 21:28:10 +000068 CONFIG_VIDEO_BMP_LOGO - use bmp_logo instead of linux_logo
wdenkc6097192002-11-03 00:24:07 +000069 CONFIG_CONSOLE_EXTRA_INFO - display additional board information strings
wdenk57b2d802003-06-27 21:31:46 +000070 that normaly goes to serial port. This define
71 requires a board specific function:
72 video_drawstring (VIDEO_INFO_X,
73 VIDEO_INFO_Y + i*VIDEO_FONT_HEIGHT,
74 info);
75 that fills a info buffer at i=row.
76 s.a: board/eltec/bab7xx.
wdenkc6097192002-11-03 00:24:07 +000077CONFIG_VGA_AS_SINGLE_DEVICE - If set the framebuffer device will be initialised
wdenk57b2d802003-06-27 21:31:46 +000078 as an output only device. The Keyboard driver
79 will not be set-up. This may be used, if you
80 have none or more than one Keyboard devices
81 (USB Keyboard, AT Keyboard).
wdenkc6097192002-11-03 00:24:07 +000082
83CONFIG_VIDEO_SW_CURSOR: - Draws a cursor after the last character. No
wdenk57b2d802003-06-27 21:31:46 +000084 blinking is provided. Uses the macros CURSOR_SET
85 and CURSOR_OFF.
wdenkc6097192002-11-03 00:24:07 +000086CONFIG_VIDEO_HW_CURSOR: - Uses the hardware cursor capability of the
wdenk57b2d802003-06-27 21:31:46 +000087 graphic chip. Uses the macro CURSOR_SET.
88 ATTENTION: If booting an OS, the display driver
89 must disable the hardware register of the graphic
90 chip. Otherwise a blinking field is displayed
wdenkc6097192002-11-03 00:24:07 +000091*/
92
93#include <common.h>
94
95#ifdef CONFIG_CFB_CONSOLE
96
wdenk9dd2b882002-12-03 21:28:10 +000097#include <malloc.h>
98
wdenkc6097192002-11-03 00:24:07 +000099/*****************************************************************************/
100/* Console device defines with SMI graphic */
101/* Any other graphic must change this section */
102/*****************************************************************************/
103
104#ifdef CONFIG_VIDEO_SMI_LYNXEM
105
106#define VIDEO_FB_LITTLE_ENDIAN
107#define VIDEO_HW_RECTFILL
108#define VIDEO_HW_BITBLT
109#endif
110
111/*****************************************************************************/
112/* Defines for the CT69000 driver */
113/*****************************************************************************/
114#ifdef CONFIG_VIDEO_CT69000
115
116#define VIDEO_FB_LITTLE_ENDIAN
117#define VIDEO_HW_RECTFILL
118#define VIDEO_HW_BITBLT
119#endif
120
121/*****************************************************************************/
wdenk9dd2b882002-12-03 21:28:10 +0000122/* Defines for the SED13806 driver */
123/*****************************************************************************/
124#ifdef CONFIG_VIDEO_SED13806
125
126#define VIDEO_FB_LITTLE_ENDIAN
127#define VIDEO_HW_RECTFILL
128#define VIDEO_HW_BITBLT
129#endif
130
131/*****************************************************************************/
wdenkc6097192002-11-03 00:24:07 +0000132/* Include video_fb.h after definitions of VIDEO_HW_RECTFILL etc */
133/*****************************************************************************/
134#include <video_fb.h>
135
136/*****************************************************************************/
137/* some Macros */
138/*****************************************************************************/
139#define VIDEO_VISIBLE_COLS (pGD->winSizeX)
140#define VIDEO_VISIBLE_ROWS (pGD->winSizeY)
141#define VIDEO_PIXEL_SIZE (pGD->gdfBytesPP)
142#define VIDEO_DATA_FORMAT (pGD->gdfIndex)
143#define VIDEO_FB_ADRS (pGD->frameAdrs)
144
145/*****************************************************************************/
146/* Console device defines with i8042 keyboard controller */
147/* Any other keyboard controller must change this section */
148/*****************************************************************************/
149
150#ifdef CONFIG_I8042_KBD
151#include <i8042.h>
152
153#define VIDEO_KBD_INIT_FCT i8042_kbd_init()
154#define VIDEO_TSTC_FCT i8042_tstc
155#define VIDEO_GETC_FCT i8042_getc
156#endif
157
158/*****************************************************************************/
159/* Console device */
160/*****************************************************************************/
161
162#include <version.h>
163#include <linux/types.h>
164#include <devices.h>
165#include <video_font.h>
166#ifdef CFG_CMD_DATE
167#include <rtc.h>
168
169#endif
170
171/*****************************************************************************/
172/* Cursor definition: */
173/* CONFIG_CONSOLE_CURSOR: Uses a timer function (see drivers/i8042.c) to */
174/* let the cursor blink. Uses the macros CURSOR_OFF */
175/* and CURSOR_ON. */
176/* CONFIG_VIDEO_SW_CURSOR: Draws a cursor after the last character. No */
177/* blinking is provided. Uses the macros CURSOR_SET */
178/* and CURSOR_OFF. */
179/* CONFIG_VIDEO_HW_CURSOR: Uses the hardware cursor capability of the */
180/* graphic chip. Uses the macro CURSOR_SET. */
181/* ATTENTION: If booting an OS, the display driver */
182/* must disable the hardware register of the graphic */
183/* chip. Otherwise a blinking field is displayed */
184/*****************************************************************************/
185#if !defined(CONFIG_CONSOLE_CURSOR) && \
186 !defined(CONFIG_VIDEO_SW_CURSOR) && \
187 !defined(CONFIG_VIDEO_HW_CURSOR)
188/* no Cursor defined */
189#define CURSOR_ON
190#define CURSOR_OFF
191#define CURSOR_SET
192#endif
193
194#ifdef CONFIG_CONSOLE_CURSOR
195#ifdef CURSOR_ON
196#error only one of CONFIG_CONSOLE_CURSOR,CONFIG_VIDEO_SW_CURSOR,CONFIG_VIDEO_HW_CURSOR can be defined
197#endif
198void console_cursor (int state);
199#define CURSOR_ON console_cursor(1);
200#define CURSOR_OFF console_cursor(0);
201#define CURSOR_SET
202#ifndef CONFIG_I8042_KBD
203#warning Cursor drawing on/off needs timer function s.a. drivers/i8042.c
204#endif
205#else
206#ifdef CONFIG_CONSOLE_TIME
207#error CONFIG_CONSOLE_CURSOR must be defined for CONFIG_CONSOLE_TIME
208#endif
209#endif /* CONFIG_CONSOLE_CURSOR */
210
211#ifdef CONFIG_VIDEO_SW_CURSOR
212#ifdef CURSOR_ON
213#error only one of CONFIG_CONSOLE_CURSOR,CONFIG_VIDEO_SW_CURSOR,CONFIG_VIDEO_HW_CURSOR can be defined
214#endif
215#define CURSOR_ON
216#define CURSOR_OFF video_putchar(console_col * VIDEO_FONT_WIDTH,\
wdenk57b2d802003-06-27 21:31:46 +0000217 console_row * VIDEO_FONT_HEIGHT, ' ');
wdenkc6097192002-11-03 00:24:07 +0000218#define CURSOR_SET video_set_cursor();
219#endif /* CONFIG_VIDEO_SW_CURSOR */
220
221
222#ifdef CONFIG_VIDEO_HW_CURSOR
223#ifdef CURSOR_ON
224#error only one of CONFIG_CONSOLE_CURSOR,CONFIG_VIDEO_SW_CURSOR,CONFIG_VIDEO_HW_CURSOR can be defined
225#endif
226#define CURSOR_ON
227#define CURSOR_OFF
228#define CURSOR_SET video_set_hw_cursor(console_col * VIDEO_FONT_WIDTH, \
wdenk57b2d802003-06-27 21:31:46 +0000229 (console_row * VIDEO_FONT_HEIGHT) + VIDEO_LOGO_HEIGHT);
wdenkc6097192002-11-03 00:24:07 +0000230#endif /* CONFIG_VIDEO_HW_CURSOR */
231
232#ifdef CONFIG_VIDEO_LOGO
wdenk9dd2b882002-12-03 21:28:10 +0000233#ifdef CONFIG_VIDEO_BMP_LOGO
234#include <bmp_logo.h>
235#define VIDEO_LOGO_WIDTH BMP_LOGO_WIDTH
236#define VIDEO_LOGO_HEIGHT BMP_LOGO_HEIGHT
237#define VIDEO_LOGO_LUT_OFFSET BMP_LOGO_OFFSET
238#define VIDEO_LOGO_COLORS BMP_LOGO_COLORS
239
240#else /* CONFIG_VIDEO_BMP_LOGO */
wdenkc6097192002-11-03 00:24:07 +0000241#define LINUX_LOGO_WIDTH 80
242#define LINUX_LOGO_HEIGHT 80
243#define LINUX_LOGO_COLORS 214
244#define LINUX_LOGO_LUT_OFFSET 0x20
245#define __initdata
246#include <linux_logo.h>
247#define VIDEO_LOGO_WIDTH LINUX_LOGO_WIDTH
248#define VIDEO_LOGO_HEIGHT LINUX_LOGO_HEIGHT
wdenk9dd2b882002-12-03 21:28:10 +0000249#define VIDEO_LOGO_LUT_OFFSET LINUX_LOGO_LUT_OFFSET
250#define VIDEO_LOGO_COLORS LINUX_LOGO_COLORS
251#endif /* CONFIG_VIDEO_BMP_LOGO */
wdenkc6097192002-11-03 00:24:07 +0000252#define VIDEO_INFO_X (VIDEO_LOGO_WIDTH)
253#define VIDEO_INFO_Y (VIDEO_FONT_HEIGHT/2)
wdenk9dd2b882002-12-03 21:28:10 +0000254#else /* CONFIG_VIDEO_LOGO */
wdenkc6097192002-11-03 00:24:07 +0000255#define VIDEO_LOGO_WIDTH 0
256#define VIDEO_LOGO_HEIGHT 0
wdenk9dd2b882002-12-03 21:28:10 +0000257#endif /* CONFIG_VIDEO_LOGO */
wdenkc6097192002-11-03 00:24:07 +0000258
259#define VIDEO_COLS VIDEO_VISIBLE_COLS
260#define VIDEO_ROWS VIDEO_VISIBLE_ROWS
261#define VIDEO_SIZE (VIDEO_ROWS*VIDEO_COLS*VIDEO_PIXEL_SIZE)
262#define VIDEO_PIX_BLOCKS (VIDEO_SIZE >> 2)
263#define VIDEO_LINE_LEN (VIDEO_COLS*VIDEO_PIXEL_SIZE)
264#define VIDEO_BURST_LEN (VIDEO_COLS/8)
265
266#ifdef CONFIG_VIDEO_LOGO
267#define CONSOLE_ROWS ((VIDEO_ROWS - VIDEO_LOGO_HEIGHT) / VIDEO_FONT_HEIGHT)
268#else
269#define CONSOLE_ROWS (VIDEO_ROWS / VIDEO_FONT_HEIGHT)
270#endif
271
272#define CONSOLE_COLS (VIDEO_COLS / VIDEO_FONT_WIDTH)
273#define CONSOLE_ROW_SIZE (VIDEO_FONT_HEIGHT * VIDEO_LINE_LEN)
274#define CONSOLE_ROW_FIRST (video_console_address)
275#define CONSOLE_ROW_SECOND (video_console_address + CONSOLE_ROW_SIZE)
276#define CONSOLE_ROW_LAST (video_console_address + CONSOLE_SIZE - CONSOLE_ROW_SIZE)
277#define CONSOLE_SIZE (CONSOLE_ROW_SIZE * CONSOLE_ROWS)
278#define CONSOLE_SCROLL_SIZE (CONSOLE_SIZE - CONSOLE_ROW_SIZE)
279
280/* Macros */
281#ifdef VIDEO_FB_LITTLE_ENDIAN
282#define SWAP16(x) ((((x) & 0x00ff) << 8) | ( (x) >> 8))
283#define SWAP32(x) ((((x) & 0x000000ff) << 24) | (((x) & 0x0000ff00) << 8)|\
wdenk57b2d802003-06-27 21:31:46 +0000284 (((x) & 0x00ff0000) >> 8) | (((x) & 0xff000000) >> 24) )
wdenkc6097192002-11-03 00:24:07 +0000285#define SHORTSWAP32(x) ((((x) & 0x000000ff) << 8) | (((x) & 0x0000ff00) >> 8)|\
wdenk57b2d802003-06-27 21:31:46 +0000286 (((x) & 0x00ff0000) << 8) | (((x) & 0xff000000) >> 8) )
wdenkc6097192002-11-03 00:24:07 +0000287#else
288#define SWAP16(x) (x)
289#define SWAP32(x) (x)
290#define SHORTSWAP32(x) (x)
291#endif
292
293#if defined(DEBUG) || defined(DEBUG_CFB_CONSOLE)
294#define PRINTD(x) printf(x)
295#else
296#define PRINTD(x)
297#endif
298
299
300#ifdef CONFIG_CONSOLE_EXTRA_INFO
301extern void video_get_info_str ( /* setup a board string: type, speed, etc. */
302 int line_number, /* location to place info string beside logo */
303 char *info /* buffer for info string */
304 );
305
306#endif
307
308/* Locals */
309static GraphicDevice *pGD; /* Pointer to Graphic array */
310
311static void *video_fb_address; /* frame buffer address */
312static void *video_console_address; /* console buffer start address */
313
314static int console_col = 0; /* cursor col */
315static int console_row = 0; /* cursor row */
316
317static u32 eorx, fgx, bgx; /* color pats */
318
319static const int video_font_draw_table8[] = {
wdenk57b2d802003-06-27 21:31:46 +0000320 0x00000000, 0x000000ff, 0x0000ff00, 0x0000ffff,
321 0x00ff0000, 0x00ff00ff, 0x00ffff00, 0x00ffffff,
322 0xff000000, 0xff0000ff, 0xff00ff00, 0xff00ffff,
323 0xffff0000, 0xffff00ff, 0xffffff00, 0xffffffff };
wdenkc6097192002-11-03 00:24:07 +0000324
325static const int video_font_draw_table15[] = {
wdenk57b2d802003-06-27 21:31:46 +0000326 0x00000000, 0x00007fff, 0x7fff0000, 0x7fff7fff };
wdenkc6097192002-11-03 00:24:07 +0000327
328static const int video_font_draw_table16[] = {
wdenk57b2d802003-06-27 21:31:46 +0000329 0x00000000, 0x0000ffff, 0xffff0000, 0xffffffff };
wdenkc6097192002-11-03 00:24:07 +0000330
331static const int video_font_draw_table24[16][3] = {
wdenk57b2d802003-06-27 21:31:46 +0000332 { 0x00000000, 0x00000000, 0x00000000 },
333 { 0x00000000, 0x00000000, 0x00ffffff },
334 { 0x00000000, 0x0000ffff, 0xff000000 },
335 { 0x00000000, 0x0000ffff, 0xffffffff },
336 { 0x000000ff, 0xffff0000, 0x00000000 },
337 { 0x000000ff, 0xffff0000, 0x00ffffff },
338 { 0x000000ff, 0xffffffff, 0xff000000 },
339 { 0x000000ff, 0xffffffff, 0xffffffff },
340 { 0xffffff00, 0x00000000, 0x00000000 },
341 { 0xffffff00, 0x00000000, 0x00ffffff },
342 { 0xffffff00, 0x0000ffff, 0xff000000 },
343 { 0xffffff00, 0x0000ffff, 0xffffffff },
344 { 0xffffffff, 0xffff0000, 0x00000000 },
345 { 0xffffffff, 0xffff0000, 0x00ffffff },
346 { 0xffffffff, 0xffffffff, 0xff000000 },
347 { 0xffffffff, 0xffffffff, 0xffffffff } };
wdenkc6097192002-11-03 00:24:07 +0000348
349static const int video_font_draw_table32[16][4] = {
wdenk57b2d802003-06-27 21:31:46 +0000350 { 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
351 { 0x00000000, 0x00000000, 0x00000000, 0x00ffffff },
352 { 0x00000000, 0x00000000, 0x00ffffff, 0x00000000 },
353 { 0x00000000, 0x00000000, 0x00ffffff, 0x00ffffff },
354 { 0x00000000, 0x00ffffff, 0x00000000, 0x00000000 },
355 { 0x00000000, 0x00ffffff, 0x00000000, 0x00ffffff },
356 { 0x00000000, 0x00ffffff, 0x00ffffff, 0x00000000 },
357 { 0x00000000, 0x00ffffff, 0x00ffffff, 0x00ffffff },
358 { 0x00ffffff, 0x00000000, 0x00000000, 0x00000000 },
359 { 0x00ffffff, 0x00000000, 0x00000000, 0x00ffffff },
360 { 0x00ffffff, 0x00000000, 0x00ffffff, 0x00000000 },
361 { 0x00ffffff, 0x00000000, 0x00ffffff, 0x00ffffff },
362 { 0x00ffffff, 0x00ffffff, 0x00000000, 0x00000000 },
363 { 0x00ffffff, 0x00ffffff, 0x00000000, 0x00ffffff },
364 { 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00000000 },
365 { 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff } };
wdenkc6097192002-11-03 00:24:07 +0000366
367
368/******************************************************************************/
369
370
371static void video_drawchars (int xx, int yy, unsigned char *s, int count)
372{
373 u8 *cdat, *dest, *dest0;
374 int rows, offset, c;
375
376 offset = yy * VIDEO_LINE_LEN + xx * VIDEO_PIXEL_SIZE;
377 dest0 = video_fb_address + offset;
378
379 switch (VIDEO_DATA_FORMAT)
380 {
381 case GDF__8BIT_INDEX:
382 case GDF__8BIT_332RGB:
wdenk57b2d802003-06-27 21:31:46 +0000383 while (count--)
384 {
385 c = *s ;
386 cdat = video_fontdata + c * VIDEO_FONT_HEIGHT;
387 for (rows = VIDEO_FONT_HEIGHT, dest = dest0; rows--; dest += VIDEO_LINE_LEN)
388 {
389 u8 bits = *cdat++;
390 ((u32 *)dest)[0] = (video_font_draw_table8[bits >> 4] & eorx) ^ bgx;
391 ((u32 *)dest)[1] = (video_font_draw_table8[bits & 15] & eorx) ^ bgx;
392 }
393 dest0 += VIDEO_FONT_WIDTH * VIDEO_PIXEL_SIZE;
394 s++;
395 }
396 break;
wdenkc6097192002-11-03 00:24:07 +0000397
398 case GDF_15BIT_555RGB:
wdenk57b2d802003-06-27 21:31:46 +0000399 while (count--)
400 {
401 c = *s ;
402 cdat = video_fontdata + c * VIDEO_FONT_HEIGHT;
403 for (rows = VIDEO_FONT_HEIGHT, dest = dest0; rows--; dest += VIDEO_LINE_LEN)
404 {
405 u8 bits = *cdat++;
406 ((u32 *)dest)[0] = SHORTSWAP32((video_font_draw_table15[bits >> 6] & eorx) ^ bgx);
407 ((u32 *)dest)[1] = SHORTSWAP32((video_font_draw_table15[bits >> 4 & 3] & eorx) ^ bgx);
408 ((u32 *)dest)[2] = SHORTSWAP32((video_font_draw_table15[bits >> 2 & 3] & eorx) ^ bgx);
409 ((u32 *)dest)[3] = SHORTSWAP32((video_font_draw_table15[bits & 3] & eorx) ^ bgx);
410 }
411 dest0 += VIDEO_FONT_WIDTH * VIDEO_PIXEL_SIZE;
412 s++ ;
413 }
414 break;
wdenkc6097192002-11-03 00:24:07 +0000415
416 case GDF_16BIT_565RGB:
wdenk57b2d802003-06-27 21:31:46 +0000417 while (count--)
418 {
419 c = *s ;
420 cdat = video_fontdata + c * VIDEO_FONT_HEIGHT;
421 for (rows = VIDEO_FONT_HEIGHT, dest = dest0; rows--; dest += VIDEO_LINE_LEN)
422 {
423 u8 bits = *cdat++;
424 ((u32 *)dest)[0] = SHORTSWAP32((video_font_draw_table16[bits >> 6] & eorx) ^ bgx);
425 ((u32 *)dest)[1] = SHORTSWAP32((video_font_draw_table16[bits >> 4 & 3] & eorx) ^ bgx);
426 ((u32 *)dest)[2] = SHORTSWAP32((video_font_draw_table16[bits >> 2 & 3] & eorx) ^ bgx);
427 ((u32 *)dest)[3] = SHORTSWAP32((video_font_draw_table16[bits & 3] & eorx) ^ bgx);
428 }
429 dest0 += VIDEO_FONT_WIDTH * VIDEO_PIXEL_SIZE;
430 s++ ;
431 }
432 break;
wdenkc6097192002-11-03 00:24:07 +0000433
434 case GDF_32BIT_X888RGB:
wdenk57b2d802003-06-27 21:31:46 +0000435 while (count--)
436 {
437 c = *s ;
438 cdat = video_fontdata + c * VIDEO_FONT_HEIGHT;
439 for (rows = VIDEO_FONT_HEIGHT, dest = dest0; rows--; dest += VIDEO_LINE_LEN)
440 {
441 u8 bits = *cdat++;
442 ((u32 *)dest)[0] = SWAP32((video_font_draw_table32[bits >> 4][0] & eorx) ^ bgx);
443 ((u32 *)dest)[1] = SWAP32((video_font_draw_table32[bits >> 4][1] & eorx) ^ bgx);
444 ((u32 *)dest)[2] = SWAP32((video_font_draw_table32[bits >> 4][2] & eorx) ^ bgx);
445 ((u32 *)dest)[3] = SWAP32((video_font_draw_table32[bits >> 4][3] & eorx) ^ bgx);
446 ((u32 *)dest)[4] = SWAP32((video_font_draw_table32[bits & 15][0] & eorx) ^ bgx);
447 ((u32 *)dest)[5] = SWAP32((video_font_draw_table32[bits & 15][1] & eorx) ^ bgx);
448 ((u32 *)dest)[6] = SWAP32((video_font_draw_table32[bits & 15][2] & eorx) ^ bgx);
449 ((u32 *)dest)[7] = SWAP32((video_font_draw_table32[bits & 15][3] & eorx) ^ bgx);
450 }
451 dest0 += VIDEO_FONT_WIDTH * VIDEO_PIXEL_SIZE;
452 s++ ;
453 }
454 break;
wdenkc6097192002-11-03 00:24:07 +0000455
456 case GDF_24BIT_888RGB:
wdenk57b2d802003-06-27 21:31:46 +0000457 while (count--)
458 {
459 c = *s ;
460 cdat = video_fontdata + c * VIDEO_FONT_HEIGHT;
461 for (rows = VIDEO_FONT_HEIGHT, dest = dest0; rows--; dest += VIDEO_LINE_LEN)
462 {
463 u8 bits = *cdat++;
464 ((u32 *)dest)[0] = (video_font_draw_table24[bits >> 4][0] & eorx) ^ bgx;
465 ((u32 *)dest)[1] = (video_font_draw_table24[bits >> 4][1] & eorx) ^ bgx;
466 ((u32 *)dest)[2] = (video_font_draw_table24[bits >> 4][2] & eorx) ^ bgx;
467 ((u32 *)dest)[3] = (video_font_draw_table24[bits & 15][0] & eorx) ^ bgx;
468 ((u32 *)dest)[4] = (video_font_draw_table24[bits & 15][1] & eorx) ^ bgx;
469 ((u32 *)dest)[5] = (video_font_draw_table24[bits & 15][2] & eorx) ^ bgx;
470 }
471 dest0 += VIDEO_FONT_WIDTH * VIDEO_PIXEL_SIZE;
472 s++ ;
473 }
474 break;
wdenkc6097192002-11-03 00:24:07 +0000475 }
476}
477
478/*****************************************************************************/
479
480static inline void video_drawstring(int xx, int yy, unsigned char *s)
481{
482 video_drawchars (xx, yy, s, strlen(s));
483}
484
485/*****************************************************************************/
486
487static void video_putchar(int xx, int yy, unsigned char c)
488{
wdenkc6097192002-11-03 00:24:07 +0000489 video_drawchars (xx, yy + VIDEO_LOGO_HEIGHT, &c, 1);
wdenkc6097192002-11-03 00:24:07 +0000490}
491
492/*****************************************************************************/
493#if defined(CONFIG_CONSOLE_CURSOR) || defined(CONFIG_VIDEO_SW_CURSOR)
494static void video_set_cursor(void)
495{
496 /* swap drawing colors */
497 eorx = fgx;
498 fgx = bgx;
499 bgx = eorx;
500 eorx = fgx ^ bgx;
501 /* draw cursor */
502 video_putchar (console_col * VIDEO_FONT_WIDTH,
wdenk57b2d802003-06-27 21:31:46 +0000503 console_row * VIDEO_FONT_HEIGHT, ' ');
wdenkc6097192002-11-03 00:24:07 +0000504 /* restore drawing colors */
505 eorx = fgx;
506 fgx = bgx;
507 bgx = eorx;
508 eorx = fgx ^ bgx;
509}
510#endif
511/*****************************************************************************/
512#ifdef CONFIG_CONSOLE_CURSOR
513void console_cursor (int state)
514{
515 static int last_state = 0;
516#ifdef CONFIG_CONSOLE_TIME
517 struct rtc_time tm;
518 char info[16];
519
520 /* time update only if cursor is on (faster scroll) */
521 if (state)
522 {
523 rtc_get (&tm);
524
525 sprintf(info, " %02d:%02d:%02d ", tm.tm_hour, tm.tm_min, tm.tm_sec);
526 video_drawstring(VIDEO_VISIBLE_COLS-10*VIDEO_FONT_WIDTH,
wdenk57b2d802003-06-27 21:31:46 +0000527 VIDEO_INFO_Y, info);
wdenkc6097192002-11-03 00:24:07 +0000528
529 sprintf(info, "%02d.%02d.%04d", tm.tm_mday, tm.tm_mon, tm.tm_year);
530 video_drawstring(VIDEO_VISIBLE_COLS-10*VIDEO_FONT_WIDTH,
wdenk57b2d802003-06-27 21:31:46 +0000531 VIDEO_INFO_Y+1*VIDEO_FONT_HEIGHT, info);
wdenkc6097192002-11-03 00:24:07 +0000532 }
533#endif
534
535 if (state && (last_state != state))
536 {
wdenk57b2d802003-06-27 21:31:46 +0000537 video_set_cursor();
wdenkc6097192002-11-03 00:24:07 +0000538 }
539
540 if (!state && (last_state != state))
541 {
wdenk57b2d802003-06-27 21:31:46 +0000542 /* clear cursor */
543 video_putchar (console_col * VIDEO_FONT_WIDTH,
544 console_row * VIDEO_FONT_HEIGHT, ' ');
wdenkc6097192002-11-03 00:24:07 +0000545 }
546
547 last_state = state;
548}
549#endif
550
551/*****************************************************************************/
552
553#ifndef VIDEO_HW_RECTFILL
554static void memsetl (int *p, int c, int v)
555{
556 while (c--)
wdenk57b2d802003-06-27 21:31:46 +0000557 *(p++) = v;
wdenkc6097192002-11-03 00:24:07 +0000558}
559#endif
560
561/*****************************************************************************/
562
563#ifndef VIDEO_HW_BITBLT
564static void memcpyl (int *d, int *s, int c)
565{
566 while (c--)
wdenk57b2d802003-06-27 21:31:46 +0000567 *(d++) = *(s++);
wdenkc6097192002-11-03 00:24:07 +0000568}
569#endif
570
571/*****************************************************************************/
572
573static void console_scrollup (void)
574{
575 /* copy up rows ignoring the first one */
576
577#ifdef VIDEO_HW_BITBLT
578 video_hw_bitblt (
579 VIDEO_PIXEL_SIZE, /* bytes per pixel */
580 0, /* source pos x */
581 VIDEO_LOGO_HEIGHT + VIDEO_FONT_HEIGHT, /* source pos y */
582 0, /* dest pos x */
583 VIDEO_LOGO_HEIGHT, /* dest pos y */
584 VIDEO_VISIBLE_COLS, /* frame width */
585 VIDEO_VISIBLE_ROWS - VIDEO_LOGO_HEIGHT - VIDEO_FONT_HEIGHT /* frame height */
586 );
587#else
588 memcpyl (CONSOLE_ROW_FIRST, CONSOLE_ROW_SECOND, CONSOLE_SCROLL_SIZE >> 2);
589#endif
590
591 /* clear the last one */
592#ifdef VIDEO_HW_RECTFILL
593 video_hw_rectfill (
594 VIDEO_PIXEL_SIZE, /* bytes per pixel */
595 0, /* dest pos x */
596 VIDEO_VISIBLE_ROWS - VIDEO_FONT_HEIGHT, /* dest pos y */
597 VIDEO_VISIBLE_COLS, /* frame width */
598 VIDEO_FONT_HEIGHT, /* frame height */
599 CONSOLE_BG_COL /* fill color */
600 );
601#else
602 memsetl (CONSOLE_ROW_LAST, CONSOLE_ROW_SIZE >> 2, CONSOLE_BG_COL);
603#endif
604}
605
606/*****************************************************************************/
607
608static void console_back (void)
609{
610 CURSOR_OFF
611 console_col--;
612
613 if (console_col < 0)
614 {
wdenk57b2d802003-06-27 21:31:46 +0000615 console_col = CONSOLE_COLS - 1;
616 console_row--;
617 if (console_row < 0)
618 console_row = 0;
wdenkc6097192002-11-03 00:24:07 +0000619 }
620 video_putchar (console_col * VIDEO_FONT_WIDTH,
wdenk57b2d802003-06-27 21:31:46 +0000621 console_row * VIDEO_FONT_HEIGHT, ' ');
wdenkc6097192002-11-03 00:24:07 +0000622}
623
624/*****************************************************************************/
625
626static void console_newline (void)
627{
628 CURSOR_OFF
629 console_row++;
630 console_col = 0;
631
632 /* Check if we need to scroll the terminal */
633 if (console_row >= CONSOLE_ROWS)
634 {
635 /* Scroll everything up */
636 console_scrollup ();
637
638 /* Decrement row number */
639 console_row--;
640 }
641}
642
643/*****************************************************************************/
644
645void video_putc (const char c)
646{
647 switch (c)
648 {
649 case 13: /* ignore */
wdenk57b2d802003-06-27 21:31:46 +0000650 break;
wdenkc6097192002-11-03 00:24:07 +0000651
652 case '\n': /* next line */
wdenk57b2d802003-06-27 21:31:46 +0000653 console_newline();
654 break;
wdenkc6097192002-11-03 00:24:07 +0000655
656 case 9: /* tab 8 */
wdenk57b2d802003-06-27 21:31:46 +0000657 CURSOR_OFF
658 console_col |= 0x0008;
659 console_col &= ~0x0007;
wdenkc6097192002-11-03 00:24:07 +0000660
wdenk57b2d802003-06-27 21:31:46 +0000661 if (console_col >= CONSOLE_COLS)
662 console_newline();
663 break;
wdenkc6097192002-11-03 00:24:07 +0000664
665 case 8: /* backspace */
wdenk57b2d802003-06-27 21:31:46 +0000666 console_back();
667 break;
wdenkc6097192002-11-03 00:24:07 +0000668
669 default: /* draw the char */
wdenk57b2d802003-06-27 21:31:46 +0000670 video_putchar (console_col * VIDEO_FONT_WIDTH,
671 console_row * VIDEO_FONT_HEIGHT, c);
672 console_col++ ;
wdenkc6097192002-11-03 00:24:07 +0000673
wdenk57b2d802003-06-27 21:31:46 +0000674 /* check for newline */
675 if (console_col >= CONSOLE_COLS)
676 console_newline();
wdenkc6097192002-11-03 00:24:07 +0000677 }
678 CURSOR_SET
679}
680
681
wdenkc6097192002-11-03 00:24:07 +0000682/*****************************************************************************/
683
684void video_puts (const char *s)
685{
686 int count = strlen(s);
687
688 while(count--)
wdenk57b2d802003-06-27 21:31:46 +0000689 video_putc(*s++);
wdenkc6097192002-11-03 00:24:07 +0000690}
691
692/*****************************************************************************/
693
694#ifdef CONFIG_VIDEO_LOGO
695void logo_plot (void *screen, int width, int x, int y)
696{
wdenk9dd2b882002-12-03 21:28:10 +0000697
698 int skip = (width - VIDEO_LOGO_WIDTH) * VIDEO_PIXEL_SIZE,
wdenk57b2d802003-06-27 21:31:46 +0000699 xcount, i,
700 ycount = VIDEO_LOGO_HEIGHT;
wdenkc6097192002-11-03 00:24:07 +0000701 unsigned char
wdenk57b2d802003-06-27 21:31:46 +0000702 *source,
703 *dest = (unsigned char *) screen + ((y * width * VIDEO_PIXEL_SIZE) + x),
704 r, g, b, *logo_red, *logo_blue, *logo_green;
wdenkc6097192002-11-03 00:24:07 +0000705
wdenk9dd2b882002-12-03 21:28:10 +0000706#ifdef CONFIG_VIDEO_BMP_LOGO
707 source = bmp_logo_bitmap;
wdenk57b2d802003-06-27 21:31:46 +0000708
wdenk9dd2b882002-12-03 21:28:10 +0000709 /* Allocate temporary space for computing colormap */
710 logo_red = malloc (BMP_LOGO_COLORS);
711 logo_green = malloc (BMP_LOGO_COLORS);
712 logo_blue = malloc (BMP_LOGO_COLORS);
713 /* Compute color map */
714 for (i = 0; i < VIDEO_LOGO_COLORS; i++) {
wdenk57b2d802003-06-27 21:31:46 +0000715 logo_red [i] = (bmp_logo_palette [i] & 0x0f00) >> 4;
716 logo_green [i] = (bmp_logo_palette [i] & 0x00f0);
717 logo_blue [i] = (bmp_logo_palette [i] & 0x000f) << 4;
wdenk9dd2b882002-12-03 21:28:10 +0000718 }
719#else
720 source = linux_logo;
721 logo_red = linux_logo_red;
722 logo_green = linux_logo_green;
723 logo_blue = linux_logo_blue;
724#endif
wdenk57b2d802003-06-27 21:31:46 +0000725
wdenkc6097192002-11-03 00:24:07 +0000726 if (VIDEO_DATA_FORMAT == GDF__8BIT_INDEX)
727 {
wdenk57b2d802003-06-27 21:31:46 +0000728 for (i = 0; i < VIDEO_LOGO_COLORS; i++)
729 {
730 video_set_lut (i + VIDEO_LOGO_LUT_OFFSET,
731 logo_red [i], logo_green [i], logo_blue [i]);
732 }
wdenkc6097192002-11-03 00:24:07 +0000733 }
734
735 while (ycount--)
736 {
wdenk57b2d802003-06-27 21:31:46 +0000737 xcount = VIDEO_LOGO_WIDTH;
738 while (xcount--)
739 {
740 r = logo_red [*source - VIDEO_LOGO_LUT_OFFSET];
741 g = logo_green [*source - VIDEO_LOGO_LUT_OFFSET];
742 b = logo_blue [*source - VIDEO_LOGO_LUT_OFFSET];
743
744 switch (VIDEO_DATA_FORMAT)
745 {
746 case GDF__8BIT_INDEX:
747 *dest = *source;
748 break;
749 case GDF__8BIT_332RGB:
750 *dest = ((r>>5)<<5) | ((g>>5)<<2) | (b>>6);
751 break;
752 case GDF_15BIT_555RGB:
753 *(unsigned short *)dest =
754 SWAP16((unsigned short)(((r>>3)<<10) | ((g>>3)<<5) | (b>>3)));
755 break;
756 case GDF_16BIT_565RGB:
757 *(unsigned short *)dest =
758 SWAP16((unsigned short)(((r>>3)<<11) | ((g>>2)<<5) | (b>>3)));
759 break;
760 case GDF_32BIT_X888RGB:
761 *(unsigned long *)dest =
762 SWAP32((unsigned long)((r<<16) | (g<<8) | b));
763 break;
764 case GDF_24BIT_888RGB:
wdenkc6097192002-11-03 00:24:07 +0000765#ifdef VIDEO_FB_LITTLE_ENDIAN
wdenk57b2d802003-06-27 21:31:46 +0000766 dest[0] = b;
767 dest[1] = g;
768 dest[2] = r;
wdenkc6097192002-11-03 00:24:07 +0000769#else
wdenk57b2d802003-06-27 21:31:46 +0000770 dest[0] = r;
771 dest[1] = g;
772 dest[2] = b;
wdenkc6097192002-11-03 00:24:07 +0000773#endif
wdenk57b2d802003-06-27 21:31:46 +0000774 break;
775 }
776 source++;
777 dest += VIDEO_PIXEL_SIZE;
778 }
779 dest += skip;
wdenkc6097192002-11-03 00:24:07 +0000780 }
wdenk9dd2b882002-12-03 21:28:10 +0000781#ifdef CONFIG_VIDEO_BMP_LOGO
782 free (logo_red);
783 free (logo_green);
784 free (logo_blue);
785#endif
wdenkc6097192002-11-03 00:24:07 +0000786}
787
wdenkc6097192002-11-03 00:24:07 +0000788/*****************************************************************************/
789
790static void *video_logo (void)
791{
792 char info[128];
wdenk9dd2b882002-12-03 21:28:10 +0000793 extern char version_string;
wdenkc6097192002-11-03 00:24:07 +0000794
795 logo_plot (video_fb_address, VIDEO_COLS, 0, 0);
796
wdenk9dd2b882002-12-03 21:28:10 +0000797 sprintf(info, " %s", &version_string);
wdenkc6097192002-11-03 00:24:07 +0000798 video_drawstring (VIDEO_INFO_X, VIDEO_INFO_Y, info);
799
800#ifdef CONFIG_CONSOLE_EXTRA_INFO
801 {
802 int i, n = ((VIDEO_LOGO_HEIGHT-VIDEO_FONT_HEIGHT)/VIDEO_FONT_HEIGHT);
803
804 for (i = 1; i < n; i++)
805 {
wdenk57b2d802003-06-27 21:31:46 +0000806 video_get_info_str (i, info);
807 if (*info)
808 video_drawstring (VIDEO_INFO_X,
809 VIDEO_INFO_Y + i*VIDEO_FONT_HEIGHT, info);
wdenkc6097192002-11-03 00:24:07 +0000810 }
811 }
812#endif
813
814 return (video_fb_address + VIDEO_LOGO_HEIGHT * VIDEO_LINE_LEN);
815}
816#endif
817
818
819/*****************************************************************************/
820
821static int video_init(void)
822{
823 unsigned char color8;
824
825 if ((pGD=video_hw_init()) == NULL)
wdenk57b2d802003-06-27 21:31:46 +0000826 return -1;
wdenkc6097192002-11-03 00:24:07 +0000827
828 video_fb_address = (void*)VIDEO_FB_ADRS;
829#ifdef CONFIG_VIDEO_HW_CURSOR
830 video_init_hw_cursor(VIDEO_FONT_WIDTH, VIDEO_FONT_HEIGHT);
831#endif
832
833 /* Init drawing pats */
834 switch (VIDEO_DATA_FORMAT)
835 {
836 case GDF__8BIT_INDEX:
wdenk57b2d802003-06-27 21:31:46 +0000837 video_set_lut (0x01, CONSOLE_FG_COL, CONSOLE_FG_COL, CONSOLE_FG_COL);
838 video_set_lut (0x00, CONSOLE_BG_COL, CONSOLE_BG_COL, CONSOLE_BG_COL);
839 fgx = 0x01010101;
840 bgx = 0x00000000;
841 break;
wdenkc6097192002-11-03 00:24:07 +0000842 case GDF__8BIT_332RGB:
wdenk57b2d802003-06-27 21:31:46 +0000843 color8 = ((CONSOLE_FG_COL & 0xe0) | ((CONSOLE_FG_COL>>3) & 0x1c) | CONSOLE_FG_COL>>6);
844 fgx = (color8<<24) | (color8<<16) | (color8<<8) | color8;
845 color8 = ((CONSOLE_BG_COL & 0xe0) | ((CONSOLE_BG_COL>>3) & 0x1c) | CONSOLE_BG_COL>>6);
846 bgx = (color8<<24) | (color8<<16) | (color8<<8) | color8;
847 break;
wdenkc6097192002-11-03 00:24:07 +0000848 case GDF_15BIT_555RGB:
wdenk57b2d802003-06-27 21:31:46 +0000849 fgx = (((CONSOLE_FG_COL>>3)<<26) | ((CONSOLE_FG_COL>>3)<<21) | ((CONSOLE_FG_COL>>3)<<16) |
850 ((CONSOLE_FG_COL>>3)<<10) | ((CONSOLE_FG_COL>>3)<<5) | (CONSOLE_FG_COL>>3));
851 bgx = (((CONSOLE_BG_COL>>3)<<26) | ((CONSOLE_BG_COL>>3)<<21) | ((CONSOLE_BG_COL>>3)<<16) |
852 ((CONSOLE_BG_COL>>3)<<10) | ((CONSOLE_BG_COL>>3)<<5) | (CONSOLE_BG_COL>>3));
853 break;
wdenkc6097192002-11-03 00:24:07 +0000854 case GDF_16BIT_565RGB:
wdenk57b2d802003-06-27 21:31:46 +0000855 fgx = (((CONSOLE_FG_COL>>3)<<27) | ((CONSOLE_FG_COL>>2)<<21) | ((CONSOLE_FG_COL>>3)<<16) |
856 ((CONSOLE_FG_COL>>3)<<11) | ((CONSOLE_FG_COL>>2)<<5) | (CONSOLE_FG_COL>>3));
857 bgx = (((CONSOLE_BG_COL>>3)<<27) | ((CONSOLE_BG_COL>>2)<<21) | ((CONSOLE_BG_COL>>3)<<16) |
858 ((CONSOLE_BG_COL>>3)<<11) | ((CONSOLE_BG_COL>>2)<<5) | (CONSOLE_BG_COL>>3));
859 break;
wdenkc6097192002-11-03 00:24:07 +0000860 case GDF_32BIT_X888RGB:
wdenk57b2d802003-06-27 21:31:46 +0000861 fgx = (CONSOLE_FG_COL<<16) | (CONSOLE_FG_COL<<8) | CONSOLE_FG_COL;
862 bgx = (CONSOLE_BG_COL<<16) | (CONSOLE_BG_COL<<8) | CONSOLE_BG_COL;
863 break;
wdenkc6097192002-11-03 00:24:07 +0000864 case GDF_24BIT_888RGB:
wdenk57b2d802003-06-27 21:31:46 +0000865 fgx = (CONSOLE_FG_COL<<24) | (CONSOLE_FG_COL<<16) | (CONSOLE_FG_COL<<8) | CONSOLE_FG_COL;
866 bgx = (CONSOLE_BG_COL<<24) | (CONSOLE_BG_COL<<16) | (CONSOLE_BG_COL<<8) | CONSOLE_BG_COL;
867 break;
wdenkc6097192002-11-03 00:24:07 +0000868 }
869 eorx = fgx ^ bgx;
870
871#ifdef CONFIG_VIDEO_LOGO
872 /* Plot the logo and get start point of console */
873 PRINTD("Video: Drawing the logo ...\n");
874 video_console_address = video_logo();
875#else
876 video_console_address = video_fb_address;
877#endif
878
879 /* Initialize the console */
880 console_col = 0;
881 console_row = 0;
882
883 return 0 ;
884}
885
886
887/*****************************************************************************/
888
889int drv_video_init (void)
890{
891 int skip_dev_init;
892 device_t console_dev;
893 char *penv;
894
895 skip_dev_init = 0;
896
897 /* Force console i/o to serial ? */
898 if ((penv = getenv ("console")) != NULL)
wdenk57b2d802003-06-27 21:31:46 +0000899 if (strcmp (penv, "serial") == 0)
900 return 0;
wdenkc6097192002-11-03 00:24:07 +0000901
902 /* Init video chip - returns with framebuffer cleared */
903 if (video_init() == -1)
wdenk57b2d802003-06-27 21:31:46 +0000904 skip_dev_init = 1;
wdenkc6097192002-11-03 00:24:07 +0000905#ifdef CONFIG_VGA_AS_SINGLE_DEVICE
906 /* Devices VGA and Keyboard will be assigned seperately */
907 /* Init vga device */
908 if (!skip_dev_init)
909 {
wdenk57b2d802003-06-27 21:31:46 +0000910 memset (&console_dev, 0, sizeof(console_dev));
911 strcpy(console_dev.name, "vga");
912 console_dev.ext = DEV_EXT_VIDEO; /* Video extensions */
913 console_dev.flags = DEV_FLAGS_OUTPUT | DEV_FLAGS_SYSTEM;
914 console_dev.putc = video_putc; /* 'putc' function */
915 console_dev.puts = video_puts; /* 'puts' function */
916 console_dev.tstc = NULL; /* 'tstc' function */
917 console_dev.getc = NULL; /* 'getc' function */
wdenkc6097192002-11-03 00:24:07 +0000918
wdenk57b2d802003-06-27 21:31:46 +0000919 if (device_register (&console_dev) == 0)
920 return 1;
wdenkc6097192002-11-03 00:24:07 +0000921 }
922#else
923 PRINTD("KBD: Keyboard init ...\n");
924 if (VIDEO_KBD_INIT_FCT == -1)
wdenk57b2d802003-06-27 21:31:46 +0000925 skip_dev_init = 1;
wdenkc6097192002-11-03 00:24:07 +0000926
927 /* Init console device */
928 if (!skip_dev_init)
929 {
wdenk57b2d802003-06-27 21:31:46 +0000930 memset (&console_dev, 0, sizeof(console_dev));
931 strcpy(console_dev.name, "console");
932 console_dev.ext = DEV_EXT_VIDEO; /* Video extensions */
933 console_dev.flags = DEV_FLAGS_OUTPUT | DEV_FLAGS_INPUT | DEV_FLAGS_SYSTEM;
934 console_dev.putc = video_putc; /* 'putc' function */
935 console_dev.puts = video_puts; /* 'puts' function */
936 console_dev.tstc = VIDEO_TSTC_FCT; /* 'tstc' function */
937 console_dev.getc = VIDEO_GETC_FCT; /* 'getc' function */
wdenkc6097192002-11-03 00:24:07 +0000938
wdenk57b2d802003-06-27 21:31:46 +0000939 if (device_register (&console_dev) == 0)
940 return 1;
wdenkc6097192002-11-03 00:24:07 +0000941 }
942#endif /* CONFIG_VGA_AS_SINGLE_DEVICE */
943 /* No console dev available */
944 return 0;
945}
946
947#endif /* CONFIG_CFB_CONSOLE */