summaryrefslogtreecommitdiffstats
path: root/src/core/core_timing_util.h
diff options
context:
space:
mode:
authorFernando Sahmkow <fsahmkow27@gmail.com>2020-02-12 00:56:24 +0100
committerFernandoS27 <fsahmkow27@gmail.com>2020-02-12 01:19:11 +0100
commit1e6f8aba04b7be0f90b97aed2527558c755935d6 (patch)
treedea6dc5efd324eb6bc8667a114e20c6e91a28195 /src/core/core_timing_util.h
parentKernel: Refactor synchronization to better match RE (diff)
downloadyuzu-1e6f8aba04b7be0f90b97aed2527558c755935d6.tar
yuzu-1e6f8aba04b7be0f90b97aed2527558c755935d6.tar.gz
yuzu-1e6f8aba04b7be0f90b97aed2527558c755935d6.tar.bz2
yuzu-1e6f8aba04b7be0f90b97aed2527558c755935d6.tar.lz
yuzu-1e6f8aba04b7be0f90b97aed2527558c755935d6.tar.xz
yuzu-1e6f8aba04b7be0f90b97aed2527558c755935d6.tar.zst
yuzu-1e6f8aba04b7be0f90b97aed2527558c755935d6.zip
Diffstat (limited to 'src/core/core_timing_util.h')
-rw-r--r--src/core/core_timing_util.h12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/core/core_timing_util.h b/src/core/core_timing_util.h
index cdd84d70f..addc72b19 100644
--- a/src/core/core_timing_util.h
+++ b/src/core/core_timing_util.h
@@ -6,28 +6,24 @@
#include <chrono>
#include "common/common_types.h"
+#include "core/hardware_properties.h"
namespace Core::Timing {
-// The below clock rate is based on Switch's clockspeed being widely known as 1.020GHz
-// The exact value used is of course unverified.
-constexpr u64 BASE_CLOCK_RATE = 1019215872; // Switch clock speed is 1020MHz un/docked
-constexpr u64 CNTFREQ = 19200000; // Value from fusee.
-
s64 msToCycles(std::chrono::milliseconds ms);
s64 usToCycles(std::chrono::microseconds us);
s64 nsToCycles(std::chrono::nanoseconds ns);
inline std::chrono::milliseconds CyclesToMs(s64 cycles) {
- return std::chrono::milliseconds(cycles * 1000 / BASE_CLOCK_RATE);
+ return std::chrono::milliseconds(cycles * 1000 / Hardware::BASE_CLOCK_RATE);
}
inline std::chrono::nanoseconds CyclesToNs(s64 cycles) {
- return std::chrono::nanoseconds(cycles * 1000000000 / BASE_CLOCK_RATE);
+ return std::chrono::nanoseconds(cycles * 1000000000 / Hardware::BASE_CLOCK_RATE);
}
inline std::chrono::microseconds CyclesToUs(s64 cycles) {
- return std::chrono::microseconds(cycles * 1000000 / BASE_CLOCK_RATE);
+ return std::chrono::microseconds(cycles * 1000000 / Hardware::BASE_CLOCK_RATE);
}
u64 CpuCyclesToClockCycles(u64 ticks);