summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/CMakeLists.txt6
-rw-r--r--src/core/hle/function_wrappers.h1
-rw-r--r--src/core/hle/kernel/event.cpp2
-rw-r--r--src/core/hle/kernel/event.h8
-rw-r--r--src/core/hle/kernel/timer.cpp2
-rw-r--r--src/core/hle/kernel/timer.h2
-rw-r--r--src/core/hle/service/apt/apt.cpp4
-rw-r--r--src/core/hle/service/cam/cam.cpp8
-rw-r--r--src/core/hle/service/dsp_dsp.cpp2
-rw-r--r--src/core/hle/service/hid/hid.cpp12
-rw-r--r--src/core/hle/service/ir/ir.cpp4
-rw-r--r--src/core/hle/service/ndm/ndm.cpp47
-rw-r--r--src/core/hle/service/ndm/ndm.h52
-rw-r--r--src/core/hle/service/ndm/ndm_u.cpp (renamed from src/core/hle/service/ndm_u.cpp)23
-rw-r--r--src/core/hle/service/ndm/ndm_u.h (renamed from src/core/hle/service/ndm_u.h)15
-rw-r--r--src/core/hle/service/nwm_uds.cpp2
-rw-r--r--src/core/hle/service/service.cpp5
-rw-r--r--src/core/hle/service/srv.cpp2
-rw-r--r--src/core/hle/service/y2r_u.cpp2
-rw-r--r--src/core/hle/svc.cpp4
-rw-r--r--src/core/hle/svc.h16
21 files changed, 153 insertions, 66 deletions
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
index 35b61dada..3473e2f5b 100644
--- a/src/core/CMakeLists.txt
+++ b/src/core/CMakeLists.txt
@@ -87,7 +87,8 @@ set(SRCS
hle/service/ir/ir_user.cpp
hle/service/ldr_ro.cpp
hle/service/mic_u.cpp
- hle/service/ndm_u.cpp
+ hle/service/ndm/ndm.cpp
+ hle/service/ndm/ndm_u.cpp
hle/service/news/news.cpp
hle/service/news/news_s.cpp
hle/service/news/news_u.cpp
@@ -218,7 +219,8 @@ set(HEADERS
hle/service/ir/ir_user.h
hle/service/ldr_ro.h
hle/service/mic_u.h
- hle/service/ndm_u.h
+ hle/service/ndm/ndm.h
+ hle/service/ndm/ndm_u.h
hle/service/news/news.h
hle/service/news/news_s.h
hle/service/news/news_u.h
diff --git a/src/core/hle/function_wrappers.h b/src/core/hle/function_wrappers.h
index 882a51df1..4d718b681 100644
--- a/src/core/hle/function_wrappers.h
+++ b/src/core/hle/function_wrappers.h
@@ -10,6 +10,7 @@
#include "core/memory.h"
#include "core/hle/hle.h"
#include "core/hle/result.h"
+#include "core/hle/svc.h"
namespace HLE {
diff --git a/src/core/hle/kernel/event.cpp b/src/core/hle/kernel/event.cpp
index 53feebbc0..2b7c6992a 100644
--- a/src/core/hle/kernel/event.cpp
+++ b/src/core/hle/kernel/event.cpp
@@ -35,7 +35,7 @@ void Event::Acquire() {
ASSERT_MSG(!ShouldWait(), "object unavailable!");
// Release the event if it's not sticky...
- if (reset_type != RESETTYPE_STICKY)
+ if (reset_type != ResetType::Sticky)
signaled = false;
}
diff --git a/src/core/hle/kernel/event.h b/src/core/hle/kernel/event.h
index 89d405236..73d0da419 100644
--- a/src/core/hle/kernel/event.h
+++ b/src/core/hle/kernel/event.h
@@ -7,10 +7,16 @@
#include "common/common_types.h"
#include "core/hle/kernel/kernel.h"
-#include "core/hle/svc.h"
namespace Kernel {
+enum class ResetType {
+ OneShot,
+ Sticky,
+ Pulse,
+};
+
+
class Event final : public WaitObject {
public:
/**
diff --git a/src/core/hle/kernel/timer.cpp b/src/core/hle/kernel/timer.cpp
index ce6bbd719..b8daaeede 100644
--- a/src/core/hle/kernel/timer.cpp
+++ b/src/core/hle/kernel/timer.cpp
@@ -43,7 +43,7 @@ bool Timer::ShouldWait() {
void Timer::Acquire() {
ASSERT_MSG( !ShouldWait(), "object unavailable!");
- if (reset_type == RESETTYPE_ONESHOT)
+ if (reset_type == ResetType::OneShot)
signaled = false;
}
diff --git a/src/core/hle/kernel/timer.h b/src/core/hle/kernel/timer.h
index 540e4e187..b1db60e8f 100644
--- a/src/core/hle/kernel/timer.h
+++ b/src/core/hle/kernel/timer.h
@@ -6,8 +6,8 @@
#include "common/common_types.h"
+#include "core/hle/kernel/event.h"
#include "core/hle/kernel/kernel.h"
-#include "core/hle/svc.h"
namespace Kernel {
diff --git a/src/core/hle/service/apt/apt.cpp b/src/core/hle/service/apt/apt.cpp
index 98c72fc32..a49365287 100644
--- a/src/core/hle/service/apt/apt.cpp
+++ b/src/core/hle/service/apt/apt.cpp
@@ -434,8 +434,8 @@ void Init() {
cpu_percent = 0;
// TODO(bunnei): Check if these are created in Initialize or on APT process startup.
- notification_event = Kernel::Event::Create(RESETTYPE_ONESHOT, "APT_U:Notification");
- parameter_event = Kernel::Event::Create(RESETTYPE_ONESHOT, "APT_U:Start");
+ notification_event = Kernel::Event::Create(Kernel::ResetType::OneShot, "APT_U:Notification");
+ parameter_event = Kernel::Event::Create(Kernel::ResetType::OneShot, "APT_U:Start");
next_parameter.signal = static_cast<u32>(SignalType::AppJustStarted);
next_parameter.destination_id = 0x300;
diff --git a/src/core/hle/service/cam/cam.cpp b/src/core/hle/service/cam/cam.cpp
index 4d714037f..9df48a650 100644
--- a/src/core/hle/service/cam/cam.cpp
+++ b/src/core/hle/service/cam/cam.cpp
@@ -293,10 +293,10 @@ void Init() {
AddService(new CAM_S_Interface);
AddService(new CAM_U_Interface);
- completion_event_cam1 = Kernel::Event::Create(RESETTYPE_ONESHOT, "CAM_U::completion_event_cam1");
- completion_event_cam2 = Kernel::Event::Create(RESETTYPE_ONESHOT, "CAM_U::completion_event_cam2");
- interrupt_error_event = Kernel::Event::Create(RESETTYPE_ONESHOT, "CAM_U::interrupt_error_event");
- vsync_interrupt_error_event = Kernel::Event::Create(RESETTYPE_ONESHOT, "CAM_U::vsync_interrupt_error_event");
+ completion_event_cam1 = Kernel::Event::Create(ResetType::OneShot, "CAM_U::completion_event_cam1");
+ completion_event_cam2 = Kernel::Event::Create(ResetType::OneShot, "CAM_U::completion_event_cam2");
+ interrupt_error_event = Kernel::Event::Create(ResetType::OneShot, "CAM_U::interrupt_error_event");
+ vsync_interrupt_error_event = Kernel::Event::Create(ResetType::OneShot, "CAM_U::vsync_interrupt_error_event");
}
void Shutdown() {
diff --git a/src/core/hle/service/dsp_dsp.cpp b/src/core/hle/service/dsp_dsp.cpp
index 3ba24d466..08e437125 100644
--- a/src/core/hle/service/dsp_dsp.cpp
+++ b/src/core/hle/service/dsp_dsp.cpp
@@ -457,7 +457,7 @@ const Interface::FunctionInfo FunctionTable[] = {
// Interface class
Interface::Interface() {
- semaphore_event = Kernel::Event::Create(RESETTYPE_ONESHOT, "DSP_DSP::semaphore_event");
+ semaphore_event = Kernel::Event::Create(Kernel::ResetType::OneShot, "DSP_DSP::semaphore_event");
read_pipe_count = 0;
Register(FunctionTable);
diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp
index 11d7e69a1..cb4fd38e2 100644
--- a/src/core/hle/service/hid/hid.cpp
+++ b/src/core/hle/service/hid/hid.cpp
@@ -68,7 +68,7 @@ void Update() {
mem->pad.current_state.hex = state.hex;
mem->pad.index = next_pad_index;
- next_touch_index = (next_touch_index + 1) % mem->pad.entries.size();
+ next_pad_index = (next_pad_index + 1) % mem->pad.entries.size();
// Get the previous Pad state
u32 last_entry_index = (mem->pad.index - 1) % mem->pad.entries.size();
@@ -201,11 +201,11 @@ void Init() {
next_touch_index = 0;
// Create event handles
- event_pad_or_touch_1 = Event::Create(RESETTYPE_ONESHOT, "HID:EventPadOrTouch1");
- event_pad_or_touch_2 = Event::Create(RESETTYPE_ONESHOT, "HID:EventPadOrTouch2");
- event_accelerometer = Event::Create(RESETTYPE_ONESHOT, "HID:EventAccelerometer");
- event_gyroscope = Event::Create(RESETTYPE_ONESHOT, "HID:EventGyroscope");
- event_debug_pad = Event::Create(RESETTYPE_ONESHOT, "HID:EventDebugPad");
+ event_pad_or_touch_1 = Event::Create(ResetType::OneShot, "HID:EventPadOrTouch1");
+ event_pad_or_touch_2 = Event::Create(ResetType::OneShot, "HID:EventPadOrTouch2");
+ event_accelerometer = Event::Create(ResetType::OneShot, "HID:EventAccelerometer");
+ event_gyroscope = Event::Create(ResetType::OneShot, "HID:EventGyroscope");
+ event_debug_pad = Event::Create(ResetType::OneShot, "HID:EventDebugPad");
}
void Shutdown() {
diff --git a/src/core/hle/service/ir/ir.cpp b/src/core/hle/service/ir/ir.cpp
index c2121cb2e..505c441c6 100644
--- a/src/core/hle/service/ir/ir.cpp
+++ b/src/core/hle/service/ir/ir.cpp
@@ -99,8 +99,8 @@ void Init() {
transfer_shared_memory = nullptr;
// Create event handle(s)
- handle_event = Event::Create(RESETTYPE_ONESHOT, "IR:HandleEvent");
- conn_status_event = Event::Create(RESETTYPE_ONESHOT, "IR:ConnectionStatusEvent");
+ handle_event = Event::Create(ResetType::OneShot, "IR:HandleEvent");
+ conn_status_event = Event::Create(ResetType::OneShot, "IR:ConnectionStatusEvent");
}
void Shutdown() {
diff --git a/src/core/hle/service/ndm/ndm.cpp b/src/core/hle/service/ndm/ndm.cpp
new file mode 100644
index 000000000..47076a7b8
--- /dev/null
+++ b/src/core/hle/service/ndm/ndm.cpp
@@ -0,0 +1,47 @@
+// Copyright 2016 Citra Emulator Project
+// Licensed under GPLv2 or any later version
+// Refer to the license.txt file included.
+
+#include "common/common_types.h"
+#include "common/logging/log.h"
+#include "core/hle/service/service.h"
+#include "core/hle/service/ndm/ndm.h"
+#include "core/hle/service/ndm/ndm_u.h"
+
+namespace Service {
+namespace NDM {
+
+void SuspendDaemons(Service::Interface* self) {
+ u32* cmd_buff = Kernel::GetCommandBuffer();
+
+ LOG_WARNING(Service_NDM, "(STUBBED) bit_mask=0x%08X ", cmd_buff[1]);
+
+ cmd_buff[1] = RESULT_SUCCESS.raw; // No error
+}
+
+void ResumeDaemons(Service::Interface* self) {
+ u32* cmd_buff = Kernel::GetCommandBuffer();
+
+ LOG_WARNING(Service_NDM, "(STUBBED) bit_mask=0x%08X ", cmd_buff[1]);
+
+ cmd_buff[1] = RESULT_SUCCESS.raw; // No error
+}
+
+void OverrideDefaultDaemons(Service::Interface* self) {
+ u32* cmd_buff = Kernel::GetCommandBuffer();
+
+ LOG_WARNING(Service_NDM, "(STUBBED) bit_mask=0x%08X ", cmd_buff[1]);
+
+ cmd_buff[1] = RESULT_SUCCESS.raw; // No error
+}
+
+void Init() {
+ AddService(new NDM_U_Interface);
+}
+
+void Shutdown() {
+
+}
+
+}// namespace NDM
+}// namespace Service
diff --git a/src/core/hle/service/ndm/ndm.h b/src/core/hle/service/ndm/ndm.h
new file mode 100644
index 000000000..734730f8c
--- /dev/null
+++ b/src/core/hle/service/ndm/ndm.h
@@ -0,0 +1,52 @@
+// Copyright 2016 Citra Emulator Project
+// Licensed under GPLv2 or any later version
+// Refer to the license.txt file included.
+
+#pragma once
+
+#include "common/common_types.h"
+
+namespace Service {
+
+class Interface;
+
+namespace NDM {
+
+/**
+ * SuspendDaemons
+ * Inputs:
+ * 0 : Command header (0x00020082)
+ * 1 : Daemon bit mask
+ * Outputs:
+ * 1 : Result, 0 on success, otherwise error code
+ */
+void SuspendDaemons(Service::Interface* self);
+
+/**
+ * ResumeDaemons
+ * Inputs:
+ * 0 : Command header (0x00020082)
+ * 1 : Daemon bit mask
+ * Outputs:
+ * 1 : Result, 0 on success, otherwise error code
+ */
+void ResumeDaemons(Service::Interface* self);
+
+/**
+ * OverrideDefaultDaemons
+ * Inputs:
+ * 0 : Command header (0x00020082)
+ * 1 : Daemon bit mask
+ * Outputs:
+ * 1 : Result, 0 on success, otherwise error code
+ */
+void OverrideDefaultDaemons(Service::Interface* self);
+
+/// Initialize NDM service
+void Init();
+
+/// Shutdown NDM service
+void Shutdown();
+
+}// namespace NDM
+}// namespace Service
diff --git a/src/core/hle/service/ndm_u.cpp b/src/core/hle/service/ndm/ndm_u.cpp
index 8fdf1ef90..bf95cc7aa 100644
--- a/src/core/hle/service/ndm_u.cpp
+++ b/src/core/hle/service/ndm/ndm_u.cpp
@@ -2,12 +2,11 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
-#include "core/hle/service/ndm_u.h"
+#include "core/hle/service/ndm/ndm.h"
+#include "core/hle/service/ndm/ndm_u.h"
-////////////////////////////////////////////////////////////////////////////////////////////////////
-// Namespace NDM_U
-
-namespace NDM_U {
+namespace Service {
+namespace NDM {
const Interface::FunctionInfo FunctionTable[] = {
{0x00010042, nullptr, "EnterExclusiveState"},
@@ -15,8 +14,8 @@ const Interface::FunctionInfo FunctionTable[] = {
{0x00030000, nullptr, "QueryExclusiveMode"},
{0x00040002, nullptr, "LockState"},
{0x00050002, nullptr, "UnlockState"},
- {0x00060040, nullptr, "SuspendDaemons"},
- {0x00070040, nullptr, "ResumeDaemons"},
+ {0x00060040, SuspendDaemons, "SuspendDaemons"},
+ {0x00070040, ResumeDaemons, "ResumeDaemons"},
{0x00080040, nullptr, "DisableWifiUsage"},
{0x00090000, nullptr, "EnableWifiUsage"},
{0x000A0000, nullptr, "GetCurrentState"},
@@ -29,17 +28,15 @@ const Interface::FunctionInfo FunctionTable[] = {
{0x00110000, nullptr, "GetScanInterval"},
{0x00120040, nullptr, "SetRetryInterval"},
{0x00130000, nullptr, "GetRetryInterval"},
- {0x00140040, nullptr, "OverrideDefaultDaemons"},
+ {0x00140040, OverrideDefaultDaemons, "OverrideDefaultDaemons"},
{0x00150000, nullptr, "ResetDefaultDaemons"},
{0x00160000, nullptr, "GetDefaultDaemons"},
{0x00170000, nullptr, "ClearHalfAwakeMacFilter"},
};
-////////////////////////////////////////////////////////////////////////////////////////////////////
-// Interface class
-
-Interface::Interface() {
+NDM_U_Interface::NDM_U_Interface() {
Register(FunctionTable);
}
-} // namespace
+} // namespace NDM
+} // namespace Service
diff --git a/src/core/hle/service/ndm_u.h b/src/core/hle/service/ndm/ndm_u.h
index 51c4b3902..d567abc84 100644
--- a/src/core/hle/service/ndm_u.h
+++ b/src/core/hle/service/ndm/ndm_u.h
@@ -6,20 +6,17 @@
#include "core/hle/service/service.h"
-////////////////////////////////////////////////////////////////////////////////////////////////////
-// Namespace NDM
+namespace Service {
+namespace NDM {
-// No idea what this is
-
-namespace NDM_U {
-
-class Interface : public Service::Interface {
+class NDM_U_Interface : public Service::Interface {
public:
- Interface();
+ NDM_U_Interface();
std::string GetPortName() const override {
return "ndm:u";
}
};
-} // namespace
+} // namespace NDM
+} // namespace Service
diff --git a/src/core/hle/service/nwm_uds.cpp b/src/core/hle/service/nwm_uds.cpp
index dc80984b2..ae4640409 100644
--- a/src/core/hle/service/nwm_uds.cpp
+++ b/src/core/hle/service/nwm_uds.cpp
@@ -138,7 +138,7 @@ const Interface::FunctionInfo FunctionTable[] = {
// Interface class
Interface::Interface() {
- handle_event = Kernel::Event::Create(RESETTYPE_ONESHOT, "NWM_UDS::handle_event");
+ handle_event = Kernel::Event::Create(Kernel::ResetType::OneShot, "NWM_UDS::handle_event");
Register(FunctionTable);
}
diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp
index 0de0b13a3..35b648409 100644
--- a/src/core/hle/service/service.cpp
+++ b/src/core/hle/service/service.cpp
@@ -16,7 +16,6 @@
#include "core/hle/service/http_c.h"
#include "core/hle/service/ldr_ro.h"
#include "core/hle/service/mic_u.h"
-#include "core/hle/service/ndm_u.h"
#include "core/hle/service/ns_s.h"
#include "core/hle/service/nwm_uds.h"
#include "core/hle/service/pm_app.h"
@@ -35,6 +34,7 @@
#include "core/hle/service/cfg/cfg.h"
#include "core/hle/service/hid/hid.h"
#include "core/hle/service/ir/ir.h"
+#include "core/hle/service/ndm/ndm.h"
#include "core/hle/service/news/news.h"
#include "core/hle/service/nim/nim.h"
#include "core/hle/service/ptm/ptm.h"
@@ -114,6 +114,7 @@ void Init() {
Service::HID::Init();
Service::IR::Init();
Service::NEWS::Init();
+ Service::NDM::Init();
Service::NIM::Init();
Service::PTM::Init();
@@ -126,7 +127,6 @@ void Init() {
AddService(new HTTP_C::Interface);
AddService(new LDR_RO::Interface);
AddService(new MIC_U::Interface);
- AddService(new NDM_U::Interface);
AddService(new NS_S::Interface);
AddService(new NWM_UDS::Interface);
AddService(new PM_APP::Interface);
@@ -141,6 +141,7 @@ void Init() {
void Shutdown() {
Service::PTM::Shutdown();
+ Service::NDM::Shutdown();
Service::NIM::Shutdown();
Service::NEWS::Shutdown();
Service::IR::Shutdown();
diff --git a/src/core/hle/service/srv.cpp b/src/core/hle/service/srv.cpp
index 41fc3437b..aae955bf8 100644
--- a/src/core/hle/service/srv.cpp
+++ b/src/core/hle/service/srv.cpp
@@ -25,7 +25,7 @@ static void GetProcSemaphore(Service::Interface* self) {
u32* cmd_buff = Kernel::GetCommandBuffer();
// TODO(bunnei): Change to a semaphore once these have been implemented
- event_handle = Kernel::Event::Create(RESETTYPE_ONESHOT, "SRV:Event");
+ event_handle = Kernel::Event::Create(Kernel::ResetType::OneShot, "SRV:Event");
event_handle->Clear();
cmd_buff[1] = 0; // No error
diff --git a/src/core/hle/service/y2r_u.cpp b/src/core/hle/service/y2r_u.cpp
index a495441a4..22f373adf 100644
--- a/src/core/hle/service/y2r_u.cpp
+++ b/src/core/hle/service/y2r_u.cpp
@@ -424,7 +424,7 @@ const Interface::FunctionInfo FunctionTable[] = {
// Interface class
Interface::Interface() {
- completion_event = Kernel::Event::Create(RESETTYPE_ONESHOT, "Y2R:Completed");
+ completion_event = Kernel::Event::Create(Kernel::ResetType::OneShot, "Y2R:Completed");
std::memset(&conversion, 0, sizeof(conversion));
Register(FunctionTable);
diff --git a/src/core/hle/svc.cpp b/src/core/hle/svc.cpp
index 7a39b101d..ae54afb1c 100644
--- a/src/core/hle/svc.cpp
+++ b/src/core/hle/svc.cpp
@@ -661,7 +661,7 @@ static ResultCode QueryMemory(MemoryInfo* memory_info, PageInfo* page_info, u32
static ResultCode CreateEvent(Handle* out_handle, u32 reset_type) {
using Kernel::Event;
- SharedPtr<Event> evt = Kernel::Event::Create(static_cast<ResetType>(reset_type));
+ SharedPtr<Event> evt = Event::Create(static_cast<Kernel::ResetType>(reset_type));
CASCADE_RESULT(*out_handle, Kernel::g_handle_table.Create(std::move(evt)));
LOG_TRACE(Kernel_SVC, "called reset_type=0x%08X : created handle=0x%08X",
@@ -707,7 +707,7 @@ static ResultCode ClearEvent(Handle handle) {
static ResultCode CreateTimer(Handle* out_handle, u32 reset_type) {
using Kernel::Timer;
- SharedPtr<Timer> timer = Timer::Create(static_cast<ResetType>(reset_type));
+ SharedPtr<Timer> timer = Timer::Create(static_cast<Kernel::ResetType>(reset_type));
CASCADE_RESULT(*out_handle, Kernel::g_handle_table.Create(std::move(timer)));
LOG_TRACE(Kernel_SVC, "called reset_type=0x%08X : created handle=0x%08X",
diff --git a/src/core/hle/svc.h b/src/core/hle/svc.h
index 4b9c71e06..818973eb6 100644
--- a/src/core/hle/svc.h
+++ b/src/core/hle/svc.h
@@ -20,22 +20,6 @@ struct PageInfo {
u32 flags;
};
-enum ResetType {
- RESETTYPE_ONESHOT,
- RESETTYPE_STICKY,
- RESETTYPE_PULSE,
- RESETTYPE_MAX_BIT = (1u << 31),
-};
-
-enum ArbitrationType {
- ARBITRATIONTYPE_SIGNAL,
- ARBITRATIONTYPE_WAIT_IF_LESS_THAN,
- ARBITRATIONTYPE_DECREMENT_AND_WAIT_IF_LESS_THAN,
- ARBITRATIONTYPE_WAIT_IF_LESS_THAN_WITH_TIMEOUT,
- ARBITRATIONTYPE_DECREMENT_AND_WAIT_IF_LESS_THAN_WITH_TIMEOUT,
- ARBITRATIONTYPE_MAX_BIT = (1u << 31)
-};
-
////////////////////////////////////////////////////////////////////////////////////////////////////
// Namespace SVC