2008年11月8日 星期六

EFI Driver Template Code

#include "Tiano.h"
#include "EfiDriverLib.h"
#include "DrvSampleSetup.h"
#include "DrvSample.h"

//
// Local function declarations
//

EFI_STATUS
DrvSampleEntry (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
);

EFI_DRIVER_ENTRY_POINT (DrvSampleEntry)

EFI_STATUS
DrvSampleEntry (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
/*++

Routine Description:

DrvSample driver entry point function.

Arguments:

ImageHandle - image handle for this driver image
SystemTable - pointer to the EFI System Table

--*/

{
EFI_STATUS Status;
EFI_HANDLE Handle;

Status = EFI_SUCCESS;
Handle = NULL;
EfiInitializeDriverLib (ImageHandle, SystemTable);
//
// TODO: Add implementation code
//
//
// Initialize our setup/forms data
//

Status = SetupInit (ImageHandle, SystemTable, &Handle);
if (EFI_ERROR(Status)) {
//
// TODO: Handle error
//

}
//
// Initialize and produce our driver binding protocol
//

Status = DriverBindingProtocolInit (ImageHandle, SystemTable, &Handle);
if (EFI_ERROR(Status)) {
//
// TODO: Handle error
//

}
//
// Initialize and produce our driver diagnostics protocol
//

Status = DriverDiagnosticsProtocolInit (ImageHandle, SystemTable, &Handle);
if (EFI_ERROR(Status)) {
//
// TODO: Handle error
//

}
//
// Initialize and produce our component name protocol
//

Status = ComponentNameProtocolInit (ImageHandle, SystemTable, &Handle);
if (EFI_ERROR(Status)) {
//
// TODO: Handle error
//

}
//
// Initialize and produce our driver configuration protocol
//

Status = DriverConfigurationProtocolInit (ImageHandle, SystemTable, &Handle);
if (EFI_ERROR(Status)) {
//
// TODO: Handle error
//

}
return Status;
}


資料來源:
http://blog.sina.com.cn/s/blog_4b265789010006gu.html
EFI Programming on Mac OS X

沒有留言: