timer service. In the future, the Thread creation should possibly be\r
abstracted by the CPU architectural protocol\r
\r
-Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.<BR>\r
Portions copyright (c) 2010 - 2011, Apple Inc. All rights reserved.\r
-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
-http://opensource.org/licenses/bsd-license.php\r
-\r
-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
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
\r
\r
**/\r
//\r
// Pointer to the CPU Architectural Protocol instance\r
//\r
-EFI_CPU_ARCH_PROTOCOL *mCpu;\r
+EFI_CPU_ARCH_PROTOCOL *mCpu;\r
\r
//\r
// The Timer Architectural Protocol that this driver produces\r
//\r
-EFI_TIMER_ARCH_PROTOCOL mTimer = {\r
+EFI_TIMER_ARCH_PROTOCOL mTimer = {\r
EmuTimerDriverRegisterHandler,\r
EmuTimerDriverSetTimerPeriod,\r
EmuTimerDriverGetTimerPeriod,\r
//\r
// The notification function to call on every timer interrupt\r
//\r
-EFI_TIMER_NOTIFY mTimerNotifyFunction = NULL;\r
+EFI_TIMER_NOTIFY mTimerNotifyFunction = NULL;\r
\r
//\r
// The current period of the timer interrupt\r
//\r
-UINT64 mTimerPeriodMs;\r
-\r
+UINT64 mTimerPeriodMs;\r
\r
VOID\r
EFIAPI\r
-TimerCallback (UINT64 DeltaMs)\r
+TimerCallback (\r
+ UINT64 DeltaMs\r
+ )\r
{\r
EFI_TPL OriginalTPL;\r
EFI_TIMER_NOTIFY CallbackFunction;\r
\r
-\r
OriginalTPL = gBS->RaiseTPL (TPL_HIGH_LEVEL);\r
\r
if (OriginalTPL < TPL_HIGH_LEVEL) {\r
}\r
\r
gBS->RestoreTPL (OriginalTPL);\r
-\r
}\r
\r
EFI_STATUS\r
EFIAPI\r
EmuTimerDriverRegisterHandler (\r
- IN EFI_TIMER_ARCH_PROTOCOL *This,\r
- IN EFI_TIMER_NOTIFY NotifyFunction\r
+ IN EFI_TIMER_ARCH_PROTOCOL *This,\r
+ IN EFI_TIMER_NOTIFY NotifyFunction\r
)\r
+\r
/*++\r
\r
Routine Description:\r
//\r
// Check for invalid parameters\r
//\r
- if (NotifyFunction == NULL && mTimerNotifyFunction == NULL) {\r
+ if ((NotifyFunction == NULL) && (mTimerNotifyFunction == NULL)) {\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
- if (NotifyFunction != NULL && mTimerNotifyFunction != NULL) {\r
+ if ((NotifyFunction != NULL) && (mTimerNotifyFunction != NULL)) {\r
return EFI_ALREADY_STARTED;\r
}\r
\r
/* Enable Timer. */\r
gEmuThunk->SetTimer (mTimerPeriodMs, TimerCallback);\r
}\r
+\r
mTimerNotifyFunction = NotifyFunction;\r
\r
return EFI_SUCCESS;\r
IN EFI_TIMER_ARCH_PROTOCOL *This,\r
IN UINT64 TimerPeriod\r
)\r
+\r
/*++\r
\r
Routine Description:\r
\r
**/\r
{\r
-\r
//\r
// If TimerPeriod is 0, then the timer thread should be canceled\r
// If the TimerPeriod is valid, then create and/or adjust the period of the timer thread\r
//\r
- if (TimerPeriod == 0\r
- || ((TimerPeriod > TIMER_MINIMUM_VALUE)\r
- && (TimerPeriod < TIMER_MAXIMUM_VALUE))) {\r
+ if ( (TimerPeriod == 0)\r
+ || ( (TimerPeriod > TIMER_MINIMUM_VALUE)\r
+ && (TimerPeriod < TIMER_MAXIMUM_VALUE)))\r
+ {\r
mTimerPeriodMs = DivU64x32 (TimerPeriod + 5000, 10000);\r
\r
gEmuThunk->SetTimer (mTimerPeriodMs, TimerCallback);\r
EFI_STATUS\r
EFIAPI\r
EmuTimerDriverGetTimerPeriod (\r
- IN EFI_TIMER_ARCH_PROTOCOL *This,\r
- OUT UINT64 *TimerPeriod\r
+ IN EFI_TIMER_ARCH_PROTOCOL *This,\r
+ OUT UINT64 *TimerPeriod\r
)\r
+\r
/*++\r
\r
Routine Description:\r
EmuTimerDriverGenerateSoftInterrupt (\r
IN EFI_TIMER_ARCH_PROTOCOL *This\r
)\r
+\r
/*++\r
\r
Routine Description:\r
\r
EFI_SUCCESS - The soft timer interrupt was generated.\r
\r
- EFI_UNSUPPORTEDT - The platform does not support the generation of soft timer interrupts.\r
+ EFI_UNSUPPORTED - The platform does not support the generation of soft timer interrupts.\r
\r
**/\r
{\r
IN EFI_HANDLE ImageHandle,\r
IN EFI_SYSTEM_TABLE *SystemTable\r
)\r
+\r
/*++\r
\r
Routine Description:\r
\r
EFI_OUT_OF_RESOURCES - Not enough resources available to initialize driver.\r
\r
- EFI_DEVICE_ERROR - A device error occured attempting to initialize the driver.\r
+ EFI_DEVICE_ERROR - A device error occurred attempting to initialize the driver.\r
\r
**/\r
{\r
return Status;\r
}\r
\r
-\r
return EFI_SUCCESS;\r
}\r