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>
20 Returns the current time and date information, and the time-keeping capabilities
21 of the hardware platform.
23 @param Time A pointer to storage to receive a snapshot of the current time.
24 @param Capabilities An optional pointer to a buffer to receive the real time clock
25 device's capabilities.
27 @retval EFI_SUCCESS The operation completed successfully.
28 @retval EFI_INVALID_PARAMETER Time is NULL.
29 @retval EFI_DEVICE_ERROR The time could not be retrieved due to hardware error.
36 OUT EFI_TIME_CAPABILITIES
*Capabilities
40 // Fill in Time and Capabilities via data from you RTC
42 return EFI_DEVICE_ERROR
;
47 Sets the current local time and date information.
49 @param Time A pointer to the current time.
51 @retval EFI_SUCCESS The operation completed successfully.
52 @retval EFI_INVALID_PARAMETER A time field is out of range.
53 @retval EFI_DEVICE_ERROR The time could not be set due due to hardware error.
63 // Use Time, to set the time in your RTC hardware
65 return EFI_DEVICE_ERROR
;
70 Returns the current wakeup alarm clock setting.
72 @param Enabled Indicates if the alarm is currently enabled or disabled.
73 @param Pending Indicates if the alarm signal is pending and requires acknowledgement.
74 @param Time The current alarm setting.
76 @retval EFI_SUCCESS The alarm settings were returned.
77 @retval EFI_INVALID_PARAMETER Any parameter is NULL.
78 @retval EFI_DEVICE_ERROR The wakeup time could not be retrieved due to a hardware error.
89 // Not a required feature
90 return EFI_UNSUPPORTED
;
95 Sets the system wakeup alarm clock time.
97 @param Enabled Enable or disable the wakeup alarm.
98 @param Time If Enable is TRUE, the time to set the wakeup alarm for.
100 @retval EFI_SUCCESS If Enable is TRUE, then the wakeup alarm was enabled. If
101 Enable is FALSE, then the wakeup alarm was disabled.
102 @retval EFI_INVALID_PARAMETER A time field is out of range.
103 @retval EFI_DEVICE_ERROR The wakeup time could not be set due to a hardware error.
104 @retval EFI_UNSUPPORTED A wakeup timer is not supported on this platform.
114 // Not a required feature
115 return EFI_UNSUPPORTED
;
121 This is the declaration of an EFI image entry point. This can be the entry point to an application
122 written to this specification, an EFI boot service driver, or an EFI runtime driver.
124 @param ImageHandle Handle that identifies the loaded image.
125 @param SystemTable System Table for this image.
127 @retval EFI_SUCCESS The operation completed successfully.
133 IN EFI_HANDLE ImageHandle
,
134 IN EFI_SYSTEM_TABLE
*SystemTable
138 // Do some initialization if required to turn on the RTC
145 Fixup internal data so that EFI can be call in virtual mode.
146 Call the passed in Child Notify event and convert any pointers in
149 @param[in] Event The Event that is being processed
150 @param[in] Context Event Context
154 LibRtcVirtualNotifyEvent (
160 // Only needed if you are going to support the OS calling RTC functions in virtual mode.
161 // You will need to call EfiConvertPointer (). To convert any stored physical addresses
162 // to virtual address. After the OS transitions to calling in virtual mode, all future
163 // runtime calls will be made in virtual mode.