summaryrefslogtreecommitdiff
path: root/src/core/hardware_properties.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/hardware_properties.h')
-rw-r--r--src/core/hardware_properties.h45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/core/hardware_properties.h b/src/core/hardware_properties.h
new file mode 100644
index 000000000..213461b6a
--- /dev/null
+++ b/src/core/hardware_properties.h
@@ -0,0 +1,45 @@
1// Copyright 2020 yuzu Emulator Project
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#pragma once
6
7#include <tuple>
8
9#include "common/common_types.h"
10
11namespace Core {
12
13namespace Hardware {
14
15// The below clock rate is based on Switch's clockspeed being widely known as 1.020GHz
16// The exact value used is of course unverified.
17constexpr u64 BASE_CLOCK_RATE = 1019215872; // Switch cpu frequency is 1020MHz un/docked
18constexpr u64 CNTFREQ = 19200000; // Switch's hardware clock speed
19constexpr u32 NUM_CPU_CORES = 4; // Number of CPU Cores
20
21} // namespace Hardware
22
23struct EmuThreadHandle {
24 u32 host_handle;
25 u32 guest_handle;
26
27 u64 GetRaw() const {
28 return (static_cast<u64>(host_handle) << 32) | guest_handle;
29 }
30
31 bool operator==(const EmuThreadHandle& rhs) const {
32 return std::tie(host_handle, guest_handle) == std::tie(rhs.host_handle, rhs.guest_handle);
33 }
34
35 bool operator!=(const EmuThreadHandle& rhs) const {
36 return !operator==(rhs);
37 }
38
39 static constexpr EmuThreadHandle InvalidHandle() {
40 constexpr u32 invalid_handle = 0xFFFFFFFF;
41 return {invalid_handle, invalid_handle};
42 }
43};
44
45} // namespace Core