MCPcopy Create free account
hub / github.com/bfbbdecomp/bfbb / __SITransfer

Function __SITransfer

src/dolphin/src/si/SIBios.c:359–402  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

357#define ROUND(n, a) (((u32)(n) + (a)-1) & ~((a)-1))
358
359static BOOL __SITransfer(s32 chan, void* output, u32 outputBytes, void* input, u32 inputBytes,
360 SICallback callback)
361{
362 BOOL enabled;
363 u32 rLen;
364 u32 i;
365 u32 sr;
366 SIComm_u comcsr;
367
368 enabled = OSDisableInterrupts();
369 if (Si.chan != -1)
370 {
371 OSRestoreInterrupts(enabled);
372 return FALSE;
373 }
374
375 sr = __SIRegs[14];
376 sr &= (0xf000000) >> (8 * chan);
377 __SIRegs[14] = sr;
378
379 Si.chan = chan;
380 Si.callback = callback;
381 Si.inputBytes = inputBytes;
382 Si.input = input;
383
384 rLen = ROUND(outputBytes, 4) / 4;
385 for (i = 0; i < rLen; i++)
386 {
387 __SIRegs[32 + i] = ((u32*)output)[i];
388 }
389
390 comcsr.val = __SIRegs[13];
391 comcsr.f.tcint = 1;
392 comcsr.f.tcintmsk = callback ? 1 : 0;
393 comcsr.f.outlngth = (outputBytes == SI_MAX_COMCSR_OUTLNGTH) ? 0 : outputBytes;
394 comcsr.f.inlngth = (inputBytes == SI_MAX_COMCSR_INLNGTH) ? 0 : inputBytes;
395 comcsr.f.channel = chan;
396 comcsr.f.tstart = 1;
397 __SIRegs[13] = comcsr.val;
398
399 OSRestoreInterrupts(enabled);
400
401 return TRUE;
402}
403
404u32 SIGetStatus(s32 chan)
405{

Callers 3

SITransferNextFunction · 0.85
AlarmHandlerFunction · 0.85
SITransferFunction · 0.85

Calls 1

OSDisableInterruptsFunction · 0.85

Tested by

no test coverage detected