From: Subv Date: Thu, 4 Dec 2014 17:04:59 +0000 (-0500) Subject: Added svcReleaseSemaphore and svcCreateSemaphore. X-Git-Tag: v0.3.0~54^2~3^2 X-Git-Url: https://chaos.moe/g/?a=commitdiff_plain;h=a85c6edfaa16a43b6cb8fbd31fb3ad1fb1fc32ec;p=corbenik%2Fctrulib.git Added svcReleaseSemaphore and svcCreateSemaphore. Tested. --- diff --git a/libctru/include/3ds/svc.h b/libctru/include/3ds/svc.h index d498d45..733db1a 100644 --- a/libctru/include/3ds/svc.h +++ b/libctru/include/3ds/svc.h @@ -62,6 +62,8 @@ void svcSleepThread(s64 ns); s32 svcSetThreadPriority(Handle thread, s32 prio); s32 svcCreateMutex(Handle* mutex, bool initially_locked); s32 svcReleaseMutex(Handle handle); +s32 svcCreateSemaphore(Handle* semaphore, s32 initial_count, s32 max_count); +s32 svcReleaseSemaphore(s32* count, Handle semaphore, s32 release_count); s32 svcCreateEvent(Handle* event, u8 reset_type); s32 svcSignalEvent(Handle handle); s32 svcClearEvent(Handle handle); diff --git a/libctru/source/svc.s b/libctru/source/svc.s index 2f2eb0e..3fac109 100644 --- a/libctru/source/svc.s +++ b/libctru/source/svc.s @@ -264,3 +264,21 @@ svcOutputDebugString: ldr r2, [sp], #4 str r1, [r2] bx lr + +.global svcCreateSemaphore +.type svcCreateSemaphore, %function +svcCreateSemaphore: + push {r0} + svc 0x15 + pop {r3} + str r1, [r3] + bx lr + +.global svcReleaseSemaphore +.type svcReleaseSemaphore, %function +svcReleaseSemaphore: + push {r0} + svc 0x16 + pop {r3} + str r1, [r3] + bx lr \ No newline at end of file