10000 Add freestanding set_timer and wait_for_event by nicholasbishop · Pull Request #1298 · rust-osdev/uefi-rs · GitHub
[go: up one dir, main page]

Skip to content

Add freestanding set_timer and wait_for_event #1298

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 9, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
test-runner: Add test_timer_freestanding
  • Loading branch information
nicholasbishop committed Aug 7, 2024
commit 2aa5bd34aef0a750fc3dd8a2b9a0928ad3e539e8
9 changes: 9 additions & 0 deletions uefi-test-runner/src/boot/misc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ pub fn test(st: &SystemTable<Boot>) {
test_timer(bt);
info!("Testing events...");
test_check_event_freestanding();
test_timer_freestanding();
test_event_callback(bt);
test_callback_with_ctx(bt);
info!("Testing watchdog...");
Expand Down Expand Up @@ -48,6 +49,14 @@ fn test_check_event_freestanding() {
assert!(!is_signaled);
}

fn test_timer_freestanding() {
let timer_event =
unsafe { boot::create_event(EventType::TIMER, Tpl::CALLBACK, None, None) }.unwrap();
let mut events = unsafe { [timer_event.unsafe_clone()] };
boot::set_timer(&timer_event, TimerTrigger::Relative(5_0 /*00 ns */)).unwrap();
assert_eq!(boot::wait_for_event(&mut events).unwrap(), 0);
}

fn test_timer(bt: &BootServices) {
let timer_event = unsafe { bt.create_event(EventType::TIMER, Tpl::APPLICATION, None, None) }
.expect("Failed to create TIMER event");
Expand Down
0