iPXE
|
Frame buffer console. More...
#include <string.h>
#include <errno.h>
#include <assert.h>
#include <byteswap.h>
#include <ipxe/ansiesc.h>
#include <ipxe/image.h>
#include <ipxe/pixbuf.h>
#include <ipxe/umalloc.h>
#include <ipxe/console.h>
#include <ipxe/fbcon.h>
Go to the source code of this file.
Functions | |
FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
static uint32_t | fbcon_colour (struct fbcon *fbcon, uint32_t rgb) |
Calculate raw colour value. More... | |
static uint32_t | fbcon_ansi_colour (struct fbcon *fbcon, unsigned int ansicol) |
Calculate ANSI font colour. More... | |
static void | fbcon_set_default_foreground (struct fbcon *fbcon) |
Set default foreground colour. More... | |
static void | fbcon_set_default_background (struct fbcon *fbcon) |
Set default background colour. More... | |
static void | fbcon_clear (struct fbcon *fbcon, unsigned int ypos) |
Clear rows of characters. More... | |
static void | fbcon_store (struct fbcon *fbcon, struct fbcon_text_cell *cell, unsigned int xpos, unsigned int ypos) |
Store character at specified position. More... | |
static void | fbcon_draw (struct fbcon *fbcon, struct fbcon_text_cell *cell, unsigned int xpos, unsigned int ypos) |
Draw character at specified position. More... | |
static void | fbcon_redraw (struct fbcon *fbcon) |
Redraw all characters. More... | |
static void | fbcon_scroll (struct fbcon *fbcon) |
Scroll screen. More... | |
static void | fbcon_draw_cursor (struct fbcon *fbcon, int show_cursor) |
Draw character at cursor position. More... | |
static void | fbcon_handle_cup (struct ansiesc_context *ctx, unsigned int count __unused, int params[]) |
Handle ANSI CUP (cursor position) More... | |
static void | fbcon_handle_ed (struct ansiesc_context *ctx, unsigned int count __unused, int params[] __unused) |
Handle ANSI ED (erase in page) More... | |
static void | fbcon_handle_sgr (struct ansiesc_context *ctx, unsigned int count, int params[]) |
Handle ANSI SGR (set graphics rendition) More... | |
static void | fbcon_handle_dectcem_set (struct ansiesc_context *ctx, unsigned int count __unused, int params[] __unused) |
Handle ANSI DECTCEM set (show cursor) More... | |
static void | fbcon_handle_dectcem_reset (struct ansiesc_context *ctx, unsigned int count __unused, int params[] __unused) |
Handle ANSI DECTCEM reset (hide cursor) More... | |
void | fbcon_putchar (struct fbcon *fbcon, int character) |
Print a character to current cursor position. More... | |
static int | fbcon_picture_init (struct fbcon *fbcon, struct pixel_buffer *pixbuf) |
Initialise background picture. More... | |
int | fbcon_init (struct fbcon *fbcon, userptr_t start, struct fbcon_geometry *pixel, struct fbcon_colour_map *map, struct fbcon_font *font, struct console_configuration *config) |
Initialise frame buffer console. More... | |
void | fbcon_fini (struct fbcon *fbcon) |
Finalise frame buffer console. More... | |
Variables | |
static struct ansiesc_handler | fbcon_ansiesc_handlers [] |
ANSI escape sequence handlers. More... | |
Frame buffer console.
Definition in file fbcon.c.
FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
Calculate raw colour value.
fbcon | Frame buffer console |
rgb | 24-bit RGB value |
raw | Raw colour |
Definition at line 50 of file fbcon.c.
References cpu_to_le32, fbcon::map, and map.
Referenced by fbcon_ansi_colour(), fbcon_handle_sgr(), and fbcon_picture_init().
Calculate ANSI font colour.
fbcon | Frame buffer console |
ansicol | ANSI colour value (0-based) |
colour | Raw colour |
Definition at line 70 of file fbcon.c.
References fbcon_colour().
Referenced by fbcon_handle_sgr(), and fbcon_set_default_foreground().
|
static |
Set default foreground colour.
fbcon | Frame buffer console |
Definition at line 87 of file fbcon.c.
References fbcon::bold, fbcon_ansi_colour(), and fbcon::foreground.
Referenced by fbcon_handle_sgr(), and fbcon_init().
|
static |
Set default background colour.
fbcon | Frame buffer console |
Definition at line 99 of file fbcon.c.
References fbcon::background, and FBCON_TRANSPARENT.
Referenced by fbcon_handle_sgr(), and fbcon_init().
|
static |
Clear rows of characters.
fbcon | Frame buffer console |
ypos | Starting Y position |
Definition at line 111 of file fbcon.c.
References fbcon::background, fbcon::character, copy_to_user(), fbcon_text_cell::foreground, fbcon::foreground, fbcon_geometry::height, offset, fbcon_text::start, fbcon::text, and fbcon_geometry::width.
Referenced by fbcon_handle_ed(), fbcon_init(), and fbcon_scroll().
|
static |
Store character at specified position.
fbcon | Frame buffer console |
cell | Text cell |
xpos | X position |
ypos | Y position |
Definition at line 139 of file fbcon.c.
References fbcon::character, copy_to_user(), offset, fbcon_text::start, fbcon::text, and fbcon_geometry::width.
Referenced by fbcon_putchar().
|
static |
Draw character at specified position.
fbcon | Frame buffer console |
cell | Text cell |
xpos | X position |
ypos | Y position |
Definition at line 157 of file fbcon.c.
References fbcon_text_cell::background, fbcon_text_cell::character, fbcon::character, copy_to_user(), FBCON_CHAR_WIDTH, FBCON_TRANSPARENT, fbcon::font, fbcon_text_cell::foreground, fbcon_font::glyph, fbcon_font::height, fbcon::indent, fbcon_geometry::len, memcpy_user(), memset_user(), offset, fbcon::picture, fbcon::pixel, src, fbcon_picture::start, fbcon::start, and fbcon_geometry::stride.
Referenced by fbcon_draw_cursor(), fbcon_putchar(), and fbcon_redraw().
|
static |
Redraw all characters.
fbcon | Frame buffer console |
Definition at line 220 of file fbcon.c.
References fbcon::character, copy_from_user(), fbcon_draw(), fbcon_geometry::height, offset, fbcon_text::start, fbcon::text, and fbcon_geometry::width.
Referenced by fbcon_handle_ed(), and fbcon_scroll().
|
static |
Scroll screen.
fbcon | Frame buffer console |
Definition at line 242 of file fbcon.c.
References assert(), fbcon::character, fbcon_clear(), fbcon_redraw(), fbcon_geometry::height, memmove_user(), fbcon_text::start, fbcon::text, fbcon_geometry::width, and fbcon::ypos.
Referenced by fbcon_putchar().
|
static |
Draw character at cursor position.
fbcon | Frame buffer console |
show_cursor | Show cursor |
Definition at line 267 of file fbcon.c.
References fbcon_text_cell::background, fbcon::background, fbcon::character, copy_from_user(), fbcon_draw(), FBCON_TRANSPARENT, fbcon_text_cell::foreground, fbcon::foreground, offset, fbcon_text::start, fbcon::text, fbcon_geometry::width, fbcon::xpos, and fbcon::ypos.
Referenced by fbcon_handle_cup(), fbcon_handle_dectcem_reset(), fbcon_handle_dectcem_set(), fbcon_handle_ed(), and fbcon_putchar().
|
static |
Handle ANSI CUP (cursor position)
ctx | ANSI escape sequence context |
count | Parameter count |
params[0] | Row (1 is top) |
params[1] | Column (1 is left) |
Definition at line 290 of file fbcon.c.
References fbcon::character, container_of, ctx, cx, fbcon_draw_cursor(), fbcon_geometry::height, fbcon::show_cursor, fbcon_geometry::width, fbcon::xpos, and fbcon::ypos.
|
static |
Handle ANSI ED (erase in page)
ctx | ANSI escape sequence context |
count | Parameter count |
params[0] | Region to erase |
Definition at line 313 of file fbcon.c.
References ANSIESC_ED_ALL, assert(), container_of, ctx, fbcon_clear(), fbcon_draw_cursor(), fbcon_redraw(), fbcon::show_cursor, fbcon::xpos, and fbcon::ypos.
|
static |
Handle ANSI SGR (set graphics rendition)
ctx | ANSI escape sequence context |
count | Parameter count |
params | List of graphic rendition aspects |
Definition at line 340 of file fbcon.c.
References fbcon::background, fbcon::bold, container_of, count, ctx, end, fbcon_ansi_colour(), FBCON_BOLD, fbcon_colour(), fbcon_set_default_background(), fbcon_set_default_foreground(), fbcon::foreground, and NULL.
|
static |
Handle ANSI DECTCEM set (show cursor)
ctx | ANSI escape sequence context |
count | Parameter count |
params | List of graphic rendition aspects |
Definition at line 400 of file fbcon.c.
References container_of, ctx, fbcon_draw_cursor(), and fbcon::show_cursor.
|
static |
Handle ANSI DECTCEM reset (hide cursor)
ctx | ANSI escape sequence context |
count | Parameter count |
params | List of graphic rendition aspects |
Definition at line 416 of file fbcon.c.
References container_of, ctx, fbcon_draw_cursor(), and fbcon::show_cursor.
void fbcon_putchar | ( | struct fbcon * | fbcon, |
int | character | ||
) |
Print a character to current cursor position.
fbcon | Frame buffer console |
character | Character |
Definition at line 441 of file fbcon.c.
References ansiesc_process(), fbcon_text_cell::background, fbcon::background, fbcon::bold, fbcon_text_cell::character, fbcon::character, fbcon::ctx, fbcon_draw(), fbcon_draw_cursor(), fbcon_scroll(), fbcon_store(), fbcon_text_cell::foreground, fbcon::foreground, fbcon_geometry::height, fbcon::show_cursor, fbcon::utf8, utf8_accumulate(), fbcon_geometry::width, fbcon::xpos, and fbcon::ypos.
Referenced by efifb_putchar(), and vesafb_putchar().
|
static |
Initialise background picture.
fbcon | Frame buffer console |
pixbuf | Background picture |
rc | Return status code |
Definition at line 506 of file fbcon.c.
References copy_from_user(), copy_to_user(), pixel_buffer::data, DBGC, ENOMEM, fbcon_colour(), pixel_buffer::height, fbcon_geometry::height, len, fbcon_geometry::len, memset_user(), offset, fbcon::picture, fbcon::pixel, raw, rc, fbcon_picture::start, fbcon_geometry::stride, ufree(), umalloc(), pixel_buffer::width, and fbcon_geometry::width.
Referenced by fbcon_init().
int fbcon_init | ( | struct fbcon * | fbcon, |
userptr_t | start, | ||
struct fbcon_geometry * | pixel, | ||
struct fbcon_colour_map * | map, | ||
struct fbcon_font * | font, | ||
struct console_configuration * | config | ||
) |
Initialise frame buffer console.
fbcon | Frame buffer console |
start | Start address |
pixel | Pixel geometry |
map | Colour mapping |
font | Font definition |
config | Console configuration |
rc | Return status code |
Definition at line 588 of file fbcon.c.
References assert(), console_configuration::bottom, bottom, fbcon_margin::bottom, fbcon::character, console_set_size(), fbcon::ctx, DBGC, EINVAL, ENOMEM, fbcon_ansiesc_handlers, FBCON_CHAR_WIDTH, fbcon_clear(), fbcon_picture_init(), fbcon_set_default_background(), fbcon_set_default_foreground(), fbcon::font, ansiesc_context::handlers, console_configuration::height, fbcon_font::height, fbcon_geometry::height, fbcon::indent, console_configuration::left, fbcon_margin::left, fbcon_geometry::len, fbcon::len, fbcon::map, map, fbcon::margin, memcpy_user(), memset(), memset_user(), fbcon::picture, console_configuration::pixbuf, fbcon::pixel, rc, console_configuration::right, fbcon_margin::right, fbcon::show_cursor, start, fbcon_text::start, fbcon_picture::start, fbcon::start, fbcon_geometry::stride, fbcon::text, console_configuration::top, top, fbcon_margin::top, ufree(), umalloc(), user_to_phys(), console_configuration::width, and fbcon_geometry::width.
Referenced by efifb_init(), and vesafb_init().
void fbcon_fini | ( | struct fbcon * | fbcon | ) |
Finalise frame buffer console.
fbcon | Frame buffer console |
Definition at line 718 of file fbcon.c.
References fbcon::picture, fbcon_text::start, fbcon_picture::start, fbcon::text, and ufree().
Referenced by efifb_fini(), efifb_init(), vesafb_fini(), and vesafb_init().
|
static |
ANSI escape sequence handlers.
Definition at line 426 of file fbcon.c.
Referenced by fbcon_init().