1
/* term.h - definitions for terminal handling */
3
* GRUB -- GRand Unified Bootloader
4
* Copyright (C) 2002 Free Software Foundation, Inc.
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2 of the License, or
9
* (at your option) any later version.
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21
#ifndef GRUB_TERM_HEADER
22
#define GRUB_TERM_HEADER 1
24
/* These are used to represent the various color states we use */
27
/* represents the color used to display all text that does not use the user
28
* defined colors below
31
/* represents the user defined colors for normal text */
33
/* represents the user defined colors for highlighted text */
39
/* Flags for representing the capabilities of a terminal. */
40
/* Some notes about the flags:
41
- These flags are used by higher-level functions but not terminals
43
- If a terminal is dumb, you may assume that only putchar, getkey and
45
- Some fancy features (nocursor, setcolor, and highlight) can be set to
48
/* Set when input characters shouldn't be echoed back. */
49
#define TERM_NO_ECHO (1 << 0)
50
/* Set when the editing feature should be disabled. */
51
#define TERM_NO_EDIT (1 << 1)
52
/* Set when the terminal cannot do fancy things. */
53
#define TERM_DUMB (1 << 2)
54
/* Set when the terminal needs to be initialized. */
55
#define TERM_NEED_INIT (1 << 16)
59
/* The name of a terminal. */
61
/* The feature flags defined above. */
63
/* Default for maximum number of lines if not specified */
64
unsigned short max_lines;
65
/* Put a character. */
66
void (*putchar) (int c);
67
/* Check if any input character is available. */
68
int (*checkkey) (void);
69
/* Get a character. */
71
/* Get the cursor position. The return value is ((X << 8) | Y). */
73
/* Go to the position (X, Y). */
74
void (*gotoxy) (int x, int y);
75
/* Clear the screen. */
77
/* Set the current color to be used */
78
void (*setcolorstate) (color_state state);
79
/* Set the normal color and the highlight color. The format of each
81
void (*setcolor) (int normal_color, int highlight_color);
82
/* Turn on/off the cursor. */
83
int (*setcursor) (int on);
85
/* function to start a terminal */
86
int (*startup) (void);
87
/* function to use to shutdown a terminal */
88
void (*shutdown) (void);
91
/* This lists up available terminals. */
92
extern struct term_entry term_table[];
93
/* This points to the current terminal. This is useful, because only
94
a single terminal is enabled normally. */
95
extern struct term_entry *current_term;
97
#endif /* ! STAGE1_5 */
99
/* The console stuff. */
100
extern int console_current_color;
101
void console_putchar (int c);
104
int console_checkkey (void);
105
int console_getkey (void);
106
int console_getxy (void);
107
void console_gotoxy (int x, int y);
108
void console_cls (void);
109
void console_setcolorstate (color_state state);
110
void console_setcolor (int normal_color, int highlight_color);
111
int console_setcursor (int on);
114
#ifdef SUPPORT_SERIAL
115
void serial_putchar (int c);
116
int serial_checkkey (void);
117
int serial_getkey (void);
118
int serial_getxy (void);
119
void serial_gotoxy (int x, int y);
120
void serial_cls (void);
121
void serial_setcolorstate (color_state state);
124
#ifdef SUPPORT_HERCULES
125
void hercules_putchar (int c);
126
int hercules_getxy (void);
127
void hercules_gotoxy (int x, int y);
128
void hercules_cls (void);
129
void hercules_setcolorstate (color_state state);
130
void hercules_setcolor (int normal_color, int highlight_color);
131
int hercules_setcursor (int on);
134
#ifdef SUPPORT_GRAPHICS
135
extern int foreground, background, border, graphics_inited;
137
void graphics_set_splash(char *splashfile);
138
int set_videomode (int mode);
139
void graphics_putchar (int c);
140
int graphics_getxy(void);
141
void graphics_gotoxy(int x, int y);
142
void graphics_cls(void);
143
void graphics_setcolorstate (color_state state);
144
void graphics_setcolor (int normal_color, int highlight_color);
145
int graphics_setcursor (int on);
146
int graphics_init(void);
147
void graphics_end(void);
150
void graphics_set_palette(int idx, int red, int green, int blue);
151
#endif /* SUPPORT_GRAPHICS */
153
#endif /* ! GRUB_TERM_HEADER */