1 /*
2  * Copyright (C) 2023 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17 
18 #ifndef __SIMPLE_TEXT_OUTPUT_PROTOCOL_H__
19 #define __SIMPLE_TEXT_OUTPUT_PROTOCOL_H__
20 
21 #include "types.h"
22 
23 typedef struct {
24   int32_t max_mode;
25   int32_t mode;
26   int32_t attribute;
27   int32_t cursor_column;
28   int32_t cursor_row;
29   bool cursor_visible;
30 } SimpleTextOutputMode;
31 
32 typedef struct EfiSimpleTextOutputProtocol {
33   EfiStatus (*reset)(struct EfiSimpleTextOutputProtocol* self, bool extended_verification);
34   EfiStatus (*output_string)(struct EfiSimpleTextOutputProtocol* self, char16_t* string);
35   EfiStatus (*test_string)(struct EfiSimpleTextOutputProtocol* self, char16_t* string);
36   EfiStatus (*query_mode)(struct EfiSimpleTextOutputProtocol* self, size_t mode_num, size_t* cols,
37                           size_t* rows);
38   EfiStatus (*set_mode)(struct EfiSimpleTextOutputProtocol* self, size_t mode_num);
39   EfiStatus (*set_attribute)(struct EfiSimpleTextOutputProtocol* self, size_t attribute);
40   EfiStatus (*clear_screen)(struct EfiSimpleTextOutputProtocol* self);
41   EfiStatus (*set_cursor_position)(struct EfiSimpleTextOutputProtocol* self, size_t col,
42                                    size_t row);
43   EfiStatus (*enable_cursor)(struct EfiSimpleTextOutputProtocol* self, bool visible);
44   SimpleTextOutputMode* mode;
45 } EfiSimpleTextOutputProtocol;
46 
47 #endif  // __SIMPLE_TEXT_OUTPUT_PROTOCOL_H__
48