Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
MorsGames
GitHub Repository: MorsGames/sm64plus
Path: blob/master/lib/src/__osSiRawStartDma.c
7857 views
1
#include "libultra_internal.h"
2
#include "hardware.h"
3
4
s32 __osSiRawStartDma(s32 dir, void *addr) {
5
if (__osSiDeviceBusy()) {
6
return -1;
7
}
8
9
if (dir == OS_WRITE) {
10
osWritebackDCache(addr, 64);
11
}
12
13
HW_REG(SI_DRAM_ADDR_REG, void *) = (void *) osVirtualToPhysical(addr);
14
15
if (dir == OS_READ) {
16
HW_REG(SI_PIF_ADDR_RD64B_REG, u32) = 0x1FC007C0;
17
} else {
18
HW_REG(SI_PIF_ADDR_WR64B_REG, u32) = 0x1FC007C0;
19
}
20
21
if (dir == OS_READ) {
22
osInvalDCache(addr, 64);
23
}
24
return 0;
25
}
26
27