static struct term_state ts;
static struct ansi_ops op = {
- .erase = vesacon_erase,
- .write_char = vesacon_write_char,
- .showcursor = vesacon_showcursor,
- .set_cursor = __vesacon_set_cursor, /* in drawtxt.c */
- .scroll_up = vesacon_scroll_up,
- .beep = __ansicon_beep,
+ .erase = vesacon_erase,
+ .write_char = vesacon_write_char,
+ .showcursor = vesacon_showcursor,
+ .set_cursor = __vesacon_set_cursor, /* in drawtxt.c */
+ .scroll_up = vesacon_scroll_up,
+ .beep = __ansicon_beep,
};
-static struct term_info ti =
- {
- .cols = TEXT_PIXEL_COLS/FONT_WIDTH,
+static struct term_info ti = {
+ .cols = TEXT_PIXEL_COLS / FONT_WIDTH,
.disabled = 0,
.ts = &ts,
.op = &op
- };
+};
/* Reference counter to the screen, to keep track of if we need
reinitialization. */
/* Common setup */
int __vesacon_open(struct file_info *fp)
{
- (void)fp;
-
- if (!vesacon_counter) {
- /* Are we disabled? */
- if (syslinux_serial_console_info()->flowctl & 0x8000) {
- ti.disabled = 1;
- ti.rows = 25;
- ti.cols = 80;
- } else {
- /* Switch mode */
- if (__vesacon_init()) {
- vesacon_counter = -1;
+ (void)fp;
+
+ if (!vesacon_counter) {
+ /* Are we disabled? */
+ if (syslinux_serial_console_info()->flowctl & 0x8000) {
+ ti.disabled = 1;
+ ti.rows = 25;
+ ti.cols = 80;
+ } else {
+ /* Switch mode */
+ if (__vesacon_init()) {
+ vesacon_counter = -1;
+ return EAGAIN;
+ }
+
+ /* Initial state */
+ __ansi_init(&ti);
+ ti.rows = __vesacon_text_rows;
+ }
+ } else if (vesacon_counter == -1) {
return EAGAIN;
- }
-
- /* Initial state */
- __ansi_init(&ti);
- ti.rows = __vesacon_text_rows;
}
- } else if (vesacon_counter == -1) {
- return EAGAIN;
- }
- fp->o.rows = ti.rows;
- fp->o.cols = ti.cols;
+ fp->o.rows = ti.rows;
+ fp->o.cols = ti.cols;
- vesacon_counter++;
- return 0;
+ vesacon_counter++;
+ return 0;
}
int __vesacon_close(struct file_info *fp)
{
- (void)fp;
+ (void)fp;
- vesacon_counter--;
- return 0;
+ vesacon_counter--;
+ return 0;
}
/* Erase a region of the screen */
static void vesacon_erase(const struct term_state *st,
int x0, int y0, int x1, int y1)
{
- __vesacon_erase(x0, y0, x1, y1, st->cindex);
+ __vesacon_erase(x0, y0, x1, y1, st->cindex);
}
/* Draw text on the screen */
static void vesacon_write_char(int x, int y, uint8_t ch,
const struct term_state *st)
{
- __vesacon_write_char(x, y, ch, st->cindex);
+ __vesacon_write_char(x, y, ch, st->cindex);
}
/* Show or hide the cursor */
static void vesacon_showcursor(const struct term_state *st)
{
- __vesacon_set_cursor(st->xy.x, st->xy.y, st->cursor);
+ __vesacon_set_cursor(st->xy.x, st->xy.y, st->cursor);
}
static void vesacon_scroll_up(const struct term_state *st)
{
- __vesacon_scroll_up(1, st->cindex);
+ __vesacon_scroll_up(1, st->cindex);
}
ssize_t __vesacon_write(struct file_info *fp, const void *buf, size_t count)
{
- const unsigned char *bufp = buf;
- size_t n = 0;
+ const unsigned char *bufp = buf;
+ size_t n = 0;
- (void)fp;
+ (void)fp;
- if ( ti.disabled )
- return count; /* Nothing to do */
+ if (ti.disabled)
+ return count; /* Nothing to do */
- /* This only updates the shadow text buffer... */
- while ( count-- ) {
- __ansi_putchar(&ti, *bufp++);
- n++;
- }
+ /* This only updates the shadow text buffer... */
+ while (count--) {
+ __ansi_putchar(&ti, *bufp++);
+ n++;
+ }
- /* This actually draws it */
- __vesacon_doit();
+ /* This actually draws it */
+ __vesacon_doit();
- return n;
+ return n;
}
const struct output_dev dev_vesacon_w = {
- .dev_magic = __DEV_MAGIC,
- .flags = __DEV_TTY | __DEV_OUTPUT,
- .fileflags = O_WRONLY | O_CREAT | O_TRUNC | O_APPEND,
- .write = __vesacon_write,
- .close = __vesacon_close,
- .open = __vesacon_open,
- .fallback = &dev_ansicon_w,
+ .dev_magic = __DEV_MAGIC,
+ .flags = __DEV_TTY | __DEV_OUTPUT,
+ .fileflags = O_WRONLY | O_CREAT | O_TRUNC | O_APPEND,
+ .write = __vesacon_write,
+ .close = __vesacon_close,
+ .open = __vesacon_open,
+ .fallback = &dev_ansicon_w,
};