]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/PcatRealTimeClockRuntimeDxe/PcRtc.h
Update the variable name and GUID to set time zone and daylight saving: Use L"RTC...
[mirror_edk2.git] / MdeModulePkg / Universal / PcatRealTimeClockRuntimeDxe / PcRtc.h
index 6189daac39108d816b1b18ecd7d85b827085a6b4..5beb0756910d830956ce0dc8bed42a7aab8988b4 100644 (file)
@@ -1,6 +1,7 @@
-/*++\r
+/** @file\r
+  Header file for real time clock driver.\r
 \r
-Copyright (c) 2006 - 2007 Intel Corporation. <BR>\r
+Copyright (c) 2006 - 2007, Intel Corporation\r
 All rights reserved. This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -9,25 +10,14 @@ http://opensource.org/licenses/bsd-license.php
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
+**/\r
 \r
-Module Name:\r
-  \r
-    PcRtc.h\r
-\r
-Abstract:\r
-\r
-    Include for real time clock driver\r
-\r
-Revision History\r
-\r
-\r
---*/\r
 \r
 #ifndef _RTC_H_\r
 #define _RTC_H_\r
 \r
 \r
-#include <PiDxe.h>\r
+#include <Uefi.h>\r
 \r
 #include <Protocol/RealTimeClock.h>\r
 \r
@@ -41,11 +31,12 @@ Revision History
 #include <Library/UefiBootServicesTableLib.h>\r
 #include <Library/UefiRuntimeLib.h>\r
 #include <Library/UefiRuntimeServicesTableLib.h>\r
+#include <Library/PcdLib.h>\r
 \r
 \r
 typedef struct {\r
   EFI_LOCK  RtcLock;\r
-  UINT16    SavedTimeZone;\r
+  INT16     SavedTimeZone;\r
   UINT8     Daylight;\r
 } PC_RTC_MODULE_GLOBALS;\r
 \r
@@ -153,353 +144,228 @@ typedef union {
 \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
 \r
-  None\r
+/**\r
+  Converts time read from RTC to EFI_TIME format defined by UEFI spec.\r
 \r
-Returns:\r
+  This function converts raw time data read from RTC to the EFI_TIME format\r
+  defined by UEFI spec.\r
+  If data mode of RTC is BCD, then converts it to decimal,\r
+  If RTC is in 12-hour format, then converts it to 24-hour format.\r
 \r
-  GC_TODO: add return values\r
+  @param   Time       On input, the time data read from RTC to convert\r
+                      On output, the time converted to UEFI format\r
+  @param   Century    Value of century read from RTC.\r
+  @param   RegisterB  Value of Register B of RTC, indicating data mode\r
+                      and hour format.\r
 \r
---*/\r
-;\r
+  @retval  EFI_INVALID_PARAMETER  Parameters passed in are invalid.\r
+  @retval  EFI_SUCCESS            Convert RTC time to EFI time successfully.\r
 \r
-VOID\r
+**/\r
+EFI_STATUS\r
 ConvertRtcTimeToEfiTime (\r
-  IN EFI_TIME       *Time,\r
-  IN RTC_REGISTER_B RegisterB\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
-\r
-Returns:\r
+  IN OUT EFI_TIME        *Time,\r
+  IN     UINT8           Century,\r
+  IN     RTC_REGISTER_B  RegisterB\r
+  );\r
 \r
-  GC_TODO: add return values\r
+/**\r
+  Wait for a period for the RTC to be ready.\r
 \r
---*/\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