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