1 /*++
2 
3 Copyright (c) 2004, Intel Corporation. All rights reserved.<BR>
4 This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution.  The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
8 
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11 
12 Module Name:
13 
14   Metronome.h
15 
16 Abstract:
17 
18   Metronome Architectural Protocol as defined in DXE CIS
19 
20   This code abstracts the DXE core to provide delay services.
21 
22 --*/
23 
24 #ifndef _ARCH_PROTOCOL_METRONOME_H_
25 #define _ARCH_PROTOCOL_METRONOME_H_
26 
27 //
28 // Global ID for the Metronome Architectural Protocol
29 //
30 #define EFI_METRONOME_ARCH_PROTOCOL_GUID \
31   { 0x26baccb2, 0x6f42, 0x11d4, {0xbc, 0xe7, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81} }
32 
33 //
34 // Declare forward reference for the Metronome Architectural Protocol
35 //
36 EFI_FORWARD_DECLARATION (EFI_METRONOME_ARCH_PROTOCOL);
37 
38 typedef
39 EFI_STATUS
40 (EFIAPI *EFI_METRONOME_WAIT_FOR_TICK) (
41    IN EFI_METRONOME_ARCH_PROTOCOL   *This,
42    IN UINT32                        TickNumber
43   );
44 /*++
45 
46 Routine Description:
47 
48   The WaitForTick() function waits for the number of ticks specified by
49   TickNumber from a known time source in the platform.  If TickNumber of
50   ticks are detected, then EFI_SUCCESS is returned.  The actual time passed
51   between entry of this function and the first tick is between 0 and
52   TickPeriod 100 nS units.  If you want to guarantee that at least TickPeriod
53   time has elapsed, wait for two ticks.  This function waits for a hardware
54   event to determine when a tick occurs.  It is possible for interrupt
55   processing, or exception processing to interrupt the execution of the
56   WaitForTick() function.  Depending on the hardware source for the ticks, it
57   is possible for a tick to be missed.  This function cannot guarantee that
58   ticks will not be missed.  If a timeout occurs waiting for the specified
59   number of ticks, then EFI_TIMEOUT is returned.
60 
61 Arguments:
62 
63   This       - The EFI_METRONOME_ARCH_PROTOCOL instance.
64 
65   TickNumber - Number of ticks to wait.
66 
67 Returns:
68 
69   EFI_SUCCESS - The wait for the number of ticks specified by TickNumber
70                 succeeded.
71 
72   EFI_TIMEOUT - A timeout occurred waiting for the specified number of ticks.
73 
74 --*/
75 
76 //
77 // Interface stucture for the Metronome Architectural Protocol
78 //
79 struct _EFI_METRONOME_ARCH_PROTOCOL {
80   EFI_METRONOME_WAIT_FOR_TICK  WaitForTick;
81   UINT32                       TickPeriod;
82 };
83 
84 /*++
85 
86   Protocol Description:
87     This protocol provides access to a known time source in the platform to the
88     core.  The core uses this known time source to produce core services that
89     require calibrated delays.
90 
91   Parameters:
92 
93     WaitForTick - Waits for a specified number of ticks from a known time source
94                   in the platform.  The actual time passed between entry of this
95                   function and the first tick is between 0 and TickPeriod 100 nS
96                   units.  If you want to guarantee that at least TickPeriod time
97                   has elapsed, wait for two ticks.
98 
99     TickPeriod  - The period of platform's known time source in 100 nS units.
100                   This value on any platform must be at least 10 uS, and must not
101                   exceed 200 uS.  The value in this field is a constant that must
102                   not be modified after the Metronome architectural protocol is
103                   installed.  All consumers must treat this as a read-only field.
104 
105 --*/
106 
107 extern EFI_GUID gEfiMetronomeArchProtocolGuid;
108 
109 #endif
110