xref: /haiku/headers/private/kernel/platform/efi/protocol/simple-text-output.h (revision 485b5cf8bc00ab5aaee5db81a91d135dc61d9cc3)
1*485b5cf8SAlexander von Gluck IV // Copyright 2016 The Fuchsia Authors. All rights reserved.
2*485b5cf8SAlexander von Gluck IV // Use of this source code is governed by a BSD-style license that can be
3*485b5cf8SAlexander von Gluck IV // found in the LICENSE file.
4*485b5cf8SAlexander von Gluck IV 
5*485b5cf8SAlexander von Gluck IV #pragma once
6*485b5cf8SAlexander von Gluck IV 
7*485b5cf8SAlexander von Gluck IV #include <efi/types.h>
8*485b5cf8SAlexander von Gluck IV 
9*485b5cf8SAlexander von Gluck IV #define EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL_GUID \
10*485b5cf8SAlexander von Gluck IV     {0x387477c2, 0x69c7, 0x11d2, {0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b}}
11*485b5cf8SAlexander von Gluck IV extern efi_guid SimpleTextOutputProtocol;
12*485b5cf8SAlexander von Gluck IV 
13*485b5cf8SAlexander von Gluck IV typedef struct {
14*485b5cf8SAlexander von Gluck IV     int32_t MaxMode;
15*485b5cf8SAlexander von Gluck IV     int32_t Mode;
16*485b5cf8SAlexander von Gluck IV     int32_t Attribute;
17*485b5cf8SAlexander von Gluck IV     int32_t CursorColumn;
18*485b5cf8SAlexander von Gluck IV     int32_t CursorRow;
19*485b5cf8SAlexander von Gluck IV     bool CursorVisible;
20*485b5cf8SAlexander von Gluck IV } simple_text_output_mode;
21*485b5cf8SAlexander von Gluck IV 
22*485b5cf8SAlexander von Gluck IV //*******************************************************
23*485b5cf8SAlexander von Gluck IV // UNICODE DRAWING CHARACTERS
24*485b5cf8SAlexander von Gluck IV //*******************************************************
25*485b5cf8SAlexander von Gluck IV #define BOXDRAW_HORIZONTAL 0x2500
26*485b5cf8SAlexander von Gluck IV #define BOXDRAW_VERTICAL 0x2502
27*485b5cf8SAlexander von Gluck IV #define BOXDRAW_DOWN_RIGHT 0x250c
28*485b5cf8SAlexander von Gluck IV #define BOXDRAW_DOWN_LEFT 0x2510
29*485b5cf8SAlexander von Gluck IV #define BOXDRAW_UP_RIGHT 0x2514
30*485b5cf8SAlexander von Gluck IV #define BOXDRAW_UP_LEFT 0x2518
31*485b5cf8SAlexander von Gluck IV #define BOXDRAW_VERTICAL_RIGHT 0x251c
32*485b5cf8SAlexander von Gluck IV #define BOXDRAW_VERTICAL_LEFT 0x2524
33*485b5cf8SAlexander von Gluck IV #define BOXDRAW_DOWN_HORIZONTAL 0x252c
34*485b5cf8SAlexander von Gluck IV #define BOXDRAW_UP_HORIZONTAL 0x2534
35*485b5cf8SAlexander von Gluck IV #define BOXDRAW_VERTICAL_HORIZONTAL 0x253c
36*485b5cf8SAlexander von Gluck IV #define BOXDRAW_DOUBLE_HORIZONTAL 0x2550
37*485b5cf8SAlexander von Gluck IV #define BOXDRAW_DOUBLE_VERTICAL 0x2551
38*485b5cf8SAlexander von Gluck IV #define BOXDRAW_DOWN_RIGHT_DOUBLE 0x2552
39*485b5cf8SAlexander von Gluck IV #define BOXDRAW_DOWN_DOUBLE_RIGHT 0x2553
40*485b5cf8SAlexander von Gluck IV #define BOXDRAW_DOUBLE_DOWN_RIGHT 0x2554
41*485b5cf8SAlexander von Gluck IV #define BOXDRAW_DOWN_LEFT_DOUBLE 0x2555
42*485b5cf8SAlexander von Gluck IV #define BOXDRAW_DOWN_DOUBLE_LEFT 0x2556
43*485b5cf8SAlexander von Gluck IV #define BOXDRAW_DOUBLE_DOWN_LEFT 0x2557
44*485b5cf8SAlexander von Gluck IV #define BOXDRAW_UP_RIGHT_DOUBLE 0x2558
45*485b5cf8SAlexander von Gluck IV #define BOXDRAW_UP_DOUBLE_RIGHT 0x2559
46*485b5cf8SAlexander von Gluck IV #define BOXDRAW_DOUBLE_UP_RIGHT 0x255a
47*485b5cf8SAlexander von Gluck IV #define BOXDRAW_UP_LEFT_DOUBLE 0x255b
48*485b5cf8SAlexander von Gluck IV #define BOXDRAW_UP_DOUBLE_LEFT 0x255c
49*485b5cf8SAlexander von Gluck IV #define BOXDRAW_DOUBLE_UP_LEFT 0x255d
50*485b5cf8SAlexander von Gluck IV #define BOXDRAW_VERTICAL_RIGHT_DOUBLE 0x255e
51*485b5cf8SAlexander von Gluck IV #define BOXDRAW_VERTICAL_DOUBLE_RIGHT 0x255f
52*485b5cf8SAlexander von Gluck IV #define BOXDRAW_DOUBLE_VERTICAL_RIGHT 0x2560
53*485b5cf8SAlexander von Gluck IV #define BOXDRAW_VERTICAL_LEFT_DOUBLE 0x2561
54*485b5cf8SAlexander von Gluck IV #define BOXDRAW_VERTICAL_DOUBLE_LEFT 0x2562
55*485b5cf8SAlexander von Gluck IV #define BOXDRAW_DOUBLE_VERTICAL_LEFT 0x2563
56*485b5cf8SAlexander von Gluck IV #define BOXDRAW_DOWN_HORIZONTAL_DOUBLE 0x2564
57*485b5cf8SAlexander von Gluck IV #define BOXDRAW_DOWN_DOUBLE_HORIZONTAL 0x2565
58*485b5cf8SAlexander von Gluck IV #define BOXDRAW_DOUBLE_DOWN_HORIZONTAL 0x2566
59*485b5cf8SAlexander von Gluck IV #define BOXDRAW_UP_HORIZONTAL_DOUBLE 0x2567
60*485b5cf8SAlexander von Gluck IV #define BOXDRAW_UP_DOUBLE_HORIZONTAL 0x2568
61*485b5cf8SAlexander von Gluck IV #define BOXDRAW_DOUBLE_UP_HORIZONTAL 0x2569
62*485b5cf8SAlexander von Gluck IV #define BOXDRAW_VERTICAL_HORIZONTAL_DOUBLE 0x256a
63*485b5cf8SAlexander von Gluck IV #define BOXDRAW_VERTICAL_DOUBLE_HORIZONTAL 0x256b
64*485b5cf8SAlexander von Gluck IV #define BOXDRAW_DOUBLE_VERTICAL_HORIZONTAL 0x256c
65*485b5cf8SAlexander von Gluck IV 
66*485b5cf8SAlexander von Gluck IV //*******************************************************
67*485b5cf8SAlexander von Gluck IV // EFI Required Block Elements Code Chart
68*485b5cf8SAlexander von Gluck IV //*******************************************************
69*485b5cf8SAlexander von Gluck IV #define BLOCKELEMENT_FULL_BLOCK 0x2588
70*485b5cf8SAlexander von Gluck IV #define BLOCKELEMENT_LIGHT_SHADE 0x2591
71*485b5cf8SAlexander von Gluck IV 
72*485b5cf8SAlexander von Gluck IV //*******************************************************
73*485b5cf8SAlexander von Gluck IV // EFI Required Geometric Shapes Code Chart
74*485b5cf8SAlexander von Gluck IV //*******************************************************
75*485b5cf8SAlexander von Gluck IV #define GEOMETRICSHAPE_UP_TRIANGLE 0x25b2
76*485b5cf8SAlexander von Gluck IV #define GEOMETRICSHAPE_RIGHT_TRIANGLE 0x25ba
77*485b5cf8SAlexander von Gluck IV #define GEOMETRICSHAPE_DOWN_TRIANGLE 0x25bc
78*485b5cf8SAlexander von Gluck IV #define GEOMETRICSHAPE_LEFT_TRIANGLE 0x25c4
79*485b5cf8SAlexander von Gluck IV 
80*485b5cf8SAlexander von Gluck IV //*******************************************************
81*485b5cf8SAlexander von Gluck IV // EFI Required Arrow shapes
82*485b5cf8SAlexander von Gluck IV //*******************************************************
83*485b5cf8SAlexander von Gluck IV #define ARROW_UP 0x2191
84*485b5cf8SAlexander von Gluck IV #define ARROW_DOWN 0x2193
85*485b5cf8SAlexander von Gluck IV 
86*485b5cf8SAlexander von Gluck IV //*******************************************************
87*485b5cf8SAlexander von Gluck IV // Attributes
88*485b5cf8SAlexander von Gluck IV //*******************************************************
89*485b5cf8SAlexander von Gluck IV #define EFI_BLACK 0x00
90*485b5cf8SAlexander von Gluck IV #define EFI_BLUE 0x01
91*485b5cf8SAlexander von Gluck IV #define EFI_GREEN 0x02
92*485b5cf8SAlexander von Gluck IV #define EFI_CYAN 0x03
93*485b5cf8SAlexander von Gluck IV #define EFI_RED 0x04
94*485b5cf8SAlexander von Gluck IV #define EFI_ZIRCON 0x05
95*485b5cf8SAlexander von Gluck IV #define EFI_BROWN 0x06
96*485b5cf8SAlexander von Gluck IV #define EFI_LIGHTGRAY 0x07
97*485b5cf8SAlexander von Gluck IV #define EFI_BRIGHT 0x08
98*485b5cf8SAlexander von Gluck IV #define EFI_DARKGRAY 0x08
99*485b5cf8SAlexander von Gluck IV #define EFI_LIGHTBLUE 0x09
100*485b5cf8SAlexander von Gluck IV #define EFI_LIGHTGREEN 0x0A
101*485b5cf8SAlexander von Gluck IV #define EFI_LIGHTCYAN 0x0B
102*485b5cf8SAlexander von Gluck IV #define EFI_LIGHTRED 0x0C
103*485b5cf8SAlexander von Gluck IV #define EFI_LIGHTZIRCON 0x0D
104*485b5cf8SAlexander von Gluck IV #define EFI_YELLOW 0x0E
105*485b5cf8SAlexander von Gluck IV #define EFI_WHITE 0x0F
106*485b5cf8SAlexander von Gluck IV #define EFI_BACKGROUND_BLACK 0x00
107*485b5cf8SAlexander von Gluck IV #define EFI_BACKGROUND_BLUE 0x10
108*485b5cf8SAlexander von Gluck IV #define EFI_BACKGROUND_GREEN 0x20
109*485b5cf8SAlexander von Gluck IV #define EFI_BACKGROUND_CYAN 0x30
110*485b5cf8SAlexander von Gluck IV #define EFI_BACKGROUND_RED 0x40
111*485b5cf8SAlexander von Gluck IV #define EFI_BACKGROUND_ZIRCON 0x50
112*485b5cf8SAlexander von Gluck IV #define EFI_BACKGROUND_BROWN 0x60
113*485b5cf8SAlexander von Gluck IV #define EFI_BACKGROUND_LIGHTGRAY 0x70
114*485b5cf8SAlexander von Gluck IV 
115*485b5cf8SAlexander von Gluck IV typedef struct efi_simple_text_output_protocol {
116*485b5cf8SAlexander von Gluck IV     efi_status (*Reset) (struct efi_simple_text_output_protocol* self,
117*485b5cf8SAlexander von Gluck IV                          bool extended_verification) EFIAPI;
118*485b5cf8SAlexander von Gluck IV 
119*485b5cf8SAlexander von Gluck IV     efi_status (*OutputString) (struct efi_simple_text_output_protocol* self,
120*485b5cf8SAlexander von Gluck IV                                 char16_t* string) EFIAPI;
121*485b5cf8SAlexander von Gluck IV 
122*485b5cf8SAlexander von Gluck IV     efi_status (*TestString) (struct efi_simple_text_output_protocol* self,
123*485b5cf8SAlexander von Gluck IV                               char16_t* string) EFIAPI;
124*485b5cf8SAlexander von Gluck IV 
125*485b5cf8SAlexander von Gluck IV     efi_status (*QueryMode) (struct efi_simple_text_output_protocol* self,
126*485b5cf8SAlexander von Gluck IV                              size_t mode_num, size_t* cols, size_t* rows) EFIAPI;
127*485b5cf8SAlexander von Gluck IV 
128*485b5cf8SAlexander von Gluck IV     efi_status (*SetMode) (struct efi_simple_text_output_protocol* self,
129*485b5cf8SAlexander von Gluck IV                            size_t mode_num) EFIAPI;
130*485b5cf8SAlexander von Gluck IV 
131*485b5cf8SAlexander von Gluck IV     efi_status (*SetAttribute) (struct efi_simple_text_output_protocol* self,
132*485b5cf8SAlexander von Gluck IV                                 size_t attribute) EFIAPI;
133*485b5cf8SAlexander von Gluck IV 
134*485b5cf8SAlexander von Gluck IV     efi_status (*ClearScreen) (struct efi_simple_text_output_protocol* self) EFIAPI;
135*485b5cf8SAlexander von Gluck IV 
136*485b5cf8SAlexander von Gluck IV     efi_status (*SetCursorPosition) (struct efi_simple_text_output_protocol* self,
137*485b5cf8SAlexander von Gluck IV                                      size_t col, size_t row) EFIAPI;
138*485b5cf8SAlexander von Gluck IV 
139*485b5cf8SAlexander von Gluck IV     efi_status (*EnableCursor) (struct efi_simple_text_output_protocol* self,
140*485b5cf8SAlexander von Gluck IV                                 bool visible) EFIAPI;
141*485b5cf8SAlexander von Gluck IV 
142*485b5cf8SAlexander von Gluck IV     simple_text_output_mode* Mode;
143*485b5cf8SAlexander von Gluck IV } efi_simple_text_output_protocol;
144