Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
MorsGames
GitHub Repository: MorsGames/sm64plus
Path: blob/master/lib/src/epidma.c
7857 views
1
#ifdef VERSION_SH
2
3
#include "PR/os_internal.h"
4
#include "piint.h"
5
6
s32 osEPiStartDma(OSPiHandle *pihandle, OSIoMesg *mb, s32 direction) {
7
register s32 ret;
8
9
if (!__osPiDevMgr.active) {
10
return -1;
11
}
12
mb->piHandle = pihandle;
13
if (direction == OS_READ) {
14
mb->hdr.type = OS_MESG_TYPE_EDMAREAD;
15
} else {
16
mb->hdr.type = OS_MESG_TYPE_EDMAWRITE;
17
}
18
if (mb->hdr.pri == OS_MESG_PRI_HIGH) {
19
ret = osJamMesg(osPiGetCmdQueue(), mb, OS_MESG_NOBLOCK);
20
} else {
21
ret = osSendMesg(osPiGetCmdQueue(), mb, OS_MESG_NOBLOCK);
22
}
23
return ret;
24
}
25
26
#endif
27
28