start timer at initialization
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2377 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@ -48,12 +48,8 @@ EFI_TIMER_NOTIFY mTimerNotifyFunction = NULL;
|
|||||||
//
|
//
|
||||||
// The current period of the timer interrupt
|
// The current period of the timer interrupt
|
||||||
//
|
//
|
||||||
UINT64 mTimerPeriod;
|
UINT64 mTimerPeriodMs;
|
||||||
|
|
||||||
//
|
|
||||||
// The timer value from the last timer interrupt
|
|
||||||
//
|
|
||||||
UINT32 mNtLastTick;
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
TimerCallback (UINT64 DeltaMs)
|
TimerCallback (UINT64 DeltaMs)
|
||||||
@ -83,6 +79,7 @@ Returns:
|
|||||||
|
|
||||||
OriginalTPL = gBS->RaiseTPL (EFI_TPL_HIGH_LEVEL);
|
OriginalTPL = gBS->RaiseTPL (EFI_TPL_HIGH_LEVEL);
|
||||||
|
|
||||||
|
if (OriginalTPL < EFI_TPL_HIGH_LEVEL) {
|
||||||
CallbackFunction = mTimerNotifyFunction;
|
CallbackFunction = mTimerNotifyFunction;
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -92,6 +89,7 @@ Returns:
|
|||||||
if (CallbackFunction != NULL) {
|
if (CallbackFunction != NULL) {
|
||||||
CallbackFunction ((UINT64) (DeltaMs * 10000));
|
CallbackFunction ((UINT64) (DeltaMs * 10000));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
gBS->RestoreTPL (OriginalTPL);
|
gBS->RestoreTPL (OriginalTPL);
|
||||||
|
|
||||||
@ -161,7 +159,7 @@ Returns:
|
|||||||
gUnix->SetTimer (0, TimerCallback);
|
gUnix->SetTimer (0, TimerCallback);
|
||||||
} else if (mTimerNotifyFunction == NULL) {
|
} else if (mTimerNotifyFunction == NULL) {
|
||||||
/* Enable Timer. */
|
/* Enable Timer. */
|
||||||
gUnix->SetTimer (mTimerPeriod * 10, TimerCallback);
|
gUnix->SetTimer (mTimerPeriodMs, TimerCallback);
|
||||||
}
|
}
|
||||||
mTimerNotifyFunction = NotifyFunction;
|
mTimerNotifyFunction = NotifyFunction;
|
||||||
|
|
||||||
@ -219,9 +217,9 @@ Returns:
|
|||||||
if (TimerPeriod == 0
|
if (TimerPeriod == 0
|
||||||
|| ((TimerPeriod > TIMER_MINIMUM_VALUE)
|
|| ((TimerPeriod > TIMER_MINIMUM_VALUE)
|
||||||
&& (TimerPeriod < TIMER_MAXIMUM_VALUE))) {
|
&& (TimerPeriod < TIMER_MAXIMUM_VALUE))) {
|
||||||
mTimerPeriod = TimerPeriod;
|
mTimerPeriodMs = DivU64x32 (TimerPeriod + 5000, 10000);
|
||||||
|
|
||||||
gUnix->SetTimer (TimerPeriod * 10, TimerCallback);
|
gUnix->SetTimer (mTimerPeriodMs, TimerCallback);
|
||||||
}
|
}
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
@ -261,7 +259,7 @@ Returns:
|
|||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
*TimerPeriod = mTimerPeriod;
|
*TimerPeriod = mTimerPeriodMs * 10000;
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
@ -354,5 +352,13 @@ Returns:
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Start the timer thread at the default timer period
|
||||||
|
//
|
||||||
|
Status = mTimer.SetTimerPeriod (&mTimer, DEFAULT_TIMER_TICK_DURATION);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -34,9 +34,9 @@ Abstract:
|
|||||||
#define TIMER_MAXIMUM_VALUE (0x100000000ULL - 1)
|
#define TIMER_MAXIMUM_VALUE (0x100000000ULL - 1)
|
||||||
|
|
||||||
//
|
//
|
||||||
// Default timer value in 100 ns units (10 ms)
|
// Default timer value in 100 ns units (50 ms)
|
||||||
//
|
//
|
||||||
#define DEFAULT_TIMER_TICK_DURATION 100000
|
#define DEFAULT_TIMER_TICK_DURATION 500000
|
||||||
|
|
||||||
//
|
//
|
||||||
// Function Prototypes
|
// Function Prototypes
|
||||||
|
Reference in New Issue
Block a user