前面写了一个hello world驱动,现在简单调用一下
-----------------testlib.c文件----------------------------
#include
#include
#include
#include
#include
#include
//#include
#include EFI_STATUS EFIAPI UefiMain(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
{EFI_STATUS Status = EFI_SUCCESS;EFI_FIRSTDRIVER_PROTOCOL *gf;Status = gBS->LocateProtocol(&gEfifirstdriverProtocolGuid,NULL,&gf);if(EFI_SUCCESS == Status){Print(L"success to locate protocol\n");}else{Print(L"failed to locate protocvol\n");}gf->Func1(gf);Print(L"ia in protocol is %d\n",gf->ia);return Status;
}
testlib.dsc的 [libraryclass] 块中加上
firstdriver|firstdriver/firstdriver/firstdriver.inf
-------------------testlib.inf-------------------------
[Packages]MdePkg/MdePkg.decfirstdriver/firstdriver.dec[LibraryClasses]UefiApplicationEntryPointUefiLib[Protocols]gEfifirstdriverProtocolGuid