hardware_properties.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. // Copyright 2020 yuzu Emulator Project
  2. // Licensed under GPLv2 or any later version
  3. // Refer to the license.txt file included.
  4. #pragma once
  5. #include <tuple>
  6. #include "common/common_types.h"
  7. namespace Core {
  8. namespace Hardware {
  9. // The below clock rate is based on Switch's clockspeed being widely known as 1.020GHz
  10. // The exact value used is of course unverified.
  11. constexpr u64 BASE_CLOCK_RATE = 1019215872; // Switch cpu frequency is 1020MHz un/docked
  12. constexpr u64 CNTFREQ = 19200000; // Switch's hardware clock speed
  13. constexpr u32 NUM_CPU_CORES = 4; // Number of CPU Cores
  14. } // namespace Hardware
  15. constexpr u32 INVALID_HOST_THREAD_ID = 0xFFFFFFFF;
  16. struct EmuThreadHandle {
  17. u32 host_handle;
  18. u32 guest_handle;
  19. u64 GetRaw() const {
  20. return (static_cast<u64>(host_handle) << 32) | guest_handle;
  21. }
  22. bool operator==(const EmuThreadHandle& rhs) const {
  23. return std::tie(host_handle, guest_handle) == std::tie(rhs.host_handle, rhs.guest_handle);
  24. }
  25. bool operator!=(const EmuThreadHandle& rhs) const {
  26. return !operator==(rhs);
  27. }
  28. static constexpr EmuThreadHandle InvalidHandle() {
  29. constexpr u32 invalid_handle = 0xFFFFFFFF;
  30. return {invalid_handle, invalid_handle};
  31. }
  32. bool IsInvalid() const {
  33. return (*this) == InvalidHandle();
  34. }
  35. };
  36. } // namespace Core