From 82c84883a5d10bd6c9a3516fe16b996c5333360e Mon Sep 17 00:00:00 2001 From: Subv Date: Wed, 3 Dec 2014 18:49:51 -0500 Subject: SVC: Implemented svcCreateSemaphore ToDo: Implement svcReleaseSemaphore * Some testing against hardware needed --- src/core/hle/kernel/semaphore.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 src/core/hle/kernel/semaphore.h (limited to 'src/core/hle/kernel/semaphore.h') diff --git a/src/core/hle/kernel/semaphore.h b/src/core/hle/kernel/semaphore.h new file mode 100644 index 000000000..6a686db2e --- /dev/null +++ b/src/core/hle/kernel/semaphore.h @@ -0,0 +1,22 @@ +// Copyright 2014 Citra Emulator Project +// Licensed under GPLv2+ +// Refer to the license.txt file included. + +#pragma once + +#include "common/common_types.h" + +#include "core/hle/kernel/kernel.h" + +namespace Kernel { + +/** + * Creates a semaphore + * @param initial_count number of reserved entries in the semaphore + * @param max_count maximum number of holders the semaphore can have + * @param name Optional name of semaphore + * @return Handle to newly created object + */ +Handle CreateSemaphore(u32 initial_count, u32 max_count, const std::string& name = "Unknown"); + +} // namespace -- cgit v1.2.3 From 49b31badba5672bae3a5950abe3d45c883879c0d Mon Sep 17 00:00:00 2001 From: Subv Date: Thu, 4 Dec 2014 11:40:36 -0500 Subject: SVC: Implemented ReleaseSemaphore. This behavior was tested on hardware, however i'm still not sure what use the "initial_count" parameter has --- src/core/hle/kernel/semaphore.h | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'src/core/hle/kernel/semaphore.h') diff --git a/src/core/hle/kernel/semaphore.h b/src/core/hle/kernel/semaphore.h index 6a686db2e..854831ecf 100644 --- a/src/core/hle/kernel/semaphore.h +++ b/src/core/hle/kernel/semaphore.h @@ -12,11 +12,20 @@ namespace Kernel { /** * Creates a semaphore + * @param handle Pointer to the handle of the newly created object * @param initial_count number of reserved entries in the semaphore * @param max_count maximum number of holders the semaphore can have - * @param name Optional name of semaphore - * @return Handle to newly created object + * @param name Optional name of semaphore + * @return ResultCode of the error */ -Handle CreateSemaphore(u32 initial_count, u32 max_count, const std::string& name = "Unknown"); +ResultCode CreateSemaphore(Handle* handle, u32 initial_count, u32 max_count, const std::string& name = "Unknown"); +/** + * Releases a certain number of slots from a semaphore + * @param count The number of free slots the semaphore had before this call + * @param handle The handle of the semaphore to release + * @param release_count The number of slots to release + * @return ResultCode of the error + */ +ResultCode ReleaseSemaphore(s32* count, Handle handle, s32 release_count); } // namespace -- cgit v1.2.3 From abff4a7ee23a04baa9d264417c9c814309ef294b Mon Sep 17 00:00:00 2001 From: Subv Date: Thu, 4 Dec 2014 11:55:13 -0500 Subject: Semaphore: Implemented the initial_count parameter. --- src/core/hle/kernel/semaphore.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/core/hle/kernel/semaphore.h') diff --git a/src/core/hle/kernel/semaphore.h b/src/core/hle/kernel/semaphore.h index 854831ecf..b29812e1d 100644 --- a/src/core/hle/kernel/semaphore.h +++ b/src/core/hle/kernel/semaphore.h @@ -13,8 +13,8 @@ namespace Kernel { /** * Creates a semaphore * @param handle Pointer to the handle of the newly created object - * @param initial_count number of reserved entries in the semaphore - * @param max_count maximum number of holders the semaphore can have + * @param initial_count number of slots reserved for other threads + * @param max_count maximum number of slots the semaphore can have * @param name Optional name of semaphore * @return ResultCode of the error */ -- cgit v1.2.3 From 5e259862352eaef61567ee33b7d68f2f268344b5 Mon Sep 17 00:00:00 2001 From: Subv Date: Fri, 12 Dec 2014 20:46:52 -0500 Subject: Kernel/Semaphores: Addressed some issues. --- src/core/hle/kernel/semaphore.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/core/hle/kernel/semaphore.h') diff --git a/src/core/hle/kernel/semaphore.h b/src/core/hle/kernel/semaphore.h index b29812e1d..f0075fdb8 100644 --- a/src/core/hle/kernel/semaphore.h +++ b/src/core/hle/kernel/semaphore.h @@ -11,21 +11,22 @@ namespace Kernel { /** - * Creates a semaphore + * Creates a semaphore. * @param handle Pointer to the handle of the newly created object - * @param initial_count number of slots reserved for other threads - * @param max_count maximum number of slots the semaphore can have + * @param initial_count Number of slots reserved for other threads + * @param max_count Maximum number of slots the semaphore can have * @param name Optional name of semaphore * @return ResultCode of the error */ ResultCode CreateSemaphore(Handle* handle, u32 initial_count, u32 max_count, const std::string& name = "Unknown"); /** - * Releases a certain number of slots from a semaphore + * Releases a certain number of slots from a semaphore. * @param count The number of free slots the semaphore had before this call * @param handle The handle of the semaphore to release * @param release_count The number of slots to release * @return ResultCode of the error */ ResultCode ReleaseSemaphore(s32* count, Handle handle, s32 release_count); + } // namespace -- cgit v1.2.3