这篇教程C++ DivU64x32函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中DivU64x32函数的典型用法代码示例。如果您正苦于以下问题:C++ DivU64x32函数的具体用法?C++ DivU64x32怎么用?C++ DivU64x32使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了DivU64x32函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: InitializeDebugTimer/** Initialize CPU local APIC timer.**/VOIDInitializeDebugTimer ( VOID ){ UINTN ApicTimerDivisor; UINT32 InitialCount; GetApicTimerState (&ApicTimerDivisor, NULL, NULL); // // Cpu Local Apic timer interrupt frequency, it is set to 0.1s // InitialCount = (UINT32)DivU64x32 ( MultU64x64 ( PcdGet32(PcdFSBClock) / (UINT32)ApicTimerDivisor, 100 ), 1000 ); InitializeApicTimer (ApicTimerDivisor, InitialCount, TRUE, DEBUG_TIMER_VECTOR); if (MultiProcessorDebugSupport) { mDebugMpContext.DebugTimerInitCount = InitialCount; }}
开发者ID:etiago,项目名称:vbox,代码行数:31,
示例2: TimerDriverSetTimerPeriod/** This function adjusts the period of timer interrupts to the value specified by TimerPeriod. If the timer period is updated, then the selected timer period is stored in EFI_TIMER.TimerPeriod, and EFI_SUCCESS is returned. If the timer hardware is not programmable, then EFI_UNSUPPORTED is returned. If an error occurs while attempting to update the timer period, then the timer hardware will be put back in its state prior to this call, and EFI_DEVICE_ERROR is returned. If TimerPeriod is 0, then the timer interrupt is disabled. This is not the same as disabling the CPU's interrupts. Instead, it must either turn off the timer hardware, or it must adjust the interrupt controller so that a CPU interrupt is not generated when the timer interrupt fires. @param This The EFI_TIMER_ARCH_PROTOCOL instance. @param TimerPeriod The rate to program the timer interrupt in 100 nS units. If the timer hardware is not programmable, then EFI_UNSUPPORTED is returned. If the timer is programmable, then the timer period will be rounded up to the nearest timer period that is supported by the timer hardware. If TimerPeriod is set to 0, then the timer interrupts will be disabled. @retval EFI_SUCCESS The timer period was changed. @retval EFI_UNSUPPORTED The platform cannot change the period of the timer interrupt. @retval EFI_DEVICE_ERROR The timer period could not be changed due to a device error.**/EFI_STATUSEFIAPITimerDriverSetTimerPeriod ( IN EFI_TIMER_ARCH_PROTOCOL *This, IN UINT64 TimerPeriod ){ UINT64 TimerTicks; // Always disable the timer ArmArchTimerDisableTimer (); if (TimerPeriod != 0) { // Convert TimerPeriod to micro sec units TimerTicks = DivU64x32 (TimerPeriod, 10); TimerTicks = MultU64x32 (TimerTicks, (PcdGet32(PcdArmArchTimerFreqInHz)/1000000)); ArmArchTimerSetTimerVal((UINTN)TimerTicks); // Enable the timer ArmArchTimerEnableTimer (); } // Save the new timer period mTimerPeriod = TimerPeriod; return EFI_SUCCESS;}
开发者ID:Cutty,项目名称:edk2,代码行数:56,
示例3: DebugAgentTimerSetPeriod/** Set the period for the debug agent timer. Zero means disable the timer. @param[in] TimerPeriodMilliseconds Frequency of the debug agent timer.**/VOIDEFIAPIDebugAgentTimerSetPeriod ( IN UINT32 TimerPeriodMilliseconds ){ UINT64 TimerCount; INT32 LoadValue; if (TimerPeriodMilliseconds == 0) { // Turn off GPTIMER3 MmioWrite32 (gTCLR, TCLR_ST_OFF); DisableInterruptSource (); } else { // Calculate required timer count TimerCount = DivU64x32(TimerPeriodMilliseconds * 1000000, PcdGet32(PcdDebugAgentTimerFreqNanoSeconds)); // Set GPTIMER5 Load register LoadValue = (INT32) -TimerCount; MmioWrite32 (gTLDR, LoadValue); MmioWrite32 (gTCRR, LoadValue); // Enable Overflow interrupt MmioWrite32 (gTIER, TIER_TCAR_IT_DISABLE | TIER_OVF_IT_ENABLE | TIER_MAT_IT_DISABLE); // Turn on GPTIMER3, it will reload at overflow MmioWrite32 (gTCLR, TCLR_AR_AUTORELOAD | TCLR_ST_ON); EnableInterruptSource (); }}
开发者ID:FishYu1222,项目名称:edk2,代码行数:38,
示例4: NanoSecondDelay/** Stalls the CPU for at least the given number of nanoseconds. This function wraps EsalStall function of Extended SAL Stall Services Class. It stalls the CPU for the number of nanoseconds specified by NanoSeconds. @param NanoSeconds The minimum number of nanoseconds to delay. @return NanoSeconds**/UINTNEFIAPINanoSecondDelay ( IN UINTN NanoSeconds ){ UINT64 MicroSeconds; // // The unit of ESAL Stall service is microsecond, so we turn the time interval // from nanosecond to microsecond, using the ceiling value to ensure stalling // at least the given number of nanoseconds. // MicroSeconds = DivU64x32 (NanoSeconds + 999, 1000); EsalCall ( EFI_EXTENDED_SAL_STALL_SERVICES_PROTOCOL_GUID_LO, EFI_EXTENDED_SAL_STALL_SERVICES_PROTOCOL_GUID_HI, StallFunctionId, MicroSeconds, 0, 0, 0, 0, 0, 0 ); return NanoSeconds;}
开发者ID:b-man,项目名称:edk2,代码行数:39,
示例5: RamDiskInitBlockIo/** Initialize the BlockIO & BlockIO2 protocol of a RAM disk device. @param[in] PrivateData Points to RAM disk private data.**/VOIDRamDiskInitBlockIo ( IN RAM_DISK_PRIVATE_DATA *PrivateData ){ EFI_BLOCK_IO_PROTOCOL *BlockIo; EFI_BLOCK_IO2_PROTOCOL *BlockIo2; EFI_BLOCK_IO_MEDIA *Media; BlockIo = &PrivateData->BlockIo; BlockIo2 = &PrivateData->BlockIo2; Media = &PrivateData->Media; CopyMem (BlockIo, &mRamDiskBlockIoTemplate, sizeof (EFI_BLOCK_IO_PROTOCOL)); CopyMem (BlockIo2, &mRamDiskBlockIo2Template, sizeof (EFI_BLOCK_IO2_PROTOCOL)); BlockIo->Media = Media; BlockIo2->Media = Media; Media->RemovableMedia = FALSE; Media->MediaPresent = TRUE; Media->LogicalPartition = FALSE; Media->ReadOnly = FALSE; Media->WriteCaching = FALSE; Media->BlockSize = RAM_DISK_BLOCK_SIZE; Media->LastBlock = DivU64x32 ( PrivateData->Size + RAM_DISK_BLOCK_SIZE - 1, RAM_DISK_BLOCK_SIZE ) - 1;}
开发者ID:mdaniel,项目名称:virtualbox-org-svn-vbox-trunk,代码行数:35,
示例6: NanoSecondDelay/** Stalls the CPU for at least the given number of nanoseconds. Stalls the CPU for the number of nanoseconds specified by NanoSeconds. @param NanoSeconds The minimum number of nanoseconds to delay. @return The value of NanoSeconds inputted.**/UINTNEFIAPINanoSecondDelay ( IN UINTN NanoSeconds ){ EFI_STATUS Status; UINT64 HundredNanoseconds; UINTN Index; if ((gTimerPeriod != 0) && ((UINT64)NanoSeconds > gTimerPeriod) && (EfiGetCurrentTpl () == TPL_APPLICATION)) { // // This stall is long, so use gBS->WaitForEvent () to yield CPU to DXE Core // HundredNanoseconds = DivU64x32 (NanoSeconds, 100); Status = gBS->SetTimer (gTimerEvent, TimerRelative, HundredNanoseconds); ASSERT_EFI_ERROR (Status); Status = gBS->WaitForEvent (sizeof (gTimerEvent)/sizeof (EFI_EVENT), &gTimerEvent, &Index); ASSERT_EFI_ERROR (Status); } else { gEmuThunk->Sleep (NanoSeconds); } return NanoSeconds;}
开发者ID:fishyu2,项目名称:EmulatorPkg,代码行数:39,
示例7: EmuTimerDriverSetTimerPeriodEFI_STATUSEFIAPIEmuTimerDriverSetTimerPeriod ( IN EFI_TIMER_ARCH_PROTOCOL *This, IN UINT64 TimerPeriod )/*++Routine Description: This function adjusts the period of timer interrupts to the value specified by TimerPeriod. If the timer period is updated, then the selected timer period is stored in EFI_TIMER.TimerPeriod, and EFI_SUCCESS is returned. If the timer hardware is not programmable, then EFI_UNSUPPORTED is returned. If an error occurs while attempting to update the timer period, then the timer hardware will be put back in its state prior to this call, and EFI_DEVICE_ERROR is returned. If TimerPeriod is 0, then the timer interrupt is disabled. This is not the same as disabling the CPU's interrupts. Instead, it must either turn off the timer hardware, or it must adjust the interrupt controller so that a CPU interrupt is not generated when the timer interrupt fires.Arguments: This - The EFI_TIMER_ARCH_PROTOCOL instance. TimerPeriod - The rate to program the timer interrupt in 100 nS units. If the timer hardware is not programmable, then EFI_UNSUPPORTED is returned. If the timer is programmable, then the timer period will be rounded up to the nearest timer period that is supported by the timer hardware. If TimerPeriod is set to 0, then the timer interrupts will be disabled.Returns: EFI_SUCCESS - The timer period was changed. EFI_UNSUPPORTED - The platform cannot change the period of the timer interrupt. EFI_DEVICE_ERROR - The timer period could not be changed due to a device error.**/{ // // If TimerPeriod is 0, then the timer thread should be canceled // If the TimerPeriod is valid, then create and/or adjust the period of the timer thread // if (TimerPeriod == 0 || ((TimerPeriod > TIMER_MINIMUM_VALUE) && (TimerPeriod < TIMER_MAXIMUM_VALUE))) { mTimerPeriodMs = DivU64x32 (TimerPeriod + 5000, 10000); gEmuThunk->SetTimer (mTimerPeriodMs, TimerCallback); } return EFI_SUCCESS;}
开发者ID:fishyu2,项目名称:EmulatorPkg,代码行数:58,
示例8: SP805SetTimerPeriod/** This function adjusts the period of timer interrupts to the value specified by TimerPeriod. If the timer period is updated, then the selected timer period is stored in EFI_TIMER.TimerPeriod, and EFI_SUCCESS is returned. If the timer hardware is not programmable, then EFI_UNSUPPORTED is returned. If an error occurs while attempting to update the timer period, then the timer hardware will be put back in its state prior to this call, and EFI_DEVICE_ERROR is returned. If TimerPeriod is 0, then the timer interrupt is disabled. This is not the same as disabling the CPU's interrupts. Instead, it must either turn off the timer hardware, or it must adjust the interrupt controller so that a CPU interrupt is not generated when the timer interrupt fires. @param This The EFI_TIMER_ARCH_PROTOCOL instance. @param TimerPeriod The rate to program the timer interrupt in 100 nS units. If the timer hardware is not programmable, then EFI_UNSUPPORTED is returned. If the timer is programmable, then the timer period will be rounded up to the nearest timer period that is supported by the timer hardware. If TimerPeriod is set to 0, then the timer interrupts will be disabled. @retval EFI_SUCCESS The timer period was changed. @retval EFI_UNSUPPORTED The platform cannot change the period of the timer interrupt. @retval EFI_DEVICE_ERROR The timer period could not be changed due to a device error.**/STATICEFI_STATUSEFIAPISP805SetTimerPeriod ( IN EFI_WATCHDOG_TIMER_ARCH_PROTOCOL *This, IN UINT64 TimerPeriod // In 100ns units ){ EFI_STATUS Status; UINT64 Ticks64bit; SP805Unlock (); Status = EFI_SUCCESS; if (TimerPeriod == 0) { // This is a watchdog stop request SP805Stop (); } else { // Calculate the Watchdog ticks required for a delay of (TimerTicks * 100) nanoseconds // The SP805 will count down to zero and generate an interrupt. // // WatchdogTicks = ((TimerPeriod * 100 * SP805_CLOCK_FREQUENCY) / 1GHz); // // i.e.: // // WatchdogTicks = (TimerPeriod * SP805_CLOCK_FREQUENCY) / 10 MHz ; Ticks64bit = MultU64x32 (TimerPeriod, PcdGet32 (PcdSP805WatchdogClockFrequencyInHz)); Ticks64bit = DivU64x32 (Ticks64bit, 10 * 1000 * 1000); // The registers in the SP805 are only 32 bits if (Ticks64bit > MAX_UINT32) { // We could load the watchdog with the maximum supported value but // if a smaller value was requested, this could have the watchdog // triggering before it was intended. // Better generate an error to let the caller know. Status = EFI_DEVICE_ERROR; goto EXIT; } // Update the watchdog with a 32-bit value. MmioWrite32 (SP805_WDOG_LOAD_REG, (UINT32)Ticks64bit); // Start the watchdog SP805Start (); } mTimerPeriod = TimerPeriod;EXIT: // Ensure the watchdog is locked before exiting. SP805Lock (); ASSERT_EFI_ERROR (Status); return Status;}
开发者ID:MattDevo,项目名称:edk2,代码行数:84,
示例9: as/** Calculate the Duration in microseconds. Duration is multiplied by 1000, instead of Frequency being divided by 1000 or multiplying the result by 1000, in order to maintain precision. Since Duration is a 64-bit value, multiplying it by 1000 is unlikely to produce an overflow. The time is calculated as (Duration * 1000) / Timer_Frequency. @param[in] Duration The event duration in timer ticks. @return A 64-bit value which is the Elapsed time in microseconds.**/UINT64DurationInMicroSeconds ( IN UINT64 Duration ){ UINT64 Temp; Temp = MultU64x32 (Duration, 1000); return DivU64x32 (Temp, TimerInfo.Frequency);}
开发者ID:OznOg,项目名称:edk2,代码行数:23,
示例10: SP805SetTimerPeriod/** This function adjusts the period of timer interrupts to the value specified by TimerPeriod. If the timer period is updated, then the selected timer period is stored in EFI_TIMER.TimerPeriod, and EFI_SUCCESS is returned. If the timer hardware is not programmable, then EFI_UNSUPPORTED is returned. If an error occurs while attempting to update the timer period, then the timer hardware will be put back in its state prior to this call, and EFI_DEVICE_ERROR is returned. If TimerPeriod is 0, then the timer interrupt is disabled. This is not the same as disabling the CPU's interrupts. Instead, it must either turn off the timer hardware, or it must adjust the interrupt controller so that a CPU interrupt is not generated when the timer interrupt fires. @param This The EFI_TIMER_ARCH_PROTOCOL instance. @param TimerPeriod The rate to program the timer interrupt in 100 nS units. If the timer hardware is not programmable, then EFI_UNSUPPORTED is returned. If the timer is programmable, then the timer period will be rounded up to the nearest timer period that is supported by the timer hardware. If TimerPeriod is set to 0, then the timer interrupts will be disabled. @retval EFI_SUCCESS The timer period was changed. @retval EFI_UNSUPPORTED The platform cannot change the period of the timer interrupt. @retval EFI_DEVICE_ERROR The timer period could not be changed due to a device error.**/EFI_STATUSEFIAPISP805SetTimerPeriod ( IN CONST EFI_WATCHDOG_TIMER_ARCH_PROTOCOL *This, IN UINT64 TimerPeriod // In 100ns units ){ EFI_STATUS Status = EFI_SUCCESS; UINT64 Ticks64bit; SP805Unlock(); if( TimerPeriod == 0 ) { // This is a watchdog stop request SP805Stop(); goto EXIT; } else { // Calculate the Watchdog ticks required for a delay of (TimerTicks * 100) nanoseconds // The SP805 will count down to ZERO once, generate an interrupt and // then it will again reload the initial value and start again. // On the second time when it reaches ZERO, it will actually reset the board. // Therefore, we need to load half the required delay. // // WatchdogTicks = ((TimerPeriod * 100 * SP805_CLOCK_FREQUENCY) / 1GHz) / 2 ; // // i.e.: // // WatchdogTicks = (TimerPeriod * SP805_CLOCK_FREQUENCY) / 20 MHz ; Ticks64bit = DivU64x32(MultU64x32(TimerPeriod, (UINTN)PcdGet32(PcdSP805WatchdogClockFrequencyInHz)), 20000000); // The registers in the SP805 are only 32 bits if(Ticks64bit > (UINT64)0xFFFFFFFF) { // We could load the watchdog with the maximum supported value but // if a smaller value was requested, this could have the watchdog // triggering before it was intended. // Better generate an error to let the caller know. Status = EFI_DEVICE_ERROR; goto EXIT; } // Update the watchdog with a 32-bit value. MmioWrite32(SP805_WDOG_LOAD_REG, (UINT32)Ticks64bit); // Start the watchdog SP805Start(); } EXIT: // Ensure the watchdog is locked before exiting. SP805Lock(); return Status;}
开发者ID:AshleyDeSimone,项目名称:edk2,代码行数:81,
示例11: PlatfomrSmbiosDriverEntryPoint/** Main entry for this driver. @param ImageHandle Image handle this driver. @param SystemTable Pointer to SystemTable. @retval EFI_SUCESS This function always complete successfully.**/EFI_STATUSEFIAPIPlatfomrSmbiosDriverEntryPoint ( IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable ){ EFI_STATUS Status; EFI_SMBIOS_HANDLE SmbiosHandle; SMBIOS_STRUCTURE_POINTER Smbios; // Phase 0 - Patch table to make SMBIOS 2.7 structures smaller to conform // to an early version of the specification. // Phase 1 - Initialize SMBIOS tables from template Status = SmbiosLibInitializeFromTemplate (gSmbiosTemplate); ASSERT_EFI_ERROR (Status); // Phase 2 - Patch SMBIOS table entries Smbios.Hdr = SmbiosLibGetRecord (EFI_SMBIOS_TYPE_BIOS_INFORMATION, 0, &SmbiosHandle); if (Smbios.Type0 != NULL) { // 64K * (n+1) bytes Smbios.Type0->BiosSize = (UINT8)DivU64x32 (FixedPcdGet64 (PcdEmuFirmwareFdSize), 64*1024) - 1; SmbiosLibUpdateUnicodeString ( SmbiosHandle, Smbios.Type0->BiosVersion, (CHAR16 *) PcdGetPtr (PcdFirmwareVersionString) ); SmbiosLibUpdateUnicodeString ( SmbiosHandle, Smbios.Type0->BiosReleaseDate, (CHAR16 *) PcdGetPtr (PcdFirmwareReleaseDateString) ); } // Phase 3 - Create tables from scratch // Create Type 13 record from EFI Variables // Do we need this record for EFI as the info is availible from EFI varaibles // Also language types don't always match between EFI and SMBIOS // CreateSmbiosLanguageInformation (1, gSmbiosLangToEfiLang); CreatePlatformSmbiosMemoryRecords (); return EFI_SUCCESS;}
开发者ID:AshleyDeSimone,项目名称:edk2,代码行数:57,
示例12: MicroSecondDelay/** Stalls the CPU for at least the given number of microseconds. Stalls the CPU for the number of microseconds specified by MicroSeconds. @param MicroSeconds The minimum number of microseconds to delay. @return MicroSeconds**/UINTN EFIAPI MicroSecondDelay ( IN UINTN MicroSeconds ){ InternalAcpiDelay ( (UINT32)DivU64x32 ( MultU64x32 ( MicroSeconds, V_ACPI_TMR_FREQUENCY ), 1000000u ) ); return MicroSeconds;}
开发者ID:01org,项目名称:Galileo-Runtime,代码行数:27,
示例13: NanoSecondDelay/** Stalls the CPU for at least the given number of nanoseconds. Stalls the CPU for the number of nanoseconds specified by NanoSeconds. @param NanoSeconds The minimum number of nanoseconds to delay. @return NanoSeconds**/UINTNEFIAPINanoSecondDelay ( IN UINTN NanoSeconds ){ InternalAcpiDelay ( (UINT32)DivU64x32 ( MultU64x32 ( NanoSeconds, ACPI_TIMER_FREQUENCY ), 1000000000u ) ); return NanoSeconds;}
开发者ID:VirtualMonitor,项目名称:VirtualMonitor,代码行数:27,
示例14: NanoSecondDelay/** Stalls the CPU for at least the given number of nanoseconds. Stalls the CPU for the number of nanoseconds specified by NanoSeconds. @param NanoSeconds The minimum number of nanoseconds to delay. @return The value of NanoSeconds inputted.**/UINTNEFIAPINanoSecondDelay ( IN UINTN NanoSeconds ){ InternalX86Delay ( (UINT32)DivU64x32 ( MultU64x64 ( InternalX86GetTimerFrequency (), NanoSeconds ), 1000000000u ) ); return NanoSeconds;}
开发者ID:RafaelRMachado,项目名称:MinnowBoard,代码行数:27,
示例15: UnixMetronomeDriverWaitForTickEFI_STATUSEFIAPIUnixMetronomeDriverWaitForTick ( IN EFI_METRONOME_ARCH_PROTOCOL *This, IN UINT32 TickNumber )/*++Routine Description: The WaitForTick() function waits for the number of ticks specified by TickNumber from a known time source in the platform. If TickNumber of ticks are detected, then EFI_SUCCESS is returned. The actual time passed between entry of this function and the first tick is between 0 and TickPeriod 100 nS units. If you want to guarantee that at least TickPeriod time has elapsed, wait for two ticks. This function waits for a hardware event to determine when a tick occurs. It is possible for interrupt processing, or exception processing to interrupt the execution of the WaitForTick() function. Depending on the hardware source for the ticks, it is possible for a tick to be missed. This function cannot guarantee that ticks will not be missed. If a timeout occurs waiting for the specified number of ticks, then EFI_TIMEOUT is returned.Arguments: This - The EFI_METRONOME_ARCH_PROTOCOL instance. TickNumber - Number of ticks to wait.Returns: EFI_SUCCESS - The wait for the number of ticks specified by TickNumber succeeded.--*/{ UINT64 SleepTime; // // Calculate the time to sleep. Win API smallest unit to sleep is 1 millisec // Tick Period is in 100ns units, divide by 10000 to convert to ms // SleepTime = DivU64x32 (MultU64x32 ((UINT64) TickNumber, TICK_PERIOD) + 9999, 10000); gUnix->Sleep ((UINT32) SleepTime); return EFI_SUCCESS;}
开发者ID:AshleyDeSimone,项目名称:edk2,代码行数:46,
示例16: GetEfiTimeInMs/** returns given time as miliseconds. * assumes 31 days per month, so it's not correct, * but is enough for basic checks. */UINT64GetEfiTimeInMs ( IN EFI_TIME *T ){ UINT64 TimeMs; TimeMs = T->Year - 1900; // is 64bit multiply workign in 32 bit? TimeMs = MultU64x32 (TimeMs, 12) + T->Month; TimeMs = MultU64x32 (TimeMs, 31) + T->Day; // counting with 31 day TimeMs = MultU64x32 (TimeMs, 24) + T->Hour; TimeMs = MultU64x32 (TimeMs, 60) + T->Minute; TimeMs = MultU64x32 (TimeMs, 60) + T->Second; TimeMs = MultU64x32 (TimeMs, 1000) + DivU64x32(T->Nanosecond, 1000000); return TimeMs;}
开发者ID:svn2github,项目名称:cloverefiboot,代码行数:22,
示例17: AppendCSDNum2VOIDAppendCSDNum2 ( IN OUT POOL_PRINT *Str, IN UINT64 Num ){ UINT64 Result; UINTN Rem; ASSERT(Str != NULL); Result = DivU64x32 (Num, 25, &Rem); if (Result > 0) { AppendCSDNum2 (Str, Result); } CatPrint (Str, L"%c", Rem + 'a');}
开发者ID:DYX884877791,项目名称:edk-Shell,代码行数:18,
示例18: ProcessCumulative/** Gather and print cumulative data. Traverse the measurement records and:<BR> For each record with a Token listed in the CumData array:<BR> - Update the instance count and the total, minimum, and maximum durations. Finally, print the gathered cumulative statistics.**/VOIDProcessCumulative( VOID){ UINT64 AvgDur; // the computed average duration UINT64 Dur; UINT64 MinDur; UINT64 MaxDur; EFI_STRING StringPtr; UINTN TIndex; EFI_STRING StringPtrUnknown; StringPtrUnknown = HiiGetString (gHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL); StringPtr = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_SECTION_CUMULATIVE), NULL); PrintToken( STRING_TOKEN (STR_DP_SECTION_HEADER), (StringPtr == NULL) ? StringPtrUnknown: StringPtr); FreePool (StringPtr); FreePool (StringPtrUnknown); PrintToken (STRING_TOKEN (STR_DP_CUMULATIVE_SECT_1)); PrintToken (STRING_TOKEN (STR_DP_CUMULATIVE_SECT_2)); PrintToken (STRING_TOKEN (STR_DP_DASHES)); for ( TIndex = 0; TIndex < NumCum; ++TIndex) { if (CumData[TIndex].Count != 0) { AvgDur = DivU64x32 (CumData[TIndex].Duration, CumData[TIndex].Count); AvgDur = DurationInMicroSeconds(AvgDur); Dur = DurationInMicroSeconds(CumData[TIndex].Duration); MaxDur = DurationInMicroSeconds(CumData[TIndex].MaxDur); MinDur = DurationInMicroSeconds(CumData[TIndex].MinDur); PrintToken (STRING_TOKEN (STR_DP_CUMULATIVE_STATS), CumData[TIndex].Name, CumData[TIndex].Count, Dur, AvgDur, MinDur, MaxDur ); } }}
开发者ID:jeppeter,项目名称:vbox,代码行数:52,
示例19: TimerDriverSetTimerPeriod/** This function adjusts the period of timer interrupts to the value specified by TimerPeriod. If the timer period is updated, then the selected timer period is stored in EFI_TIMER.TimerPeriod, and EFI_SUCCESS is returned. If the timer hardware is not programmable, then EFI_UNSUPPORTED is returned. If an error occurs while attempting to update the timer period, then the timer hardware will be put back in its state prior to this call, and EFI_DEVICE_ERROR is returned. If TimerPeriod is 0, then the timer interrupt is disabled. This is not the same as disabling the CPU's interrupts. Instead, it must either turn off the timer hardware, or it must adjust the interrupt controller so that a CPU interrupt is not generated when the timer interrupt fires. @param This The EFI_TIMER_ARCH_PROTOCOL instance. @param TimerPeriod The rate to program the timer interrupt in 100 nS units. If the timer hardware is not programmable, then EFI_UNSUPPORTED is returned. If the timer is programmable, then the timer period will be rounded up to the nearest timer period that is supported by the timer hardware. If TimerPeriod is set to 0, then the timer interrupts will be disabled. @retval EFI_SUCCESS The timer period was changed. @retval EFI_UNSUPPORTED The platform cannot change the period of the timer interrupt. @retval EFI_DEVICE_ERROR The timer period could not be changed due to a device error.**/EFI_STATUSEFIAPITimerDriverSetTimerPeriod ( IN EFI_TIMER_ARCH_PROTOCOL *This, IN UINT64 TimerPeriod ){ EFI_STATUS Status; UINT64 TimerTicks; // always disable the timer MmioAnd32 (SP804_TIMER_PERIODIC_BASE + SP804_TIMER_CONTROL_REG, ~SP804_TIMER_CTRL_ENABLE); if (TimerPeriod == 0) { // Leave timer disabled from above, and... // Disable timer 0/1 interrupt for a TimerPeriod of 0 Status = gInterrupt->DisableInterruptSource (gInterrupt, gVector); } else { // Convert TimerPeriod into 1MHz clock counts (us units = 100ns units * 10) TimerTicks = DivU64x32 (TimerPeriod, 10); TimerTicks = MultU64x32 (TimerTicks, PcdGet32(PcdSP804TimerFrequencyInMHz)); // if it's larger than 32-bits, pin to highest value if (TimerTicks > 0xffffffff) { TimerTicks = 0xffffffff; } // Program the SP804 timer with the new count value MmioWrite32 (SP804_TIMER_PERIODIC_BASE + SP804_TIMER_LOAD_REG, TimerTicks); // enable the timer MmioOr32 (SP804_TIMER_PERIODIC_BASE + SP804_TIMER_CONTROL_REG, SP804_TIMER_CTRL_ENABLE); // enable timer 0/1 interrupts Status = gInterrupt->EnableInterruptSource (gInterrupt, gVector); } // Save the new timer period mTimerPeriod = TimerPeriod; return Status;}
开发者ID:AbnerChang,项目名称:edk2-staging,代码行数:70,
示例20: InitializeDebugTimer/** Initialize CPU local APIC timer. @param[out] TimerFrequency Local APIC timer frequency returned. @param[in] DumpFlag If TRUE, dump Local APIC timer's parameter. @return 32-bit Local APIC timer init count.**/UINT32InitializeDebugTimer ( OUT UINT32 *TimerFrequency, IN BOOLEAN DumpFlag ){ UINTN ApicTimerDivisor; UINT32 InitialCount; UINT32 ApicTimerFrequency; InitializeLocalApicSoftwareEnable (TRUE); GetApicTimerState (&ApicTimerDivisor, NULL, NULL); ApicTimerFrequency = PcdGet32(PcdFSBClock) / (UINT32)ApicTimerDivisor; // // Cpu Local Apic timer interrupt frequency, it is set to 0.1s // InitialCount = (UINT32)DivU64x32 ( MultU64x64 ( ApicTimerFrequency, DEBUG_TIMER_INTERVAL ), 1000000u ); InitializeApicTimer (ApicTimerDivisor, InitialCount, TRUE, DEBUG_TIMER_VECTOR); // // Disable Debug Timer interrupt to avoid it is delivered before Debug Port // is initialized // DisableApicTimerInterrupt (); if (DumpFlag) { DEBUG ((EFI_D_INFO, "Debug Timer: FSB Clock = %d/n", PcdGet32(PcdFSBClock))); DEBUG ((EFI_D_INFO, "Debug Timer: Divisor = %d/n", ApicTimerDivisor)); DEBUG ((EFI_D_INFO, "Debug Timer: Frequency = %d/n", ApicTimerFrequency)); DEBUG ((EFI_D_INFO, "Debug Timer: InitialCount = %d/n", InitialCount)); } if (TimerFrequency != NULL) { *TimerFrequency = ApicTimerFrequency; } return InitialCount;}
开发者ID:mdaniel,项目名称:virtualbox-org-svn-vbox-trunk,代码行数:50,
示例21: NanoSecondDelay/** Stalls the CPU for at least the given number of nanoseconds. Stalls the CPU for the number of nanoseconds specified by NanoSeconds. @param NanoSeconds The minimum number of nanoseconds to delay. @return The value of NanoSeconds inputted.**/UINTNEFIAPINanoSecondDelay ( IN UINTN NanoSeconds ){ UINTN ApicBase; ApicBase = InternalX86GetApicBase (); InternalX86Delay ( ApicBase, (UINT32)DivU64x32 ( MultU64x64 ( InternalX86GetTimerFrequency (ApicBase), NanoSeconds ), 1000000000u ) ); return NanoSeconds;}
开发者ID:AshleyDeSimone,项目名称:edk2,代码行数:31,
示例22: NanoSecondDelay/** Stalls the CPU for at least the given number of nanoseconds. Stalls the CPU for the number of nanoseconds specified by NanoSeconds. @param NanoSeconds The minimum number of nanoseconds to delay. @return NanoSeconds**/UINTNEFIAPINanoSecondDelay ( IN UINTN NanoSeconds ){ if (InternalGetApciDescrptionTable() == NULL) { return NanoSeconds; } InternalAcpiDelay ( (UINT32)DivU64x32 ( MultU64x32 ( NanoSeconds, 3579545 ), 1000000000u ) ); return NanoSeconds;}
开发者ID:SunnyKi,项目名称:bareBoot,代码行数:31,
示例23: TimerDriverSetTimerPeriod/** This function adjusts the period of timer interrupts to the value specified by TimerPeriod. If the timer period is updated, then the selected timer period is stored in EFI_TIMER.TimerPeriod, and EFI_SUCCESS is returned. If the timer hardware is not programmable, then EFI_UNSUPPORTED is returned. If an error occurs while attempting to update the timer period, then the timer hardware will be put back in its state prior to this call, and EFI_DEVICE_ERROR is returned. If TimerPeriod is 0, then the timer interrupt is disabled. This is not the same as disabling the CPU's interrupts. Instead, it must either turn off the timer hardware, or it must adjust the interrupt controller so that a CPU interrupt is not generated when the timer interrupt fires. @param This The EFI_TIMER_ARCH_PROTOCOL instance. @param TimerPeriod The rate to program the timer interrupt in 100 nS units. If the timer hardware is not programmable, then EFI_UNSUPPORTED is returned. If the timer is programmable, then the timer period will be rounded up to the nearest timer period that is supported by the timer hardware. If TimerPeriod is set to 0, then the timer interrupts will be disabled. @retval EFI_SUCCESS The timer period was changed. @retval EFI_UNSUPPORTED The platform cannot change the period of the timer interrupt. @retval EFI_DEVICE_ERROR The timer period could not be changed due to a device error.**/EFI_STATUSEFIAPITimerDriverSetTimerPeriod ( IN EFI_TIMER_ARCH_PROTOCOL *This, IN UINT64 TimerPeriod ){ EFI_STATUS Status; UINT64 TimerCount; INT32 LoadValue; if (TimerPeriod == 0) { // Turn off GPTIMER3 MmioWrite32 (TCLR, TCLR_ST_OFF); Status = gInterrupt->DisableInterruptSource(gInterrupt, gVector); } else { // Calculate required timer count TimerCount = DivU64x32(TimerPeriod * 100, PcdGet32(PcdEmbeddedPerformanceCounterPeriodInNanoseconds)); // Set GPTIMER3 Load register LoadValue = (INT32) -TimerCount; MmioWrite32 (TLDR, LoadValue); MmioWrite32 (TCRR, LoadValue); // Enable Overflow interrupt MmioWrite32 (TIER, TIER_TCAR_IT_DISABLE | TIER_OVF_IT_ENABLE | TIER_MAT_IT_DISABLE); // Turn on GPTIMER3, it will reload at overflow MmioWrite32 (TCLR, TCLR_AR_AUTORELOAD | TCLR_ST_ON); Status = gInterrupt->EnableInterruptSource(gInterrupt, gVector); } // // Save the new timer period // mTimerPeriod = TimerPeriod; return Status;}
开发者ID:AshleyDeSimone,项目名称:edk2,代码行数:68,
示例24: InitializeSmmTimer/** Initialize Timer for SMM AP Sync.**/VOIDInitializeSmmTimer ( VOID ){ UINT64 TimerFrequency; UINT64 Start; UINT64 End; TimerFrequency = GetPerformanceCounterProperties (&Start, &End); mTimeoutTicker = DivU64x32 ( MultU64x64(TimerFrequency, PcdGet64 (PcdCpuSmmApSyncTimeout)), 1000 * 1000 ); if (End < Start) { mCountDown = TRUE; mCycle = Start - End; } else { mCountDown = FALSE; mCycle = End - Start; }}
开发者ID:0xDEC0DE8,项目名称:STM,代码行数:26,
示例25: WriteBootToOsPerformanceData//.........这里部分代码省略......... &NoHandles, &Handles ); if (EFI_ERROR (Status)) { return ; } // // Allocate a block of memory that contain performance data to OS // if it is not allocated yet. // if (mAcpiLowMemoryBase == 0x0FFFFFFFF) { Status = gBS->AllocatePages ( AllocateMaxAddress, EfiReservedMemoryType, 4, &mAcpiLowMemoryBase ); if (EFI_ERROR (Status)) { gBS->FreePool (Handles); return ; } } mAcpiLowMemoryLength = EFI_PAGES_TO_SIZE(4); Ptr = (UINT8 *) ((UINT32) mAcpiLowMemoryBase + sizeof (EFI_PERF_HEADER)); LimitCount = (mAcpiLowMemoryLength - sizeof (EFI_PERF_HEADER)) / sizeof (EFI_PERF_DATA); // // Initialize performance data structure // EfiZeroMem (&mPerfHeader, sizeof (EFI_PERF_HEADER)); Freq = DivU64x32 (1000000000000, (UINTN) TimerPeriod, NULL); mPerfHeader.CpuFreq = Freq; // // Record BDS raw performance data // mPerfHeader.BDSRaw = Ticker; // // Get DXE drivers performance // for (mIndex = 0; mIndex < NoHandles; mIndex++) { Ticker = 0; PdbFileName = NULL; DumpData = DrvPerf->GetGauge ( DrvPerf, // Context NULL, // Handle NULL, // Token NULL, // Host NULL // PrecGauge ); while (DumpData) { if (DumpData->Handle == Handles[mIndex]) { PdbFileName = &(DumpData->PdbFileName[0]); if (DumpData->StartTick < DumpData->EndTick) { Ticker += (DumpData->EndTick - DumpData->StartTick); } } DumpData = DrvPerf->GetGauge ( DrvPerf, // Context
开发者ID:Kohrara,项目名称:edk,代码行数:67,
示例26: EmuBlockIoOpenDeviceEFI_STATUSEmuBlockIoOpenDevice ( IN EMU_BLOCK_IO_PRIVATE *Private ){ EFI_STATUS Status; UINT64 FileSize; struct statfs buf; // // If the device is already opened, close it // if (Private->fd >= 0) { EmuBlockIoReset (&Private->EmuBlockIo, FALSE); } // // Open the device // Private->fd = open (Private->Filename, Private->Mode, 0644); if (Private->fd < 0) { printf ("EmuOpenBlock: Could not open %s: %s/n", Private->Filename, strerror(errno)); Private->Media->MediaPresent = FALSE; Status = EFI_NO_MEDIA; goto Done; } if (!Private->Media->MediaPresent) { // // BugBug: try to emulate if a CD appears - notify drivers to check it out // Private->Media->MediaPresent = TRUE; } // // get the size of the file // Status = SetFilePointer64 (Private, 0, &FileSize, SEEK_END); if (EFI_ERROR (Status)) { printf ("EmuOpenBlock: Could not get filesize of %s/n", Private->Filename); Status = EFI_UNSUPPORTED; goto Done; } if (FileSize == 0) { // lseek fails on a real device. ioctl calls are OS specific#if __APPLE__ { UINT32 BlockSize; if (ioctl (Private->fd, DKIOCGETBLOCKSIZE, &BlockSize) == 0) { Private->Media->BlockSize = BlockSize; } if (ioctl (Private->fd, DKIOCGETBLOCKCOUNT, &Private->NumberOfBlocks) == 0) { if ((Private->NumberOfBlocks == 0) && (BlockSize == 0x800)) { // A DVD is ~ 4.37 GB so make up a number Private->Media->LastBlock = (0x100000000ULL/0x800) - 1; } else { Private->Media->LastBlock = Private->NumberOfBlocks - 1; } } ioctl (Private->fd, DKIOCGETMAXBLOCKCOUNTWRITE, &Private->Media->OptimalTransferLengthGranularity); }#else { size_t BlockSize; UINT64 DiskSize; if (ioctl (Private->fd, BLKSSZGET, &BlockSize) == 0) { Private->Media->BlockSize = BlockSize; } if (ioctl (Private->fd, BLKGETSIZE64, &DiskSize) == 0) { Private->NumberOfBlocks = DivU64x32 (DiskSize, (UINT32)BlockSize); Private->Media->LastBlock = Private->NumberOfBlocks - 1; } }#endif } else { Private->Media->BlockSize = Private->BlockSize; Private->NumberOfBlocks = DivU64x32 (FileSize, Private->Media->BlockSize); Private->Media->LastBlock = Private->NumberOfBlocks - 1; if (fstatfs (Private->fd, &buf) == 0) {#if __APPLE__ Private->Media->OptimalTransferLengthGranularity = buf.f_iosize/buf.f_bsize;#else Private->Media->OptimalTransferLengthGranularity = buf.f_bsize/buf.f_bsize;#endif } } DEBUG ((EFI_D_INIT, "%HEmuOpenBlock: opened %a%N/n", Private->Filename)); Status = EFI_SUCCESS;Done: if (EFI_ERROR (Status)) { if (Private->fd >= 0) { EmuBlockIoReset (&Private->EmuBlockIo, FALSE);//.........这里部分代码省略.........
开发者ID:fishyu2,项目名称:EmulatorPkg,代码行数:101,
示例27: handle//.........这里部分代码省略......... if (Catalog->Boot.Indicator != ELTORITO_ID_SECTION_BOOTABLE || Catalog->Boot.Lba == 0) { continue; } SubBlockSize = 512; SectorCount = Catalog->Boot.SectorCount; DBG("ELT: SectorCount =%d/n", SectorCount); switch (Catalog->Boot.MediaType) { case ELTORITO_NO_EMULATION: SubBlockSize = Media->BlockSize; DBG("ELT: SubBlockSize =%d/n", SubBlockSize); break; case ELTORITO_HARD_DISK: break; case ELTORITO_12_DISKETTE: SectorCount = 0x50 * 0x02 * 0x0F; break; case ELTORITO_14_DISKETTE: SectorCount = 0x50 * 0x02 * 0x12; break; case ELTORITO_28_DISKETTE: SectorCount = 0x50 * 0x02 * 0x24; break; default: DBG("EltCheckDevice: unsupported El Torito boot media type %x/n", Catalog->Boot.MediaType); SectorCount = 0; SubBlockSize = Media->BlockSize; break; } // // Create child device handle // CdDev.Header.Type = MEDIA_DEVICE_PATH; CdDev.Header.SubType = MEDIA_CDROM_DP; SetDevicePathNodeLength (&CdDev.Header, sizeof (CdDev)); if (Index == 1) { // // This is the initial/default entry // BootEntry = 0; SectorCount = 0; //Slice } CdDev.BootEntry = (UINT32) BootEntry; BootEntry++; CdDev.PartitionStart = Catalog->Boot.Lba; DBG("ELT: Partition start %d/n", CdDev.PartitionStart); if (SectorCount < 2) { // // When the SectorCount < 2, set the Partition as the whole CD. // CdDev.PartitionStart = 0; //Slice if (VolSpaceSize > (Media->LastBlock + 1)) { CdDev.PartitionSize = (UINT32)(Media->LastBlock - Catalog->Boot.Lba + 1); } else { CdDev.PartitionSize = (UINT32)(VolSpaceSize - Catalog->Boot.Lba); } DBG("ELT: WholeCD PartitionSize=%d/n", CdDev.PartitionSize); } else { CdDev.PartitionSize = DivU64x32 ( MultU64x32 ( SectorCount, SubBlockSize ) + Media->BlockSize - 1, Media->BlockSize ); DBG("ELT: CD Partition%d Size=%d/n", Index, CdDev.PartitionSize); } Status = PartitionInstallChildHandle ( This, Handle, DiskIo, DiskIo2, BlockIo, BlockIo2, DevicePath, (EFI_DEVICE_PATH_PROTOCOL *) &CdDev, Catalog->Boot.Lba, Catalog->Boot.Lba + CdDev.PartitionSize - 1, SubBlockSize, FALSE ); if (!EFI_ERROR (Status)) { Found = EFI_SUCCESS; } } } FreePool (VolDescriptor); return Found;}
开发者ID:F3R-FernandoReis,项目名称:clover,代码行数:101,
示例28: BdsMemoryTest//.........这里部分代码省略......... FreePool (Pos); return EFI_SUCCESS; } if (!FeaturePcdGet(PcdBootlogoOnlyEnable)) { TmpStr = GetStringById (STRING_TOKEN (STR_ESC_TO_SKIP_MEM_TEST)); if (TmpStr != NULL) { PrintXY (10, 10, NULL, NULL, TmpStr); FreePool (TmpStr); } } else { DEBUG ((EFI_D_INFO, "Enter memory test./n")); } do { Status = GenMemoryTest->PerformMemoryTest ( GenMemoryTest, &TestedMemorySize, &TotalMemorySize, &ErrorOut, TestAbort ); if (ErrorOut && (Status == EFI_DEVICE_ERROR)) { TmpStr = GetStringById (STRING_TOKEN (STR_SYSTEM_MEM_ERROR)); if (TmpStr != NULL) { PrintXY (10, 10, NULL, NULL, TmpStr); FreePool (TmpStr); } ASSERT (0); } if (!FeaturePcdGet(PcdBootlogoOnlyEnable)) { TempData = (UINT32) DivU64x32 (TotalMemorySize, 16); TestPercent = (UINTN) DivU64x32 ( DivU64x32 (MultU64x32 (TestedMemorySize, 100), 16), TempData ); if (TestPercent != PreviousValue) { UnicodeValueToString (StrPercent, 0, TestPercent, 0); TmpStr = GetStringById (STRING_TOKEN (STR_MEMORY_TEST_PERCENT)); if (TmpStr != NULL) { // // TmpStr size is 64, StrPercent is reserved to 16. // StrCatS (StrPercent, sizeof (StrPercent) / sizeof (CHAR16), TmpStr); PrintXY (10, 10, NULL, NULL, StrPercent); FreePool (TmpStr); } TmpStr = GetStringById (STRING_TOKEN (STR_PERFORM_MEM_TEST)); if (TmpStr != NULL) { PlatformBdsShowProgress ( Foreground, Background, TmpStr, Color, TestPercent, (UINTN) PreviousValue ); FreePool (TmpStr); } } PreviousValue = TestPercent; } else {
开发者ID:brinlyaus,项目名称:shiny-boot,代码行数:67,
注:本文中的DivU64x32函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ Divide函数代码示例 C++ DistanceSquared函数代码示例 |