pass pointer to term to term functions
This commit is contained in:
parent
82e32bc310
commit
58664b94b7
19 changed files with 230 additions and 181 deletions
|
@ -236,7 +236,7 @@ grub_at_keyboard_getkey_noblock (void)
|
|||
}
|
||||
|
||||
static int
|
||||
grub_at_keyboard_checkkey (void)
|
||||
grub_at_keyboard_checkkey (struct grub_term_input *term __attribute__ ((unused)))
|
||||
{
|
||||
if (pending_key != -1)
|
||||
return 1;
|
||||
|
@ -250,7 +250,7 @@ grub_at_keyboard_checkkey (void)
|
|||
}
|
||||
|
||||
static int
|
||||
grub_at_keyboard_getkey (void)
|
||||
grub_at_keyboard_getkey (struct grub_term_input *term __attribute__ ((unused)))
|
||||
{
|
||||
int key;
|
||||
if (pending_key != -1)
|
||||
|
@ -267,7 +267,7 @@ grub_at_keyboard_getkey (void)
|
|||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_keyboard_controller_init (void)
|
||||
grub_keyboard_controller_init (struct grub_term_input *term __attribute__ ((unused)))
|
||||
{
|
||||
pending_key = -1;
|
||||
at_keyboard_status = 0;
|
||||
|
@ -277,7 +277,7 @@ grub_keyboard_controller_init (void)
|
|||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_keyboard_controller_fini (void)
|
||||
grub_keyboard_controller_fini (struct grub_term_input *term __attribute__ ((unused)))
|
||||
{
|
||||
grub_keyboard_controller_write (grub_keyboard_controller_orig);
|
||||
return GRUB_ERR_NONE;
|
||||
|
|
|
@ -85,7 +85,8 @@ map_char (grub_uint32_t c)
|
|||
}
|
||||
|
||||
static void
|
||||
grub_console_putchar (const struct grub_unicode_glyph *c)
|
||||
grub_console_putchar (struct grub_term_output *term __attribute__ ((unused)),
|
||||
const struct grub_unicode_glyph *c)
|
||||
{
|
||||
grub_efi_char16_t str[2 + c->ncomb];
|
||||
grub_efi_simple_text_output_interface_t *o;
|
||||
|
@ -113,7 +114,7 @@ grub_console_putchar (const struct grub_unicode_glyph *c)
|
|||
}
|
||||
|
||||
static int
|
||||
grub_console_checkkey (void)
|
||||
grub_console_checkkey (struct grub_term_input *term __attribute__ ((unused)))
|
||||
{
|
||||
grub_efi_simple_input_interface_t *i;
|
||||
grub_efi_input_key_t key;
|
||||
|
@ -208,7 +209,7 @@ grub_console_checkkey (void)
|
|||
}
|
||||
|
||||
static int
|
||||
grub_console_getkey (void)
|
||||
grub_console_getkey (struct grub_term_input *term)
|
||||
{
|
||||
grub_efi_simple_input_interface_t *i;
|
||||
grub_efi_boot_services_t *b;
|
||||
|
@ -232,7 +233,7 @@ grub_console_getkey (void)
|
|||
if (status != GRUB_EFI_SUCCESS)
|
||||
return -1;
|
||||
|
||||
grub_console_checkkey ();
|
||||
grub_console_checkkey (term);
|
||||
}
|
||||
while (read_key < 0);
|
||||
|
||||
|
@ -242,7 +243,7 @@ grub_console_getkey (void)
|
|||
}
|
||||
|
||||
static grub_uint16_t
|
||||
grub_console_getwh (void)
|
||||
grub_console_getwh (struct grub_term_output *term __attribute__ ((unused)))
|
||||
{
|
||||
grub_efi_simple_text_output_interface_t *o;
|
||||
grub_efi_uintn_t columns, rows;
|
||||
|
@ -259,7 +260,7 @@ grub_console_getwh (void)
|
|||
}
|
||||
|
||||
static grub_uint16_t
|
||||
grub_console_getxy (void)
|
||||
grub_console_getxy (struct grub_term_output *term __attribute__ ((unused)))
|
||||
{
|
||||
grub_efi_simple_text_output_interface_t *o;
|
||||
|
||||
|
@ -268,7 +269,8 @@ grub_console_getxy (void)
|
|||
}
|
||||
|
||||
static void
|
||||
grub_console_gotoxy (grub_uint8_t x, grub_uint8_t y)
|
||||
grub_console_gotoxy (struct grub_term_output *term __attribute__ ((unused)),
|
||||
grub_uint8_t x, grub_uint8_t y)
|
||||
{
|
||||
grub_efi_simple_text_output_interface_t *o;
|
||||
|
||||
|
@ -277,7 +279,7 @@ grub_console_gotoxy (grub_uint8_t x, grub_uint8_t y)
|
|||
}
|
||||
|
||||
static void
|
||||
grub_console_cls (void)
|
||||
grub_console_cls (struct grub_term_output *term __attribute__ ((unused)))
|
||||
{
|
||||
grub_efi_simple_text_output_interface_t *o;
|
||||
grub_efi_int32_t orig_attr;
|
||||
|
@ -290,7 +292,8 @@ grub_console_cls (void)
|
|||
}
|
||||
|
||||
static void
|
||||
grub_console_setcolorstate (grub_term_color_state state)
|
||||
grub_console_setcolorstate (struct grub_term_output *term __attribute__ ((unused)),
|
||||
grub_term_color_state state)
|
||||
{
|
||||
grub_efi_simple_text_output_interface_t *o;
|
||||
|
||||
|
@ -312,21 +315,24 @@ grub_console_setcolorstate (grub_term_color_state state)
|
|||
}
|
||||
|
||||
static void
|
||||
grub_console_setcolor (grub_uint8_t normal_color, grub_uint8_t highlight_color)
|
||||
grub_console_setcolor (struct grub_term_output *term __attribute__ ((unused)),
|
||||
grub_uint8_t normal_color, grub_uint8_t highlight_color)
|
||||
{
|
||||
grub_console_normal_color = normal_color;
|
||||
grub_console_highlight_color = highlight_color;
|
||||
}
|
||||
|
||||
static void
|
||||
grub_console_getcolor (grub_uint8_t *normal_color, grub_uint8_t *highlight_color)
|
||||
grub_console_getcolor (struct grub_term_output *term __attribute__ ((unused)),
|
||||
grub_uint8_t *normal_color, grub_uint8_t *highlight_color)
|
||||
{
|
||||
*normal_color = grub_console_normal_color;
|
||||
*highlight_color = grub_console_highlight_color;
|
||||
}
|
||||
|
||||
static void
|
||||
grub_console_setcursor (int on)
|
||||
grub_console_setcursor (struct grub_term_output *term __attribute__ ((unused)),
|
||||
int on)
|
||||
{
|
||||
grub_efi_simple_text_output_interface_t *o;
|
||||
|
||||
|
|
|
@ -146,10 +146,11 @@ static unsigned int calculate_normal_character_width (grub_font_t font);
|
|||
|
||||
static unsigned char calculate_character_width (struct grub_font_glyph *glyph);
|
||||
|
||||
static void grub_gfxterm_refresh (void);
|
||||
static void grub_gfxterm_refresh (struct grub_term_output *term __attribute__ ((unused)));
|
||||
|
||||
static grub_ssize_t
|
||||
grub_gfxterm_getcharwidth (const struct grub_unicode_glyph *c);
|
||||
grub_gfxterm_getcharwidth (struct grub_term_output *term __attribute__ ((unused)),
|
||||
const struct grub_unicode_glyph *c);
|
||||
|
||||
static void
|
||||
set_term_color (grub_uint8_t term_color)
|
||||
|
@ -364,7 +365,7 @@ grub_gfxterm_fullscreen (void)
|
|||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_gfxterm_term_init (void)
|
||||
grub_gfxterm_term_init (struct grub_term_output *term __attribute__ ((unused)))
|
||||
{
|
||||
char *tmp;
|
||||
grub_err_t err;
|
||||
|
@ -408,7 +409,7 @@ destroy_window (void)
|
|||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_gfxterm_term_fini (void)
|
||||
grub_gfxterm_term_fini (struct grub_term_output *term __attribute__ ((unused)))
|
||||
{
|
||||
destroy_window ();
|
||||
grub_video_restore ();
|
||||
|
@ -822,7 +823,8 @@ scroll_up (void)
|
|||
}
|
||||
|
||||
static void
|
||||
grub_gfxterm_putchar (const struct grub_unicode_glyph *c)
|
||||
grub_gfxterm_putchar (struct grub_term_output *term,
|
||||
const struct grub_unicode_glyph *c)
|
||||
{
|
||||
if (c->base == '\a')
|
||||
/* FIXME */
|
||||
|
@ -860,7 +862,7 @@ grub_gfxterm_putchar (const struct grub_unicode_glyph *c)
|
|||
|
||||
/* Calculate actual character width for glyph. This is number of
|
||||
times of normal_font_width. */
|
||||
char_width = grub_gfxterm_getcharwidth (c);
|
||||
char_width = grub_gfxterm_getcharwidth (term, c);
|
||||
|
||||
/* If we are about to exceed line length, wrap to next line. */
|
||||
if (virtual_screen.cursor_x + char_width > virtual_screen.columns)
|
||||
|
@ -959,7 +961,8 @@ calculate_character_width (struct grub_font_glyph *glyph)
|
|||
}
|
||||
|
||||
static grub_ssize_t
|
||||
grub_gfxterm_getcharwidth (const struct grub_unicode_glyph *c)
|
||||
grub_gfxterm_getcharwidth (struct grub_term_output *term __attribute__ ((unused)),
|
||||
const struct grub_unicode_glyph *c)
|
||||
{
|
||||
int dev_width;
|
||||
dev_width = grub_font_get_constructed_device_width (virtual_screen.font, c);
|
||||
|
@ -972,19 +975,20 @@ grub_gfxterm_getcharwidth (const struct grub_unicode_glyph *c)
|
|||
}
|
||||
|
||||
static grub_uint16_t
|
||||
grub_virtual_screen_getwh (void)
|
||||
grub_virtual_screen_getwh (struct grub_term_output *term __attribute__ ((unused)))
|
||||
{
|
||||
return (virtual_screen.columns << 8) | virtual_screen.rows;
|
||||
}
|
||||
|
||||
static grub_uint16_t
|
||||
grub_virtual_screen_getxy (void)
|
||||
grub_virtual_screen_getxy (struct grub_term_output *term __attribute__ ((unused)))
|
||||
{
|
||||
return ((virtual_screen.cursor_x << 8) | virtual_screen.cursor_y);
|
||||
}
|
||||
|
||||
static void
|
||||
grub_gfxterm_gotoxy (grub_uint8_t x, grub_uint8_t y)
|
||||
grub_gfxterm_gotoxy (struct grub_term_output *term __attribute__ ((unused)),
|
||||
grub_uint8_t x, grub_uint8_t y)
|
||||
{
|
||||
if (x >= virtual_screen.columns)
|
||||
x = virtual_screen.columns - 1;
|
||||
|
@ -1005,7 +1009,7 @@ grub_gfxterm_gotoxy (grub_uint8_t x, grub_uint8_t y)
|
|||
}
|
||||
|
||||
static void
|
||||
grub_virtual_screen_cls (void)
|
||||
grub_virtual_screen_cls (struct grub_term_output *term __attribute__ ((unused)))
|
||||
{
|
||||
grub_uint32_t i;
|
||||
|
||||
|
@ -1016,12 +1020,12 @@ grub_virtual_screen_cls (void)
|
|||
}
|
||||
|
||||
static void
|
||||
grub_gfxterm_cls (void)
|
||||
grub_gfxterm_cls (struct grub_term_output *term)
|
||||
{
|
||||
grub_video_color_t color;
|
||||
|
||||
/* Clear virtual screen. */
|
||||
grub_virtual_screen_cls ();
|
||||
grub_virtual_screen_cls (term);
|
||||
|
||||
/* Clear text layer. */
|
||||
grub_video_set_active_render_target (text_layer);
|
||||
|
@ -1033,11 +1037,12 @@ grub_gfxterm_cls (void)
|
|||
/* Mark virtual screen to be redrawn. */
|
||||
dirty_region_add_virtualscreen ();
|
||||
|
||||
grub_gfxterm_refresh ();
|
||||
grub_gfxterm_refresh (term);
|
||||
}
|
||||
|
||||
static void
|
||||
grub_virtual_screen_setcolorstate (grub_term_color_state state)
|
||||
grub_virtual_screen_setcolorstate (struct grub_term_output *term __attribute__ ((unused)),
|
||||
grub_term_color_state state)
|
||||
{
|
||||
switch (state)
|
||||
{
|
||||
|
@ -1062,7 +1067,8 @@ grub_virtual_screen_setcolorstate (grub_term_color_state state)
|
|||
}
|
||||
|
||||
static void
|
||||
grub_virtual_screen_setcolor (grub_uint8_t normal_color,
|
||||
grub_virtual_screen_setcolor (struct grub_term_output *term __attribute__ ((unused)),
|
||||
grub_uint8_t normal_color,
|
||||
grub_uint8_t highlight_color)
|
||||
{
|
||||
virtual_screen.normal_color_setting = normal_color;
|
||||
|
@ -1070,7 +1076,8 @@ grub_virtual_screen_setcolor (grub_uint8_t normal_color,
|
|||
}
|
||||
|
||||
static void
|
||||
grub_virtual_screen_getcolor (grub_uint8_t *normal_color,
|
||||
grub_virtual_screen_getcolor (struct grub_term_output *term __attribute__ ((unused)),
|
||||
grub_uint8_t *normal_color,
|
||||
grub_uint8_t *highlight_color)
|
||||
{
|
||||
*normal_color = virtual_screen.normal_color_setting;
|
||||
|
@ -1078,7 +1085,8 @@ grub_virtual_screen_getcolor (grub_uint8_t *normal_color,
|
|||
}
|
||||
|
||||
static void
|
||||
grub_gfxterm_setcursor (int on)
|
||||
grub_gfxterm_setcursor (struct grub_term_output *term __attribute__ ((unused)),
|
||||
int on)
|
||||
{
|
||||
if (virtual_screen.cursor_state != on)
|
||||
{
|
||||
|
@ -1092,7 +1100,7 @@ grub_gfxterm_setcursor (int on)
|
|||
}
|
||||
|
||||
static void
|
||||
grub_gfxterm_refresh (void)
|
||||
grub_gfxterm_refresh (struct grub_term_output *term __attribute__ ((unused)))
|
||||
{
|
||||
real_scroll ();
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ static const struct grub_machine_bios_data_area *bios_data_area =
|
|||
#define KEYBOARD_ALT (1 << 3)
|
||||
|
||||
static int
|
||||
grub_console_getkeystatus (void)
|
||||
grub_console_getkeystatus (struct grub_term_input *term __attribute__ ((unused)))
|
||||
{
|
||||
grub_uint8_t status = bios_data_area->keyboard_flag_lower;
|
||||
int mods = 0;
|
||||
|
|
|
@ -152,7 +152,7 @@ set_start_address (unsigned int start)
|
|||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_vga_mod_init (void)
|
||||
grub_vga_mod_init (struct grub_term_output *term __attribute__ ((unused)))
|
||||
{
|
||||
text_mode = grub_vga_set_mode (0x10);
|
||||
cursor_state = 1;
|
||||
|
@ -169,7 +169,7 @@ grub_vga_mod_init (void)
|
|||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_vga_mod_fini (void)
|
||||
grub_vga_mod_fini (struct grub_term_output *term __attribute__ ((unused)))
|
||||
{
|
||||
set_map_mask (saved_map_mask);
|
||||
grub_vga_set_mode (text_mode);
|
||||
|
@ -287,7 +287,8 @@ scroll_up (void)
|
|||
}
|
||||
|
||||
static void
|
||||
grub_vga_putchar (const struct grub_unicode_glyph *c)
|
||||
grub_vga_putchar (struct grub_term_output *term __attribute__ ((unused)),
|
||||
const struct grub_unicode_glyph *c)
|
||||
{
|
||||
#if DEBUG_VGA
|
||||
static int show = 1;
|
||||
|
@ -393,7 +394,8 @@ grub_vga_putchar (const struct grub_unicode_glyph *c)
|
|||
}
|
||||
|
||||
static grub_ssize_t
|
||||
grub_vga_getcharwidth (const struct grub_unicode_glyph *c)
|
||||
grub_vga_getcharwidth (struct grub_term_output *term __attribute__ ((unused)),
|
||||
const struct grub_unicode_glyph *c)
|
||||
{
|
||||
#if 0
|
||||
struct grub_font_glyph glyph;
|
||||
|
@ -408,19 +410,20 @@ grub_vga_getcharwidth (const struct grub_unicode_glyph *c)
|
|||
}
|
||||
|
||||
static grub_uint16_t
|
||||
grub_vga_getwh (void)
|
||||
grub_vga_getwh (struct grub_term_output *term __attribute__ ((unused)))
|
||||
{
|
||||
return (TEXT_WIDTH << 8) | TEXT_HEIGHT;
|
||||
}
|
||||
|
||||
static grub_uint16_t
|
||||
grub_vga_getxy (void)
|
||||
grub_vga_getxy (struct grub_term_output *term __attribute__ ((unused)))
|
||||
{
|
||||
return ((xpos << 8) | ypos);
|
||||
}
|
||||
|
||||
static void
|
||||
grub_vga_gotoxy (grub_uint8_t x, grub_uint8_t y)
|
||||
grub_vga_gotoxy (struct grub_term_output *term __attribute__ ((unused)),
|
||||
grub_uint8_t x, grub_uint8_t y)
|
||||
{
|
||||
if (x >= TEXT_WIDTH || y >= TEXT_HEIGHT)
|
||||
{
|
||||
|
@ -440,7 +443,7 @@ grub_vga_gotoxy (grub_uint8_t x, grub_uint8_t y)
|
|||
}
|
||||
|
||||
static void
|
||||
grub_vga_cls (void)
|
||||
grub_vga_cls (struct grub_term_output *term __attribute__ ((unused)))
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
|
@ -460,7 +463,8 @@ grub_vga_cls (void)
|
|||
}
|
||||
|
||||
static void
|
||||
grub_vga_setcolorstate (grub_term_color_state state)
|
||||
grub_vga_setcolorstate (struct grub_term_output *term __attribute__ ((unused)),
|
||||
grub_term_color_state state)
|
||||
{
|
||||
switch (state)
|
||||
{
|
||||
|
@ -479,7 +483,8 @@ grub_vga_setcolorstate (grub_term_color_state state)
|
|||
}
|
||||
|
||||
static void
|
||||
grub_vga_setcursor (int on)
|
||||
grub_vga_setcursor (struct grub_term_output *term __attribute__ ((unused)),
|
||||
int on)
|
||||
{
|
||||
if (cursor_state != on)
|
||||
{
|
||||
|
|
|
@ -84,7 +84,8 @@ inc_x (void)
|
|||
}
|
||||
|
||||
static void
|
||||
grub_vga_text_putchar (const struct grub_unicode_glyph *c)
|
||||
grub_vga_text_putchar (struct grub_term_output *term __attribute__ ((unused)),
|
||||
const struct grub_unicode_glyph *c)
|
||||
{
|
||||
switch (c->base)
|
||||
{
|
||||
|
@ -108,13 +109,14 @@ grub_vga_text_putchar (const struct grub_unicode_glyph *c)
|
|||
}
|
||||
|
||||
static grub_uint16_t
|
||||
grub_vga_text_getxy (void)
|
||||
grub_vga_text_getxy (struct grub_term_output *term __attribute__ ((unused)))
|
||||
{
|
||||
return (grub_curr_x << 8) | grub_curr_y;
|
||||
}
|
||||
|
||||
static void
|
||||
grub_vga_text_gotoxy (grub_uint8_t x, grub_uint8_t y)
|
||||
grub_vga_text_gotoxy (struct grub_term_output *term __attribute__ ((unused)),
|
||||
grub_uint8_t x, grub_uint8_t y)
|
||||
{
|
||||
grub_curr_x = x;
|
||||
grub_curr_y = y;
|
||||
|
@ -122,16 +124,17 @@ grub_vga_text_gotoxy (grub_uint8_t x, grub_uint8_t y)
|
|||
}
|
||||
|
||||
static void
|
||||
grub_vga_text_cls (void)
|
||||
grub_vga_text_cls (struct grub_term_output *term)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < ROWS * COLS; i++)
|
||||
((short *) VGA_TEXT_SCREEN)[i] = ' ' | (grub_console_cur_color << 8);
|
||||
grub_vga_text_gotoxy (0, 0);
|
||||
grub_vga_text_gotoxy (term, 0, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
grub_vga_text_setcursor (int on)
|
||||
grub_vga_text_setcursor (struct grub_term_output *term __attribute__ ((unused)),
|
||||
int on)
|
||||
{
|
||||
grub_uint8_t old;
|
||||
grub_outb (CRTC_CURSOR, CRTC_ADDR_PORT);
|
||||
|
@ -143,9 +146,9 @@ grub_vga_text_setcursor (int on)
|
|||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_vga_text_init_fini (void)
|
||||
grub_vga_text_init_fini (struct grub_term_output *term)
|
||||
{
|
||||
grub_vga_text_cls ();
|
||||
grub_vga_text_cls (term);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,13 +26,14 @@ static grub_uint8_t grub_console_normal_color = 0x7;
|
|||
static grub_uint8_t grub_console_highlight_color = 0x70;
|
||||
|
||||
grub_uint16_t
|
||||
grub_console_getwh (void)
|
||||
grub_console_getwh (struct grub_term_output *term __attribute__ ((unused)))
|
||||
{
|
||||
return (80 << 8) | 25;
|
||||
}
|
||||
|
||||
void
|
||||
grub_console_setcolorstate (grub_term_color_state state)
|
||||
grub_console_setcolorstate (struct grub_term_output *term __attribute__ ((unused)),
|
||||
grub_term_color_state state)
|
||||
{
|
||||
switch (state) {
|
||||
case GRUB_TERM_COLOR_STANDARD:
|
||||
|
@ -50,14 +51,16 @@ grub_console_setcolorstate (grub_term_color_state state)
|
|||
}
|
||||
|
||||
void
|
||||
grub_console_setcolor (grub_uint8_t normal_color, grub_uint8_t highlight_color)
|
||||
grub_console_setcolor (struct grub_term_output *term __attribute__ ((unused)),
|
||||
grub_uint8_t normal_color, grub_uint8_t highlight_color)
|
||||
{
|
||||
grub_console_normal_color = normal_color;
|
||||
grub_console_highlight_color = highlight_color;
|
||||
}
|
||||
|
||||
void
|
||||
grub_console_getcolor (grub_uint8_t *normal_color, grub_uint8_t *highlight_color)
|
||||
grub_console_getcolor (struct grub_term_output *term __attribute__ ((unused)),
|
||||
grub_uint8_t *normal_color, grub_uint8_t *highlight_color)
|
||||
{
|
||||
*normal_color = grub_console_normal_color;
|
||||
*highlight_color = grub_console_highlight_color;
|
||||
|
|
|
@ -77,7 +77,8 @@ grub_ofconsole_writeesc (const char *str)
|
|||
}
|
||||
|
||||
static void
|
||||
grub_ofconsole_putchar (const struct grub_unicode_glyph *c)
|
||||
grub_ofconsole_putchar (struct grub_term_output *term __attribute__ ((unused)),
|
||||
const struct grub_unicode_glyph *c)
|
||||
{
|
||||
char chr;
|
||||
|
||||
|
@ -109,7 +110,8 @@ grub_ofconsole_putchar (const struct grub_unicode_glyph *c)
|
|||
}
|
||||
|
||||
static void
|
||||
grub_ofconsole_setcolorstate (grub_term_color_state state)
|
||||
grub_ofconsole_setcolorstate (struct grub_term_output *term __attribute__ ((unused)),
|
||||
grub_term_color_state state)
|
||||
{
|
||||
char setcol[256];
|
||||
int fg;
|
||||
|
@ -135,7 +137,8 @@ grub_ofconsole_setcolorstate (grub_term_color_state state)
|
|||
}
|
||||
|
||||
static void
|
||||
grub_ofconsole_setcolor (grub_uint8_t normal_color,
|
||||
grub_ofconsole_setcolor (struct grub_term_output *term __attribute__ ((unused)),
|
||||
grub_uint8_t normal_color,
|
||||
grub_uint8_t highlight_color)
|
||||
{
|
||||
/* Discard bright bit. */
|
||||
|
@ -144,7 +147,8 @@ grub_ofconsole_setcolor (grub_uint8_t normal_color,
|
|||
}
|
||||
|
||||
static void
|
||||
grub_ofconsole_getcolor (grub_uint8_t *normal_color, grub_uint8_t *highlight_color)
|
||||
grub_ofconsole_getcolor (struct grub_term_output *term __attribute__ ((unused)),
|
||||
grub_uint8_t *normal_color, grub_uint8_t *highlight_color)
|
||||
{
|
||||
*normal_color = grub_ofconsole_normal_color;
|
||||
*highlight_color = grub_ofconsole_highlight_color;
|
||||
|
@ -163,7 +167,7 @@ readkey (void)
|
|||
}
|
||||
|
||||
static int
|
||||
grub_ofconsole_checkkey (void)
|
||||
grub_ofconsole_checkkey (struct grub_term_input *term __attribute__ ((unused)))
|
||||
{
|
||||
if (grub_buflen)
|
||||
return grub_keybuf[0];
|
||||
|
@ -177,7 +181,7 @@ grub_ofconsole_checkkey (void)
|
|||
}
|
||||
|
||||
static int
|
||||
grub_ofconsole_getkey (void)
|
||||
grub_ofconsole_getkey (struct grub_term_input *term __attribute__ ((unused)))
|
||||
{
|
||||
int ret;
|
||||
while (! grub_buflen)
|
||||
|
@ -190,7 +194,7 @@ grub_ofconsole_getkey (void)
|
|||
}
|
||||
|
||||
static grub_uint16_t
|
||||
grub_ofconsole_getxy (void)
|
||||
grub_ofconsole_getxy (struct grub_term_output *term __attribute__ ((unused)))
|
||||
{
|
||||
return (grub_curr_x << 8) | grub_curr_y;
|
||||
}
|
||||
|
@ -232,13 +236,14 @@ grub_ofconsole_dimensions (void)
|
|||
}
|
||||
|
||||
static grub_uint16_t
|
||||
grub_ofconsole_getwh (void)
|
||||
grub_ofconsole_getwh (struct grub_term_output *term __attribute__ ((unused)))
|
||||
{
|
||||
return (grub_ofconsole_width << 8) | grub_ofconsole_height;
|
||||
}
|
||||
|
||||
static void
|
||||
grub_ofconsole_gotoxy (grub_uint8_t x, grub_uint8_t y)
|
||||
grub_ofconsole_gotoxy (struct grub_term_output *term __attribute__ ((unused)),
|
||||
grub_uint8_t x, grub_uint8_t y)
|
||||
{
|
||||
if (! grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_NO_ANSI))
|
||||
{
|
||||
|
@ -265,17 +270,18 @@ grub_ofconsole_gotoxy (grub_uint8_t x, grub_uint8_t y)
|
|||
}
|
||||
|
||||
static void
|
||||
grub_ofconsole_cls (void)
|
||||
grub_ofconsole_cls (struct grub_term_output *term)
|
||||
{
|
||||
/* Clear the screen. Using serial console, screen(1) only recognizes the
|
||||
* ANSI escape sequence. Using video console, Apple Open Firmware (version
|
||||
* 3.1.1) only recognizes the literal ^L. So use both. */
|
||||
grub_ofconsole_writeesc ("\e[2J");
|
||||
grub_ofconsole_gotoxy (0, 0);
|
||||
grub_ofconsole_gotoxy (term, 0, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
grub_ofconsole_setcursor (int on)
|
||||
grub_ofconsole_setcursor (struct grub_term_output *term __attribute__ ((unused)),
|
||||
int on)
|
||||
{
|
||||
/* Understood by the Open Firmware flavour in OLPC. */
|
||||
if (on)
|
||||
|
@ -285,13 +291,13 @@ grub_ofconsole_setcursor (int on)
|
|||
}
|
||||
|
||||
static void
|
||||
grub_ofconsole_refresh (void)
|
||||
grub_ofconsole_refresh (struct grub_term_output *term __attribute__ ((unused)))
|
||||
{
|
||||
/* Do nothing, the current console state is ok. */
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_ofconsole_init_input (void)
|
||||
grub_ofconsole_init_input (struct grub_term_input *term __attribute__ ((unused)))
|
||||
{
|
||||
grub_ssize_t actual;
|
||||
|
||||
|
@ -304,7 +310,7 @@ grub_ofconsole_init_input (void)
|
|||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_ofconsole_init_output (void)
|
||||
grub_ofconsole_init_output (struct grub_term_output *term)
|
||||
{
|
||||
grub_ssize_t actual;
|
||||
|
||||
|
@ -328,7 +334,7 @@ grub_ofconsole_init_output (void)
|
|||
colors[col].green, colors[col].blue);
|
||||
|
||||
/* Set the right fg and bg colors. */
|
||||
grub_ofconsole_setcolorstate (GRUB_TERM_COLOR_NORMAL);
|
||||
grub_ofconsole_setcolorstate (term, GRUB_TERM_COLOR_NORMAL);
|
||||
}
|
||||
|
||||
grub_ofconsole_dimensions ();
|
||||
|
@ -336,19 +342,11 @@ grub_ofconsole_init_output (void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_ofconsole_fini (void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static struct grub_term_input grub_ofconsole_term_input =
|
||||
{
|
||||
.name = "ofconsole",
|
||||
.init = grub_ofconsole_init_input,
|
||||
.fini = grub_ofconsole_fini,
|
||||
.checkkey = grub_ofconsole_checkkey,
|
||||
.getkey = grub_ofconsole_getkey,
|
||||
};
|
||||
|
@ -357,7 +355,6 @@ static struct grub_term_output grub_ofconsole_term_output =
|
|||
{
|
||||
.name = "ofconsole",
|
||||
.init = grub_ofconsole_init_output,
|
||||
.fini = grub_ofconsole_fini,
|
||||
.putchar = grub_ofconsole_putchar,
|
||||
.getxy = grub_ofconsole_getxy,
|
||||
.getwh = grub_ofconsole_getwh,
|
||||
|
|
|
@ -154,7 +154,7 @@ serial_get_divisor (unsigned int speed)
|
|||
|
||||
/* The serial version of checkkey. */
|
||||
static int
|
||||
grub_serial_checkkey (void)
|
||||
grub_serial_checkkey (struct grub_term_input *term __attribute__ ((unused)))
|
||||
{
|
||||
if (npending)
|
||||
return input_buf[0];
|
||||
|
@ -169,7 +169,7 @@ grub_serial_checkkey (void)
|
|||
|
||||
/* The serial version of getkey. */
|
||||
static int
|
||||
grub_serial_getkey (void)
|
||||
grub_serial_getkey (struct grub_term_input *term __attribute__ ((unused)))
|
||||
{
|
||||
int ret;
|
||||
while (! npending)
|
||||
|
@ -219,8 +219,8 @@ serial_hw_init (void)
|
|||
#endif
|
||||
|
||||
/* Drain the input buffer. */
|
||||
while (grub_serial_checkkey () != -1)
|
||||
(void) grub_serial_getkey ();
|
||||
while (grub_serial_checkkey (0) != -1)
|
||||
(void) grub_serial_getkey (0);
|
||||
|
||||
/* FIXME: should check if the serial terminal was found. */
|
||||
|
||||
|
@ -229,7 +229,8 @@ serial_hw_init (void)
|
|||
|
||||
/* The serial version of putchar. */
|
||||
static void
|
||||
grub_serial_putchar (const struct grub_unicode_glyph *c)
|
||||
grub_serial_putchar (struct grub_term_output *term __attribute__ ((unused)),
|
||||
const struct grub_unicode_glyph *c)
|
||||
{
|
||||
/* Keep track of the cursor. */
|
||||
if (keep_track)
|
||||
|
@ -274,19 +275,20 @@ grub_serial_putchar (const struct grub_unicode_glyph *c)
|
|||
}
|
||||
|
||||
static grub_uint16_t
|
||||
grub_serial_getwh (void)
|
||||
grub_serial_getwh (struct grub_term_output *term __attribute__ ((unused)))
|
||||
{
|
||||
return (TEXT_WIDTH << 8) | TEXT_HEIGHT;
|
||||
}
|
||||
|
||||
static grub_uint16_t
|
||||
grub_serial_getxy (void)
|
||||
grub_serial_getxy (struct grub_term_output *term __attribute__ ((unused)))
|
||||
{
|
||||
return ((xpos << 8) | ypos);
|
||||
}
|
||||
|
||||
static void
|
||||
grub_serial_gotoxy (grub_uint8_t x, grub_uint8_t y)
|
||||
grub_serial_gotoxy (struct grub_term_output *term __attribute__ ((unused)),
|
||||
grub_uint8_t x, grub_uint8_t y)
|
||||
{
|
||||
if (x > TEXT_WIDTH || y > TEXT_HEIGHT)
|
||||
{
|
||||
|
@ -304,7 +306,7 @@ grub_serial_gotoxy (grub_uint8_t x, grub_uint8_t y)
|
|||
}
|
||||
|
||||
static void
|
||||
grub_serial_cls (void)
|
||||
grub_serial_cls (struct grub_term_output *term __attribute__ ((unused)))
|
||||
{
|
||||
keep_track = 0;
|
||||
grub_terminfo_cls (&grub_serial_term_output);
|
||||
|
@ -314,7 +316,8 @@ grub_serial_cls (void)
|
|||
}
|
||||
|
||||
static void
|
||||
grub_serial_setcolorstate (const grub_term_color_state state)
|
||||
grub_serial_setcolorstate (struct grub_term_output *term __attribute__ ((unused)),
|
||||
const grub_term_color_state state)
|
||||
{
|
||||
keep_track = 0;
|
||||
switch (state)
|
||||
|
@ -333,7 +336,8 @@ grub_serial_setcolorstate (const grub_term_color_state state)
|
|||
}
|
||||
|
||||
static void
|
||||
grub_serial_setcursor (const int on)
|
||||
grub_serial_setcursor (struct grub_term_output *term __attribute__ ((unused)),
|
||||
const int on)
|
||||
{
|
||||
if (on)
|
||||
grub_terminfo_cursor_on (&grub_serial_term_output);
|
||||
|
|
|
@ -122,7 +122,7 @@ putstr (const char *str, grub_term_output_t oterm)
|
|||
.ncomb = 0,
|
||||
.combining = 0
|
||||
};
|
||||
oterm->putchar (&c);
|
||||
oterm->putchar (oterm, &c);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -120,7 +120,7 @@ grub_usb_keyboard_getreport (grub_usb_device_t dev, grub_uint8_t *report)
|
|||
|
||||
|
||||
static int
|
||||
grub_usb_keyboard_checkkey (void)
|
||||
grub_usb_keyboard_checkkey (struct grub_term_input *term __attribute__ ((unused)))
|
||||
{
|
||||
grub_uint8_t data[8];
|
||||
int key;
|
||||
|
@ -189,7 +189,7 @@ typedef enum
|
|||
} grub_usb_keyboard_repeat_t;
|
||||
|
||||
static int
|
||||
grub_usb_keyboard_getkey (void)
|
||||
grub_usb_keyboard_getkey (struct grub_term_input *term)
|
||||
{
|
||||
int key;
|
||||
grub_err_t err;
|
||||
|
@ -202,7 +202,7 @@ grub_usb_keyboard_getkey (void)
|
|||
|
||||
do
|
||||
{
|
||||
key = grub_usb_keyboard_checkkey ();
|
||||
key = grub_usb_keyboard_checkkey (term);
|
||||
} while (key == -1);
|
||||
|
||||
data[2] = !0; /* Or whatever. */
|
||||
|
@ -254,7 +254,7 @@ grub_usb_keyboard_getkey (void)
|
|||
}
|
||||
|
||||
static int
|
||||
grub_usb_keyboard_getkeystatus (void)
|
||||
grub_usb_keyboard_getkeystatus (struct grub_term_input *term __attribute__ ((unused)))
|
||||
{
|
||||
grub_uint8_t data[8];
|
||||
int mods = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue