WFU

[ 精選文章 ]

自行車 入門 Escape 3 , Snap 21 , Revel

最近周末想運動 , 平日想通勤 , 想買台自行車 , 把自己找的資料跟大家分享 , 如果你是玩家級的 就不用看了 這是給跟我一樣的新新新手 參考的 騎車半年後的補充: 如果你有把握你是真的有時間有興趣會一直騎,建議還是存點錢買好一點的彎把公路車, 或是可以考慮買2手的自...

2016年2月19日 星期五

EFI Related

Delay()

方法一:使用UEFI內建函數
1
gBS->Stall(Microsecond);
     使用Stall要注意如下
#include <Library/UefiBootServicesTableLib.h>
Stall以微秒(µs,10-6)為單位

方法二:使用標準C Library的函數
1
sleep(second);
     使用sleep要注意如下
#include <Include/unistd.h>
inf中,在[LibraryClasses]添加LibC
sleep以秒為單位
pST  = SystemTable
gBS = SystemTable->BootServices)
UDK: #include <Library/UefiBootServicesTableLib.h>


MdePkg.dec
TimerLib
#include <Library/TimerLib.h>
MicroSecondDelay()

===================
EVENT
CreateEventEx 為事件組 一個 event 被觸發 就全部都跑一遍 (優先權為 先看TPL 在來是晚註冊的先跑)
EFI_EVENT Event;
EFI_GUID gGuid = EFI_MY_GUID;
gBS->CreateEventEx (0, 0, NULL, NULL,&gGuid,&Event);
gBS->SignalEvent (Event);
gBS->CloseEvent (Event);

原型:
CoreCreateEventEx (
  IN UINT32                   Type,
  IN EFI_TPL                  NotifyTpl,
  IN EFI_EVENT_NOTIFY         NotifyFunction, OPTIONAL
  IN CONST VOID               *NotifyContext, OPTIONAL
  IN CONST EFI_GUID           *EventGroup,    OPTIONAL
  OUT EFI_EVENT               *Event
  );


1.If a UEFI Driver creates events in its  driver entry point, those events must be closed with CloseEvent() in the UEFI Driver's Unload() function
2.If a UEFI Driver creates events in its Driver Binding Protocol Start()function associated with a device, those events must be closed with CloseEvent() in its Driver Binding Protocol  Stop() function.
3.If a UEFI Driver creates events as part of an  I/O operation, the event should be closed with CloseEvent() when the I /O operation is completed.




Adding the Unload Feature

https://blog.csdn.net/CStyle_0x007/article/details/8945459

https://blog.csdn.net/luobing4365/article/details/104552594

https://blog.csdn.net/stringNewName/article/details/80004887


extern EFI_BOOT_SERVICES *gBS;
extern EFI_SYSTEM_TABLE *gST;
extern EFI_RUNTIME_SERVICES *gRT;

InitAmiLib()
pST = SystemTable;
pBS = pST->BootServices;
pRS = pST->RuntimeServices;

#define gBS pBS
#define gRT pRS

gST = pST;
gBS = pBS;
gRT = pRS;

沒有留言:

張貼留言