]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Protocol/Timestamp.h
MdePkg: Apply uncrustify changes
[mirror_edk2.git] / MdePkg / Include / Protocol / Timestamp.h
1 /** @file
2 EFI Timestamp Protocol as defined in UEFI2.4 Specification.
3 Used to provide a platform independent interface for retrieving a high resolution timestamp counter.
4
5 Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.<BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
7
8 @par Revision Reference:
9 This Protocol is introduced in UEFI Specification 2.4
10
11 **/
12
13 #ifndef __EFI_TIME_STAMP_PROTOCOL_H__
14 #define __EFI_TIME_STAMP_PROTOCOL_H__
15
16 #define EFI_TIMESTAMP_PROTOCOL_GUID \
17 { 0xafbfde41, 0x2e6e, 0x4262, {0xba, 0x65, 0x62, 0xb9, 0x23, 0x6e, 0x54, 0x95 } }
18
19 ///
20 /// Declare forward reference for the Time Stamp Protocol
21 ///
22 typedef struct _EFI_TIMESTAMP_PROTOCOL EFI_TIMESTAMP_PROTOCOL;
23
24 ///
25 /// EFI_TIMESTAMP_PROPERTIES
26 ///
27 typedef struct {
28 ///
29 /// The frequency of the timestamp counter in Hz.
30 ///
31 UINT64 Frequency;
32 ///
33 /// The value that the timestamp counter ends with immediately before it rolls over.
34 /// For example, a 64-bit free running counter would have an EndValue of 0xFFFFFFFFFFFFFFFF.
35 /// A 24-bit free running counter would have an EndValue of 0xFFFFFF.
36 ///
37 UINT64 EndValue;
38 } EFI_TIMESTAMP_PROPERTIES;
39
40 /**
41 Retrieves the current value of a 64-bit free running timestamp counter.
42
43 The counter shall count up in proportion to the amount of time that has passed. The counter value
44 will always roll over to zero. The properties of the counter can be retrieved from GetProperties().
45 The caller should be prepared for the function to return the same value twice across successive calls.
46 The counter value will not go backwards other than when wrapping, as defined by EndValue in GetProperties().
47 The frequency of the returned timestamp counter value must remain constant. Power management operations that
48 affect clocking must not change the returned counter frequency. The quantization of counter value updates may
49 vary as long as the value reflecting time passed remains consistent.
50
51 @param None.
52
53 @retval The current value of the free running timestamp counter.
54
55 **/
56 typedef
57 UINT64
58 (EFIAPI *TIMESTAMP_GET)(
59 VOID
60 );
61
62 /**
63 Obtains timestamp counter properties including frequency and value limits.
64
65 @param[out] Properties The properties of the timestamp counter.
66
67 @retval EFI_SUCCESS The properties were successfully retrieved.
68 @retval EFI_DEVICE_ERROR An error occurred trying to retrieve the properties of the timestamp
69 counter subsystem. Properties is not pedated.
70 @retval EFI_INVALID_PARAMETER Properties is NULL.
71
72 **/
73 typedef
74 EFI_STATUS
75 (EFIAPI *TIMESTAMP_GET_PROPERTIES)(
76 OUT EFI_TIMESTAMP_PROPERTIES *Properties
77 );
78
79 ///
80 /// EFI_TIMESTAMP_PROTOCOL
81 /// The protocol provides a platform independent interface for retrieving a high resolution
82 /// timestamp counter.
83 ///
84 struct _EFI_TIMESTAMP_PROTOCOL {
85 TIMESTAMP_GET GetTimestamp;
86 TIMESTAMP_GET_PROPERTIES GetProperties;
87 };
88
89 extern EFI_GUID gEfiTimestampProtocolGuid;
90
91 #endif