summaryrefslogtreecommitdiff
path: root/lib_i386/video.c
diff options
context:
space:
mode:
authorwdenk <wdenk>2003-06-27 21:31:46 +0000
committerwdenk <wdenk>2003-06-27 21:31:46 +0000
commit8bde7f776c77b343aca29b8c7b58464d915ac245 (patch)
tree20f1fd99975215e7c658454a15cdb4ed4694e2d4 /lib_i386/video.c
parent993cad9364c6b87ae429d1ed1130d8153f6f027e (diff)
downloadu-boot-imx-8bde7f776c77b343aca29b8c7b58464d915ac245.zip
u-boot-imx-8bde7f776c77b343aca29b8c7b58464d915ac245.tar.gz
u-boot-imx-8bde7f776c77b343aca29b8c7b58464d915ac245.tar.bz2
* Code cleanup:
- remove trailing white space, trailing empty lines, C++ comments, etc. - split cmd_boot.c (separate cmd_bdinfo.c and cmd_load.c) * Patches by Kenneth Johansson, 25 Jun 2003: - major rework of command structure (work done mostly by Michal Cendrowski and Joakim Kristiansen)
Diffstat (limited to 'lib_i386/video.c')
-rw-r--r--lib_i386/video.c109
1 files changed, 54 insertions, 55 deletions
diff --git a/lib_i386/video.c b/lib_i386/video.c
index 776022e..cd89457 100644
--- a/lib_i386/video.c
+++ b/lib_i386/video.c
@@ -21,14 +21,14 @@
* MA 02111-1307 USA
*/
-#include <common.h>
-#include <pci.h>
+#include <common.h>
+#include <pci.h>
#include <devices.h>
#include <i8042.h>
-#include <asm/ptrace.h>
-#include <asm/realmode.h>
-#include <asm/io.h>
-#include <asm/pci.h>
+#include <asm/ptrace.h>
+#include <asm/realmode.h>
+#include <asm/io.h>
+#include <asm/pci.h>
/* basic textmode I/O from linux kernel */
@@ -40,7 +40,7 @@ static int orig_x, orig_y;
static void beep(int dur)
{
int i;
-
+
outb_p(3, 0x61);
for (i=0;i<10*dur;i++) {
udelay(1000);
@@ -60,23 +60,23 @@ static void scroll(void)
static void __video_putc(const char c, int *x, int *y)
{
if (c == '\n') {
- (*x) = 0;
+ (*x) = 0;
if ( ++(*y) >= lines ) {
scroll();
(*y)--;
}
- } else if (c == '\b') {
+ } else if (c == '\b') {
if ((*x) != 0) {
--(*x);
- vidmem [ ( (*x) + cols * (*y) ) * 2 ] = ' ';
+ vidmem [ ( (*x) + cols * (*y) ) * 2 ] = ' ';
}
- } else if (c == '\r') {
+ } else if (c == '\r') {
(*x) = 0;
-
- } else if (c == '\a') {
+
+ } else if (c == '\a') {
beep(3);
-
- } else if (c == '\t') {
+
+ } else if (c == '\t') {
__video_putc(' ', x, y);
__video_putc(' ', x, y);
__video_putc(' ', x, y);
@@ -85,7 +85,7 @@ static void __video_putc(const char c, int *x, int *y)
__video_putc(' ', x, y);
__video_putc(' ', x, y);
__video_putc(' ', x, y);
- } else if (c == '\v') {
+ } else if (c == '\v') {
switch ((*x) % 8) {
case 0:
__video_putc(' ', x, y);
@@ -104,7 +104,7 @@ static void __video_putc(const char c, int *x, int *y)
case 1:
__video_putc(' ', x, y);
}
- } else if (c == '\f') {
+ } else if (c == '\f') {
int i;
for (i=0;i<lines*cols*2;i+=2) {
vidmem[i] = 0;
@@ -112,7 +112,7 @@ static void __video_putc(const char c, int *x, int *y)
(*x) = 0;
(*y) = 0;
} else {
- vidmem [ ( (*x) + cols * (*y) ) * 2 ] = c;
+ vidmem [ ( (*x) + cols * (*y) ) * 2 ] = c;
if ( ++(*x) >= cols ) {
(*x) = 0;
if ( ++(*y) >= lines ) {
@@ -126,15 +126,15 @@ static void __video_putc(const char c, int *x, int *y)
static void video_putc(const char c)
{
int x,y,pos;
-
+
x = orig_x;
y = orig_y;
-
+
__video_putc(c, &x, &y);
orig_x = x;
orig_y = y;
-
+
pos = (x + cols * y) * 2; /* Update cursor position */
outb_p(14, vidport);
outb_p(0xff & (pos >> 9), vidport+1);
@@ -167,72 +167,71 @@ static void video_puts(const char *s)
int video_init(void)
{
u16 pos;
-
+
static device_t vga_dev;
static device_t kbd_dev;
-
+
vidmem = (char *) 0xb8000;
vidport = 0x3d4;
lines = 25;
cols = 80;
-
+
outb_p(14, vidport);
pos = inb_p(vidport+1);
pos <<= 8;
outb_p(15, vidport);
pos |= inb_p(vidport+1);
-
+
orig_x = pos%cols;
orig_y = pos/cols;
-#if 0
+#if 0
printf("pos %x %d %d\n", pos, orig_x, orig_y);
-#endif
+#endif
if (orig_y > lines) {
orig_x = orig_y =0;
}
-
-
+
+
memset(&vga_dev, 0, sizeof(vga_dev));
- strcpy(vga_dev.name, "vga");
- vga_dev.ext = 0;
- vga_dev.flags = DEV_FLAGS_OUTPUT | DEV_FLAGS_SYSTEM;
- vga_dev.putc = video_putc; /* 'putc' function */
- vga_dev.puts = video_puts; /* 'puts' function */
- vga_dev.tstc = NULL; /* 'tstc' function */
- vga_dev.getc = NULL; /* 'getc' function */
-
- if (device_register(&vga_dev) == 0) {
- return 1;
+ strcpy(vga_dev.name, "vga");
+ vga_dev.ext = 0;
+ vga_dev.flags = DEV_FLAGS_OUTPUT | DEV_FLAGS_SYSTEM;
+ vga_dev.putc = video_putc; /* 'putc' function */
+ vga_dev.puts = video_puts; /* 'puts' function */
+ vga_dev.tstc = NULL; /* 'tstc' function */
+ vga_dev.getc = NULL; /* 'getc' function */
+
+ if (device_register(&vga_dev) == 0) {
+ return 1;
}
-
+
if (i8042_kbd_init()) {
return 1;
}
-
+
memset(&kbd_dev, 0, sizeof(kbd_dev));
- strcpy(kbd_dev.name, "kbd");
- kbd_dev.ext = 0;
- kbd_dev.flags = DEV_FLAGS_INPUT | DEV_FLAGS_SYSTEM;
- kbd_dev.putc = NULL; /* 'putc' function */
- kbd_dev.puts = NULL; /* 'puts' function */
- kbd_dev.tstc = i8042_tstc; /* 'tstc' function */
- kbd_dev.getc = i8042_getc; /* 'getc' function */
-
- if (device_register(&kbd_dev) == 0) {
- return 1;
+ strcpy(kbd_dev.name, "kbd");
+ kbd_dev.ext = 0;
+ kbd_dev.flags = DEV_FLAGS_INPUT | DEV_FLAGS_SYSTEM;
+ kbd_dev.putc = NULL; /* 'putc' function */
+ kbd_dev.puts = NULL; /* 'puts' function */
+ kbd_dev.tstc = i8042_tstc; /* 'tstc' function */
+ kbd_dev.getc = i8042_getc; /* 'getc' function */
+
+ if (device_register(&kbd_dev) == 0) {
+ return 1;
}
return 0;
}
-int drv_video_init(void)
+int drv_video_init(void)
{
if (video_bios_init()) {
return 1;
}
-
- return video_init();
+
+ return video_init();
}
-