39 #include <linux/kernel.h>
41 #include <linux/errno.h>
45 #include <linux/module.h>
49 #include "../sticore.h"
53 static int vga_is_gfx;
59 static unsigned long softback_buf, softback_curr;
60 static unsigned long softback_in;
61 static unsigned long softback_end;
62 static int softback_lines;
65 static int cursor_drawn;
66 #define CURSOR_DRAW_DELAY (1)
67 #define DEFAULT_CURSOR_BLINK_RATE (20)
69 static int vbl_cursor_cnt;
71 static inline void cursor_undrawn(
void)
77 static const char *sticon_startup(
void)
82 static int sticon_set_palette(
struct vc_data *
c,
unsigned char *
table)
87 static void sticon_putc(
struct vc_data *conp,
int c,
int ypos,
int xpos)
89 int redraw_cursor = 0;
97 if ((
p->cursor_x == xpos) && (
p->cursor_y == ypos)) {
103 sti_putc(sticon_sti, c, ypos, xpos);
109 static void sticon_putcs(
struct vc_data *conp,
const unsigned short *
s,
110 int count,
int ypos,
int xpos)
112 int redraw_cursor = 0;
121 if ((
p->cursor_y == ypos) && (xpos <= p->cursor_x) &&
122 (
p->cursor_x < (xpos + count))) {
136 static void sticon_cursor(
struct vc_data *conp,
int mode)
153 sti_putc(sticon_sti, (car1 & 255) + (0 << 8) + (7 << 11),
161 static int sticon_scroll(
struct vc_data *conp,
int t,
int b,
int dir,
int count)
185 static void sticon_bmove(
struct vc_data *conp,
int sy,
int sx,
188 if (!width || !height)
191 if (((sy <= p->cursor_y) && (
p->cursor_y < sy+height) &&
192 (sx <= p->cursor_x) && (
p->cursor_x < sx+width)) ||
193 ((dy <= p->cursor_y) && (
p->cursor_y < dy+height) &&
194 (dx <= p->cursor_x) && (
p->cursor_x < dx+width)))
198 sti_bmove(sticon_sti, sy, sx, dy, dx, height, width);
201 static void sticon_init(
struct vc_data *c,
int init)
204 int vc_cols, vc_rows;
222 static void sticon_deinit(
struct vc_data *c)
226 static void sticon_clear(
struct vc_data *conp,
int sy,
int sx,
int height,
229 if (!height || !width)
235 static int sticon_switch(
struct vc_data *conp)
240 static int sticon_set_origin(
struct vc_data *conp)
245 static int sticon_blank(
struct vc_data *c,
int blank,
int mode_switch)
252 sticon_set_origin(c);
259 static int sticon_scrolldelta(
struct vc_data *conp,
int lines)
272 if (line >= softback_lines)
274 p = softback_curr +
offset;
275 if (p >= softback_end)
276 p += softback_buf - softback_end;
280 static unsigned long sticon_getxy(
struct vc_data *conp,
unsigned long pos,
285 if (pos >= conp->
vc_origin && pos < conp->vc_scr_end) {
286 unsigned long offset = (pos - conp->
vc_origin) / 2;
292 ret = pos + (conp->
vc_cols -
x) * 2;
294 unsigned long offset = pos - softback_curr;
296 if (pos < softback_curr)
297 offset += softback_end - softback_buf;
301 ret = pos + (conp->
vc_cols -
x) * 2;
302 if (ret == softback_end)
304 if (ret == softback_in)
317 u8 blink,
u8 underline,
u8 reverse,
u8 italic)
319 u8 attr = ((color & 0x70) >> 1) | ((color & 7));
322 color = ((color >> 3) & 0x7) | ((color & 0x7) << 3);
328 static void sticon_invert_region(
struct vc_data *conp,
u16 *p,
int count)
336 a = ((
a) & 0x88ff) | (((
a) & 0x7000) >> 4) | (((a) & 0x0700) << 4);
338 a = ((a & 0x0700) == 0x0100) ? 0x7000 : 0x7700;
344 static void sticon_save_screen(
struct vc_data *conp)
348 static const struct consw sti_con = {
350 .con_startup = sticon_startup,
351 .con_init = sticon_init,
352 .con_deinit = sticon_deinit,
353 .con_clear = sticon_clear,
354 .con_putc = sticon_putc,
355 .con_putcs = sticon_putcs,
356 .con_cursor = sticon_cursor,
357 .con_scroll = sticon_scroll,
358 .con_bmove = sticon_bmove,
359 .con_switch = sticon_switch,
360 .con_blank = sticon_blank,
361 .con_set_palette = sticon_set_palette,
362 .con_scrolldelta = sticon_scrolldelta,
363 .con_set_origin = sticon_set_origin,
364 .con_save_screen = sticon_save_screen,
365 .con_build_attr = sticon_build_attr,
366 .con_invert_region = sticon_invert_region,
367 .con_screen_pos = sticon_screen_pos,
368 .con_getxy = sticon_getxy,
373 static int __init sticonsole_init(
void)