limine_protocol/structures/terminal.rs
1use super::framebuffer::Framebuffer;
2
3/// Type for terminal `Write` function
4/// In order for the terminal to remain functioning, the GDT must at least have the default values
5///
6/// Special length values do the following things
7/// * `TerminalSize` - `-1`
8/// * This will **write** a single u64 to the pointer
9/// * `TerminalSave` - `-2`
10/// * This will save the terminal context to the pointer, of allocation size `TerminalSize`
11/// * `TerminalRestore` - `-3`
12/// * This will restore the terminal context from the pointer, of allocation size `TerminalSize`
13/// * `TerminalFullRefresh` - `-4`
14/// * This will fully repaint the framebuffer, the pointer is unused
15pub type TerminalWriteFn = extern "C" fn(*mut Terminal, *const u8, u64);
16
17/// Type for terminal callback
18/// The first argument is `Type`, which corresponds to `CallbackType`[`CallbackType`]
19/// * `DecSequence`
20/// * `ValueCount` - Number of values in the array `Values`
21/// * `Values` - Array of values in the DEC Sequence
22/// * `Final` - The final character in the DEC Sequence
23/// * `Bell`
24/// * `unused1`
25/// * `unused2`
26/// * `unused3`
27/// * `DECPrivateID`
28/// * `unused1`
29/// * `unused2`
30/// * `unused3`
31/// * `StatusReport`
32/// * `unused1`
33/// * `unused2`
34/// * `unused3`
35/// * `CursorPositionReport`
36/// * `X` - The X position at the time the report was requested
37/// * `Y` - The Y position at the time the report was requested
38/// * `unused3`
39/// * `KeyboardLEDUpdate`
40/// * `LedState` - What to set (possible values below)
41/// * `0` - Clear all LEDs
42/// * `1` - Set Scroll Lock
43/// * `2` - Set Num Lock
44/// * `3` - Set Caps Lock LED
45/// * `unused2`
46/// * `unused3`
47/// * `SwitchSequence`
48/// * `ValueCount` - Number of values in the array `Values`
49/// * `Values` - Array of values in the Switch Sequence
50/// * `Final` - The final character in the Switch Sequence
51/// * `LinuxEscapeSequence`
52/// * `ValueCount` - Number of values in the array `Values`
53/// * `Values` - Array of values in the Sequence
54pub type TerminalCallback = extern "C" fn(*mut Terminal, u64, u64, u64, u64);
55
56#[repr(u64)]
57#[derive(Debug, PartialEq, Eq)]
58/// Types of terminal callbacks
59pub enum CallbackType {
60 /// A DEC Private Mode Sequence has been encountered
61 DECSequence = 10,
62 /// A bell event has occurred
63 Bell = 20,
64 /// The kernel must respond to a DEC Private ID request
65 DECPrivateID = 30,
66 /// The kernel must respond to an ECMA-48 status report request
67 StatusReport = 40,
68 /// The kernel must respond to an ECMA-48 cursor position report request
69 CursorPositionReport = 50,
70 /// The kernel must respond to a keyboard LED change request
71 KeyboardLEDUpdate = 60,
72 /// An ECMA-48 Switch sequence has been encountered that the terminal cannot handle alone
73 SwitchSequence = 70,
74 /// A private Linux escape sequence has been encountered that the terminal cannot handle alone
75 LinuxEscapeSequence = 80,
76}
77
78#[repr(C)]
79#[derive(Debug, PartialEq, Eq)]
80/// Terminal structure
81pub struct Terminal {
82 /// How many columns are in the terminal
83 pub columns: u32,
84 /// How many rows are in the terminal
85 pub rows: u32,
86 /// The terminal's framebuffer
87 pub framebuffer: *mut Framebuffer,
88}