Saturday, August 15, 2015

Protocol - 3

Description

EfiPy also supports gBS.InstallMultipleProtocolInterfaces().
By EDK II definition,

typedef
EFI_STATUS
(EFIAPI *EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES)(
  IN OUT EFI_HANDLE           *Handle,
  ...
  );

EfiPy follows this rule as possible as it can. 

EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES = CFUNCTYPE (
  EFI_STATUS,
  POINTER(EFI_HANDLE)  # IN OUT *Handle
  )

In run time, EfiPy changes ctypes CFUNCTYPE argument by re-arrange arguments members.

EfiPy.gBS.InstallMultipleProtocolInterfaces.argtypes = [
      EfiPy.POINTER(EfiPy.EFI_HANDLE),
      EfiPy.POINTER(EfiPy.EFI_GUID),
      EfiPy.POINTER(EfiPy.PVOID),
      EfiPy.POINTER(EfiPy.PVOID)
      ]

Finally, calling EfiPy.gBS.InstallMultipleProtocolInterfaces() for install protocols in one time.

Status = EfiPy.gBS.InstallMultipleProtocolInterfaces (
               EfiPy.byref (Handle1),
               EfiPy.byref (TestGuid1),
               EfiPy.byref (TestProtocol1),
               None
               )

The same is as EfiPy.gBS.UninstallMultipleProtocolInterfaces()

Screenshot

















Sample code in sourceforge is protocol_3.py

No comments:

Post a Comment