Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
MorsGames
GitHub Repository: MorsGames/sm64plus
Path: blob/master/lib/src/__osSpRawStartDma.c
7858 views
1
#include "libultra_internal.h"
2
#include "hardware.h"
3
4
s32 __osSpRawStartDma(u32 dir, void *sp_ptr, void *dram_ptr, size_t size) {
5
if (__osSpDeviceBusy()) {
6
return -1;
7
}
8
HW_REG(SP_MEM_ADDR_REG, void *) = sp_ptr;
9
HW_REG(SP_DRAM_ADDR_REG, void *) = (void *) osVirtualToPhysical(dram_ptr);
10
if (dir == 0) {
11
HW_REG(SP_WR_LEN_REG, u32) = size - 1;
12
} else {
13
HW_REG(SP_RD_LEN_REG, u32) = size - 1;
14
}
15
return 0;
16
}
17
18