TianoCore EDK2 master
Loading...
Searching...
No Matches
Metronome.c
Go to the documentation of this file.
1
10#include <PiDxe.h>
11
12#include <Library/BaseLib.h>
13#include <Library/DebugLib.h>
16#include <Library/UefiLib.h>
17#include <Library/PcdLib.h>
18#include <Library/TimerLib.h>
19
20#include <Protocol/Metronome.h>
21
23EFIAPI
26 IN UINT32 TickNumber
27 );
28
53 FixedPcdGet32 (PcdMetronomeTickPeriod)
54};
55
79EFIAPI
82 IN UINT32 TickNumber
83 )
84{
85 //
86 // Compute how long to stall the CPU.
87 // gMetronome.TickPeriod is in 100 ns units so it needs to be divided by 10
88 // to get it in microseconds units.
89 //
90 MicroSecondDelay (TickNumber * gMetronome.TickPeriod / 10);
91 return EFI_SUCCESS;
92}
93
94EFI_HANDLE gMetronomeHandle = NULL;
95
108EFIAPI
110 IN EFI_HANDLE ImageHandle,
111 IN EFI_SYSTEM_TABLE *SystemTable
112 )
113{
114 EFI_STATUS Status;
115
116 //
117 // Do any hardware init required to make WaitForTick () to work here.
118 //
119
120 Status = gBS->InstallMultipleProtocolInterfaces (
121 &gMetronomeHandle,
122 &gEfiMetronomeArchProtocolGuid,
123 &gMetronome,
124 NULL
125 );
126 ASSERT_EFI_ERROR (Status);
127
128 return Status;
129}
UINTN EFIAPI MicroSecondDelay(IN UINTN MicroSeconds)
EFI_STATUS EFIAPI MetronomeInitialize(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
Definition: Metronome.c:109
EFI_STATUS EFIAPI WaitForTick(IN EFI_METRONOME_ARCH_PROTOCOL *This, IN UINT32 TickNumber)
Definition: Metronome.c:80
EFI_METRONOME_ARCH_PROTOCOL gMetronome
Definition: Metronome.c:51
#define NULL
Definition: Base.h:319
#define IN
Definition: Base.h:279
#define ASSERT_EFI_ERROR(StatusParameter)
Definition: DebugLib.h:462
#define FixedPcdGet32(TokenName)
Definition: PcdLib.h:92
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
VOID * EFI_HANDLE
Definition: UefiBaseType.h:33
#define EFI_SUCCESS
Definition: UefiBaseType.h:112
EFI_BOOT_SERVICES * gBS