Skip to content

Commit 163aea3

Browse files
uefi-raw: Add SimpleTextInputProtocol and SimpleTextOutputProtocol
1 parent 50657ce commit 163aea3

File tree

2 files changed

+55
-0
lines changed

2 files changed

+55
-0
lines changed

uefi-raw/src/protocol/console.rs

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
use crate::{guid, Char16, Event, Guid, Status};
2+
3+
#[derive(Clone, Copy, Debug, Default, Eq, PartialEq)]
4+
#[repr(C)]
5+
pub struct InputKey {
6+
pub scan_code: u16,
7+
pub unicode_char: Char16,
8+
}
9+
10+
#[repr(C)]
11+
pub struct SimpleTextInputProtocol {
12+
pub reset: unsafe extern "efiapi" fn(this: *mut Self, extended_verification: bool) -> Status,
13+
pub read_key_stroke: unsafe extern "efiapi" fn(this: *mut Self, key: *mut InputKey) -> Status,
14+
pub wait_for_key: Event,
15+
}
16+
17+
impl SimpleTextInputProtocol {
18+
pub const GUID: Guid = guid!("387477c1-69c7-11d2-8e39-00a0c969723b");
19+
}
20+
21+
#[derive(Clone, Copy, Debug, Default, Eq, PartialEq)]
22+
#[repr(C)]
23+
pub struct SimpleTextOutputMode {
24+
pub max_mode: i32,
25+
pub mode: i32,
26+
pub attribute: i32,
27+
pub cursor_column: i32,
28+
pub cursor_row: i32,
29+
pub cursor_visible: bool,
30+
}
31+
32+
#[repr(C)]
33+
pub struct SimpleTextOutputProtocol {
34+
pub reset: unsafe extern "efiapi" fn(this: *mut Self, extended: bool) -> Status,
35+
pub output_string: unsafe extern "efiapi" fn(this: *mut Self, string: *const Char16) -> Status,
36+
pub test_string: unsafe extern "efiapi" fn(this: *mut Self, string: *const Char16) -> Status,
37+
pub query_mode: unsafe extern "efiapi" fn(
38+
this: *mut Self,
39+
mode: usize,
40+
columns: *mut usize,
41+
rows: *mut usize,
42+
) -> Status,
43+
pub set_mode: unsafe extern "efiapi" fn(this: *mut Self, mode: usize) -> Status,
44+
pub set_attribute: unsafe extern "efiapi" fn(this: *mut Self, attribute: usize) -> Status,
45+
pub clear_screen: unsafe extern "efiapi" fn(this: *mut Self) -> Status,
46+
pub set_cursor_position:
47+
unsafe extern "efiapi" fn(this: *mut Self, column: usize, row: usize) -> Status,
48+
pub enable_cursor: unsafe extern "efiapi" fn(this: *mut Self, visible: bool) -> Status,
49+
pub mode: *mut SimpleTextOutputMode,
50+
}
51+
52+
impl SimpleTextOutputProtocol {
53+
pub const GUID: Guid = guid!("387477c2-69c7-11d2-8e39-00a0c969723b");
54+
}

uefi-raw/src/protocol/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@
44
//! ID. They can be implemented by a UEFI driver or occasionally by a
55
//! UEFI application.
66
7+
pub mod console;
78
pub mod device_path;
89
pub mod rng;

0 commit comments

Comments
 (0)