iPXE
fbcon.h
Go to the documentation of this file.
1#ifndef _IPXE_FBCON_H
2#define _IPXE_FBCON_H
3
4/** @file
5 *
6 * Frame buffer console
7 *
8 */
9
10FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
11FILE_SECBOOT ( PERMITTED );
12
13#include <stdint.h>
14#include <ipxe/ansiesc.h>
15#include <ipxe/utf8.h>
16#include <ipxe/console.h>
17
18/** Character width, in pixels */
19#define FBCON_CHAR_WIDTH 9
20
21/** Bold colour modifier (RGB value) */
22#define FBCON_BOLD 0x555555
23
24/** Transparent background magic colour (raw colour value) */
25#define FBCON_TRANSPARENT 0xffffffff
26
27/** A font glyph */
29 /** Row bitmask */
31};
32
33/** A font definition */
34struct fbcon_font {
35 /** Character height (in pixels) */
36 unsigned int height;
37 /**
38 * Get character glyph
39 *
40 * @v character Unicode character
41 * @ret glyph Character glyph
42 */
43 const uint8_t * ( * glyph ) ( unsigned int character );
44};
45
46/** A frame buffer geometry
47 *
48 * The geometry is defined in terms of "entities" (which can be either
49 * pixels or characters).
50 */
52 /** Width (number of entities per displayed row) */
53 unsigned int width;
54 /** Height (number of entities per displayed column) */
55 unsigned int height;
56 /** Length of a single entity */
57 size_t len;
58 /** Stride (offset between vertically adjacent entities) */
59 size_t stride;
60};
61
62/** A frame buffer margin */
64 /** Left margin */
65 unsigned int left;
66 /** Right margin */
67 unsigned int right;
68 /** Top margin */
69 unsigned int top;
70 /** Bottom margin */
71 unsigned int bottom;
72};
73
74/** A frame buffer colour mapping */
76 /** Red scale (right shift amount from 24-bit RGB) */
78 /** Green scale (right shift amount from 24-bit RGB) */
80 /** Blue scale (right shift amount from 24-bit RGB) */
82 /** Red LSB */
84 /** Green LSB */
86 /** Blue LSB */
88};
89
90/** A frame buffer text cell */
92 /** Foreground colour */
94 /** Background colour */
96 /** Unicode character */
97 unsigned int character;
98};
99
100/** A frame buffer text array */
102 /** Stored text cells */
104};
105
106/** A frame buffer background picture */
108 /** Start address */
109 void *start;
110};
111
112/** A frame buffer console */
113struct fbcon {
114 /** Start address */
115 void *start;
116 /** Length of one complete displayed screen */
117 size_t len;
118 /** Pixel geometry */
120 /** Character geometry */
122 /** Margin */
124 /** Indent to first character (in bytes) */
125 size_t indent;
126 /** Colour mapping */
128 /** Font definition */
130 /** Text foreground raw colour */
132 /** Text background raw colour */
134 /** Bold colour modifier raw colour */
136 /** Text cursor X position */
137 unsigned int xpos;
138 /** Text cursor Y position */
139 unsigned int ypos;
140 /** ANSI escape sequence context */
142 /** UTF-8 accumulator */
144 /** Text array */
146 /** Background picture */
148 /** Display cursor */
150};
151
152extern int fbcon_init ( struct fbcon *fbcon, void *start,
153 struct fbcon_geometry *pixel,
154 struct fbcon_colour_map *map,
155 struct fbcon_font *font,
156 struct console_configuration *config );
157extern void fbcon_fini ( struct fbcon *fbcon );
158extern void fbcon_putchar ( struct fbcon *fbcon, int character );
159
160#endif /* _IPXE_FBCON_H */
ANSI escape sequences.
unsigned int uint32_t
Definition stdint.h:12
unsigned char uint8_t
Definition stdint.h:10
int fbcon_init(struct fbcon *fbcon, void *start, struct fbcon_geometry *pixel, struct fbcon_colour_map *map, struct fbcon_font *font, struct console_configuration *config)
Initialise frame buffer console.
Definition fbcon.c:601
void fbcon_fini(struct fbcon *fbcon)
Finalise frame buffer console.
Definition fbcon.c:729
void fbcon_putchar(struct fbcon *fbcon, int character)
Print a character to current cursor position.
Definition fbcon.c:461
uint32_t start
Starting offset.
Definition netvsc.h:1
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
Definition compiler.h:896
#define FILE_SECBOOT(_status)
Declare a file's UEFI Secure Boot permission status.
Definition compiler.h:926
User interaction.
static __always_inline int struct dma_mapping * map
Definition dma.h:184
ANSI escape sequence context.
Definition ansiesc.h:74
A console configuration.
Definition console.h:25
A frame buffer colour mapping.
Definition fbcon.h:75
uint8_t blue_scale
Blue scale (right shift amount from 24-bit RGB)
Definition fbcon.h:81
uint8_t red_lsb
Red LSB.
Definition fbcon.h:83
uint8_t blue_lsb
Blue LSB.
Definition fbcon.h:87
uint8_t green_lsb
Green LSB.
Definition fbcon.h:85
uint8_t green_scale
Green scale (right shift amount from 24-bit RGB)
Definition fbcon.h:79
uint8_t red_scale
Red scale (right shift amount from 24-bit RGB)
Definition fbcon.h:77
A font glyph.
Definition fbcon.h:28
uint8_t bitmask[0]
Row bitmask.
Definition fbcon.h:30
A font definition.
Definition fbcon.h:34
unsigned int height
Character height (in pixels)
Definition fbcon.h:36
A frame buffer geometry.
Definition fbcon.h:51
unsigned int height
Height (number of entities per displayed column)
Definition fbcon.h:55
size_t len
Length of a single entity.
Definition fbcon.h:57
unsigned int width
Width (number of entities per displayed row)
Definition fbcon.h:53
size_t stride
Stride (offset between vertically adjacent entities)
Definition fbcon.h:59
A frame buffer margin.
Definition fbcon.h:63
unsigned int top
Top margin.
Definition fbcon.h:69
unsigned int left
Left margin.
Definition fbcon.h:65
unsigned int right
Right margin.
Definition fbcon.h:67
unsigned int bottom
Bottom margin.
Definition fbcon.h:71
A frame buffer background picture.
Definition fbcon.h:107
void * start
Start address.
Definition fbcon.h:109
A frame buffer text cell.
Definition fbcon.h:91
uint32_t background
Background colour.
Definition fbcon.h:95
unsigned int character
Unicode character.
Definition fbcon.h:97
uint32_t foreground
Foreground colour.
Definition fbcon.h:93
A frame buffer text array.
Definition fbcon.h:101
struct fbcon_text_cell * cells
Stored text cells.
Definition fbcon.h:103
A frame buffer console.
Definition fbcon.h:113
void * start
Start address.
Definition fbcon.h:115
unsigned int xpos
Text cursor X position.
Definition fbcon.h:137
struct fbcon_font * font
Font definition.
Definition fbcon.h:129
struct fbcon_geometry * pixel
Pixel geometry.
Definition fbcon.h:119
struct fbcon_colour_map * map
Colour mapping.
Definition fbcon.h:127
struct utf8_accumulator utf8
UTF-8 accumulator.
Definition fbcon.h:143
struct fbcon_picture picture
Background picture.
Definition fbcon.h:147
unsigned int ypos
Text cursor Y position.
Definition fbcon.h:139
int show_cursor
Display cursor.
Definition fbcon.h:149
size_t len
Length of one complete displayed screen.
Definition fbcon.h:117
uint32_t bold
Bold colour modifier raw colour.
Definition fbcon.h:135
struct fbcon_geometry character
Character geometry.
Definition fbcon.h:121
uint32_t foreground
Text foreground raw colour.
Definition fbcon.h:131
size_t indent
Indent to first character (in bytes)
Definition fbcon.h:125
struct fbcon_margin margin
Margin.
Definition fbcon.h:123
uint32_t background
Text background raw colour.
Definition fbcon.h:133
struct ansiesc_context ctx
ANSI escape sequence context.
Definition fbcon.h:141
struct fbcon_text text
Text array.
Definition fbcon.h:145
A UTF-8 character accumulator.
Definition utf8.h:58
UTF-8 Unicode encoding.