UEFI BIOS之Event(事件)

小记:当系统正在正常运行时,突然出现一个紧急事情需要去处理,当紧急事情处理完之后还需要回到之前的运行任务,这个就和事件有关,事件的类型和优先级都有哪些呢?(主要参考UEFI SPEC V2.6 第6章Services — Boot Services 6.1 Event, Timer, and Task Priority Services)

目录

1.Event, Timer, and Task Priority Functions

2.Function Introduction(函数介绍)

2.1CreateEvent()/CreateEventEx()

2.2SignalEvent()

2.3CloseEvent()

2.4WaitForEvent()

2.5SetTimer()定时器

2.6RaiseTPL()/RestoreTPL()

3.Event Types(事件类型)

4.Task Priority Levels(TPLs)

1.Event, Timer, and Task Priority Functions

2.Function Introduction(函数介绍)

2.1CreateEvent()/CreateEventEx()

CreateEvent():创建一个事件,这里只是创建,没有被触发。

这里有四个传入参数,第一个参数是Event Type(事件类型),第二个参数是NotifyTpl(优先级),第三个参数是NofityFunction当该事件触发时对应的功能是什么,这个是可选的,第四个参数是NotifyContext当触发事件对应功能时是否传递参数,这个是可选的。

CreateEventEx():创建一个事件组,当该事件组里的任意一个事件被触发时,该事件组里的所有事件都会被触发。

2.2SignalEvent()

当使用SignalEvent()时,事件会被触发。

2.3CloseEvent()

当事件被创建和触发后,使用ClosedEvent()结束事件。

通常CreateEvent()->SignalEvent()->CloseEvent()搭配使用,For example:

2.4WaitForEvent()

等待事件,比较常用的是 Wait for a keystroke等待按键。eg:

if (Key != NULL) {
    gBS->WaitForEvent (1, &gST->ConIn->WaitForKey, &EventIndex);
    gST->ConIn->ReadKeyStroke (gST->ConIn, Key);
  }

2.5SetTimer()定时器

Sets the type of timer and the trigger time for a timer event.

第二个参数EFI_TIMER_DELAY有三种类型:

1>TimerCancel:The event’s timer setting is to be cancelled and no timer trigger is to be set. TriggerTime is ignored when canceling a timer.

2>TimerPeriodic:The event is to be signaled periodically at TriggerTime intervals from the current time. This is the only timer trigger Type for which the event timer does not need to be reset for each notification. All other timer trigger types are “one shot.”

定时器一次性有效。

3>TimerRelative:The event is to be signaled in TriggerTime 100ns units.

定时器周期性触发。

2.6RaiseTPL()/RestoreTPL()

提升优先级和将优先级恢复成对使用。

RaiseTPL():Raises a task’s priority level and returns its previous level.提升优先级

RestoreTPL():Restores a task’s priority level to its previous value.将优先级恢复

3.Event Types(事件类型)

4.Task Priority Levels(TPLs)

TPL_APPLICATION:the lowest priority level

TPL_HIGH_LEVEL:the highest priority level

1.当不同优先级时,优先级高的先触发,优先级低的后触发

2.当相同优先级时,后注册的事件先触发,先注册的事件后触发

  • 8
    点赞
  • 13
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值