2 * arch/mips/lib/console.c
4 * Copyright (C) 1994 by Waldorf Electronic,
5 * written by Ralf Baechle and Andreas Busse
7 * This file is subject to the terms and conditions of the GNU General Public
8 * License. See the file COPYING in the main directory of this archive for
11 * FIXME: This file is hacked to be hardwired for the Deskstation
12 * Only thought as a debugging console output. It's as inefficient
13 * as a piece of code can be but probably a good piece of code to
14 * implement a preliminary console for a new target.
17 #include <linux/tty.h>
18 #include <asm/bootinfo.h>
20 static unsigned int size_x;
21 static unsigned int size_y;
22 static unsigned short cursor_x;
23 static unsigned short cursor_y;
24 static volatile unsigned short *vram_addr;
25 static int console_needs_init = 1;
27 extern struct screen_info screen_info;
29 /* ----------------------------------------------------------------------
31 * ---------------------------------------------------------------------- */
33 void init_console(void)
40 vram_addr = (unsigned short *)0xb00b8000;
42 console_needs_init = 0;
46 set_size_x(unsigned int x)
52 set_size_y(unsigned int y)
58 set_vram(unsigned short *vram)
64 set_crsr(unsigned int x, unsigned int y)
71 print_char(unsigned int x, unsigned int y, unsigned char c)
73 volatile unsigned short *caddr;
75 caddr = vram_addr + (y * size_x) + x;
76 *caddr = (*caddr & 0xff00) | 0x0f00 | (unsigned short) c;
82 volatile unsigned short *caddr;
86 for(i=0; i<size_x * (size_y-1); i++)
87 *(caddr++) = *(caddr + size_x);
91 caddr = vram_addr + (size_x * (size_y-1));
92 for(i=0; i<size_x; i++)
93 *(caddr++) = (*caddr & 0xff00) | (unsigned short) ' ';
96 void print_string(const unsigned char *str)
100 if (console_needs_init)
109 if(cursor_y == size_y)
112 cursor_y = size_y - 1;
117 print_char(cursor_x, cursor_y, c);
119 if(cursor_x == size_x)
123 if(cursor_y == size_y)
126 cursor_y = size_y - 1;