VirtualBox

Changeset 37539 in vbox


Ignore:
Timestamp:
Jun 17, 2011 1:04:56 PM (13 years ago)
Author:
vboxsync
Message:

DevHPET: Moved the frequency hinting into a function.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/PC/DevHPET.cpp

    r37538 r37539  
    366366}
    367367
     368
     369/**
     370 * Sets the frequency hint if it's a periodic timer.
     371 *
     372 * @param   pThis       The HPET state.
     373 * @param   pHpetTimer  The timer.
     374 */
     375DECLINLINE(void) hpetTimerSetFrequencyHint(HpetState *pThis, HpetTimer *pHpetTimer)
     376{
     377    if (pHpetTimer->u64Config & HPET_TN_PERIODIC)
     378    {
     379        uint64_t const u64Period = pHpetTimer->u64Period;
     380        uint32_t const u32Freq   = pThis->u32Period;
     381        if (u64Period > 0 && u64Period < u32Freq)
     382            TMTimerSetFrequencyHint(pHpetTimer->CTX_SUFF(pTimer), u32Freq / (uint32_t)u64Period);
     383    }
     384}
     385
     386
    368387static void hpetProgramTimer(HpetTimer *pHpetTimer)
    369388{
     
    403422    Log4(("HPET: next IRQ in %lld ticks (%lld ns)\n", u64Diff, hpetTicksToNs(pHpetTimer->CTX_SUFF(pHpet), u64Diff)));
    404423    TMTimerSetNano(pHpetTimer->CTX_SUFF(pTimer), hpetTicksToNs(pHpetTimer->CTX_SUFF(pHpet), u64Diff));
    405     if (pHpetTimer->u64Config & HPET_TN_PERIODIC)
    406     {
    407         uint64_t const u64Period = pHpetTimer->u64Period;
    408         uint32_t const u32Freq   = pHpetTimer->CTX_SUFF(pHpet)->u32Period;
    409         if (u64Period > 0 && u64Period < u32Freq)
    410             TMTimerSetFrequencyHint(pHpetTimer->CTX_SUFF(pTimer), u32Freq / (uint32_t)u64Period);
    411     }
     424    hpetTimerSetFrequencyHint(pHpetTimer->CTX_SUFF(pHpet), pHpetTimer);
    412425}
    413426
     
    12481261    {
    12491262        HpetTimer *pHpetTimer = &pThis->aTimers[iTimer];
    1250         if (   (pHpetTimer->u64Config & HPET_TN_PERIODIC)
    1251             && TMTimerIsActive(pHpetTimer->CTX_SUFF(pTimer)))
    1252         {
    1253             uint64_t const u64Period = pHpetTimer->u64Period;
    1254             uint32_t const u32Freq   = pHpetTimer->CTX_SUFF(pHpet)->u32Period;
    1255             if (u64Period > 0 && u64Period < u32Freq)
    1256                 TMTimerSetFrequencyHint(pHpetTimer->CTX_SUFF(pTimer), u32Freq / (uint32_t)u64Period);
    1257         }
     1263        if (TMTimerIsActive(pHpetTimer->CTX_SUFF(pTimer)))
     1264            hpetTimerSetFrequencyHint(pThis, pHpetTimer);
    12581265    }
    12591266    PDMCritSectLeave(&pThis->csLock);
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette