use core::ops;
use r_efi::efi;
pub type EventNotifyCallback<T> = extern "efiapi" fn(efi::Event, T);
#[derive(Debug, Clone, Copy)]
#[repr(u32)]
pub enum EventTimerType {
Cancel = efi::TIMER_CANCEL,
Periodic = efi::TIMER_PERIODIC,
Relative = efi::TIMER_RELATIVE,
}
impl From<EventTimerType> for u32 {
fn from(val: EventTimerType) -> Self {
val as u32
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
#[repr(transparent)]
pub struct EventType(u32);
impl EventType {
pub const TIMER: EventType = EventType(efi::EVT_TIMER);
pub const RUNTIME: EventType = EventType(efi::EVT_RUNTIME);
pub const NOTIFY_WAIT: EventType = EventType(efi::EVT_NOTIFY_WAIT);
pub const NOTIFY_SIGNAL: EventType = EventType(efi::EVT_NOTIFY_SIGNAL);
pub const SIGNAL_EXIT_BOOT_SERVICES: EventType = EventType(efi::EVT_SIGNAL_EXIT_BOOT_SERVICES);
pub const SIGNAL_VIRTUAL_ADDRESS_CHANGE: EventType = EventType(efi::EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE);
}
impl ops::BitOr for EventType {
type Output = EventType;
fn bitor(self, rhs: Self) -> Self::Output {
EventType(self.0 | rhs.0)
}
}
impl ops::BitOrAssign for EventType {
fn bitor_assign(&mut self, rhs: Self) {
self.0 |= rhs.0;
}
}
impl From<EventType> for u32 {
fn from(val: EventType) -> Self {
val.0
}
}