summaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/timer.cpp
diff options
context:
space:
mode:
authorGravatar Yuri Kunde Schlesner2016-09-21 11:29:48 -0700
committerGravatar GitHub2016-09-21 11:29:48 -0700
commitd5d2ca8058a0f1c00ab7ca9fe2c058ba47546c0a (patch)
tree8a22ca73ff838f3f0090b29a548ae81087fc90ed /src/core/hle/kernel/timer.cpp
parentREADME: Specify master branch for Travis CI badge (diff)
parentFix Travis clang-format check (diff)
downloadyuzu-d5d2ca8058a0f1c00ab7ca9fe2c058ba47546c0a.tar.gz
yuzu-d5d2ca8058a0f1c00ab7ca9fe2c058ba47546c0a.tar.xz
yuzu-d5d2ca8058a0f1c00ab7ca9fe2c058ba47546c0a.zip
Merge pull request #2086 from linkmauve/clang-format
Add clang-format as part of our {commit,travis}-time checks
Diffstat (limited to 'src/core/hle/kernel/timer.cpp')
-rw-r--r--src/core/hle/kernel/timer.cpp18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/core/hle/kernel/timer.cpp b/src/core/hle/kernel/timer.cpp
index b8daaeede..a9f98223c 100644
--- a/src/core/hle/kernel/timer.cpp
+++ b/src/core/hle/kernel/timer.cpp
@@ -3,14 +3,12 @@
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include <cinttypes> 5#include <cinttypes>
6
7#include "common/assert.h" 6#include "common/assert.h"
8#include "common/logging/log.h" 7#include "common/logging/log.h"
9
10#include "core/core_timing.h" 8#include "core/core_timing.h"
11#include "core/hle/kernel/kernel.h" 9#include "core/hle/kernel/kernel.h"
12#include "core/hle/kernel/timer.h"
13#include "core/hle/kernel/thread.h" 10#include "core/hle/kernel/thread.h"
11#include "core/hle/kernel/timer.h"
14 12
15namespace Kernel { 13namespace Kernel {
16 14
@@ -41,7 +39,7 @@ bool Timer::ShouldWait() {
41} 39}
42 40
43void Timer::Acquire() { 41void Timer::Acquire() {
44 ASSERT_MSG( !ShouldWait(), "object unavailable!"); 42 ASSERT_MSG(!ShouldWait(), "object unavailable!");
45 43
46 if (reset_type == ResetType::OneShot) 44 if (reset_type == ResetType::OneShot)
47 signaled = false; 45 signaled = false;
@@ -55,8 +53,8 @@ void Timer::Set(s64 initial, s64 interval) {
55 interval_delay = interval; 53 interval_delay = interval;
56 54
57 u64 initial_microseconds = initial / 1000; 55 u64 initial_microseconds = initial / 1000;
58 CoreTiming::ScheduleEvent(usToCycles(initial_microseconds), 56 CoreTiming::ScheduleEvent(usToCycles(initial_microseconds), timer_callback_event_type,
59 timer_callback_event_type, callback_handle); 57 callback_handle);
60 58
61 HLE::Reschedule(__func__); 59 HLE::Reschedule(__func__);
62} 60}
@@ -73,7 +71,8 @@ void Timer::Clear() {
73 71
74/// The timer callback event, called when a timer is fired 72/// The timer callback event, called when a timer is fired
75static void TimerCallback(u64 timer_handle, int cycles_late) { 73static void TimerCallback(u64 timer_handle, int cycles_late) {
76 SharedPtr<Timer> timer = timer_callback_handle_table.Get<Timer>(static_cast<Handle>(timer_handle)); 74 SharedPtr<Timer> timer =
75 timer_callback_handle_table.Get<Timer>(static_cast<Handle>(timer_handle));
77 76
78 if (timer == nullptr) { 77 if (timer == nullptr) {
79 LOG_CRITICAL(Kernel, "Callback fired for invalid timer %08" PRIx64, timer_handle); 78 LOG_CRITICAL(Kernel, "Callback fired for invalid timer %08" PRIx64, timer_handle);
@@ -91,7 +90,7 @@ static void TimerCallback(u64 timer_handle, int cycles_late) {
91 // Reschedule the timer with the interval delay 90 // Reschedule the timer with the interval delay
92 u64 interval_microseconds = timer->interval_delay / 1000; 91 u64 interval_microseconds = timer->interval_delay / 1000;
93 CoreTiming::ScheduleEvent(usToCycles(interval_microseconds) - cycles_late, 92 CoreTiming::ScheduleEvent(usToCycles(interval_microseconds) - cycles_late,
94 timer_callback_event_type, timer_handle); 93 timer_callback_event_type, timer_handle);
95 } 94 }
96} 95}
97 96
@@ -100,7 +99,6 @@ void TimersInit() {
100 timer_callback_event_type = CoreTiming::RegisterEvent("TimerCallback", TimerCallback); 99 timer_callback_event_type = CoreTiming::RegisterEvent("TimerCallback", TimerCallback);
101} 100}
102 101
103void TimersShutdown() { 102void TimersShutdown() {}
104}
105 103
106} // namespace 104} // namespace