From 12e92f17de40522e66954d3c5148e4520c9ca775 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sat, 12 Mar 2016 15:06:31 -0500 Subject: svc: Make ResetType an enum class --- src/core/hle/kernel/event.cpp | 2 +- src/core/hle/kernel/timer.cpp | 2 +- src/core/hle/service/apt/apt.cpp | 4 ++-- src/core/hle/service/cam/cam.cpp | 8 ++++---- src/core/hle/service/dsp_dsp.cpp | 2 +- src/core/hle/service/hid/hid.cpp | 10 +++++----- src/core/hle/service/ir/ir.cpp | 4 ++-- src/core/hle/service/nwm_uds.cpp | 2 +- src/core/hle/service/srv.cpp | 2 +- src/core/hle/service/y2r_u.cpp | 2 +- src/core/hle/svc.h | 9 ++++----- 11 files changed, 23 insertions(+), 24 deletions(-) (limited to 'src') 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/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/service/apt/apt.cpp b/src/core/hle/service/apt/apt.cpp index 98c72fc32..3a63b256a 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(ResetType::OneShot, "APT_U:Notification"); + parameter_event = Kernel::Event::Create(ResetType::OneShot, "APT_U:Start"); next_parameter.signal = static_cast(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..a918ebb1a 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(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..3015a9605 100644 --- a/src/core/hle/service/hid/hid.cpp +++ b/src/core/hle/service/hid/hid.cpp @@ -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/nwm_uds.cpp b/src/core/hle/service/nwm_uds.cpp index dc80984b2..1e1854dad 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(ResetType::OneShot, "NWM_UDS::handle_event"); Register(FunctionTable); } diff --git a/src/core/hle/service/srv.cpp b/src/core/hle/service/srv.cpp index 41fc3437b..4a3f3837a 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(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..ebbb349ae 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(ResetType::OneShot, "Y2R:Completed"); std::memset(&conversion, 0, sizeof(conversion)); Register(FunctionTable); diff --git a/src/core/hle/svc.h b/src/core/hle/svc.h index 4b9c71e06..8a37e5654 100644 --- a/src/core/hle/svc.h +++ b/src/core/hle/svc.h @@ -20,11 +20,10 @@ struct PageInfo { u32 flags; }; -enum ResetType { - RESETTYPE_ONESHOT, - RESETTYPE_STICKY, - RESETTYPE_PULSE, - RESETTYPE_MAX_BIT = (1u << 31), +enum class ResetType { + OneShot, + Sticky, + Pulse, }; enum ArbitrationType { -- cgit v1.2.3 From 31797a242fa1c0e1661a9090173576531da7c3db Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sat, 12 Mar 2016 15:09:10 -0500 Subject: svc: Remove unused ArbitrationType enum An equivalent enum already exists within address_arbiter.h --- src/core/hle/svc.h | 9 --------- 1 file changed, 9 deletions(-) (limited to 'src') diff --git a/src/core/hle/svc.h b/src/core/hle/svc.h index 8a37e5654..339a788cf 100644 --- a/src/core/hle/svc.h +++ b/src/core/hle/svc.h @@ -26,15 +26,6 @@ enum class ResetType { Pulse, }; -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 -- cgit v1.2.3 From 856a1d0386099f6311e4fb9cca345142fc22330a Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sat, 12 Mar 2016 21:47:41 -0500 Subject: svc: Move ResetType enum to the kernel event header --- src/core/hle/function_wrappers.h | 1 + src/core/hle/kernel/event.h | 8 +++++++- src/core/hle/kernel/timer.h | 2 +- src/core/hle/service/apt/apt.cpp | 4 ++-- src/core/hle/service/dsp_dsp.cpp | 2 +- src/core/hle/service/nwm_uds.cpp | 2 +- src/core/hle/service/srv.cpp | 2 +- src/core/hle/service/y2r_u.cpp | 2 +- src/core/hle/svc.cpp | 4 ++-- src/core/hle/svc.h | 6 ------ 10 files changed, 17 insertions(+), 16 deletions(-) (limited to 'src') 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.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.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 3a63b256a..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(SignalType::AppJustStarted); next_parameter.destination_id = 0x300; diff --git a/src/core/hle/service/dsp_dsp.cpp b/src/core/hle/service/dsp_dsp.cpp index a918ebb1a..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/nwm_uds.cpp b/src/core/hle/service/nwm_uds.cpp index 1e1854dad..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/srv.cpp b/src/core/hle/service/srv.cpp index 4a3f3837a..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 ebbb349ae..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 evt = Kernel::Event::Create(static_cast(reset_type)); + SharedPtr evt = Event::Create(static_cast(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::Create(static_cast(reset_type)); + SharedPtr timer = Timer::Create(static_cast(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 339a788cf..818973eb6 100644 --- a/src/core/hle/svc.h +++ b/src/core/hle/svc.h @@ -20,12 +20,6 @@ struct PageInfo { u32 flags; }; -enum class ResetType { - OneShot, - Sticky, - Pulse, -}; - //////////////////////////////////////////////////////////////////////////////////////////////////// // Namespace SVC -- cgit v1.2.3