mirror of
https://github.com/ziglang/zig.git
synced 2026-01-05 04:53:17 +00:00
std/os/uefi: add basic Event support
This commit is contained in:
parent
9445b3f057
commit
47ce736abe
@ -8,7 +8,7 @@ pub const is_the_target = builtin.os == .uefi;
|
||||
pub var handle: Handle = undefined;
|
||||
pub var system_table: *tables.SystemTable = undefined;
|
||||
|
||||
pub const Event = @OpaqueType();
|
||||
pub const Event = *@OpaqueType();
|
||||
// GUIDs must be align(8)
|
||||
pub const Guid = extern struct {
|
||||
time_low: u32,
|
||||
|
||||
@ -6,7 +6,7 @@ const Guid = uefi.Guid;
|
||||
pub const AbsolutePointerProtocol = extern struct {
|
||||
_reset: extern fn (*const AbsolutePointerProtocol, bool) usize,
|
||||
_get_state: extern fn (*const AbsolutePointerProtocol, *AbsolutePointerState) usize,
|
||||
wait_for_input: *Event,
|
||||
wait_for_input: Event,
|
||||
mode: *AbsolutePointerMode,
|
||||
|
||||
pub fn reset(self: *const AbsolutePointerProtocol, verify: bool) usize {
|
||||
|
||||
@ -6,7 +6,7 @@ const Guid = uefi.Guid;
|
||||
pub const SimplePointerProtocol = struct {
|
||||
_reset: extern fn (*const SimplePointerProtocol, bool) usize,
|
||||
_get_state: extern fn (*const SimplePointerProtocol, *SimplePointerState) usize,
|
||||
wait_for_input: *Event,
|
||||
wait_for_input: Event,
|
||||
mode: *SimplePointerMode,
|
||||
|
||||
pub fn reset(self: *const SimplePointerProtocol, verify: bool) usize {
|
||||
|
||||
@ -6,7 +6,7 @@ const Guid = uefi.Guid;
|
||||
pub const SimpleTextInputExProtocol = extern struct {
|
||||
_reset: extern fn (*const SimpleTextInputExProtocol, bool) usize,
|
||||
_read_key_stroke_ex: extern fn (*const SimpleTextInputExProtocol, *KeyData) usize,
|
||||
wait_for_key_ex: *Event,
|
||||
wait_for_key_ex: Event,
|
||||
_set_state: extern fn (*const SimpleTextInputExProtocol, *const u8) usize,
|
||||
_register_key_notify: extern fn (*const SimpleTextInputExProtocol, *const KeyData, extern fn (*const KeyData) usize, **c_void) usize,
|
||||
_unregister_key_notify: extern fn (*const SimpleTextInputExProtocol, *const c_void) usize,
|
||||
|
||||
@ -4,3 +4,4 @@ pub const ResetType = @import("tables/runtime_services.zig").ResetType;
|
||||
pub const RuntimeServices = @import("tables/runtime_services.zig").RuntimeServices;
|
||||
pub const SystemTable = @import("tables/system_table.zig").SystemTable;
|
||||
pub const TableHeader = @import("tables/table_header.zig").TableHeader;
|
||||
pub const TimerDelay = @import("tables/boot_services.zig").TimerDelay;
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
const uefi = @import("std").os.uefi;
|
||||
const Event = uefi.Event;
|
||||
const Guid = uefi.Guid;
|
||||
const Handle = uefi.Handle;
|
||||
const TableHeader = uefi.tables.TableHeader;
|
||||
@ -22,10 +23,10 @@ pub const BootServices = extern struct {
|
||||
getMemoryMap: usize, // TODO
|
||||
allocatePool: usize, // TODO
|
||||
freePool: usize, // TODO
|
||||
createEvent: usize, // TODO
|
||||
setTimer: usize, // TODO
|
||||
createEvent: extern fn (u32, usize, ?extern fn (Event, ?*const c_void) void, ?*const c_void, *Event) usize,
|
||||
setTimer: extern fn (Event, TimerDelay, u64) usize,
|
||||
waitForEvent: usize, // TODO
|
||||
signalEvent: usize, // TODO
|
||||
signalEvent: extern fn (Event) usize,
|
||||
closeEvent: usize, // TODO
|
||||
checkEvent: usize, // TODO
|
||||
installProtocolInterface: usize, // TODO
|
||||
@ -61,4 +62,22 @@ pub const BootServices = extern struct {
|
||||
createEventEx: usize, // TODO
|
||||
|
||||
pub const signature: u64 = 0x56524553544f4f42;
|
||||
|
||||
pub const event_timer: u32 = 0x80000000;
|
||||
pub const event_runtime: u32 = 0x40000000;
|
||||
pub const event_notify_wait: u32 = 0x00000100;
|
||||
pub const event_notify_signal: u32 = 0x00000200;
|
||||
pub const event_signal_exit_boot_services: u32 = 0x00000201;
|
||||
pub const event_signal_virtual_address_change: u32 = 0x00000202;
|
||||
|
||||
pub const tpl_application: usize = 4;
|
||||
pub const tpl_callback: usize = 8;
|
||||
pub const tpl_notify: usize = 16;
|
||||
pub const tpl_high_level: usize = 31;
|
||||
};
|
||||
|
||||
pub const TimerDelay = extern enum(u32) {
|
||||
TimerCancel,
|
||||
TimerPeriodic,
|
||||
TimerRelative,
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user