diff options
author | tgingold <tgingold@6f19259b-4bc3-4df7-8a09-765794883524> | 2007-02-13 02:16:12 +0000 |
---|---|---|
committer | tgingold <tgingold@6f19259b-4bc3-4df7-8a09-765794883524> | 2007-02-13 02:16:12 +0000 |
commit | 48f4262a8015a2b8ef0582b80e8815970dd23c06 (patch) | |
tree | c14df2ce1a130c8842159a1fc9ca7e5c1686dcd4 | |
parent | 8ba2f4413a21d5dd3d4833aa097b918aa5cfb8a7 (diff) | |
download | edk2-platforms-48f4262a8015a2b8ef0582b80e8815970dd23c06.tar.xz |
start timer at initialization
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2377 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r-- | EdkUnixPkg/Dxe/UnixThunk/Chipset/Timer/Timer.c | 40 | ||||
-rw-r--r-- | EdkUnixPkg/Dxe/UnixThunk/Chipset/Timer/Timer.h | 4 |
2 files changed, 25 insertions, 19 deletions
diff --git a/EdkUnixPkg/Dxe/UnixThunk/Chipset/Timer/Timer.c b/EdkUnixPkg/Dxe/UnixThunk/Chipset/Timer/Timer.c index 8001138b94..37fdde5ed3 100644 --- a/EdkUnixPkg/Dxe/UnixThunk/Chipset/Timer/Timer.c +++ b/EdkUnixPkg/Dxe/UnixThunk/Chipset/Timer/Timer.c @@ -48,12 +48,8 @@ EFI_TIMER_NOTIFY mTimerNotifyFunction = NULL; //
// The current period of the timer interrupt
//
-UINT64 mTimerPeriod;
+UINT64 mTimerPeriodMs;
-//
-// The timer value from the last timer interrupt
-//
-UINT32 mNtLastTick;
VOID
TimerCallback (UINT64 DeltaMs) @@ -83,15 +79,17 @@ Returns: OriginalTPL = gBS->RaiseTPL (EFI_TPL_HIGH_LEVEL);
- CallbackFunction = mTimerNotifyFunction;
+ if (OriginalTPL < EFI_TPL_HIGH_LEVEL) { + CallbackFunction = mTimerNotifyFunction;
- //
- // Only invoke the callback function if a Non-NULL handler has been
- // registered. Assume all other handlers are legal.
- //
- if (CallbackFunction != NULL) {
- CallbackFunction ((UINT64) (DeltaMs * 10000));
- }
+ //
+ // Only invoke the callback function if a Non-NULL handler has been
+ // registered. Assume all other handlers are legal.
+ //
+ if (CallbackFunction != NULL) {
+ CallbackFunction ((UINT64) (DeltaMs * 10000));
+ }
+ } gBS->RestoreTPL (OriginalTPL);
@@ -161,7 +159,7 @@ Returns: gUnix->SetTimer (0, TimerCallback); } else if (mTimerNotifyFunction == NULL) { /* Enable Timer. */ - gUnix->SetTimer (mTimerPeriod * 10, TimerCallback); + gUnix->SetTimer (mTimerPeriodMs, TimerCallback); } mTimerNotifyFunction = NotifyFunction;
@@ -219,9 +217,9 @@ Returns: if (TimerPeriod == 0 || ((TimerPeriod > TIMER_MINIMUM_VALUE) && (TimerPeriod < TIMER_MAXIMUM_VALUE))) {
- mTimerPeriod = TimerPeriod;
+ mTimerPeriodMs = DivU64x32 (TimerPeriod + 5000, 10000);
- gUnix->SetTimer (TimerPeriod * 10, TimerCallback); + gUnix->SetTimer (mTimerPeriodMs, TimerCallback); } return EFI_SUCCESS;
@@ -261,7 +259,7 @@ Returns: return EFI_INVALID_PARAMETER;
}
- *TimerPeriod = mTimerPeriod;
+ *TimerPeriod = mTimerPeriodMs * 10000;
return EFI_SUCCESS;
}
@@ -354,5 +352,13 @@ Returns: 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;
}
diff --git a/EdkUnixPkg/Dxe/UnixThunk/Chipset/Timer/Timer.h b/EdkUnixPkg/Dxe/UnixThunk/Chipset/Timer/Timer.h index 2764d5f6ed..230fead608 100644 --- a/EdkUnixPkg/Dxe/UnixThunk/Chipset/Timer/Timer.h +++ b/EdkUnixPkg/Dxe/UnixThunk/Chipset/Timer/Timer.h @@ -34,9 +34,9 @@ Abstract: #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
|