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