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