diff options
| author | Michael Brown | 2013-11-28 05:14:58 +0100 |
|---|---|---|
| committer | Michael Brown | 2013-11-28 06:55:45 +0100 |
| commit | decf9dd1330eb817c2c3e3b0e85a3c6ee14d01a2 (patch) | |
| tree | 3b22068757e4fec9f2c9f8d7dbe39d6493bf3d21 /src/include | |
| parent | [cmdline] Add "console" command to configure console (diff) | |
| download | ipxe-decf9dd1330eb817c2c3e3b0e85a3c6ee14d01a2.tar.gz ipxe-decf9dd1330eb817c2c3e3b0e85a3c6ee14d01a2.tar.xz ipxe-decf9dd1330eb817c2c3e3b0e85a3c6ee14d01a2.zip | |
[fbcon] Add generic concept of a frame buffer console
Add support for a simple frame buffer console, using single buffering
and a fixed-width bitmap font.
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/ipxe/ansiesc.h | 2 | ||||
| -rw-r--r-- | src/include/ipxe/errfile.h | 1 | ||||
| -rw-r--r-- | src/include/ipxe/fbcon.h | 160 |
3 files changed, 162 insertions, 1 deletions
diff --git a/src/include/ipxe/ansiesc.h b/src/include/ipxe/ansiesc.h index 1a5a9a1b7..e84545769 100644 --- a/src/include/ipxe/ansiesc.h +++ b/src/include/ipxe/ansiesc.h @@ -62,7 +62,7 @@ struct ansiesc_handler { }; /** Maximum number of parameters within a single escape sequence */ -#define ANSIESC_MAX_PARAMS 4 +#define ANSIESC_MAX_PARAMS 5 /** * ANSI escape sequence context diff --git a/src/include/ipxe/errfile.h b/src/include/ipxe/errfile.h index 4d10ec981..b24764809 100644 --- a/src/include/ipxe/errfile.h +++ b/src/include/ipxe/errfile.h @@ -65,6 +65,7 @@ FILE_LICENCE ( GPL2_OR_LATER ); #define ERRFILE_pending ( ERRFILE_CORE | 0x00190000 ) #define ERRFILE_null_reboot ( ERRFILE_CORE | 0x001a0000 ) #define ERRFILE_pinger ( ERRFILE_CORE | 0x001b0000 ) +#define ERRFILE_fbcon ( ERRFILE_CORE | 0x001c0000 ) #define ERRFILE_eisa ( ERRFILE_DRIVER | 0x00000000 ) #define ERRFILE_isa ( ERRFILE_DRIVER | 0x00010000 ) diff --git a/src/include/ipxe/fbcon.h b/src/include/ipxe/fbcon.h new file mode 100644 index 000000000..913a7feaf --- /dev/null +++ b/src/include/ipxe/fbcon.h @@ -0,0 +1,160 @@ +#ifndef _IPXE_FBCON_H +#define _IPXE_FBCON_H + +/** @file + * + * Frame buffer console + * + */ + +FILE_LICENCE ( GPL2_OR_LATER ); + +#include <stdint.h> +#include <ipxe/ansiesc.h> +#include <ipxe/uaccess.h> + +struct pixel_buffer; + +/** Character width, in pixels */ +#define FBCON_CHAR_WIDTH 9 + +/** Character height, in pixels */ +#define FBCON_CHAR_HEIGHT 16 + +/** Bold colour modifier (RGB value) */ +#define FBCON_BOLD 0x555555 + +/** Transparent background magic colour (raw colour value) */ +#define FBCON_TRANSPARENT 0xffffffff + +/** A font glyph */ +struct fbcon_font_glyph { + /** Row bitmask */ + uint8_t bitmask[FBCON_CHAR_HEIGHT]; +} __attribute__ (( packed )); + +/** A font definition */ +struct fbcon_font { + /** Character glyphs */ + userptr_t start; +} __attribute__ (( packed )); + +/** A frame buffer geometry + * + * The geometry is defined in terms of "entities" (which can be either + * pixels or characters). + */ +struct fbcon_geometry { + /** Width (number of entities per displayed row) */ + unsigned int width; + /** Height (number of entities per displayed column) */ + unsigned int height; + /** Length of a single entity */ + size_t len; + /** Stride (offset between vertically adjacent entities) */ + size_t stride; +}; + +/** A frame buffer margin */ +struct fbcon_margin { + /** Left margin */ + unsigned int left; + /** Right margin */ + unsigned int right; + /** Top margin */ + unsigned int top; + /** Bottom margin */ + unsigned int bottom; +}; + +/** A frame buffer colour mapping */ +struct fbcon_colour_map { + /** Red scale (right shift amount from 24-bit RGB) */ + uint8_t red_scale; + /** Green scale (right shift amount from 24-bit RGB) */ + uint8_t green_scale; + /** Blue scale (right shift amount from 24-bit RGB) */ + uint8_t blue_scale; + /** Red LSB */ + uint8_t red_lsb; + /** Green LSB */ + uint8_t green_lsb; + /** Blue LSB */ + uint8_t blue_lsb; +}; + +/** A frame buffer text cell */ +struct fbcon_text_cell { + /** Foreground colour */ + uint32_t foreground; + /** Background colour */ + uint32_t background; + /** Character */ + unsigned int character; +}; + +/** A frame buffer text array */ +struct fbcon_text { + /** Stored text cells */ + userptr_t start; +}; + +/** A frame buffer background picture */ +struct fbcon_picture { + /** Start address */ + userptr_t start; + /** Pixel geometry */ + struct fbcon_geometry pixel; + /** Character geometry */ + struct fbcon_geometry character; + /** Margin */ + struct fbcon_margin margin; + /** Indent to first character (in bytes) */ + size_t indent; +}; + +/** A frame buffer console */ +struct fbcon { + /** Start address */ + userptr_t start; + /** Length of one complete displayed screen */ + size_t len; + /** Pixel geometry */ + struct fbcon_geometry *pixel; + /** Character geometry */ + struct fbcon_geometry character; + /** Margin */ + struct fbcon_margin margin; + /** Indent to first character (in bytes) */ + size_t indent; + /** Colour mapping */ + struct fbcon_colour_map *map; + /** Font definition */ + struct fbcon_font *font; + /** Text foreground raw colour */ + uint32_t foreground; + /** Text background raw colour */ + uint32_t background; + /** Bold colour modifier raw colour */ + uint32_t bold; + /** Text cursor X position */ + unsigned int xpos; + /** Text cursor Y position */ + unsigned int ypos; + /** ANSI escape sequence context */ + struct ansiesc_context ctx; + /** Text array */ + struct fbcon_text text; + /** Background picture */ + struct fbcon_picture picture; +}; + +extern int fbcon_init ( struct fbcon *fbcon, userptr_t start, + struct fbcon_geometry *pixel, + struct fbcon_colour_map *map, + struct fbcon_font *font, + struct pixel_buffer *pixbuf ); +extern void fbcon_fini ( struct fbcon *fbcon ); +extern void fbcon_putchar ( struct fbcon *fbcon, int character ); + +#endif /* _IPXE_FBCON_H */ |
