Add ResetType enum (and fixed many wrong ResetType usages)

This commit is contained in:
fincs 2016-07-01 18:27:39 +02:00
parent 02a087b588
commit 2f6a28f1e3
5 changed files with 15 additions and 8 deletions

View File

@ -90,6 +90,13 @@ typedef enum {
///@name Multithreading
///@{
/// Reset types (for use with events and timers)
typedef enum {
RESET_ONESHOT = 0, ///< When the primitive is signaled, it will wake up exactly one thread and will clear itself automatically.
RESET_STICKY = 1, ///< When the primitive is signaled, it will wake up all threads and it won't clear itself automatically.
RESET_PULSE = 2, ///< Only meaningful for timers: same as ONESHOT but it will periodically signal the timer instead of just once.
} ResetType;
/// Types of thread info.
typedef enum {
THREADINFO_TYPE_UNKNOWN ///< Unknown.
@ -741,9 +748,9 @@ Result svcReleaseSemaphore(s32* count, Handle semaphore, s32 release_count);
/**
* @brief Creates an event handle.
* @param[out] event Pointer to output the created event handle to.
* @param reset_type Type of reset the event uses.
* @param reset_type Type of reset the event uses (RESET_ONESHOT/RESET_STICKY).
*/
Result svcCreateEvent(Handle* event, u8 reset_type);
Result svcCreateEvent(Handle* event, ResetType reset_type);
/**
* @brief Signals an event.
@ -846,7 +853,7 @@ Result svcUnbindInterrupt(u32 interruptId, Handle event);
* @param[out] timer Pointer to output the handle of the created timer to.
* @param reset_type Type of reset to perform on the timer.
*/
Result svcCreateTimer(Handle* timer, u8 reset_type);
Result svcCreateTimer(Handle* timer, ResetType reset_type);
/**
* @brief Sets a timer.

View File

@ -129,7 +129,7 @@ void gfxInit(GSPGPU_FramebufferFormats topFormat, GSPGPU_FramebufferFormats bott
GSPGPU_AcquireRight(0x0);
//setup our gsp shared mem section
svcCreateEvent(&gspEvent, 0x0);
svcCreateEvent(&gspEvent, RESET_ONESHOT);
GSPGPU_RegisterInterruptRelayQueue(gspEvent, 0x1, &gspSharedMemHandle, &gfxThreadID);
svcMapMemoryBlock(gspSharedMemHandle, (u32)gfxSharedMemory, 0x3, 0x10000000);

View File

@ -211,7 +211,7 @@ static Result ndspInitialize(bool resume)
rc = ndspLoadComponent();
if (R_FAILED(rc)) return rc;
rc = svcCreateEvent(&irqEvent, 1);
rc = svcCreateEvent(&irqEvent, RESET_STICKY);
if (R_FAILED(rc)) goto _fail1;
rc = DSP_RegisterInterruptEvents(irqEvent, 2, 2);
@ -479,7 +479,7 @@ Result ndspInit(void)
rc = ndspInitialize(false);
if (R_FAILED(rc)) goto _fail1;
rc = svcCreateEvent(&sleepEvent, 0);
rc = svcCreateEvent(&sleepEvent, RESET_STICKY);
if (R_FAILED(rc)) goto _fail2;
ndspThread = threadCreate(ndspThreadMain, 0x0, NDSP_THREAD_STACK_SIZE, 0x18, -2, true);

View File

@ -57,7 +57,7 @@ Result gspInitEventHandler(Handle _gspEvent, vu8* _gspSharedMem, u8 gspThreadId)
int i;
for (i = 0; i < GSPGPU_EVENT_MAX; i ++)
{
Result rc = svcCreateEvent(&gspEvents[i], 0);
Result rc = svcCreateEvent(&gspEvents[i], RESET_STICKY);
if (rc != 0)
{
// Destroy already created events due to failure

View File

@ -481,7 +481,7 @@ Result udsScanBeacons(void *buf, size_t maxsize, udsNetworkScanInfo **networks,
if(maxsize < sizeof(nwmBeaconDataReplyHeader))return -2;
ret = svcCreateEvent(&event, 0);
ret = svcCreateEvent(&event, RESET_ONESHOT);
if(R_FAILED(ret))return ret;
if(!connected)ret = udsipc_RecvBeaconBroadcastData(outbuf, maxsize, &scaninput, wlancommID, id8, event);