Code Scrub for ConPlatform.
[mirror_edk2.git] / MdeModulePkg / Universal / PcatRealTimeClockRuntimeDxe / Ia32 / Ia32PcRtc.c
CommitLineData
fb0b259e 1/** @file\r
2 Provides Set/Get time operations.\r
8cd4d17c 3\r
fb0b259e 4Copyright (c) 2006 - 2007, Intel Corporation\r
3cfb790c 5All rights reserved. This program and the accompanying materials\r
6are licensed and made available under the terms and conditions of the BSD License\r
7which accompanies this distribution. The full text of the license may be found at\r
8http://opensource.org/licenses/bsd-license.php\r
9\r
10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
8cd4d17c 12\r
fb0b259e 13**/\r
8cd4d17c 14\r
15#include "PcRtc.h"\r
16\r
fe1e36e5 17PC_RTC_MODULE_GLOBALS mModuleGlobal;\r
8cd4d17c 18\r
19EFI_STATUS\r
20EFIAPI\r
21PcRtcEfiGetTime (\r
22 OUT EFI_TIME *Time,\r
23 OUT EFI_TIME_CAPABILITIES *Capabilities\r
24 )\r
25/*++\r
26\r
27Routine Description:\r
28\r
29 GC_TODO: Add function description\r
30\r
31Arguments:\r
32\r
33 Time - GC_TODO: add argument description\r
34 Capabilities - GC_TODO: add argument description\r
35\r
36Returns:\r
37\r
38 GC_TODO: add return values\r
39\r
40--*/\r
41{\r
42 return PcRtcGetTime (Time, Capabilities, &mModuleGlobal);\r
43}\r
44\r
45EFI_STATUS\r
46EFIAPI\r
47PcRtcEfiSetTime (\r
48 IN EFI_TIME *Time\r
49 )\r
50/*++\r
51\r
52Routine Description:\r
53\r
54 GC_TODO: Add function description\r
55\r
56Arguments:\r
57\r
58 Time - GC_TODO: add argument description\r
59\r
60Returns:\r
61\r
62 GC_TODO: add return values\r
63\r
64--*/\r
65{\r
66 return PcRtcSetTime (Time, &mModuleGlobal);\r
67}\r
68\r
69EFI_STATUS\r
70EFIAPI\r
71PcRtcEfiGetWakeupTime (\r
72 OUT BOOLEAN *Enabled,\r
73 OUT BOOLEAN *Pending,\r
74 OUT EFI_TIME *Time\r
75 )\r
76/*++\r
77\r
78Routine Description:\r
79\r
80 GC_TODO: Add function description\r
81\r
82Arguments:\r
83\r
84 Enabled - GC_TODO: add argument description\r
85 Pending - GC_TODO: add argument description\r
86 Time - GC_TODO: add argument description\r
87\r
88Returns:\r
89\r
90 GC_TODO: add return values\r
91\r
92--*/\r
93{\r
94 return PcRtcGetWakeupTime (Enabled, Pending, Time, &mModuleGlobal);\r
95}\r
96\r
97EFI_STATUS\r
98EFIAPI\r
99PcRtcEfiSetWakeupTime (\r
100 IN BOOLEAN Enabled,\r
101 OUT EFI_TIME *Time\r
102 )\r
103/*++\r
104\r
105Routine Description:\r
106\r
107 GC_TODO: Add function description\r
108\r
109Arguments:\r
110\r
111 Enabled - GC_TODO: add argument description\r
112 Time - GC_TODO: add argument description\r
113\r
114Returns:\r
115\r
116 GC_TODO: add return values\r
117\r
118--*/\r
119{\r
120 return PcRtcSetWakeupTime (Enabled, Time, &mModuleGlobal);\r
121}\r
122\r
123EFI_STATUS\r
124EFIAPI\r
125InitializePcRtc (\r
126 IN EFI_HANDLE ImageHandle,\r
127 IN EFI_SYSTEM_TABLE *SystemTable\r
128 )\r
129/*++\r
130\r
131Routine Description:\r
132\r
133 Arguments:\r
134\r
8cd4d17c 135\r
fb0b259e 136\r
137Returns:\r
8cd4d17c 138--*/\r
139// GC_TODO: ImageHandle - add argument and description to function comment\r
140// GC_TODO: SystemTable - add argument and description to function comment\r
141{\r
142 EFI_STATUS Status;\r
143 EFI_HANDLE NewHandle;\r
144\r
145 EfiInitializeLock (&mModuleGlobal.RtcLock, TPL_HIGH_LEVEL);\r
146\r
147 Status = PcRtcInit (&mModuleGlobal);\r
148 if (EFI_ERROR (Status)) {\r
149 return Status;\r
150 }\r
151\r
152 gRT->GetTime = PcRtcEfiGetTime;\r
153 gRT->SetTime = PcRtcEfiSetTime;\r
154 gRT->GetWakeupTime = PcRtcEfiGetWakeupTime;\r
155 gRT->SetWakeupTime = PcRtcEfiSetWakeupTime;\r
156\r
157 NewHandle = NULL;\r
158 Status = gBS->InstallMultipleProtocolInterfaces (\r
159 &NewHandle,\r
160 &gEfiRealTimeClockArchProtocolGuid,\r
161 NULL,\r
162 NULL\r
163 );\r
164\r
165 return Status;\r
166}\r