Add ResetType enum (and fixed many wrong ResetType usages)
This commit is contained in:
parent
02a087b588
commit
2f6a28f1e3
@ -90,6 +90,13 @@ typedef enum {
|
|||||||
///@name Multithreading
|
///@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.
|
/// Types of thread info.
|
||||||
typedef enum {
|
typedef enum {
|
||||||
THREADINFO_TYPE_UNKNOWN ///< Unknown.
|
THREADINFO_TYPE_UNKNOWN ///< Unknown.
|
||||||
@ -741,9 +748,9 @@ Result svcReleaseSemaphore(s32* count, Handle semaphore, s32 release_count);
|
|||||||
/**
|
/**
|
||||||
* @brief Creates an event handle.
|
* @brief Creates an event handle.
|
||||||
* @param[out] event Pointer to output the created event handle to.
|
* @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.
|
* @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[out] timer Pointer to output the handle of the created timer to.
|
||||||
* @param reset_type Type of reset to perform on the timer.
|
* @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.
|
* @brief Sets a timer.
|
||||||
|
@ -129,7 +129,7 @@ void gfxInit(GSPGPU_FramebufferFormats topFormat, GSPGPU_FramebufferFormats bott
|
|||||||
GSPGPU_AcquireRight(0x0);
|
GSPGPU_AcquireRight(0x0);
|
||||||
|
|
||||||
//setup our gsp shared mem section
|
//setup our gsp shared mem section
|
||||||
svcCreateEvent(&gspEvent, 0x0);
|
svcCreateEvent(&gspEvent, RESET_ONESHOT);
|
||||||
GSPGPU_RegisterInterruptRelayQueue(gspEvent, 0x1, &gspSharedMemHandle, &gfxThreadID);
|
GSPGPU_RegisterInterruptRelayQueue(gspEvent, 0x1, &gspSharedMemHandle, &gfxThreadID);
|
||||||
svcMapMemoryBlock(gspSharedMemHandle, (u32)gfxSharedMemory, 0x3, 0x10000000);
|
svcMapMemoryBlock(gspSharedMemHandle, (u32)gfxSharedMemory, 0x3, 0x10000000);
|
||||||
|
|
||||||
|
@ -211,7 +211,7 @@ static Result ndspInitialize(bool resume)
|
|||||||
rc = ndspLoadComponent();
|
rc = ndspLoadComponent();
|
||||||
if (R_FAILED(rc)) return rc;
|
if (R_FAILED(rc)) return rc;
|
||||||
|
|
||||||
rc = svcCreateEvent(&irqEvent, 1);
|
rc = svcCreateEvent(&irqEvent, RESET_STICKY);
|
||||||
if (R_FAILED(rc)) goto _fail1;
|
if (R_FAILED(rc)) goto _fail1;
|
||||||
|
|
||||||
rc = DSP_RegisterInterruptEvents(irqEvent, 2, 2);
|
rc = DSP_RegisterInterruptEvents(irqEvent, 2, 2);
|
||||||
@ -479,7 +479,7 @@ Result ndspInit(void)
|
|||||||
rc = ndspInitialize(false);
|
rc = ndspInitialize(false);
|
||||||
if (R_FAILED(rc)) goto _fail1;
|
if (R_FAILED(rc)) goto _fail1;
|
||||||
|
|
||||||
rc = svcCreateEvent(&sleepEvent, 0);
|
rc = svcCreateEvent(&sleepEvent, RESET_STICKY);
|
||||||
if (R_FAILED(rc)) goto _fail2;
|
if (R_FAILED(rc)) goto _fail2;
|
||||||
|
|
||||||
ndspThread = threadCreate(ndspThreadMain, 0x0, NDSP_THREAD_STACK_SIZE, 0x18, -2, true);
|
ndspThread = threadCreate(ndspThreadMain, 0x0, NDSP_THREAD_STACK_SIZE, 0x18, -2, true);
|
||||||
|
@ -57,7 +57,7 @@ Result gspInitEventHandler(Handle _gspEvent, vu8* _gspSharedMem, u8 gspThreadId)
|
|||||||
int i;
|
int i;
|
||||||
for (i = 0; i < GSPGPU_EVENT_MAX; 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)
|
if (rc != 0)
|
||||||
{
|
{
|
||||||
// Destroy already created events due to failure
|
// Destroy already created events due to failure
|
||||||
|
@ -481,7 +481,7 @@ Result udsScanBeacons(void *buf, size_t maxsize, udsNetworkScanInfo **networks,
|
|||||||
|
|
||||||
if(maxsize < sizeof(nwmBeaconDataReplyHeader))return -2;
|
if(maxsize < sizeof(nwmBeaconDataReplyHeader))return -2;
|
||||||
|
|
||||||
ret = svcCreateEvent(&event, 0);
|
ret = svcCreateEvent(&event, RESET_ONESHOT);
|
||||||
if(R_FAILED(ret))return ret;
|
if(R_FAILED(ret))return ret;
|
||||||
|
|
||||||
if(!connected)ret = udsipc_RecvBeaconBroadcastData(outbuf, maxsize, &scaninput, wlancommID, id8, event);
|
if(!connected)ret = udsipc_RecvBeaconBroadcastData(outbuf, maxsize, &scaninput, wlancommID, id8, event);
|
||||||
|
Loading…
Reference in New Issue
Block a user