#include <Uefi.h>\r
\r
#include <Protocol/RealTimeClock.h>\r
-#include <Guid/GenericPlatformVariable.h>\r
\r
#include <Library/BaseLib.h>\r
#include <Library/DebugLib.h>\r
\r
#pragma pack()\r
\r
-EFI_STATUS\r
-PcRtcInit (\r
- IN PC_RTC_MODULE_GLOBALS *Global\r
- )\r
-/*++\r
-\r
-Routine Description:\r
+/**\r
+ Initialize RTC.\r
\r
- GC_TODO: Add function description\r
+ @param Global For global use inside this module.\r
\r
-Arguments:\r
+ @retval EFI_DEVICE_ERROR Initialization failed due to device error.\r
+ @retval EFI_SUCCESS Initialization successful.\r
\r
- Global - GC_TODO: add argument description\r
+**/\r
+EFI_STATUS\r
+PcRtcInit (\r
+ IN PC_RTC_MODULE_GLOBALS *Global\r
+ );\r
\r
-Returns:\r
+/**\r
+ Sets the current local time and date information.\r
\r
- GC_TODO: add return values\r
+ @param Time A pointer to the current time.\r
+ @param Global For global use inside this module.\r
\r
---*/\r
-;\r
+ @retval EFI_SUCCESS The operation completed successfully.\r
+ @retval EFI_INVALID_PARAMETER A time field is out of range.\r
+ @retval EFI_DEVICE_ERROR The time could not be set due due to hardware error.\r
\r
+**/\r
EFI_STATUS\r
PcRtcSetTime (\r
IN EFI_TIME *Time,\r
IN PC_RTC_MODULE_GLOBALS *Global\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- GC_TODO: Add function description\r
-\r
-Arguments:\r
-\r
- Time - GC_TODO: add argument description\r
- Global - GC_TODO: add argument description\r
+ );\r
\r
-Returns:\r
+/**\r
+ Returns the current time and date information, and the time-keeping capabilities\r
+ of the hardware platform.\r
\r
- GC_TODO: add return values\r
+ @param Time A pointer to storage to receive a snapshot of the current time.\r
+ @param Capabilities An optional pointer to a buffer to receive the real time clock\r
+ device's capabilities.\r
+ @param Global For global use inside this module.\r
\r
---*/\r
-;\r
+ @retval EFI_SUCCESS The operation completed successfully.\r
+ @retval EFI_INVALID_PARAMETER Time is NULL.\r
+ @retval EFI_DEVICE_ERROR The time could not be retrieved due to hardware error.\r
\r
+**/\r
EFI_STATUS\r
PcRtcGetTime (\r
OUT EFI_TIME *Time,\r
- IN EFI_TIME_CAPABILITIES *Capabilities,\r
+ OUT EFI_TIME_CAPABILITIES *Capabilities, OPTIONAL\r
IN PC_RTC_MODULE_GLOBALS *Global\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- GC_TODO: Add function description\r
-\r
-Arguments:\r
-\r
- Time - GC_TODO: add argument description\r
- Capabilities - GC_TODO: add argument description\r
- Global - GC_TODO: add argument description\r
+ );\r
\r
-Returns:\r
+/**\r
+ Sets the system wakeup alarm clock time.\r
\r
- GC_TODO: add return values\r
+ @param Enabled Enable or disable the wakeup alarm.\r
+ @param Time If Enable is TRUE, the time to set the wakeup alarm for.\r
+ If Enable is FALSE, then this parameter is optional, and may be NULL.\r
+ @param Global For global use inside this module.\r
\r
---*/\r
-;\r
+ @retval EFI_SUCCESS If Enable is TRUE, then the wakeup alarm was enabled.\r
+ If Enable is FALSE, then the wakeup alarm was disabled.\r
+ @retval EFI_INVALID_PARAMETER A time field is out of range.\r
+ @retval EFI_DEVICE_ERROR The wakeup time could not be set due to a hardware error.\r
+ @retval EFI_UNSUPPORTED A wakeup timer is not supported on this platform.\r
\r
+**/\r
EFI_STATUS\r
PcRtcSetWakeupTime (\r
IN BOOLEAN Enable,\r
- OUT EFI_TIME *Time,\r
- IN PC_RTC_MODULE_GLOBALS *Global\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- GC_TODO: Add function description\r
-\r
-Arguments:\r
-\r
- Enable - GC_TODO: add argument description\r
- Time - GC_TODO: add argument description\r
- Global - GC_TODO: add argument description\r
+ IN EFI_TIME *Time, OPTIONAL\r
+ IN PC_RTC_MODULE_GLOBALS *Global\r
+ );\r
\r
-Returns:\r
+/**\r
+ Returns the current wakeup alarm clock setting.\r
\r
- GC_TODO: add return values\r
+ @param Enabled Indicates if the alarm is currently enabled or disabled.\r
+ @param Pending Indicates if the alarm signal is pending and requires acknowledgement.\r
+ @param Time The current alarm setting.\r
+ @param Global For global use inside this module.\r
\r
---*/\r
-;\r
+ @retval EFI_SUCCESS The alarm settings were returned.\r
+ @retval EFI_INVALID_PARAMETER Enabled is NULL.\r
+ @retval EFI_INVALID_PARAMETER Pending is NULL.\r
+ @retval EFI_INVALID_PARAMETER Time is NULL.\r
+ @retval EFI_DEVICE_ERROR The wakeup time could not be retrieved due to a hardware error.\r
+ @retval EFI_UNSUPPORTED A wakeup timer is not supported on this platform.\r
\r
+**/\r
EFI_STATUS\r
PcRtcGetWakeupTime (\r
OUT BOOLEAN *Enabled,\r
OUT BOOLEAN *Pending,\r
OUT EFI_TIME *Time,\r
IN PC_RTC_MODULE_GLOBALS *Global\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- GC_TODO: Add function description\r
-\r
-Arguments:\r
+ );\r
\r
- Enabled - GC_TODO: add argument description\r
- Pending - GC_TODO: add argument description\r
- Time - GC_TODO: add argument description\r
- Global - GC_TODO: add argument description\r
+/**\r
+ The user Entry Point for PcRTC module.\r
\r
-Returns:\r
+ This is the entrhy point for PcRTC module. It installs the UEFI runtime service\r
+ including GetTime(),SetTime(),GetWakeupTime(),and SetWakeupTime().\r
\r
- GC_TODO: add return values\r
+ @param ImageHandle The firmware allocated handle for the EFI image.\r
+ @param SystemTable A pointer to the EFI System Table.\r
\r
---*/\r
-;\r
+ @retval EFI_SUCCESS The entry point is executed successfully.\r
+ @retval Others Some error occurs when executing this entry point.\r
\r
+**/\r
EFI_STATUS\r
EFIAPI\r
InitializePcRtc (\r
IN EFI_HANDLE ImageHandle,\r
IN EFI_SYSTEM_TABLE *SystemTable\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- GC_TODO: Add function description\r
-\r
-Arguments:\r
-\r
- ImageHandle - GC_TODO: add argument description\r
- SystemTable - GC_TODO: add argument description\r
-\r
-Returns:\r
-\r
- GC_TODO: add return values\r
-\r
---*/\r
-;\r
-\r
-UINT8\r
-BcdToDecimal (\r
- IN UINT8 BcdValue\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- GC_TODO: Add function description\r
-\r
-Arguments:\r
-\r
- BcdValue - GC_TODO: add argument description\r
+ );\r
\r
-Returns:\r
+/**\r
+ See if all fields of a variable of EFI_TIME type is correct.\r
\r
- GC_TODO: add return values\r
+ @param Time The time to be checked.\r
\r
---*/\r
-;\r
+ @retval EFI_INVALID_PARAMETER Some fields of Time are not correct.\r
+ @retval EFI_SUCCESS Time is a valid EFI_TIME variable.\r
\r
+**/\r
EFI_STATUS\r
RtcTimeFieldsValid (\r
IN EFI_TIME *Time\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- GC_TODO: Add function description\r
-\r
-Arguments:\r
-\r
- Time - GC_TODO: add argument description\r
-\r
-Returns:\r
-\r
- GC_TODO: add return values\r
-\r
---*/\r
-;\r
-\r
-UINT8\r
-DecimaltoBcd (\r
- IN UINT8 DecValue\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- GC_TODO: Add function description\r
-\r
-Arguments:\r
-\r
- DecValue - GC_TODO: add argument description\r
+ );\r
\r
-Returns:\r
+/**\r
+ Converts time from EFI_TIME format defined by UEFI spec to RTC's.\r
\r
- GC_TODO: add return values\r
+ This function converts time from EFI_TIME format defined by UEFI spec to RTC's.\r
+ If data mode of RTC is BCD, then converts EFI_TIME to it.\r
+ If RTC is in 12-hour format, then converts EFI_TIME to it.\r
\r
---*/\r
-;\r
+ @param Time On input, the time data read from UEFI to convert\r
+ On output, the time converted to RTC format\r
+ @param RegisterB Value of Register B of RTC, indicating data mode\r
+ @param Century It is set according to EFI_TIME Time.\r
\r
+**/\r
VOID\r
ConvertEfiTimeToRtcTime (\r
- IN EFI_TIME *Time,\r
- IN RTC_REGISTER_B RegisterB,\r
- IN UINT8 *Century\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- GC_TODO: Add function description\r
-\r
-Arguments:\r
-\r
- Time - GC_TODO: add argument description\r
- RegisterB - GC_TODO: add argument description\r
- Century - GC_TODO: add argument description\r
-\r
-Returns:\r
-\r
- GC_TODO: add return values\r
+ IN OUT EFI_TIME *Time,\r
+ IN RTC_REGISTER_B RegisterB,\r
+ OUT UINT8 *Century\r
+ );\r
\r
---*/\r
-;\r
+/**\r
+ See if centry register of RTC is valid.\r
\r
+ @retval EFI_SUCCESS Century register is valid.\r
+ @retval EFI_DEVICE_ERROR Century register is NOT valid.\r
+**/\r
EFI_STATUS\r
RtcTestCenturyRegister (\r
VOID\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- GC_TODO: Add function description\r
-\r
-Arguments:\r
-\r
- None\r
-\r
-Returns:\r
-\r
- GC_TODO: add return values\r
-\r
---*/\r
-;\r
+ );\r
\r
/**\r
Converts time read from RTC to EFI_TIME format defined by UEFI spec.\r
@param RegisterB Value of Register B of RTC, indicating data mode\r
and hour format.\r
\r
+ @retval EFI_INVALID_PARAMETER Parameters passed in are invalid.\r
+ @retval EFI_SUCCESS Convert RTC time to EFI time successfully.\r
+\r
**/\r
EFI_STATUS\r
ConvertRtcTimeToEfiTime (\r
IN RTC_REGISTER_B RegisterB\r
);\r
\r
+/**\r
+ Wait for a period for the RTC to be ready.\r
+\r
+ @param Timeout Tell how long it should take to wait.\r
+\r
+ @retval EFI_DEVICE_ERROR RTC device error.\r
+ @retval EFI_SUCCESS RTC is updated and ready. \r
+**/\r
EFI_STATUS\r
RtcWaitToUpdate (\r
UINTN Timeout\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- GC_TODO: Add function description\r
-\r
-Arguments:\r
-\r
- Timeout - GC_TODO: add argument description\r
-\r
-Returns:\r
-\r
- GC_TODO: add return values\r
-\r
---*/\r
-;\r
-\r
-UINT8\r
-RtcSaveContext (\r
- IN PC_RTC_MODULE_GLOBALS *Global\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- GC_TODO: Add function description\r
-\r
-Arguments:\r
-\r
- Global - GC_TODO: add argument description\r
-\r
-Returns:\r
-\r
- GC_TODO: add return values\r
-\r
---*/\r
-;\r
-\r
-VOID\r
-RtcRestoreContext (\r
- IN UINT8 SavedAddressRegister,\r
- IN PC_RTC_MODULE_GLOBALS *Global\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- GC_TODO: Add function description\r
-\r
-Arguments:\r
-\r
- SavedAddressRegister - GC_TODO: add argument description\r
- Global - GC_TODO: add argument description\r
-\r
-Returns:\r
+ );\r
\r
- GC_TODO: add return values\r
+/**\r
+ See if field Day of an EFI_TIME is correct.\r
\r
---*/\r
-;\r
+ @param Time Its Day field is to be checked.\r
\r
+ @retval TRUE Day field of Time is correct.\r
+ @retval FALSE Day field of Time is NOT correct.\r
+**/\r
BOOLEAN\r
DayValid (\r
IN EFI_TIME *Time\r
);\r
\r
+/**\r
+ Check if it is a leapyear.\r
+\r
+ @param Time The time to be checked.\r
+\r
+ @retval TRUE It is a leapyear.\r
+ @retval FALSE It is NOT a leapyear.\r
+**/\r
BOOLEAN\r
IsLeapYear (\r
IN EFI_TIME *Time\r