[OpenBIOS] r343 - in openbios-devel: arch/ppc arch/ppc/qemu arch/sparc32 arch/sparc64 include include/openbios modules

svn at openbios.org svn at openbios.org
Fri Jan 2 15:53:33 CET 2009


Author: blueswirl
Date: 2009-01-02 15:53:33 +0100 (Fri, 02 Jan 2009)
New Revision: 343

Added:
   openbios-devel/modules/console_common.c
Removed:
   openbios-devel/modules/console.c
Modified:
   openbios-devel/arch/ppc/build.xml
   openbios-devel/arch/ppc/qemu/console.c
   openbios-devel/arch/sparc32/console.c
   openbios-devel/arch/sparc32/openbios.c
   openbios-devel/arch/sparc64/openbios.c
   openbios-devel/include/openbios/drivers.h
   openbios-devel/include/video_subr.h
   openbios-devel/modules/build.xml
   openbios-devel/modules/video.c
Log:
Clean up video routines

Modified: openbios-devel/arch/ppc/build.xml
===================================================================
--- openbios-devel/arch/ppc/build.xml	2009-01-02 13:32:15 UTC (rev 342)
+++ openbios-devel/arch/ppc/build.xml	2009-01-02 14:53:33 UTC (rev 343)
@@ -231,8 +231,9 @@
   </object>
   <external-object source="libqemu.a"/>
   <external-object source="libbootstrap.a"/>
+  <external-object source="libdrivers.a"/>
+  <!-- Needs to be after drivers to avoid missing symbols -->
   <external-object source="libmodules.a"/>
-  <external-object source="libdrivers.a"/>
   <external-object source="liblibc.a"/>
   <external-object source="libfs.a"/>
   <external-object source="libgcc.a"/>

Modified: openbios-devel/arch/ppc/qemu/console.c
===================================================================
--- openbios-devel/arch/ppc/qemu/console.c	2009-01-02 13:32:15 UTC (rev 342)
+++ openbios-devel/arch/ppc/qemu/console.c	2009-01-02 14:53:33 UTC (rev 343)
@@ -17,6 +17,7 @@
 #include "libc/diskio.h"
 #include "ofmem.h"
 #include "qemu/qemu.h"
+#include "video_subr.h"
 
 #ifdef CONFIG_DEBUG_CONSOLE
 
@@ -125,14 +126,6 @@
 }
 #endif	// CONFIG_DEBUG_CONSOLE_SERIAL
 
-typedef struct osi_fb_info {
-	unsigned long   mphys;
-	int             rb, w, h, depth;
-} osi_fb_info_t;
-
-#include "../../../modules/video.c"
-#include "../../../modules/console.c"
-
 /* ******************************************************************
  *      common functions, implementing simple concurrent console
  * ****************************************************************** */

Modified: openbios-devel/arch/sparc32/console.c
===================================================================
--- openbios-devel/arch/sparc32/console.c	2009-01-02 13:32:15 UTC (rev 342)
+++ openbios-devel/arch/sparc32/console.c	2009-01-02 14:53:33 UTC (rev 343)
@@ -9,6 +9,7 @@
 #include "openbios/kernel.h"
 #include "openbios/drivers.h"
 #include "openbios.h"
+#include "video_subr.h"
 
 #ifdef CONFIG_DEBUG_CONSOLE
 
@@ -24,16 +25,8 @@
 #define DAC_SIZE  16
 
 unsigned char *vmem;
-static volatile uint32_t *dac;
+volatile uint32_t *dac;
 
