Skip to content

Commit

Permalink
ir: Add IRU_GetSend/RecvFinishedEvent
Browse files Browse the repository at this point in the history
  • Loading branch information
GaryOderNichts authored and fincs committed Dec 6, 2022
1 parent af5321c commit da323fa
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
12 changes: 12 additions & 0 deletions libctru/include/3ds/services/ir.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,15 @@ Result IRU_SetIRLEDState(u32 value);
* @param out Pointer to write the IR LED state to.
*/
Result IRU_GetIRLEDRecvState(u32 *out);

/**
* @brief Gets an event which is signaled once a send finishes.
* @param out Pointer to write the event handle to.
*/
Result IRU_GetSendFinishedEvent(Handle *out);

/**
* @brief Gets an event which is signaled once a receive finishes.
* @param out Pointer to write the event handle to.
*/
Result IRU_GetRecvFinishedEvent(Handle *out);
30 changes: 30 additions & 0 deletions libctru/source/services/ir.c
Original file line number Diff line number Diff line change
Expand Up @@ -237,3 +237,33 @@ Result IRU_GetIRLEDRecvState(u32 *out)

return ret;
}

Result IRU_GetSendFinishedEvent(Handle *out)
{
Result ret = 0;
u32 *cmdbuf = getThreadCommandBuffer();

cmdbuf[0] = IPC_MakeHeader(0xD,0,0); // 0xD0000

if(R_FAILED(ret = svcSendSyncRequest(iruHandle)))return ret;
ret = (Result)cmdbuf[1];

*out = (Handle)cmdbuf[3];

return ret;
}

Result IRU_GetRecvFinishedEvent(Handle *out)
{
Result ret = 0;
u32 *cmdbuf = getThreadCommandBuffer();

cmdbuf[0] = IPC_MakeHeader(0xE,0,0); // 0xE0000

if(R_FAILED(ret = svcSendSyncRequest(iruHandle)))return ret;
ret = (Result)cmdbuf[1];

*out = (Handle)cmdbuf[3];

return ret;
}

0 comments on commit da323fa

Please sign in to comment.