2 * GRUB -- GRand Unified Bootloader
3 * Copyright (C) 2002,2003,2005,2007,2008,2009 Free Software Foundation, Inc.
5 * GRUB is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * GRUB is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
19 #include <grub/machine/memory.h>
20 #include <grub/machine/console.h>
21 #include <grub/term.h>
22 #include <grub/types.h>
24 static const struct grub_machine_bios_data_area
*bios_data_area
=
25 (struct grub_machine_bios_data_area
*) GRUB_MEMORY_MACHINE_BIOS_DATA_AREA_ADDR
;
28 grub_console_getkeystatus (struct grub_term_input
*term
__attribute__ ((unused
)))
30 /* conveniently GRUB keystatus is modelled after BIOS one. */
31 return bios_data_area
->keyboard_flag_lower
& ~0x80;
34 static struct grub_term_input grub_console_term_input
=
37 .getkey
= grub_console_getkey
,
38 .getkeystatus
= grub_console_getkeystatus
41 static struct grub_term_output grub_console_term_output
=
44 .putchar
= grub_console_putchar
,
45 .getwh
= grub_console_getwh
,
46 .getxy
= grub_console_getxy
,
47 .gotoxy
= grub_console_gotoxy
,
48 .cls
= grub_console_cls
,
49 .setcolorstate
= grub_console_setcolorstate
,
50 .setcursor
= grub_console_setcursor
,
51 .flags
= GRUB_TERM_CODE_TYPE_CP437
,
52 .normal_color
= GRUB_TERM_DEFAULT_NORMAL_COLOR
,
53 .highlight_color
= GRUB_TERM_DEFAULT_HIGHLIGHT_COLOR
,
57 grub_console_init (void)
59 grub_term_register_output ("console", &grub_console_term_output
);
60 grub_term_register_input ("console", &grub_console_term_input
);
64 grub_console_fini (void)
66 grub_term_unregister_input (&grub_console_term_input
);
67 grub_term_unregister_output (&grub_console_term_output
);