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 
10 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
11 
12 #include <stdint.h>
13 #include <ipxe/ansiesc.h>
14 #include <ipxe/utf8.h>
15 #include <ipxe/uaccess.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 */
34 struct fbcon_font {
35  /** Character height (in pixels) */
36  unsigned int height;
37  /**
38  * Get character glyph
39  *
40  * @v character Unicode character
41  * @v glyph Character glyph to fill in
42  */
43  void ( * glyph ) ( unsigned int character, uint8_t *glyph );
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 */
63 struct fbcon_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 */
101 struct fbcon_text {
102  /** Stored text cells */
104 };
105 
106 /** A frame buffer background picture */
108  /** Start address */
110 };
111 
112 /** A frame buffer console */
113 struct fbcon {
114  /** Start address */
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 */
129  struct fbcon_font *font;
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 */
145  struct fbcon_text text;
146  /** Background picture */
148  /** Display cursor */
150 };
151 
152 extern int fbcon_init ( struct fbcon *fbcon, userptr_t start,
153  struct fbcon_geometry *pixel,
154  struct fbcon_colour_map *map,
155  struct fbcon_font *font,
156  struct console_configuration *config );
157 extern void fbcon_fini ( struct fbcon *fbcon );
158 extern void fbcon_putchar ( struct fbcon *fbcon, int character );
159 
160 #endif /* _IPXE_FBCON_H */
unsigned int height
Character height (in pixels)
Definition: fbcon.h:36
A frame buffer geometry.
Definition: fbcon.h:51
userptr_t start
Start address.
Definition: fbcon.h:109
unsigned int ypos
Text cursor Y position.
Definition: fbcon.h:139
uint8_t green_lsb
Green LSB.
Definition: fbcon.h:85
A frame buffer margin.
Definition: fbcon.h:63
uint8_t red_lsb
Red LSB.
Definition: fbcon.h:83
unsigned int bottom
Bottom margin.
Definition: fbcon.h:71
struct fbcon_font * font
Font definition.
Definition: fbcon.h:129
unsigned int width
Width (number of entities per displayed row)
Definition: fbcon.h:53
struct fbcon_geometry character
Character geometry.
Definition: fbcon.h:121
struct ansiesc_context ctx
ANSI escape sequence context.
Definition: fbcon.h:141
uint8_t bitmask[0]
Row bitmask.
Definition: fbcon.h:30
A frame buffer text cell.
Definition: fbcon.h:91
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.
Definition: fbcon.c:588
ANSI escape sequence context.
Definition: ansiesc.h:73
void(* glyph)(unsigned int character, uint8_t *glyph)
Get character glyph.
Definition: fbcon.h:43
Access to external ("user") memory.
A console configuration.
Definition: console.h:24
struct fbcon_geometry * pixel
Pixel geometry.
Definition: fbcon.h:119
unsigned int left
Left margin.
Definition: fbcon.h:65
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
UTF-8 Unicode encoding.
uint32_t start
Starting offset.
Definition: netvsc.h:12
uint32_t background
Background colour.
Definition: fbcon.h:95
A frame buffer background picture.
Definition: fbcon.h:107
uint32_t foreground
Text foreground raw colour.
Definition: fbcon.h:131
void fbcon_fini(struct fbcon *fbcon)
Finalise frame buffer console.
Definition: fbcon.c:718
uint8_t red_scale
Red scale (right shift amount from 24-bit RGB)
Definition: fbcon.h:77
size_t len
Length of a single entity.
Definition: fbcon.h:57
A frame buffer console.
Definition: fbcon.h:113
A font glyph.
Definition: fbcon.h:28
void fbcon_putchar(struct fbcon *fbcon, int character)
Print a character to current cursor position.
Definition: fbcon.c:441
ANSI escape sequences.
A frame buffer colour mapping.
Definition: fbcon.h:75
unsigned int top
Top margin.
Definition: fbcon.h:69
User interaction.
unsigned int character
Unicode character.
Definition: fbcon.h:97
userptr_t start
Stored text cells.
Definition: fbcon.h:103
uint32_t foreground
Foreground colour.
Definition: fbcon.h:93
uint8_t green_scale
Green scale (right shift amount from 24-bit RGB)
Definition: fbcon.h:79
unsigned char uint8_t
Definition: stdint.h:10
unsigned int xpos
Text cursor X position.
Definition: fbcon.h:137
struct fbcon_margin margin
Margin.
Definition: fbcon.h:123
static __always_inline int struct dma_mapping * map
Definition: dma.h:181
A frame buffer text array.
Definition: fbcon.h:101
unsigned int uint32_t
Definition: stdint.h:12
A font definition.
Definition: fbcon.h:34
uint32_t background
Text background raw colour.
Definition: fbcon.h:133
uint8_t blue_scale
Blue scale (right shift amount from 24-bit RGB)
Definition: fbcon.h:81
struct fbcon_text text
Text array.
Definition: fbcon.h:145
struct utf8_accumulator utf8
UTF-8 accumulator.
Definition: fbcon.h:143
size_t len
Length of one complete displayed screen.
Definition: fbcon.h:117
A UTF-8 character accumulator.
Definition: utf8.h:57
unsigned int height
Height (number of entities per displayed column)
Definition: fbcon.h:55
unsigned int right
Right margin.
Definition: fbcon.h:67
uint32_t bold
Bold colour modifier raw colour.
Definition: fbcon.h:135
uint8_t blue_lsb
Blue LSB.
Definition: fbcon.h:87
struct fbcon_picture picture
Background picture.
Definition: fbcon.h:147
size_t indent
Indent to first character (in bytes)
Definition: fbcon.h:125
struct fbcon_colour_map * map
Colour mapping.
Definition: fbcon.h:127
userptr_t start
Start address.
Definition: fbcon.h:115
int show_cursor
Display cursor.
Definition: fbcon.h:149
size_t stride
Stride (offset between vertically adjacent entities)
Definition: fbcon.h:59
unsigned long userptr_t
A pointer to a user buffer.
Definition: uaccess.h:33