2 Implement EFI RealTimeClock runtime services via RTC Lib.
4 Currently this driver does not support runtime virtual calling.
6 Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
8 SPDX-License-Identifier: BSD-2-Clause-Patent
13 #include <Library/BaseLib.h>
14 #include <Library/DebugLib.h>
15 #include <Library/IoLib.h>
16 #include <Library/RealTimeClockLib.h>
19 Returns the current time and date information, and the time-keeping capabilities
20 of the hardware platform.
22 @param Time A pointer to storage to receive a snapshot of the current time.
23 @param Capabilities An optional pointer to a buffer to receive the real time clock
24 device's capabilities.
26 @retval EFI_SUCCESS The operation completed successfully.
27 @retval EFI_INVALID_PARAMETER Time is NULL.
28 @retval EFI_DEVICE_ERROR The time could not be retrieved due to hardware error.
35 OUT EFI_TIME_CAPABILITIES
*Capabilities
39 // Fill in Time and Capabilities via data from you RTC
41 return EFI_DEVICE_ERROR
;
45 Sets the current local time and date information.
47 @param Time A pointer to the current time.
49 @retval EFI_SUCCESS The operation completed successfully.
50 @retval EFI_INVALID_PARAMETER A time field is out of range.
51 @retval EFI_DEVICE_ERROR The time could not be set due due to hardware error.
61 // Use Time, to set the time in your RTC hardware
63 return EFI_DEVICE_ERROR
;
67 Returns the current wakeup alarm clock setting.
69 @param Enabled Indicates if the alarm is currently enabled or disabled.
70 @param Pending Indicates if the alarm signal is pending and requires acknowledgement.
71 @param Time The current alarm setting.
73 @retval EFI_SUCCESS The alarm settings were returned.
74 @retval EFI_INVALID_PARAMETER Any parameter is NULL.
75 @retval EFI_DEVICE_ERROR The wakeup time could not be retrieved due to a hardware error.
86 // Not a required feature
87 return EFI_UNSUPPORTED
;
91 Sets the system wakeup alarm clock time.
93 @param Enabled Enable or disable the wakeup alarm.
94 @param Time If Enable is TRUE, the time to set the wakeup alarm for.
96 @retval EFI_SUCCESS If Enable is TRUE, then the wakeup alarm was enabled. If
97 Enable is FALSE, then the wakeup alarm was disabled.
98 @retval EFI_INVALID_PARAMETER A time field is out of range.
99 @retval EFI_DEVICE_ERROR The wakeup time could not be set due to a hardware error.
100 @retval EFI_UNSUPPORTED A wakeup timer is not supported on this platform.
110 // Not a required feature
111 return EFI_UNSUPPORTED
;
115 This is the declaration of an EFI image entry point. This can be the entry point to an application
116 written to this specification, an EFI boot service driver, or an EFI runtime driver.
118 @param ImageHandle Handle that identifies the loaded image.
119 @param SystemTable System Table for this image.
121 @retval EFI_SUCCESS The operation completed successfully.
127 IN EFI_HANDLE ImageHandle
,
128 IN EFI_SYSTEM_TABLE
*SystemTable
132 // Do some initialization if required to turn on the RTC
138 Fixup internal data so that EFI can be call in virtual mode.
139 Call the passed in Child Notify event and convert any pointers in
142 @param[in] Event The Event that is being processed
143 @param[in] Context Event Context
147 LibRtcVirtualNotifyEvent (
153 // Only needed if you are going to support the OS calling RTC functions in virtual mode.
154 // You will need to call EfiConvertPointer (). To convert any stored physical addresses
155 // to virtual address. After the OS transitions to calling in virtual mode, all future
156 // runtime calls will be made in virtual mode.