--- /dev/null
+/** @file\r
+ Help functions to access UDP service.\r
+\r
+Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.<BR>\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
+**/\r
+\r
+#include <Uefi.h>\r
+#include <Library/DebugLib.h>\r
+#include <Library/UefiBootServicesTableLib.h>\r
+#include <Protocol/Dpc.h>\r
+\r
+//\r
+// Pointer to the DPC Protocol\r
+//\r
+EFI_DPC_PROTOCOL *mDpc;\r
+\r
+/**\r
+ This constructor function caches the EFI_DPC_PROTOCOL pointer.\r
+\r
+ @param[in] ImageHandle The firmware allocated handle for the EFI image.\r
+ @param[in] SystemTable A pointer to the EFI System Table.\r
+\r
+ @retval EFI_SUCCESS The constructor always return EFI_SUCCESS.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+DpcLibConstructor (\r
+ IN EFI_HANDLE ImageHandle,\r
+ IN EFI_SYSTEM_TABLE *SystemTable\r
+ )\r
+{\r
+ EFI_STATUS Status;\r
+\r
+ //\r
+ // Locate the EFI_DPC_PROTOCOL in the handle database\r
+ //\r
+ Status = gBS->LocateProtocol (&gEfiDpcProtocolGuid, NULL, (VOID **)&mDpc);\r
+ ASSERT_EFI_ERROR (Status);\r
+\r
+ return Status;\r
+}\r
+\r
+/**\r
+ Add a Deferred Procedure Call to the end of the DPC queue.\r
+\r
+ @param[in] DpcTpl The EFI_TPL that the DPC should be invoked.\r
+ @param[in] DpcProcedure Pointer to the DPC's function.\r
+ @param[in] DpcContext Pointer to the DPC's context. Passed to DpcProcedure\r
+ when DpcProcedure is invoked.\r
+\r
+ @retval EFI_SUCCESS The DPC was queued.\r
+ @retval EFI_INVALID_PARAMETER DpcTpl is not a valid EFI_TPL.\r
+ @retval EFI_INVALID_PARAMETER DpcProcedure is NULL.\r
+ @retval EFI_OUT_OF_RESOURCES There are not enough resources available to\r
+ add the DPC to the queue.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+QueueDpc (\r
+ IN EFI_TPL DpcTpl,\r
+ IN EFI_DPC_PROCEDURE DpcProcedure,\r
+ IN VOID *DpcContext OPTIONAL\r
+ )\r
+{\r
+ //\r
+ // Call the EFI_DPC_PROTOCOL to queue the DPC\r
+ //\r
+ return mDpc->QueueDpc (mDpc, DpcTpl, DpcProcedure, DpcContext);\r
+}\r
+\r
+/**\r
+ Dispatch the queue of DPCs. ALL DPCs that have been queued with a DpcTpl\r
+ value greater than or equal to the current TPL are invoked in the order that\r
+ they were queued. DPCs with higher DpcTpl values are invoked before DPCs with\r
+ lower DpcTpl values.\r
+\r
+ @retval EFI_SUCCESS One or more DPCs were invoked.\r
+ @retval EFI_NOT_FOUND No DPCs were invoked.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+DispatchDpc (\r
+ VOID\r
+ )\r
+{\r
+ //\r
+ // Call the EFI_DPC_PROTOCOL to dispatch previously queued DPCs\r
+ //\r
+ return mDpc->DispatchDpc (mDpc);\r
+}\r