summaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/timer.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/hle/kernel/timer.h')
-rw-r--r--src/core/hle/kernel/timer.h88
1 files changed, 0 insertions, 88 deletions
diff --git a/src/core/hle/kernel/timer.h b/src/core/hle/kernel/timer.h
deleted file mode 100644
index ce3e74426..000000000
--- a/src/core/hle/kernel/timer.h
+++ /dev/null
@@ -1,88 +0,0 @@
1// Copyright 2015 Citra 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 "common/common_types.h"
8#include "core/hle/kernel/object.h"
9#include "core/hle/kernel/wait_object.h"
10
11namespace Kernel {
12
13class KernelCore;
14
15class Timer final : public WaitObject {
16public:
17 /**
18 * Creates a timer
19 * @param kernel The kernel instance to create the timer callback handle for.
20 * @param reset_type ResetType describing how to create the timer
21 * @param name Optional name of timer
22 * @return The created Timer
23 */
24 static SharedPtr<Timer> Create(KernelCore& kernel, ResetType reset_type,
25 std::string name = "Unknown");
26
27 std::string GetTypeName() const override {
28 return "Timer";
29 }
30 std::string GetName() const override {
31 return name;
32 }
33
34 static const HandleType HANDLE_TYPE = HandleType::Timer;
35 HandleType GetHandleType() const override {
36 return HANDLE_TYPE;
37 }
38
39 ResetType GetResetType() const {
40 return reset_type;
41 }
42
43 u64 GetInitialDelay() const {
44 return initial_delay;
45 }
46
47 u64 GetIntervalDelay() const {
48 return interval_delay;
49 }
50
51 bool ShouldWait(Thread* thread) const override;
52 void Acquire(Thread* thread) override;
53
54 /**
55 * Starts the timer, with the specified initial delay and interval.
56 * @param initial Delay until the timer is first fired
57 * @param interval Delay until the timer is fired after the first time
58 */
59 void Set(s64 initial, s64 interval);
60
61 void Cancel();
62 void Clear();
63
64 /**
65 * Signals the timer, waking up any waiting threads and rescheduling it
66 * for the next interval.
67 * This method should not be called from outside the timer callback handler,
68 * lest multiple callback events get scheduled.
69 */
70 void Signal(int cycles_late);
71
72private:
73 explicit Timer(KernelCore& kernel);
74 ~Timer() override;
75
76 ResetType reset_type; ///< The ResetType of this timer
77
78 u64 initial_delay; ///< The delay until the timer fires for the first time
79 u64 interval_delay; ///< The delay until the timer fires after the first time
80
81 bool signaled; ///< Whether the timer has been signaled or not
82 std::string name; ///< Name of timer (optional)
83
84 /// Handle used as userdata to reference this object when inserting into the CoreTiming queue.
85 Handle callback_handle;
86};
87
88} // namespace Kernel