@@ -48,7 +48,11 @@ pub struct BootServices {
48
48
notify_ctx : * mut c_void ,
49
49
event : * mut Event ,
50
50
) -> Status ,
51
- set_timer : usize ,
51
+ set_timer : unsafe extern "efiapi" fn (
52
+ event : Event ,
53
+ ty : u32 ,
54
+ trigger_time : u64
55
+ ) -> Status ,
52
56
wait_for_event : unsafe extern "efiapi" fn (
53
57
number_of_events : usize ,
54
58
events : * mut Event ,
@@ -346,6 +350,16 @@ impl BootServices {
346
350
)
347
351
}
348
352
353
+ /// Sets the trigger for `EventType::TIMER` event.
354
+ pub fn set_timer ( & self , event : Event , trigger_time : TimerTrigger ) -> Result {
355
+ let ( ty, time) = match trigger_time {
356
+ TimerTrigger :: Cancel => ( 0 , 0 ) ,
357
+ TimerTrigger :: Periodic ( hundreds_ns) => ( 1 , hundreds_ns) ,
358
+ TimerTrigger :: Relative ( hundreds_ns) => ( 2 , hundreds_ns) ,
359
+ } ;
360
+ unsafe { ( self . set_timer ) ( event, ty, time) } . into ( )
361
+ }
362
+
349
363
/// Query a handle for a certain protocol.
350
364
///
351
365
/// This function attempts to get the protocol implementation of a handle,
@@ -805,3 +819,17 @@ bitflags! {
805
819
806
820
/// Raw event notification function
807
821
type EventNotifyFn = unsafe extern "efiapi" fn ( event : Event , context : * mut c_void ) ;
822
+
823
+ /// Timer events manipulation
824
+ pub enum TimerTrigger {
825
+ /// Cancel event's timer
826
+ Cancel ,
827
+ /// The event is to be signaled periodically.
828
+ /// Parameter is the period in 100ns units.
829
+ /// Delay of 0 will be signalled on every timer tick.
830
+ Periodic ( u64 ) ,
831
+ /// The event is to be signaled once in 100ns units.
832
+ /// Parameter is the delay in 100ns units.
833
+ /// Delay of 0 will be signalled on next timer tick.
834
+ Relative ( u64 ) ,
835
+ }
0 commit comments