-typedef struct osi_fb_info {
-	unsigned long   mphys;
-	int             rb, w, h, depth;
-} osi_fb_info_t;
-
-#include "../../modules/video.c"
-#include "../../modules/console.c"
-
 static void video_putchar(int c)
 {
     char buf[2];

Modified: openbios-devel/arch/sparc32/openbios.c
===================================================================
--- openbios-devel/arch/sparc32/openbios.c	2009-01-02 13:32:15 UTC (rev 342)
+++ openbios-devel/arch/sparc32/openbios.c	2009-01-02 14:53:33 UTC (rev 343)
@@ -17,6 +17,7 @@
 #include "sys_info.h"
 #include "openbios.h"
 #include "boot.h"
+#include "video_subr.h"
 
 int qemu_machine_type;
 

Modified: openbios-devel/arch/sparc64/openbios.c
===================================================================
--- openbios-devel/arch/sparc64/openbios.c	2009-01-02 13:32:15 UTC (rev 342)
+++ openbios-devel/arch/sparc64/openbios.c	2009-01-02 14:53:33 UTC (rev 343)
@@ -28,6 +28,7 @@
 #include "libc/vsprintf.h"
 #define NO_QEMU_PROTOS
 #include "openbios/fw_cfg.h"
+#include "video_subr.h"
 
 #define BIOS_CFG_CMD  0x510
 #define BIOS_CFG_DATA 0x511

Modified: openbios-devel/include/openbios/drivers.h
===================================================================
--- openbios-devel/include/openbios/drivers.h	2009-01-02 13:32:15 UTC (rev 342)
+++ openbios-devel/include/openbios/drivers.h	2009-01-02 14:53:33 UTC (rev 343)
@@ -13,18 +13,6 @@
 
 #include "openbios/config.h"
 
-/* modules/video.c */
-int video_get_res(int *w, int *h);
-void draw_pixel(int x, int y, int colind);
-void set_color(int ind, ulong color);
-void video_scroll(int height);
-void init_video(unsigned long fb, int width, int height, int depth, int rb);
-
-/* modules/console.c */
-int console_draw_str(const char *str);
-void console_close(void);
-void cls(void);
-
 #ifdef CONFIG_DRIVER_PCI
 /* drivers/pci.c */
 int ob_pci_init(void);

Modified: openbios-devel/include/video_subr.h
===================================================================
--- openbios-devel/include/video_subr.h	2009-01-02 13:32:15 UTC (rev 342)
+++ openbios-devel/include/video_subr.h	2009-01-02 14:53:33 UTC (rev 343)
@@ -15,4 +15,19 @@
 void vga_vbe_init(const char *path, uint32_t fb, uint32_t fb_size,
                   unsigned long rom, uint32_t rom_size);
 
+/* modules/video.c */
+int video_get_res(int *w, int *h);
+void draw_pixel(int x, int y, int colind);
+void set_color(int ind, unsigned long color);
+void video_scroll(int height);
+void init_video(unsigned long fb, int width, int height, int depth, int rb);
+
+/* modules/console_common.c */
+int console_draw_str(const char *str);
+int console_init(void);
+void console_close(void);
+void cls(void);
+
+extern volatile uint32_t *dac;
+
 #endif /* VIDEO_SUBR_H */

Modified: openbios-devel/modules/build.xml
===================================================================
--- openbios-devel/modules/build.xml	2009-01-02 13:32:15 UTC (rev 342)
+++ openbios-devel/modules/build.xml	2009-01-02 14:53:33 UTC (rev 343)
@@ -6,6 +6,8 @@
   <object source="bindings.c"/>
   <object source="client.c"/>
   <object source="ipchecksum.c"/>
+  <object source="video.c"/>
+  <object source="console_common.c"/>
   <object source="elfnote.c" condition="X86"/>
   <object source="elfnote.c" condition="AMD64"/>
   <object source="elfnote.c" condition="SPARC32"/>

Deleted: openbios-devel/modules/console.c
===================================================================
--- openbios-devel/modules/console.c	2009-01-02 13:32:15 UTC (rev 342)
+++ openbios-devel/modules/console.c	2009-01-02 14:53:33 UTC (rev 343)
@@ -1,329 +0,0 @@
-/*
- *	<console.c>
- *
- *	Simple text console
- *
- *   Copyright (C) 2002, 2003 Samuel Rydh (samuel at ibrium.se)
- *   Copyright (C) 2005 Stefan Reinauer <stepan at openbios.org>
- *
- *   This program is free software; you can redistribute it and/or
- *   modify it under the terms of the GNU General Public License
- *   as published by the Free Software Foundation
- *
- */
-
-#include "openbios/config.h"
-#include "openbios/bindings.h"
-#include "openbios/fontdata.h"
-
-#if !defined(fontdata)
-#if defined(CONFIG_FONT_8X8)
-#define fontdata fontdata_8x8
-#define FONT_HEIGHT FONT_HEIGHT_8X8
-#define FONT_WIDTH FONT_WIDTH_8X8
-#elif defined(CONFIG_FONT_8X16)
-#define fontdata fontdata_8x16
-#define FONT_HEIGHT FONT_HEIGHT_8X16
-#define FONT_WIDTH FONT_WIDTH_8X16
-#else
-#error no font selected
-#endif
-#endif
-
-#define FONT_ADJ_HEIGHT	 (FONT_HEIGHT + 2)
-#define NCOLS	80
-#define NROWS	48
-
-typedef enum {
-    ESnormal, ESesc, ESsquare, ESgetpars, ESgotpars, ESfunckey,
-    EShash, ESsetG0, ESsetG1, ESpercent, ESignore, ESnonstd,
-    ESpalette
-} vc_state_t;
-
-#define NPAR 16
-static struct {
-	int	inited;
-	int	physw, physh;
-	int	w,h;
-
-	int	x,y;
-	char	*buf;
-
-	int	cursor_on;
-	vc_state_t vc_state;
-	unsigned int vc_npar,vc_par[NPAR]; /* Parameters of current
-                                              escape sequence */
-} cons;
-
-static int
-get_conschar( int x, int y )
-{
-	if( (uint)x < cons.w && (uint)y < cons.h )
-		return cons.buf[y*cons.w + x];
-	return ' ';
-}
-
-static void
-draw_char( uint h, uint v )
-{
-        const unsigned char *c = fontdata;
-	int x, y, xx, rskip, m;
-	int invert = (h==cons.x && v==cons.y && cons.cursor_on);
-	int ch = get_conschar( h, v );
-
-	while( h >= cons.w || v >= cons.h )
-		return;
-
-	h *= FONT_WIDTH;
-	v *= FONT_ADJ_HEIGHT;
-
-	rskip = (FONT_WIDTH > 8)? 2 : 1;
-	c += rskip * (unsigned int)(ch & 0xff) * FONT_HEIGHT;
-
-	for( x=0; x<FONT_WIDTH; x++ ) {
-		xx = x % 8;
-		if( x && !xx )
-			c++;
-		m = (1<<(7-xx));
-		for( y=0; y<FONT_HEIGHT; y++ ){
-			int col = ((!(c[rskip*y] & m)) != invert) ? 254 : 0;
-			draw_pixel( h+x, v+y+1, col );
-		}
-		draw_pixel( h+x, v, 254 );
-		draw_pixel( h+x, v+FONT_HEIGHT+1, 254 );
-	}
-}
-
-static void
-show_cursor( int show )
-{
-	if( cons.cursor_on == show )
-		return;
-	cons.cursor_on = show;
-	draw_char( cons.x, cons.y );
-}
-
-
-static void
-draw_line( int n )
-{
-	int i;
-
-	if( n >= cons.h || n < 0 )
-		return;
-	for( i=0; i<cons.w; i++ )
-		draw_char( i, n );
-}
-
-#if 0
-static void
-refresh( void )
-{
-	int i;
-	for( i=0; i<cons.h; i++ )
-		draw_line(i);
-}
-#endif
-
-static int
-console_init( void )
-{
-	if( video_get_res(&cons.physw,&cons.physh) < 0 )
-		return -1;
-
-	set_color( 0, 0 );
-
-	cons.w = cons.physw/FONT_WIDTH;
-	cons.h = cons.physh/FONT_ADJ_HEIGHT;
-	cons.buf = malloc( cons.w * cons.h );
-	cons.inited = 1;
-	cons.x = cons.y = 0;
-        cons.vc_state = ESnormal;
-	return 0;
-}
-
-void
-console_close( void )
-{
- 	if( !cons.inited )
-		return;
-	free( cons.buf );
-	cons.inited = 0;
-}
-
-static void
-rec_char( int ch, int x, int y )
-{
-	if( (uint)x < cons.w && (uint)y < cons.h ) {
-		cons.buf[y*cons.w + x] = ch;
-		draw_char( x, y );
-	}
-}
-
-static void
-scroll1( void )
-{
-	int x;
-
-	video_scroll( FONT_ADJ_HEIGHT );
-
-	for( x=0; x<cons.w; x++ )
-		cons.buf[(cons.h-1)*cons.w + x] = 0;
-	draw_line(cons.h-1);
-}
-
-static void
-do_con_trol(int ch)
-{
-    unsigned int i, j;
-
-    switch (ch) {
-    case 8:
-        if (cons.x)
-            cons.x--;
-        return;
-    case 10 ... 12:
-        cons.x = 0;
-        cons.y++;
-        return;
-    case 13:
-        cons.x = 0;
-        return;
-    case 24:
-    case 26:
-        cons.vc_state = ESnormal;
-        return;
-    case 27:
-        cons.vc_state = ESesc;
-        return;
-    }
-
-    switch (cons.vc_state) {
-    case ESesc:
-        cons.vc_state = ESnormal;
-        switch (ch) {
-        case '[':
-            cons.vc_state = ESsquare;
-            return;
-        case 'M':
-            scroll1();
-            return;
-        default:
-            printk("Unhandled escape code '%c'\n", ch);
-            return;
-        }
-        return;
-    case ESsquare:
-        for(cons.vc_npar = 0; cons.vc_npar < NPAR ; cons.vc_npar++)
-            cons.vc_par[cons.vc_npar] = 0;
-        cons.vc_npar = 0;
-        cons.vc_state = ESgetpars;
-        // Fall through
-    case ESgetpars:
-        if (ch == ';' && cons.vc_npar < NPAR - 1) {
-            cons.vc_npar++;
-            return;
-        } else if (ch >= '0' && ch <= '9') {
-            cons.vc_par[cons.vc_npar] *= 10;
-            cons.vc_par[cons.vc_npar] += ch - '0';
-            return;
-        } else
-            cons.vc_state=ESgotpars;
-        // Fall through
-    case ESgotpars:
-        cons.vc_state = ESnormal;
-        switch(ch) {
-        case 'H':
-        case 'f':
-            if (cons.vc_par[0])
-                cons.vc_par[0]--;
-
-            if (cons.vc_par[1])
-                cons.vc_par[1]--;
-
-            cons.x = cons.vc_par[1];
-            cons.y = cons.vc_par[0];
-            return;
-        case 'J':
-            if (cons.vc_par[0] == 0 && (uint)cons.y < (uint)cons.h &&
-                (uint)cons.x < (uint)cons.w) {
-                // erase from cursor to end of display
-                for (i = cons.x; i < cons.w; i++)
-                    cons.buf[cons.y * cons.w + i] = ' ';
-                draw_line(cons.y);
-                for (j = cons.y + 1; j < cons.h; j++) {
-                    for (i = 0; i < cons.w; i++)
-                        cons.buf[j * cons.w + i] = ' ';
-                    draw_line(j);
-                }
-            }
-            return;
-        case 'K':
-            switch (cons.vc_par[0]) {
-            case 0: /* erase from cursor to end of line */
-                for (i = cons.x; i < cons.w; i++)
-                    cons.buf[cons.y * cons.w + i] = ' ';
-                draw_line(cons.y);
-                return;
-            case 1: /* erase from start of line to cursor */
-                for (i = 0; i <= cons.x; i++)
-                    cons.buf[cons.y * cons.w + i] = ' ';
-                draw_line(cons.y);
-                return;
-            case 2: /* erase whole line */
-                for (i = 0; i <= cons.w; i++)
-                    cons.buf[cons.y * cons.w + i] = ' ';
-                draw_line(cons.y);
-                return;
-            default:
-                return;
-            }
-            return;
-        case 'M':
-            scroll1();
-            return;
-        case 'm':
-            return;
-        case '@':
-            return;
-        default:
-            printk("Unhandled escape code '%c', par[%d, %d, %d, %d, %d]\n",
-                   ch, cons.vc_par[0], cons.vc_par[1], cons.vc_par[2],
-                   cons.vc_par[3], cons.vc_par[4]);
-            return;
-        }
-        return;
-    default:
-        cons.vc_state = ESnormal;
-        rec_char(ch, cons.x++, cons.y);
-        return;
-    }
-}
-
-int
-console_draw_str( const char *str )
-{
-	int ch, y, x;
-
-	if( !cons.inited && console_init() )
-		return -1;
-
-	show_cursor(0);
-	while( (ch=*str++) ) {
-		do_con_trol(ch);
-
-		if( cons.x >= cons.w ) {
-			cons.x=0, cons.y++;
-		}
-		if( cons.y >= cons.h ) {
-			for( y=0; y<cons.h-1; y++ )
-				for( x=0; x<cons.w; x++ )
-					cons.buf[y*cons.w + x] = cons.buf[(y+1)*cons.w + x];
-			cons.y = cons.h-1;
-			cons.x = 0;
-			scroll1();
-		}
-	}
-	show_cursor(1);
-	return 0;
-}

Copied: openbios-devel/modules/console_common.c (from rev 342, openbios-devel/modules/console.c)
===================================================================
--- openbios-devel/modules/console_common.c	                        (rev 0)
+++ openbios-devel/modules/console_common.c	2009-01-02 14:53:33 UTC (rev 343)
@@ -0,0 +1,330 @@
+/*
+ *	<console.c>
+ *
+ *	Simple text console
+ *
+ *   Copyright (C) 2002, 2003 Samuel Rydh (samuel at ibrium.se)
+ *   Copyright (C) 2005 Stefan Reinauer <stepan at openbios.org>
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation
+ *
+ */
+
+#include "openbios/config.h"
+#include "openbios/bindings.h"
+#include "openbios/fontdata.h"
+#include "video_subr.h"
+
+#if !defined(fontdata)
+#if defined(CONFIG_FONT_8X8)
+#define fontdata fontdata_8x8
+#define FONT_HEIGHT FONT_HEIGHT_8X8
+#define FONT_WIDTH FONT_WIDTH_8X8
+#elif defined(CONFIG_FONT_8X16)
+#define fontdata fontdata_8x16
+#define FONT_HEIGHT FONT_HEIGHT_8X16
+#define FONT_WIDTH FONT_WIDTH_8X16
+#else
+#error no font selected
+#endif
+#endif
+
+#define FONT_ADJ_HEIGHT	 (FONT_HEIGHT + 2)
+#define NCOLS	80
+#define NROWS	48
+
+typedef enum {
+    ESnormal, ESesc, ESsquare, ESgetpars, ESgotpars, ESfunckey,
+    EShash, ESsetG0, ESsetG1, ESpercent, ESignore, ESnonstd,
+    ESpalette
+} vc_state_t;
+
+#define NPAR 16
+static struct {
+	int	inited;
+	int	physw, physh;
+	int	w,h;
+
+	int	x,y;
+	char	*buf;
+
+	int	cursor_on;
+	vc_state_t vc_state;
+	unsigned int vc_npar,vc_par[NPAR]; /* Parameters of current
+                                              escape sequence */
+} cons;
+
+static int
+get_conschar( int x, int y )
+{
+	if( (uint)x < cons.w && (uint)y < cons.h )
+		return cons.buf[y*cons.w + x];
+	return ' ';
+}
+
+static void
+draw_char( uint h, uint v )
+{
+        const unsigned char *c = fontdata;
+	int x, y, xx, rskip, m;
+	int invert = (h==cons.x && v==cons.y && cons.cursor_on);
+	int ch = get_conschar( h, v );
+
+	while( h >= cons.w || v >= cons.h )
+		return;
+
+	h *= FONT_WIDTH;
+	v *= FONT_ADJ_HEIGHT;
+
+	rskip = (FONT_WIDTH > 8)? 2 : 1;
+	c += rskip * (unsigned int)(ch & 0xff) * FONT_HEIGHT;
+
+	for( x=0; x<FONT_WIDTH; x++ ) {
+		xx = x % 8;
+		if( x && !xx )
+			c++;
+		m = (1<<(7-xx));
+		for( y=0; y<FONT_HEIGHT; y++ ){
+			int col = ((!(c[rskip*y] & m)) != invert) ? 254 : 0;
+			draw_pixel( h+x, v+y+1, col );
+		}
+		draw_pixel( h+x, v, 254 );
+		draw_pixel( h+x, v+FONT_HEIGHT+1, 254 );
+	}
+}
+
+static void
+show_cursor( int show )
+{
+	if( cons.cursor_on == show )
+		return;
+	cons.cursor_on = show;
+	draw_char( cons.x, cons.y );
+}
+
+
+static void
+draw_line( int n )
+{
+	int i;
+
+	if( n >= cons.h || n < 0 )
+		return;
+	for( i=0; i<cons.w; i++ )
+		draw_char( i, n );
+}
+
+#if 0
+static void
+refresh( void )
+{
+	int i;
+	for( i=0; i<cons.h; i++ )
+		draw_line(i);
+}
+#endif
+
+int
+console_init( void )
+{
+	if( video_get_res(&cons.physw,&cons.physh) < 0 )
+		return -1;
+
+	set_color( 0, 0 );
+
+	cons.w = cons.physw/FONT_WIDTH;
+	cons.h = cons.physh/FONT_ADJ_HEIGHT;
+	cons.buf = malloc( cons.w * cons.h );
+	cons.inited = 1;
+	cons.x = cons.y = 0;
+        cons.vc_state = ESnormal;
+	return 0;
+}
+
+void
+console_close( void )
+{
+ 	if( !cons.inited )
+		return;
+	free( cons.buf );
+	cons.inited = 0;
+}
+
+static void
+rec_char( int ch, int x, int y )
+{
+	if( (uint)x < cons.w && (uint)y < cons.h ) {
+		cons.buf[y*cons.w + x] = ch;
+		draw_char( x, y );
+	}
+}
+
+static void
+scroll1( void )
+{
+	int x;
+
+	video_scroll( FONT_ADJ_HEIGHT );
+
+	for( x=0; x<cons.w; x++ )
+		cons.buf[(cons.h-1)*cons.w + x] = 0;
+	draw_line(cons.h-1);
+}
+
+static void
+do_con_trol(int ch)
+{
+    unsigned int i, j;
+
+    switch (ch) {
+    case 8:
+        if (cons.x)
+            cons.x--;
+        return;
+    case 10 ... 12:
+        cons.x = 0;
+        cons.y++;
+        return;
+    case 13:
+        cons.x = 0;
+        return;
+    case 24:
+    case 26:
+        cons.vc_state = ESnormal;
+        return;
+    case 27:
+        cons.vc_state = ESesc;
+        return;
+    }
+
+    switch (cons.vc_state) {
+    case ESesc:
+        cons.vc_state = ESnormal;
+        switch (ch) {
+        case '[':
+            cons.vc_state = ESsquare;
+            return;
+        case 'M':
+            scroll1();
+            return;
+        default:
+            printk("Unhandled escape code '%c'\n", ch);
+            return;
+        }
+        return;
+    case ESsquare:
+        for(cons.vc_npar = 0; cons.vc_npar < NPAR ; cons.vc_npar++)
+            cons.vc_par[cons.vc_npar] = 0;
+        cons.vc_npar = 0;
+        cons.vc_state = ESgetpars;
+        // Fall through
+    case ESgetpars:
+        if (ch == ';' && cons.vc_npar < NPAR - 1) {
+            cons.vc_npar++;
+            return;
+        } else if (ch >= '0' && ch <= '9') {
+            cons.vc_par[cons.vc_npar] *= 10;
+            cons.vc_par[cons.vc_npar] += ch - '0';
+            return;
+        } else
+            cons.vc_state=ESgotpars;
+        // Fall through
+    case ESgotpars:
+        cons.vc_state = ESnormal;
+        switch(ch) {
+        case 'H':
+        case 'f':
+            if (cons.vc_par[0])
+                cons.vc_par[0]--;
+
+            if (cons.vc_par[1])
+                cons.vc_par[1]--;
+
+            cons.x = cons.vc_par[1];
+            cons.y = cons.vc_par[0];
+            return;
+        case 'J':
+            if (cons.vc_par[0] == 0 && (uint)cons.y < (uint)cons.h &&
+                (uint)cons.x < (uint)cons.w) {
+                // erase from cursor to end of display
+                for (i = cons.x; i < cons.w; i++)
+                    cons.buf[cons.y * cons.w + i] = ' ';
+                draw_line(cons.y);
+                for (j = cons.y + 1; j < cons.h; j++) {
+                    for (i = 0; i < cons.w; i++)
+                        cons.buf[j * cons.w + i] = ' ';
+                    draw_line(j);
+                }
+            }
+            return;
+        case 'K':
+            switch (cons.vc_par[0]) {
+            case 0: /* erase from cursor to end of line */
+                for (i = cons.x; i < cons.w; i++)
+                    cons.buf[cons.y * cons.w + i] = ' ';
+                draw_line(cons.y);
+                return;
+            case 1: /* erase from start of line to cursor */
+                for (i = 0; i <= cons.x; i++)
+                    cons.buf[cons.y * cons.w + i] = ' ';
+                draw_line(cons.y);
+                return;
+            case 2: /* erase whole line */
+                for (i = 0; i <= cons.w; i++)
+                    cons.buf[cons.y * cons.w + i] = ' ';
+                draw_line(cons.y);
+                return;
+            default:
+                return;
+            }
+            return;
+        case 'M':
+            scroll1();
+            return;
+        case 'm':
+            return;
+        case '@':
+            return;
+        default:
+            printk("Unhandled escape code '%c', par[%d, %d, %d, %d, %d]\n",
+                   ch, cons.vc_par[0], cons.vc_par[1], cons.vc_par[2],
+                   cons.vc_par[3], cons.vc_par[4]);
+            return;
+        }
+        return;
+    default:
+        cons.vc_state = ESnormal;
+        rec_char(ch, cons.x++, cons.y);
+        return;
+    }
+}
+
+int
+console_draw_str( const char *str )
+{
+	int ch, y, x;
+
+	if( !cons.inited && console_init() )
+		return -1;
+
+	show_cursor(0);
+	while( (ch=*str++) ) {
+		do_con_trol(ch);
+
+		if( cons.x >= cons.w ) {
+			cons.x=0, cons.y++;
+		}
+		if( cons.y >= cons.h ) {
+			for( y=0; y<cons.h-1; y++ )
+				for( x=0; x<cons.w; x++ )
+					cons.buf[y*cons.w + x] = cons.buf[(y+1)*cons.w + x];
+			cons.y = cons.h-1;
+			cons.x = 0;
+			scroll1();
+		}
+	}
+	show_cursor(1);
+	return 0;
+}

Modified: openbios-devel/modules/video.c
===================================================================
--- openbios-devel/modules/video.c	2009-01-02 13:32:15 UTC (rev 342)
+++ openbios-devel/modules/video.c	2009-01-02 14:53:33 UTC (rev 343)
@@ -21,6 +21,11 @@
 #include "openbios/drivers.h"
 #include "video_subr.h"
 
+typedef struct osi_fb_info {
+    unsigned long mphys;
+    int rb, w, h, depth;
+} osi_fb_info_t;
+
 static struct {
 	int		has_video;
 	osi_fb_info_t	fb;




More information about the OpenBIOS mailing list