MCPcopy Create free account
hub / github.com/devkitPro/libctru / nfcSendTagCommand

Function nfcSendTagCommand

libctru/source/services/nfc.c:475–507  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

473}
474
475Result nfcSendTagCommand(const void *inbuf, size_t insize, void *outbuf, size_t outsize, size_t *actual_transfer_size, u64 microseconds)
476{
477 u32* cmdbuf=getThreadCommandBuffer();
478 u32 saved_threadstorage[2];
479
480 cmdbuf[0]=IPC_MakeHeader(0x20,4,2); // 0x200102
481 cmdbuf[1]=insize;
482 cmdbuf[2]=outsize;
483 cmdbuf[3]=(u32)(microseconds);
484 cmdbuf[4]=(u32)(microseconds>>32);
485 cmdbuf[5]=IPC_Desc_StaticBuffer(insize,0);
486 cmdbuf[6]=(u32)inbuf;
487
488 u32 * staticbufs = getThreadStaticBuffers();
489 saved_threadstorage[0] = staticbufs[0];
490 saved_threadstorage[1] = staticbufs[1];
491
492 staticbufs[0] = IPC_Desc_StaticBuffer(outsize,0);
493 staticbufs[1] = (u32)outbuf;
494
495 Result ret=0;
496 ret=svcSendSyncRequest(nfcHandle);
497
498 staticbufs[0] = saved_threadstorage[0];
499 staticbufs[1] = saved_threadstorage[1];
500
501 if(R_FAILED(ret))return ret;
502
503 ret = cmdbuf[1];
504 if(actual_transfer_size)*actual_transfer_size = cmdbuf[2];
505
506 return ret;
507}
508
509Result nfcCmd21(void)
510{

Callers

nothing calls this directly

Calls 4

getThreadCommandBufferFunction · 0.85
IPC_MakeHeaderFunction · 0.85
IPC_Desc_StaticBufferFunction · 0.85
getThreadStaticBuffersFunction · 0.85

Tested by

no test coverage detected