summaryrefslogtreecommitdiff
path: root/src/core/hle/svc.cpp
diff options
context:
space:
mode:
authorGravatar Subv2014-12-04 14:45:47 -0500
committerGravatar Subv2015-01-08 21:22:14 -0500
commit07044651ef2644451dc4f78045856ad078cb69fe (patch)
tree50113ade759854c60c0e91864f27f2f680993e84 /src/core/hle/svc.cpp
parentMerge pull request #425 from Subv/coretiming (diff)
downloadyuzu-07044651ef2644451dc4f78045856ad078cb69fe.tar.gz
yuzu-07044651ef2644451dc4f78045856ad078cb69fe.tar.xz
yuzu-07044651ef2644451dc4f78045856ad078cb69fe.zip
SVC: Implemented the Timer service calls.
Diffstat (limited to 'src/core/hle/svc.cpp')
-rw-r--r--src/core/hle/svc.cpp36
1 files changed, 32 insertions, 4 deletions
diff --git a/src/core/hle/svc.cpp b/src/core/hle/svc.cpp
index c25409a9f..0cf3de75c 100644
--- a/src/core/hle/svc.cpp
+++ b/src/core/hle/svc.cpp
@@ -15,6 +15,7 @@
15#include "core/hle/kernel/semaphore.h" 15#include "core/hle/kernel/semaphore.h"
16#include "core/hle/kernel/shared_memory.h" 16#include "core/hle/kernel/shared_memory.h"
17#include "core/hle/kernel/thread.h" 17#include "core/hle/kernel/thread.h"
18#include "core/hle/kernel/timer.h"
18 19
19#include "core/hle/function_wrappers.h" 20#include "core/hle/function_wrappers.h"
20#include "core/hle/result.h" 21#include "core/hle/result.h"
@@ -139,6 +140,7 @@ static Result WaitSynchronization1(Handle handle, s64 nano_seconds) {
139/// Wait for the given handles to synchronize, timeout after the specified nanoseconds 140/// Wait for the given handles to synchronize, timeout after the specified nanoseconds
140static Result WaitSynchronizationN(s32* out, Handle* handles, s32 handle_count, bool wait_all, 141static Result WaitSynchronizationN(s32* out, Handle* handles, s32 handle_count, bool wait_all,
141 s64 nano_seconds) { 142 s64 nano_seconds) {
143
142 // TODO(bunnei): Do something with nano_seconds, currently ignoring this 144 // TODO(bunnei): Do something with nano_seconds, currently ignoring this
143 bool unlock_all = true; 145 bool unlock_all = true;
144 bool wait_infinite = (nano_seconds == -1); // Used to wait until a thread has terminated 146 bool wait_infinite = (nano_seconds == -1); // Used to wait until a thread has terminated
@@ -338,6 +340,32 @@ static Result ClearEvent(Handle evt) {
338 return Kernel::ClearEvent(evt).raw; 340 return Kernel::ClearEvent(evt).raw;
339} 341}
340 342
343/// Creates a timer
344static Result CreateTimer(Handle* handle, u32 reset_type) {
345 ResultCode res = Kernel::CreateTimer(handle, static_cast<ResetType>(reset_type));
346 LOG_TRACE(Kernel_SVC, "called reset_type=0x%08X : created handle=0x%08X",
347 reset_type, *handle);
348 return res.raw;
349}
350
351/// Clears a timer
352static Result ClearTimer(Handle handle) {
353 LOG_TRACE(Kernel_SVC, "called timer=0x%08X", handle);
354 return Kernel::ClearTimer(handle).raw;
355}
356
357/// Starts a timer
358static Result SetTimer(Handle handle, s64 initial, s64 interval) {
359 LOG_TRACE(Kernel_SVC, "called timer=0x%08X", handle);
360 return Kernel::SetTimer(handle, initial, interval).raw;
361}
362
363/// Cancels a timer
364static Result CancelTimer(Handle handle) {
365 LOG_TRACE(Kernel_SVC, "called timer=0x%08X", handle);
366 return Kernel::CancelTimer(handle).raw;
367}
368
341/// Sleep the current thread 369/// Sleep the current thread
342static void SleepThread(s64 nanoseconds) { 370static void SleepThread(s64 nanoseconds) {
343 LOG_TRACE(Kernel_SVC, "called nanoseconds=%lld", nanoseconds); 371 LOG_TRACE(Kernel_SVC, "called nanoseconds=%lld", nanoseconds);
@@ -391,10 +419,10 @@ const HLE::FunctionDef SVC_Table[] = {
391 {0x17, HLE::Wrap<CreateEvent>, "CreateEvent"}, 419 {0x17, HLE::Wrap<CreateEvent>, "CreateEvent"},
392 {0x18, HLE::Wrap<SignalEvent>, "SignalEvent"}, 420 {0x18, HLE::Wrap<SignalEvent>, "SignalEvent"},
393 {0x19, HLE::Wrap<ClearEvent>, "ClearEvent"}, 421 {0x19, HLE::Wrap<ClearEvent>, "ClearEvent"},
394 {0x1A, nullptr, "CreateTimer"}, 422 {0x1A, HLE::Wrap<CreateTimer>, "CreateTimer"},
395 {0x1B, nullptr, "SetTimer"}, 423 {0x1B, HLE::Wrap<SetTimer>, "SetTimer"},
396 {0x1C, nullptr, "CancelTimer"}, 424 {0x1C, HLE::Wrap<CancelTimer>, "CancelTimer"},
397 {0x1D, nullptr, "ClearTimer"}, 425 {0x1D, HLE::Wrap<ClearTimer>, "ClearTimer"},
398 {0x1E, HLE::Wrap<CreateMemoryBlock>, "CreateMemoryBlock"}, 426 {0x1E, HLE::Wrap<CreateMemoryBlock>, "CreateMemoryBlock"},
399 {0x1F, HLE::Wrap<MapMemoryBlock>, "MapMemoryBlock"}, 427 {0x1F, HLE::Wrap<MapMemoryBlock>, "MapMemoryBlock"},
400 {0x20, nullptr, "UnmapMemoryBlock"}, 428 {0x20, nullptr, "UnmapMemoryBlock"},