]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Code scrub for WatchdogTimer driver.
authorxli24 <xli24@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 17 Nov 2008 04:33:19 +0000 (04:33 +0000)
committerxli24 <xli24@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 17 Nov 2008 04:33:19 +0000 (04:33 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@6555 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.c
MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.h
MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf

index 5f55a796589f3da4ce996deb9edd76c6be3c44e9..ca6d3445f8e229a0043b5c7c3ee9f8831193285a 100644 (file)
@@ -1,7 +1,5 @@
 /** @file\r
-  \r
-  Generic watchdog timer services implemenetation using UEFI APIs and\r
-  install watchdog timer architecture protocol.\r
+  Implementation of Watchdog Timer Architectural Protocol using UEFI APIs.\r
   \r
 Copyright (c) 2006 - 2008, Intel Corporation\r
 All rights reserved. This program and the accompanying materials\r
@@ -19,7 +17,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 //\r
 // Handle for the Watchdog Timer Architectural Protocol instance produced by this driver\r
 //\r
-EFI_HANDLE                        mWatchdogTimerHandle = NULL;\r
+EFI_HANDLE  mWatchdogTimerHandle = NULL;\r
 \r
 //\r
 // The Watchdog Timer Architectural Protocol instance produced by this driver\r
@@ -31,35 +29,35 @@ EFI_WATCHDOG_TIMER_ARCH_PROTOCOL  mWatchdogTimer = {
 };\r
 \r
 //\r
-// The watchdog timer period in 100 nS units\r
+// The watchdog timer period in 100 ns units\r
 //\r
-UINT64                            mWatchdogTimerPeriod = 0;\r
+UINT64  mWatchdogTimerPeriod = 0;\r
 \r
 //\r
 // The notification function to call if the watchdig timer fires\r
 //\r
-EFI_WATCHDOG_TIMER_NOTIFY         mWatchdogTimerNotifyFunction = NULL;\r
+EFI_WATCHDOG_TIMER_NOTIFY  mWatchdogTimerNotifyFunction = NULL;\r
 \r
 //\r
 // The one-shot timer event that is armed when the watchdog timer is enabled\r
 //\r
-EFI_EVENT                         mWatchdogTimerEvent;\r
+EFI_EVENT  mWatchdogTimerEvent;\r
 \r
 \r
 /**\r
-  Notification function that is called if the watchdog timer is fired.  If a\r
-  handler has been registered with the Watchdog Timer Architectural Protocol,\r
-  then that handler is called passing in the time period that has passed that\r
-  cause the watchdog timer to fire.  Then, a call to the Runtime Service\r
-  ResetSystem() is made to reset the platform.\r
+  Notification function that is called if the watchdog timer is fired.\r
 \r
+  Notification function for the one-shot timer event that was signaled\r
+  when the watchdog timer expired. If a handler has been registered with\r
+  the Watchdog Timer Architectural Protocol, then that handler is called\r
+  passing in the time period that has passed that cause the watchdog timer\r
+  to fire.  Then, a call to the Runtime Service ResetSystem() is made to\r
+  reset the platform.\r
 \r
-  @param  Timer     The one-shot timer event that was signaled when the watchdog timer\r
-                         expired.\r
+  @param  Timer     The one-shot timer event that was signaled when the\r
+                    watchdog timer expired.\r
   @param  Context   The context that was registered when the event Timer was created.\r
 \r
-  @return None.\r
-\r
 **/\r
 VOID\r
 EFIAPI\r
@@ -84,6 +82,8 @@ WatchdogTimerDriverExpires (
 \r
 \r
 /**\r
+  Registers a handler that is to be invoked when the watchdog timer fires.\r
+\r
   This function registers a handler that is to be invoked when the watchdog\r
   timer fires.  By default, the EFI_WATCHDOG_TIMER protocol will call the\r
   Runtime Service ResetSystem() when the watchdog timer fires.  If a\r
@@ -99,9 +99,9 @@ WatchdogTimerDriverExpires (
   @param  NotifyFunction        The function to call when the watchdog timer fires.  If this\r
                                 is NULL, then the handler will be unregistered.\r
 \r
-  @return EFI_SUCCESS           The watchdog timer handler was registered or unregistered.\r
-  @return EFI_ALREADY_STARTED   NotifyFunction is not NULL, and a handler is already registered.\r
-  @return EFI_INVALID_PARAMETER NotifyFunction is NULL, and a handler was not previously registered.\r
+  @retval EFI_SUCCESS           The watchdog timer handler was registered or unregistered.\r
+  @retval EFI_ALREADY_STARTED   NotifyFunction is not NULL, and a handler is already registered.\r
+  @retval EFI_INVALID_PARAMETER NotifyFunction is NULL, and a handler was not previously registered.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -111,10 +111,17 @@ WatchdogTimerDriverRegisterHandler (
   IN EFI_WATCHDOG_TIMER_NOTIFY         NotifyFunction\r
   )\r
 {\r
+  //\r
+  // If NotifyFunction is NULL, and a handler was not previously registered,\r
+  // return EFI_INVALID_PARAMETER.\r
+  //\r
   if (NotifyFunction == NULL && mWatchdogTimerNotifyFunction == NULL) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
-\r
+  //\r
+  // If NotifyFunction is not NULL, and a handler is already registered,\r
+  // return EFI_ALREADY_STARTED.\r
+  //\r
   if (NotifyFunction != NULL && mWatchdogTimerNotifyFunction != NULL) {\r
     return EFI_ALREADY_STARTED;\r
   }\r
@@ -125,18 +132,20 @@ WatchdogTimerDriverRegisterHandler (
 }\r
 \r
 /**\r
+  Sets the amount of time in the future to fire the watchdog timer.\r
+\r
   This function sets the amount of time to wait before firing the watchdog\r
-  timer to TimerPeriod 100 nS units.  If TimerPeriod is 0, then the watchdog\r
+  timer to TimerPeriod 100 ns units.  If TimerPeriod is 0, then the watchdog\r
   timer is disabled.\r
 \r
   @param  This              The EFI_WATCHDOG_TIMER_ARCH_PROTOCOL instance.\r
-  @param  TimerPeriod       The amount of time in 100 nS units to wait before the watchdog\r
+  @param  TimerPeriod       The amount of time in 100 ns units to wait before the watchdog\r
                             timer is fired.  If TimerPeriod is zero, then the watchdog\r
                             timer is disabled.\r
 \r
-  @return EFI_SUCCESS       The watchdog timer has been programmed to fire in Time\r
-                            100 nS units.\r
-  @return EFI_DEVICE_ERROR  A watchdog timer could not be programmed due to a device\r
+  @retval EFI_SUCCESS       The watchdog timer has been programmed to fire in Time\r
+                            100 ns units.\r
+  @retval EFI_DEVICE_ERROR  A watchdog timer could not be programmed due to a device\r
                             error.\r
 \r
 **/\r
@@ -157,18 +166,20 @@ WatchdogTimerDriverSetTimerPeriod (
 }\r
 \r
 /**\r
+  Retrieves the amount of time in 100 ns units that the system will wait before firing the watchdog timer.\r
+\r
   This function retrieves the amount of time the system will wait before firing\r
   the watchdog timer.  This period is returned in TimerPeriod, and EFI_SUCCESS\r
   is returned.  If TimerPeriod is NULL, then EFI_INVALID_PARAMETER is returned.\r
 \r
   @param  This                    The EFI_WATCHDOG_TIMER_ARCH_PROTOCOL instance.\r
-  @param  TimerPeriod             A pointer to the amount of time in 100 nS units that the system\r
+  @param  TimerPeriod             A pointer to the amount of time in 100 ns units that the system\r
                                   will wait before the watchdog timer is fired.  If TimerPeriod of\r
                                   zero is returned, then the watchdog timer is disabled.\r
 \r
-  @return EFI_SUCCESS             The amount of time that the system will wait before\r
+  @retval EFI_SUCCESS             The amount of time that the system will wait before\r
                                   firing the watchdog timer was returned in TimerPeriod.\r
-  @return EFI_INVALID_PARAMETER   TimerPeriod is NULL.\r
+  @retval EFI_INVALID_PARAMETER   TimerPeriod is NULL.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -188,12 +199,12 @@ WatchdogTimerDriverGetTimerPeriod (
 }\r
 \r
 /**\r
-  Initialize the Watchdog Timer Architectural Protocol driver.\r
+  Entry point of the Watchdog Timer Architectural Protocol driver.\r
 \r
-  @param  ImageHandle             ImageHandle of the loaded driver.\r
-  @param  SystemTable             Pointer to the System Table.\r
+  @param  ImageHandle   The image handle of this driver.\r
+  @param  SystemTable   The pointer of EFI_SYSTEM_TABLE.\r
 \r
-  @return EFI_SUCCESS             Timer Architectural Protocol created.\r
+  @retval EFI_SUCCESS   Watchdog Timer Architectural Protocol successfully installed.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -206,12 +217,12 @@ WatchdogTimerDriverInitialize (
   EFI_STATUS  Status;\r
 \r
   //\r
-  // Make sure the Watchdog Timer Architectural Protocol is not already installed in the system\r
+  // Make sure the Watchdog Timer Architectural Protocol has not been installed in the system yet.\r
   //\r
   ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiWatchdogTimerArchProtocolGuid);\r
 \r
   //\r
-  // Create the timer event used to implement a simple watchdog timer\r
+  // Create the timer event to implement a simple watchdog timer\r
   //\r
   Status = gBS->CreateEvent (\r
                   EVT_TIMER | EVT_NOTIFY_SIGNAL,\r
@@ -233,5 +244,5 @@ WatchdogTimerDriverInitialize (
                   );\r
   ASSERT_EFI_ERROR (Status);\r
 \r
-  return Status;\r
+  return EFI_SUCCESS;\r
 }\r
index 3ceea7d2e898b6d4297e680787292e3e3e0c43a1..bd76081aec1133bdb72410d0f6407137af85f5e9 100644 (file)
@@ -1,7 +1,5 @@
 /** @file\r
-\r
-  The internal header file includes the common header files, defines\r
-  internal functions used by WatchDogTimer module.  \r
+  The internal include file for WatchDogTimer module.  \r
 \r
 Copyright (c) 2006 - 2008, Intel Corporation                                                         \r
 All rights reserved. This program and the accompanying materials                          \r
@@ -30,6 +28,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \r
 \r
 /**\r
+  Registers a handler that is to be invoked when the watchdog timer fires.\r
+\r
   This function registers a handler that is to be invoked when the watchdog\r
   timer fires.  By default, the EFI_WATCHDOG_TIMER protocol will call the\r
   Runtime Service ResetSystem() when the watchdog timer fires.  If a\r
@@ -45,9 +45,9 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
   @param  NotifyFunction        The function to call when the watchdog timer fires.  If this\r
                                 is NULL, then the handler will be unregistered.\r
 \r
-  @return EFI_SUCCESS           The watchdog timer handler was registered or unregistered.\r
-  @return EFI_ALREADY_STARTED   NotifyFunction is not NULL, and a handler is already registered.\r
-  @return EFI_INVALID_PARAMETER NotifyFunction is NULL, and a handler was not previously registered.\r
+  @retval EFI_SUCCESS           The watchdog timer handler was registered or unregistered.\r
+  @retval EFI_ALREADY_STARTED   NotifyFunction is not NULL, and a handler is already registered.\r
+  @retval EFI_INVALID_PARAMETER NotifyFunction is NULL, and a handler was not previously registered.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -58,18 +58,20 @@ WatchdogTimerDriverRegisterHandler (
   );\r
 \r
 /**\r
+  Sets the amount of time in the future to fire the watchdog timer.\r
+\r
   This function sets the amount of time to wait before firing the watchdog\r
-  timer to TimerPeriod 100 nS units.  If TimerPeriod is 0, then the watchdog\r
+  timer to TimerPeriod 100 ns units.  If TimerPeriod is 0, then the watchdog\r
   timer is disabled.\r
 \r
   @param  This              The EFI_WATCHDOG_TIMER_ARCH_PROTOCOL instance.\r
-  @param  TimerPeriod       The amount of time in 100 nS units to wait before the watchdog\r
+  @param  TimerPeriod       The amount of time in 100 ns units to wait before the watchdog\r
                             timer is fired.  If TimerPeriod is zero, then the watchdog\r
                             timer is disabled.\r
 \r
-  @return EFI_SUCCESS       The watchdog timer has been programmed to fire in Time\r
-                            100 nS units.\r
-  @return EFI_DEVICE_ERROR  A watchdog timer could not be programmed due to a device\r
+  @retval EFI_SUCCESS       The watchdog timer has been programmed to fire in Time\r
+                            100 ns units.\r
+  @retval EFI_DEVICE_ERROR  A watchdog timer could not be programmed due to a device\r
                             error.\r
 \r
 **/\r
@@ -81,18 +83,20 @@ WatchdogTimerDriverSetTimerPeriod (
   );\r
 \r
 /**\r
+  Retrieves the amount of time in 100 ns units that the system will wait before firing the watchdog timer.\r
+\r
   This function retrieves the amount of time the system will wait before firing\r
   the watchdog timer.  This period is returned in TimerPeriod, and EFI_SUCCESS\r
   is returned.  If TimerPeriod is NULL, then EFI_INVALID_PARAMETER is returned.\r
 \r
   @param  This                    The EFI_WATCHDOG_TIMER_ARCH_PROTOCOL instance.\r
-  @param  TimerPeriod             A pointer to the amount of time in 100 nS units that the system\r
+  @param  TimerPeriod             A pointer to the amount of time in 100 ns units that the system\r
                                   will wait before the watchdog timer is fired.  If TimerPeriod of\r
                                   zero is returned, then the watchdog timer is disabled.\r
 \r
-  @return EFI_SUCCESS             The amount of time that the system will wait before\r
+  @retval EFI_SUCCESS             The amount of time that the system will wait before\r
                                   firing the watchdog timer was returned in TimerPeriod.\r
-  @return EFI_INVALID_PARAMETER   TimerPeriod is NULL.\r
+  @retval EFI_INVALID_PARAMETER   TimerPeriod is NULL.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -102,20 +106,4 @@ WatchdogTimerDriverGetTimerPeriod (
   IN UINT64                            *TimerPeriod\r
   );\r
 \r
-/**\r
-  Initialize the Watchdog Timer Architectural Protocol driver.\r
-\r
-  @param  ImageHandle             ImageHandle of the loaded driver.\r
-  @param  SystemTable             Pointer to the System Table.\r
-\r
-  @return EFI_SUCCESS             Timer Architectural Protocol created.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-WatchdogTimerDriverInitialize (\r
-  IN EFI_HANDLE        ImageHandle,\r
-  IN EFI_SYSTEM_TABLE  *SystemTable\r
-  );\r
-\r
 #endif\r
index f03d50de3529b9cc7bbb1363480b3d65ce535ab1..ac769246c3310dcca789f343640d9068a8ece0d7 100644 (file)
@@ -1,8 +1,7 @@
 #/** @file\r
-# Component description file for WatchdogTimer module.\r
+# Generic watchdog timer driver produceing Watchdog Timer Architectural Protocol using UEFI APIs.\r
 #\r
-# Generic watchdog timer implemenetation using EFI APIs.\r
-# Copyright (c) 2006 - 2007, Intel Corporation\r
+# Copyright (c) 2006 - 2008, Intel Corporation\r
 #\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